Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions server/config/persist_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,11 @@ func (o *PersistOptions) GetHotRegionCacheHitsThreshold() int {
return int(o.GetScheduleConfig().HotRegionCacheHitsThreshold)
}

// GetStoresLimit gets the stores' limit.
func (o *PersistOptions) GetStoresLimit() map[uint64]StoreLimitConfig {
return o.GetScheduleConfig().StoreLimit
}

// GetSchedulers gets the scheduler configurations.
func (o *PersistOptions) GetSchedulers() SchedulerConfigs {
return o.GetScheduleConfig().Schedulers
Expand Down
12 changes: 3 additions & 9 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -785,9 +785,7 @@ func (s *Server) GetConfig() *config.Config {

// GetScheduleConfig gets the balance config information.
func (s *Server) GetScheduleConfig() *config.ScheduleConfig {
cfg := &config.ScheduleConfig{}
*cfg = *s.persistOptions.GetScheduleConfig()
return cfg
return s.persistOptions.GetScheduleConfig().Clone()
}

// SetScheduleConfig sets the balance config information.
Expand Down Expand Up @@ -815,9 +813,7 @@ func (s *Server) SetScheduleConfig(cfg config.ScheduleConfig) error {

// GetReplicationConfig get the replication config.
func (s *Server) GetReplicationConfig() *config.ReplicationConfig {
cfg := &config.ReplicationConfig{}
*cfg = *s.persistOptions.GetReplicationConfig()
return cfg
return s.persistOptions.GetReplicationConfig().Clone()
}

// SetReplicationConfig sets the replication config.
Expand Down Expand Up @@ -905,9 +901,7 @@ func (s *Server) SetReplicationConfig(cfg config.ReplicationConfig) error {

// GetPDServerConfig gets the balance config information.
func (s *Server) GetPDServerConfig() *config.PDServerConfig {
cfg := &config.PDServerConfig{}
*cfg = *s.persistOptions.GetPDServerConfig()
return cfg
return s.persistOptions.GetPDServerConfig().Clone()
}

// SetPDServerConfig sets the server config.
Expand Down
3 changes: 2 additions & 1 deletion server/statistics/store_collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ func (s *storeStatistics) Collect() {
placementStatusGauge.WithLabelValues(labelType, name).Set(float64(value))
}

for storeID, limit := range s.opt.GetScheduleConfig().StoreLimit {
storesLimit := s.opt.GetStoresLimit()
for storeID, limit := range storesLimit {
Comment thread
rleungx marked this conversation as resolved.
Outdated
id := strconv.FormatUint(storeID, 10)
StoreLimitGauge.WithLabelValues(id, "add-peer").Set(limit.AddPeer)
StoreLimitGauge.WithLabelValues(id, "remove-peer").Set(limit.RemovePeer)
Expand Down