From b888156759ab8d8b2963dbe9773b0a4380e574b9 Mon Sep 17 00:00:00 2001 From: nolouch Date: Wed, 8 Jan 2025 14:50:02 +0800 Subject: [PATCH] config: tototally remove the deprecated field in pd server config Signed-off-by: nolouch --- server/config/config.go | 26 ++++---------------------- server/config/persist_options.go | 1 - 2 files changed, 4 insertions(+), 23 deletions(-) diff --git a/server/config/config.go b/server/config/config.go index 69cd76409bc..804d952ba32 100644 --- a/server/config/config.go +++ b/server/config/config.go @@ -18,7 +18,6 @@ import ( "crypto/tls" "encoding/json" "fmt" - "math" "net/url" "os" "path/filepath" @@ -507,9 +506,6 @@ type PDServerConfig struct { MetricStorage string `toml:"metric-storage" json:"metric-storage"` // There are some values supported: "auto", "none", or a specific address, default: "auto" DashboardAddress string `toml:"dashboard-address" json:"dashboard-address"` - // TraceRegionFlow the option to update flow information of regions. - // WARN: TraceRegionFlow is deprecated. - TraceRegionFlow bool `toml:"trace-region-flow" json:"trace-region-flow,string,omitempty"` // FlowRoundByDigit used to discretization processing flow information. FlowRoundByDigit int `toml:"flow-round-by-digit" json:"flow-round-by-digit"` // MinResolvedTSPersistenceInterval is the interval to save the min resolved ts. @@ -581,29 +577,15 @@ func (c *PDServerConfig) adjust(meta *configutil.ConfigMetaData) error { func (c *PDServerConfig) migrateConfigurationFromFile(meta *configutil.ConfigMetaData) error { oldName, newName := "trace-region-flow", "flow-round-by-digit" - defineOld, defineNew := meta.IsDefined(oldName), meta.IsDefined(newName) + defineOld, _ := meta.IsDefined(oldName), meta.IsDefined(newName) switch { - case defineOld && defineNew: - if c.TraceRegionFlow && (c.FlowRoundByDigit == defaultFlowRoundByDigit) { - return errors.Errorf("config item %s and %s(deprecated) are conflict", newName, oldName) - } - case defineOld && !defineNew: - if !c.TraceRegionFlow { - c.FlowRoundByDigit = math.MaxInt8 - } + case defineOld: + return errors.Errorf("config item %s and %s(deprecated) are conflict", newName, oldName) + default: } return nil } -// MigrateDeprecatedFlags updates new flags according to deprecated flags. -func (c *PDServerConfig) MigrateDeprecatedFlags() { - if !c.TraceRegionFlow { - c.FlowRoundByDigit = math.MaxInt8 - } - // json omity the false. next time will not persist to the kv. - c.TraceRegionFlow = false -} - // Clone returns a cloned PD server config. func (c *PDServerConfig) Clone() *PDServerConfig { runtimeServices := append(c.RuntimeServices[:0:0], c.RuntimeServices...) diff --git a/server/config/persist_options.go b/server/config/persist_options.go index 59d42383743..e5926b2637b 100644 --- a/server/config/persist_options.go +++ b/server/config/persist_options.go @@ -817,7 +817,6 @@ func (o *PersistOptions) Reload(storage endpoint.ConfigStorage) error { adjustScheduleCfg(&cfg.Schedule) // Some fields may not be stored in the storage, we need to calculate them manually. cfg.StoreConfig.Adjust() - cfg.PDServerCfg.MigrateDeprecatedFlags() if isExist { o.schedule.Store(&cfg.Schedule) o.replication.Store(&cfg.Replication)