From 9cb5396cf643f59da94958f2330370198fb4cd9f Mon Sep 17 00:00:00 2001 From: "yihao.dai" Date: Wed, 9 Oct 2024 19:49:20 +0800 Subject: [PATCH] enhance: Use common gc config (#36668) (#36670) Use the GC config from `common` and remove the GC config from `queryNode`. issue: https://github.com/milvus-io/milvus/issues/36667 pr: https://github.com/milvus-io/milvus/pull/36668 related pr: https://github.com/milvus-io/milvus/pull/34949 --------- Signed-off-by: bigsheeper --- cmd/roles/roles.go | 4 +- internal/querynodev2/handlers_test.go | 2 +- internal/querynodev2/local_worker_test.go | 2 +- internal/querynodev2/server_test.go | 2 +- internal/querynodev2/services_test.go | 2 +- pkg/util/paramtable/component_param.go | 49 +++++------------------ 6 files changed, 17 insertions(+), 44 deletions(-) diff --git a/cmd/roles/roles.go b/cmd/roles/roles.go index 2ce6200a19..82de6f24e3 100644 --- a/cmd/roles/roles.go +++ b/cmd/roles/roles.go @@ -402,10 +402,10 @@ func (mr *MilvusRoles) Run() { action := func(GOGC uint32) { debug.SetGCPercent(int(GOGC)) } - gc.NewTuner(paramtable.Get().CommonCfg.OverloadedMemoryThresholdPercentage.GetAsFloat(), uint32(paramtable.Get().QueryNodeCfg.MinimumGOGCConfig.GetAsInt()), uint32(paramtable.Get().QueryNodeCfg.MaximumGOGCConfig.GetAsInt()), action) + gc.NewTuner(paramtable.Get().CommonCfg.OverloadedMemoryThresholdPercentage.GetAsFloat(), uint32(paramtable.Get().CommonCfg.MinimumGOGCConfig.GetAsInt()), uint32(paramtable.Get().CommonCfg.MaximumGOGCConfig.GetAsInt()), action) } else { action := func(uint32) {} - gc.NewTuner(paramtable.Get().CommonCfg.OverloadedMemoryThresholdPercentage.GetAsFloat(), uint32(paramtable.Get().QueryNodeCfg.MinimumGOGCConfig.GetAsInt()), uint32(paramtable.Get().QueryNodeCfg.MaximumGOGCConfig.GetAsInt()), action) + gc.NewTuner(paramtable.Get().CommonCfg.OverloadedMemoryThresholdPercentage.GetAsFloat(), uint32(paramtable.Get().CommonCfg.MinimumGOGCConfig.GetAsInt()), uint32(paramtable.Get().CommonCfg.MaximumGOGCConfig.GetAsInt()), action) } } diff --git a/internal/querynodev2/handlers_test.go b/internal/querynodev2/handlers_test.go index a9b2ed0f1d..a311743fca 100644 --- a/internal/querynodev2/handlers_test.go +++ b/internal/querynodev2/handlers_test.go @@ -63,7 +63,7 @@ func (suite *HandlersSuite) SetupTest() { var err error paramtable.Init() suite.params = paramtable.Get() - suite.params.Save(suite.params.QueryNodeCfg.GCEnabled.Key, "false") + suite.params.Save(suite.params.CommonCfg.GCEnabled.Key, "false") // mock factory suite.factory = dependency.NewMockFactory(suite.T()) diff --git a/internal/querynodev2/local_worker_test.go b/internal/querynodev2/local_worker_test.go index b916d60910..724387e137 100644 --- a/internal/querynodev2/local_worker_test.go +++ b/internal/querynodev2/local_worker_test.go @@ -71,7 +71,7 @@ func (suite *LocalWorkerTestSuite) BeforeTest(suiteName, testName string) { paramtable.Init() suite.params = paramtable.Get() // close GC at test to avoid data race - suite.params.Save(suite.params.QueryNodeCfg.GCEnabled.Key, "false") + suite.params.Save(suite.params.CommonCfg.GCEnabled.Key, "false") suite.ctx, suite.cancel = context.WithCancel(context.Background()) // init node diff --git a/internal/querynodev2/server_test.go b/internal/querynodev2/server_test.go index cc9854a606..30164e0b8b 100644 --- a/internal/querynodev2/server_test.go +++ b/internal/querynodev2/server_test.go @@ -65,7 +65,7 @@ func (suite *QueryNodeSuite) SetupTest() { var err error paramtable.Init() suite.params = paramtable.Get() - suite.params.Save(suite.params.QueryNodeCfg.GCEnabled.Key, "false") + suite.params.Save(suite.params.CommonCfg.GCEnabled.Key, "false") // mock factory suite.factory = dependency.NewMockFactory(suite.T()) diff --git a/internal/querynodev2/services_test.go b/internal/querynodev2/services_test.go index 8a8225ea07..86d88b3732 100644 --- a/internal/querynodev2/services_test.go +++ b/internal/querynodev2/services_test.go @@ -94,7 +94,7 @@ func (suite *ServiceSuite) SetupSuite() { // collection and segments data // init param paramtable.Init() - paramtable.Get().Save(paramtable.Get().QueryNodeCfg.GCEnabled.Key, "false") + paramtable.Get().Save(paramtable.Get().CommonCfg.GCEnabled.Key, "false") suite.rootPath = suite.T().Name() suite.collectionID = 111 diff --git a/pkg/util/paramtable/component_param.go b/pkg/util/paramtable/component_param.go index 6645891860..8cbd35ddcd 100644 --- a/pkg/util/paramtable/component_param.go +++ b/pkg/util/paramtable/component_param.go @@ -254,11 +254,13 @@ type commonConfig struct { UseVectorAsClusteringKey ParamItem `refreshable:"true"` EnableVectorClusteringKey ParamItem `refreshable:"true"` - GCEnabled ParamItem `refreshable:"false"` - GCHelperEnabled ParamItem `refreshable:"false"` + // GC + GCEnabled ParamItem `refreshable:"false"` + GCHelperEnabled ParamItem `refreshable:"false"` + MaximumGOGCConfig ParamItem `refreshable:"false"` + MinimumGOGCConfig ParamItem `refreshable:"false"` + OverloadedMemoryThresholdPercentage ParamItem `refreshable:"false"` - MaximumGOGCConfig ParamItem `refreshable:"false"` - MinimumGOGCConfig ParamItem `refreshable:"false"` ReadOnlyPrivileges ParamItem `refreshable:"false"` ReadWritePrivileges ParamItem `refreshable:"false"` AdminPrivileges ParamItem `refreshable:"false"` @@ -850,6 +852,7 @@ This helps Milvus-CDC synchronize incremental data`, p.GCEnabled = ParamItem{ Key: "common.gcenabled", + FallbackKeys: []string{"queryNode.gcenabled"}, Version: "2.4.7", DefaultValue: "true", } @@ -857,6 +860,7 @@ This helps Milvus-CDC synchronize incremental data`, p.GCHelperEnabled = ParamItem{ Key: "common.gchelper.enabled", + FallbackKeys: []string{"queryNode.gchelper.enabled"}, Version: "2.4.7", DefaultValue: "true", } @@ -875,6 +879,7 @@ This helps Milvus-CDC synchronize incremental data`, p.MaximumGOGCConfig = ParamItem{ Key: "common.gchelper.maximumGoGC", + FallbackKeys: []string{"queryNode.gchelper.maximumGoGC"}, Version: "2.4.7", DefaultValue: "200", } @@ -882,6 +887,7 @@ This helps Milvus-CDC synchronize incremental data`, p.MinimumGOGCConfig = ParamItem{ Key: "common.gchelper.minimumGoGC", + FallbackKeys: []string{"queryNode.gchelper.minimumGoGC"}, Version: "2.4.7", DefaultValue: "30", } @@ -2371,12 +2377,7 @@ type queryNodeConfig struct { TopKMergeRatio ParamItem `refreshable:"true"` CPURatio ParamItem `refreshable:"true"` MaxTimestampLag ParamItem `refreshable:"true"` - GCEnabled ParamItem `refreshable:"true"` - - GCHelperEnabled ParamItem `refreshable:"false"` - MinimumGOGCConfig ParamItem `refreshable:"false"` - MaximumGOGCConfig ParamItem `refreshable:"false"` - GracefulStopTimeout ParamItem `refreshable:"false"` + GracefulStopTimeout ParamItem `refreshable:"false"` // delete buffer MaxSegmentDeleteBuffer ParamItem `refreshable:"false"` @@ -2925,34 +2926,6 @@ Max read concurrency must greater than or equal to 1, and less than or equal to } p.MaxTimestampLag.Init(base.mgr) - p.GCEnabled = ParamItem{ - Key: "queryNode.gcenabled", - Version: "2.3.0", - DefaultValue: "true", - } - p.GCEnabled.Init(base.mgr) - - p.GCHelperEnabled = ParamItem{ - Key: "queryNode.gchelper.enabled", - Version: "2.0.0", - DefaultValue: "true", - } - p.GCHelperEnabled.Init(base.mgr) - - p.MaximumGOGCConfig = ParamItem{ - Key: "queryNode.gchelper.maximumGoGC", - Version: "2.0.0", - DefaultValue: "200", - } - p.MaximumGOGCConfig.Init(base.mgr) - - p.MinimumGOGCConfig = ParamItem{ - Key: "queryNode.gchelper.minimumGoGC", - Version: "2.0.0", - DefaultValue: "30", - } - p.MinimumGOGCConfig.Init(base.mgr) - p.GracefulStopTimeout = ParamItem{ Key: "queryNode.gracefulStopTimeout", Version: "2.2.1",