File tree Expand file tree Collapse file tree 3 files changed +9
-10
lines changed
Expand file tree Collapse file tree 3 files changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -495,6 +495,11 @@ func (o *PersistOptions) GetHotRegionCacheHitsThreshold() int {
495495 return int (o .GetScheduleConfig ().HotRegionCacheHitsThreshold )
496496}
497497
498+ // GetStoresLimit gets the stores' limit.
499+ func (o * PersistOptions ) GetStoresLimit () map [uint64 ]StoreLimitConfig {
500+ return o .GetScheduleConfig ().StoreLimit
501+ }
502+
498503// GetSchedulers gets the scheduler configurations.
499504func (o * PersistOptions ) GetSchedulers () SchedulerConfigs {
500505 return o .GetScheduleConfig ().Schedulers
Original file line number Diff line number Diff line change @@ -785,9 +785,7 @@ func (s *Server) GetConfig() *config.Config {
785785
786786// GetScheduleConfig gets the balance config information.
787787func (s * Server ) GetScheduleConfig () * config.ScheduleConfig {
788- cfg := & config.ScheduleConfig {}
789- * cfg = * s .persistOptions .GetScheduleConfig ()
790- return cfg
788+ return s .persistOptions .GetScheduleConfig ().Clone ()
791789}
792790
793791// SetScheduleConfig sets the balance config information.
@@ -815,9 +813,7 @@ func (s *Server) SetScheduleConfig(cfg config.ScheduleConfig) error {
815813
816814// GetReplicationConfig get the replication config.
817815func (s * Server ) GetReplicationConfig () * config.ReplicationConfig {
818- cfg := & config.ReplicationConfig {}
819- * cfg = * s .persistOptions .GetReplicationConfig ()
820- return cfg
816+ return s .persistOptions .GetReplicationConfig ().Clone ()
821817}
822818
823819// SetReplicationConfig sets the replication config.
@@ -905,9 +901,7 @@ func (s *Server) SetReplicationConfig(cfg config.ReplicationConfig) error {
905901
906902// GetPDServerConfig gets the balance config information.
907903func (s * Server ) GetPDServerConfig () * config.PDServerConfig {
908- cfg := & config.PDServerConfig {}
909- * cfg = * s .persistOptions .GetPDServerConfig ()
910- return cfg
904+ return s .persistOptions .GetPDServerConfig ().Clone ()
911905}
912906
913907// SetPDServerConfig sets the server config.
Original file line number Diff line number Diff line change @@ -187,7 +187,7 @@ func (s *storeStatistics) Collect() {
187187 placementStatusGauge .WithLabelValues (labelType , name ).Set (float64 (value ))
188188 }
189189
190- for storeID , limit := range s .opt .GetScheduleConfig (). StoreLimit {
190+ for storeID , limit := range s .opt .GetStoresLimit () {
191191 id := strconv .FormatUint (storeID , 10 )
192192 StoreLimitGauge .WithLabelValues (id , "add-peer" ).Set (limit .AddPeer )
193193 StoreLimitGauge .WithLabelValues (id , "remove-peer" ).Set (limit .RemovePeer )
You can’t perform that action at this time.
0 commit comments