Skip to content

Commit

Permalink
Deprecate SchedulersPayload
Browse files Browse the repository at this point in the history
Signed-off-by: okJiang <[email protected]>
  • Loading branch information
okJiang committed Aug 9, 2024
1 parent 8bd348e commit 0fece29
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 20 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
2 changes: 1 addition & 1 deletion pkg/schedule/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ type ScheduleConfig struct {
Schedulers SchedulerConfigs `toml:"schedulers" json:"schedulers-v2"` // json v2 is for the sake of compatible upgrade

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

// Controls the time interval between write hot regions info into leveldb.
Expand Down Expand Up @@ -324,7 +325,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

0 comments on commit 0fece29

Please sign in to comment.