From d7f74a8cab6c5d939dfbda6c6e8af594fc1c75f9 Mon Sep 17 00:00:00 2001 From: mornyx Date: Thu, 25 Aug 2022 16:59:38 +0800 Subject: [PATCH 1/2] Disable conprof by default Signed-off-by: mornyx --- config/config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/config.go b/config/config.go index d86b558..d2c3bfe 100644 --- a/config/config.go +++ b/config/config.go @@ -23,7 +23,7 @@ import ( ) const ( - DefProfilingEnable = true + DefProfilingEnable = false // TODO(mornyx): Enable when tiflash#5687 is fixed. DefProfilingIntervalSeconds = 60 DefProfileSeconds = 10 DefProfilingTimeoutSeconds = 120 From 30eff0c4bfc6e398395a6bc1dc6dcccf3fa50681 Mon Sep 17 00:00:00 2001 From: mornyx Date: Thu, 25 Aug 2022 17:09:27 +0800 Subject: [PATCH 2/2] Fix unit tests Signed-off-by: mornyx --- config/config_test.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/config/config_test.go b/config/config_test.go index ff2b532..153f411 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -84,7 +84,8 @@ key-path = "ngm.key"` require.NotNil(t, cfg) data, err := json.Marshal(cfg) require.NoError(t, err) - require.Equal(t, `{"address":"0.0.0.0:12020","advertise_address":"10.0.1.8:12020","pd":{"endpoints":["10.0.1.8:2379"]},"log":{"path":"log","level":"INFO"},"storage":{"path":"data"},"continuous_profiling":{"enable":true,"profile_seconds":10,"interval_seconds":60,"timeout_seconds":120,"data_retention_seconds":259200},"security":{"ca_path":"ngm.ca","cert_path":"ngm.cert","key_path":"ngm.key"}}`, string(data)) + // TODO(mornyx): Rollback when tiflash#5687 is fixed. + require.Equal(t, `{"address":"0.0.0.0:12020","advertise_address":"10.0.1.8:12020","pd":{"endpoints":["10.0.1.8:2379"]},"log":{"path":"log","level":"INFO"},"storage":{"path":"data"},"continuous_profiling":{"enable":false,"profile_seconds":10,"interval_seconds":60,"timeout_seconds":120,"data_retention_seconds":259200},"security":{"ca_path":"ngm.ca","cert_path":"ngm.cert","key_path":"ngm.key"}}`, string(data)) ctx, cancel := context.WithCancel(context.Background()) defer cancel() @@ -111,7 +112,8 @@ path = "data1"` require.Equal(t, getCfg(), globalCfg) data, err = json.Marshal(globalCfg) require.NoError(t, err) - require.Equal(t, `{"address":"0.0.0.0:12020","advertise_address":"10.0.1.8:12020","pd":{"endpoints":["10.0.1.8:2378","10.0.1.9:2379"]},"log":{"path":"log","level":"INFO"},"storage":{"path":"data"},"continuous_profiling":{"enable":true,"profile_seconds":10,"interval_seconds":60,"timeout_seconds":120,"data_retention_seconds":259200},"security":{"ca_path":"ngm.ca","cert_path":"ngm.cert","key_path":"ngm.key"}}`, string(data)) + // TODO(mornyx): Rollback when tiflash#5687 is fixed. + require.Equal(t, `{"address":"0.0.0.0:12020","advertise_address":"10.0.1.8:12020","pd":{"endpoints":["10.0.1.8:2378","10.0.1.9:2379"]},"log":{"path":"log","level":"INFO"},"storage":{"path":"data"},"continuous_profiling":{"enable":false,"profile_seconds":10,"interval_seconds":60,"timeout_seconds":120,"data_retention_seconds":259200},"security":{"ca_path":"ngm.ca","cert_path":"ngm.cert","key_path":"ngm.key"}}`, string(data)) cfgData = `` err = ioutil.WriteFile(cfgFileName, []byte(cfgData), 0666) @@ -121,7 +123,8 @@ path = "data1"` time.Sleep(time.Millisecond * 10) data, err = json.Marshal(GetGlobalConfig()) require.NoError(t, err) - require.Equal(t, `{"address":"0.0.0.0:12020","advertise_address":"10.0.1.8:12020","pd":{"endpoints":["10.0.1.8:2378","10.0.1.9:2379"]},"log":{"path":"log","level":"INFO"},"storage":{"path":"data"},"continuous_profiling":{"enable":true,"profile_seconds":10,"interval_seconds":60,"timeout_seconds":120,"data_retention_seconds":259200},"security":{"ca_path":"ngm.ca","cert_path":"ngm.cert","key_path":"ngm.key"}}`, string(data)) + // TODO(mornyx): Rollback when tiflash#5687 is fixed. + require.Equal(t, `{"address":"0.0.0.0:12020","advertise_address":"10.0.1.8:12020","pd":{"endpoints":["10.0.1.8:2378","10.0.1.9:2379"]},"log":{"path":"log","level":"INFO"},"storage":{"path":"data"},"continuous_profiling":{"enable":false,"profile_seconds":10,"interval_seconds":60,"timeout_seconds":120,"data_retention_seconds":259200},"security":{"ca_path":"ngm.ca","cert_path":"ngm.cert","key_path":"ngm.key"}}`, string(data)) } func TestConfigValid(t *testing.T) {