Skip to content

Commit

Permalink
config: Deprecate SchedulersPayload (#8509)
Browse files Browse the repository at this point in the history
ref #8474

Signed-off-by: okJiang <[email protected]>

Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com>
  • Loading branch information
okJiang and ti-chi-bot[bot] authored Aug 12, 2024
1 parent 6b812c6 commit 3f32f54
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 37 deletions.
8 changes: 0 additions & 8 deletions pkg/mcs/scheduling/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -540,14 +540,6 @@ func (s *Server) GetConfig() *config.Config {
cfg.Schedule = *s.persistConfig.GetScheduleConfig().Clone()
cfg.Replication = *s.persistConfig.GetReplicationConfig().Clone()
cfg.ClusterVersion = *s.persistConfig.GetClusterVersion()
if s.storage == nil {
return cfg
}
sches, configs, err := s.storage.LoadAllSchedulerConfigs()
if err != nil {
return cfg
}
cfg.Schedule.SchedulersPayload = schedulers.ToPayload(sches, configs)
return cfg
}

Expand Down
4 changes: 0 additions & 4 deletions pkg/schedule/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,9 +278,6 @@ type ScheduleConfig struct {
// Schedulers support for loading customized schedulers
Schedulers SchedulerConfigs `toml:"schedulers" json:"schedulers-v2"` // json v2 is for the sake of compatible upgrade

// Only used to display
SchedulersPayload map[string]any `toml:"schedulers-payload" json:"schedulers-payload"`

// Controls the time interval between write hot regions info into leveldb.
HotRegionsWriteInterval typeutil.Duration `toml:"hot-regions-write-interval" json:"hot-regions-write-interval"`

Expand Down Expand Up @@ -324,7 +321,6 @@ func (c *ScheduleConfig) Clone() *ScheduleConfig {
cfg := *c
cfg.StoreLimit = storeLimit
cfg.Schedulers = schedulers
cfg.SchedulersPayload = nil
return &cfg
}

Expand Down
1 change: 0 additions & 1 deletion server/api/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,6 @@ func (h *confHandler) GetScheduleConfig(w http.ResponseWriter, r *http.Request)
h.rd.JSON(w, http.StatusInternalServerError, err.Error())
return
}
cfg.Schedule.SchedulersPayload = nil
h.rd.JSON(w, http.StatusOK, cfg.Schedule)
return
}
Expand Down
10 changes: 0 additions & 10 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ import (
sc "github.com/tikv/pd/pkg/schedule/config"
"github.com/tikv/pd/pkg/schedule/hbstream"
"github.com/tikv/pd/pkg/schedule/placement"
"github.com/tikv/pd/pkg/schedule/schedulers"
"github.com/tikv/pd/pkg/storage"
"github.com/tikv/pd/pkg/storage/endpoint"
"github.com/tikv/pd/pkg/storage/kv"
Expand Down Expand Up @@ -982,14 +981,6 @@ func (s *Server) GetConfig() *config.Config {
cfg.MicroService = *s.persistOptions.GetMicroServiceConfig().Clone()
cfg.LabelProperty = s.persistOptions.GetLabelPropertyConfig().Clone()
cfg.ClusterVersion = *s.persistOptions.GetClusterVersion()
if s.storage == nil {
return cfg
}
sches, configs, err := s.storage.LoadAllSchedulerConfigs()
if err != nil {
return cfg
}
cfg.Schedule.SchedulersPayload = schedulers.ToPayload(sches, configs)
return cfg
}

Expand Down Expand Up @@ -1054,7 +1045,6 @@ func (s *Server) SetScheduleConfig(cfg sc.ScheduleConfig) error {
return err
}
old := s.persistOptions.GetScheduleConfig()
cfg.SchedulersPayload = nil
s.persistOptions.SetScheduleConfig(&cfg)
if err := s.persistOptions.Persist(s.storage); err != nil {
s.persistOptions.SetScheduleConfig(old)
Expand Down
13 changes: 1 addition & 12 deletions tests/integrations/mcs/scheduling/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -395,14 +395,6 @@ func (suite *apiTestSuite) checkConfig(cluster *tests.TestCluster) {
re.Equal(cfg.Replication.MaxReplicas, s.GetConfig().Replication.MaxReplicas)
re.Equal(cfg.Replication.LocationLabels, s.GetConfig().Replication.LocationLabels)
re.Equal(cfg.DataDir, s.GetConfig().DataDir)
testutil.Eventually(re, func() bool {
// wait for all schedulers to be loaded in scheduling server.
return len(cfg.Schedule.SchedulersPayload) == 4
})
re.Contains(cfg.Schedule.SchedulersPayload, "balance-leader-scheduler")
re.Contains(cfg.Schedule.SchedulersPayload, "balance-region-scheduler")
re.Contains(cfg.Schedule.SchedulersPayload, "balance-hot-region-scheduler")
re.Contains(cfg.Schedule.SchedulersPayload, "evict-slow-store-scheduler")
}

func (suite *apiTestSuite) TestConfigForward() {
Expand All @@ -423,10 +415,7 @@ func (suite *apiTestSuite) checkConfigForward(cluster *tests.TestCluster) {
testutil.ReadGetJSON(re, tests.TestDialClient, urlPrefix, &cfg)
re.Equal(cfg["schedule"].(map[string]any)["leader-schedule-limit"],
float64(opts.GetLeaderScheduleLimit()))
re.Equal(cfg["replication"].(map[string]any)["max-replicas"],
float64(opts.GetReplicationConfig().MaxReplicas))
schedulers := cfg["schedule"].(map[string]any)["schedulers-payload"].(map[string]any)
return len(schedulers) == 4
return cfg["replication"].(map[string]any)["max-replicas"] == float64(opts.GetReplicationConfig().MaxReplicas)
})

// Test to change config in api server
Expand Down
1 change: 0 additions & 1 deletion tools/pd-ctl/pdctl/command/config_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,6 @@ func showConfigCommandFunc(cmd *cobra.Command, _ []string) {

var hideConfig = []string{
"schedulers-v2",
"schedulers-payload",
"store-limit",
"enable-remove-down-replica",
"enable-replace-offline-replica",
Expand Down
1 change: 0 additions & 1 deletion tools/pd-ctl/tests/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ func (suite *configTestSuite) checkConfig(cluster *pdTests.TestCluster) {

// hidden config
scheduleConfig.Schedulers = nil
scheduleConfig.SchedulersPayload = nil
scheduleConfig.StoreLimit = nil
scheduleConfig.SchedulerMaxWaitingOperator = 0
scheduleConfig.EnableRemoveDownReplica = false
Expand Down

0 comments on commit 3f32f54

Please sign in to comment.