From 19fdb08128f7c8e584888019519f84c5fdfad071 Mon Sep 17 00:00:00 2001 From: Rob Skillington Date: Thu, 10 Dec 2020 20:13:25 -0500 Subject: [PATCH] [dbnode] Add ability to force enable cold writes from config (#3002) --- src/cmd/services/m3dbnode/config/config.go | 4 ++++ src/cmd/services/m3dbnode/config/config_test.go | 1 + src/dbnode/server/server.go | 5 +++++ 3 files changed, 10 insertions(+) diff --git a/src/cmd/services/m3dbnode/config/config.go b/src/cmd/services/m3dbnode/config/config.go index b1b3b8332d..bf3f62569e 100644 --- a/src/cmd/services/m3dbnode/config/config.go +++ b/src/cmd/services/m3dbnode/config/config.go @@ -207,6 +207,10 @@ type DBConfiguration struct { // Debug configuration. Debug config.DebugConfiguration `yaml:"debug"` + + // ForceColdWritesEnabled will force enable cold writes for all namespaces + // if set. + ForceColdWritesEnabled *bool `yaml:"forceColdWritesEnabled"` } // LoggingOrDefault returns the logging configuration or defaults. diff --git a/src/cmd/services/m3dbnode/config/config_test.go b/src/cmd/services/m3dbnode/config/config_test.go index 5beeb0a5e7..8218580a33 100644 --- a/src/cmd/services/m3dbnode/config/config_test.go +++ b/src/cmd/services/m3dbnode/config/config_test.go @@ -729,6 +729,7 @@ func TestConfiguration(t *testing.T) { debug: mutexProfileFraction: 0 blockProfileRate: 0 + forceColdWritesEnabled: null coordinator: null ` diff --git a/src/dbnode/server/server.go b/src/dbnode/server/server.go index 52df3307c7..ef21426ef7 100644 --- a/src/dbnode/server/server.go +++ b/src/dbnode/server/server.go @@ -651,6 +651,11 @@ func Run(runOpts RunOptions) { }() opts = opts.SetIndexClaimsManager(icm) + if value := cfg.ForceColdWritesEnabled; value != nil { + // Allow forcing cold writes to be enabled by config. + opts = opts.SetForceColdWritesEnabled(*value) + } + forceColdWrites := opts.ForceColdWritesEnabled() var envCfgResults environment.ConfigureResults if len(envConfig.Statics) == 0 {