Documentation ¶
Index ¶
- Constants
- Variables
- func IsDefaultScheduler(typ string) bool
- func IsSchedulerRegistered(typ types.CheckerSchedulerType) bool
- func RegisterScheduler(typ types.CheckerSchedulerType)
- func ValidateLabelKey(key string) error
- func ValidateLabels(labels []*metapb.StoreLabel) error
- type CheckerConfigProvider
- type ConfProvider
- type Coprocessor
- type ReplicationConfig
- type ScheduleConfig
- func (c *ScheduleConfig) Adjust(meta *configutil.ConfigMetaData, reloading bool) error
- func (c *ScheduleConfig) Clone() *ScheduleConfig
- func (c *ScheduleConfig) Deprecated() error
- func (c *ScheduleConfig) GetMaxMergeRegionKeys() uint64
- func (c *ScheduleConfig) MigrateDeprecatedFlags()
- func (c *ScheduleConfig) Validate() error
- type SchedulerConfig
- type SchedulerConfigProvider
- type SchedulerConfigs
- type SharedConfigProvider
- type Storage
- type StoreConfig
- func (c *StoreConfig) Adjust()
- func (c *StoreConfig) CheckRegionKeys(keys, mergeKeys uint64) error
- func (c *StoreConfig) CheckRegionSize(size, mergeSize uint64) error
- func (c *StoreConfig) Clone() *StoreConfig
- func (c *StoreConfig) Equal(other *StoreConfig) bool
- func (c *StoreConfig) GetRegionBucketSize() uint64
- func (c *StoreConfig) GetRegionMaxKeys() uint64
- func (c *StoreConfig) GetRegionMaxSize() uint64
- func (c *StoreConfig) GetRegionSplitKeys() uint64
- func (c *StoreConfig) GetRegionSplitSize() uint64
- func (c *StoreConfig) IsEnableRegionBucket() bool
- func (c *StoreConfig) IsRaftKV2() bool
- func (c *StoreConfig) SetRegionBucketEnabled(enabled bool)
- func (c *StoreConfig) String() string
- type StoreConfigProvider
- type StoreLimit
- type StoreLimitConfig
Constants ¶
const ( // DefaultMaxReplicas is the default number of replicas for each region. DefaultMaxReplicas = 3 // DefaultSplitMergeInterval is the default value of config split merge interval. DefaultSplitMergeInterval = time.Hour )
const ( // TTLConfigPrefix is the prefix of the config item that needs to set TTL. TTLConfigPrefix = "/config/ttl" MaxSnapshotCountKey = "schedule.max-snapshot-count" MaxMergeRegionSizeKey = "schedule.max-merge-region-size" MaxPendingPeerCountKey = "schedule.max-pending-peer-count" MaxMergeRegionKeysKey = "schedule.max-merge-region-keys" LeaderScheduleLimitKey = "schedule.leader-schedule-limit" RegionScheduleLimitKey = "schedule.region-schedule-limit" WitnessScheduleLimitKey = "schedule.witness-schedule-limit" ReplicaRescheduleLimitKey = "schedule.replica-schedule-limit" MergeScheduleLimitKey = "schedule.merge-schedule-limit" HotRegionScheduleLimitKey = "schedule.hot-region-schedule-limit" SchedulerMaxWaitingOperatorKey = "schedule.scheduler-max-waiting-operator" EnableLocationReplacement = "schedule.enable-location-replacement" DefaultAddPeer = "default-add-peer" DefaultRemovePeer = "default-remove-peer" // EnableTiKVSplitRegion is the option to enable tikv split region. // it's related to schedule, but it's not an explicit config EnableTiKVSplitRegion = "schedule.enable-tikv-split-region" DefaultGCInterval = 5 * time.Second DefaultTTL = 5 * time.Minute )
The following consts are used to identify the config item that needs to set TTL.
const RejectLeader = "reject-leader"
RejectLeader is the label property type that suggests a store should not have any region leaders.
Variables ¶
var ( // DefaultStoreLimit is the default store limit of add peer and remove peer. DefaultStoreLimit = StoreLimit{AddPeer: 15, RemovePeer: 15} // DefaultTiFlashStoreLimit is the default TiFlash store limit of add peer and remove peer. DefaultTiFlashStoreLimit = StoreLimit{AddPeer: 30, RemovePeer: 30} )
var DefaultSchedulers = SchedulerConfigs{ {Type: types.SchedulerTypeCompatibleMap[types.BalanceRegionScheduler]}, {Type: types.SchedulerTypeCompatibleMap[types.BalanceLeaderScheduler]}, {Type: types.SchedulerTypeCompatibleMap[types.BalanceHotRegionScheduler]}, {Type: types.SchedulerTypeCompatibleMap[types.EvictSlowStoreScheduler]}, }
DefaultSchedulers are the schedulers be created by default. If these schedulers are not in the persistent configuration, they will be created automatically when reloading.
var (
// RaftstoreV2 is the v2 raftstore engine mark.
RaftstoreV2 = "raft-kv2"
)
Functions ¶
func IsDefaultScheduler ¶
IsDefaultScheduler checks whether the scheduler is enabled by default.
func IsSchedulerRegistered ¶
func IsSchedulerRegistered(typ types.CheckerSchedulerType) bool
IsSchedulerRegistered checks if the named scheduler type is registered.
func RegisterScheduler ¶
func RegisterScheduler(typ types.CheckerSchedulerType)
RegisterScheduler registers the scheduler type.
func ValidateLabelKey ¶
ValidateLabelKey checks the legality of the label key.
func ValidateLabels ¶
func ValidateLabels(labels []*metapb.StoreLabel) error
ValidateLabels checks the legality of the labels.
Types ¶
type CheckerConfigProvider ¶
type CheckerConfigProvider interface { SharedConfigProvider StoreConfigProvider GetSwitchWitnessInterval() time.Duration IsRemoveExtraReplicaEnabled() bool IsRemoveDownReplicaEnabled() bool IsReplaceOfflineReplicaEnabled() bool IsMakeUpReplicaEnabled() bool IsLocationReplacementEnabled() bool GetIsolationLevel() string GetSplitMergeInterval() time.Duration GetPatrolRegionInterval() time.Duration GetPatrolRegionWorkerCount() int GetMaxMergeRegionSize() uint64 GetMaxMergeRegionKeys() uint64 GetReplicaScheduleLimit() uint64 }
CheckerConfigProvider is the interface for checker configurations.
type ConfProvider ¶
type ConfProvider interface { SchedulerConfigProvider CheckerConfigProvider StoreConfigProvider // for test purpose SetPlacementRuleEnabled(bool) SetSplitMergeInterval(time.Duration) SetMaxReplicas(int) SetAllStoresLimit(storelimit.Type, float64) }
ConfProvider is the interface that wraps the ConfProvider related methods.
type Coprocessor ¶
type Coprocessor struct { // RegionMaxSize is the max size of a region, if the region size is larger than this value, region will be // split by RegionSplitSize. RegionMaxSize string `json:"region-max-size"` // RegionSplitSize is the split size of a region, region will according to this value to split. RegionSplitSize string `json:"region-split-size"` RegionMaxKeys int `json:"region-max-keys"` RegionSplitKeys int `json:"region-split-keys"` EnableRegionBucket bool `json:"enable-region-bucket"` RegionBucketSize string `json:"region-bucket-size"` }
Coprocessor is the config of coprocessor.
type ReplicationConfig ¶
type ReplicationConfig struct { // MaxReplicas is the number of replicas for each region. MaxReplicas uint64 `toml:"max-replicas" json:"max-replicas"` // The label keys specified the location of a store. // The placement priorities is implied by the order of label keys. // For example, ["zone", "rack"] means that we should place replicas to // different zones first, then to different racks if we don't have enough zones. LocationLabels typeutil.StringSlice `toml:"location-labels" json:"location-labels"` // StrictlyMatchLabel strictly checks if the label of TiKV is matched with LocationLabels. StrictlyMatchLabel bool `toml:"strictly-match-label" json:"strictly-match-label,string"` // When PlacementRules feature is enabled. MaxReplicas, LocationLabels and IsolationLabels are not used any more. EnablePlacementRules bool `toml:"enable-placement-rules" json:"enable-placement-rules,string"` // EnablePlacementRuleCache controls whether use cache during rule checker EnablePlacementRulesCache bool `toml:"enable-placement-rules-cache" json:"enable-placement-rules-cache,string"` // IsolationLevel is used to isolate replicas explicitly and forcibly if it's not empty. // Its value must be empty or one of LocationLabels. // Example: // location-labels = ["zone", "rack", "host"] // isolation-level = "zone" // With configuration like above, PD ensure that all replicas be placed in different zones. // Even if a zone is down, PD will not try to make up replicas in other zone // because other zones already have replicas on it. IsolationLevel string `toml:"isolation-level" json:"isolation-level"` }
ReplicationConfig is the replication configuration. NOTE: This type is exported by HTTP API. Please pay more attention when modifying it.
func (*ReplicationConfig) Adjust ¶
func (c *ReplicationConfig) Adjust(meta *configutil.ConfigMetaData) error
Adjust adjusts the config.
func (*ReplicationConfig) Clone ¶
func (c *ReplicationConfig) Clone() *ReplicationConfig
Clone makes a deep copy of the config.
func (*ReplicationConfig) Validate ¶
func (c *ReplicationConfig) Validate() error
Validate is used to validate if some replication configurations are right.
type ScheduleConfig ¶
type ScheduleConfig struct { // If the snapshot count of one store is greater than this value, // it will never be used as a source or target store. MaxSnapshotCount uint64 `toml:"max-snapshot-count" json:"max-snapshot-count"` MaxPendingPeerCount uint64 `toml:"max-pending-peer-count" json:"max-pending-peer-count"` // If both the size of region is smaller than MaxMergeRegionSize // and the number of rows in region is smaller than MaxMergeRegionKeys, // it will try to merge with adjacent regions. MaxMergeRegionSize uint64 `toml:"max-merge-region-size" json:"max-merge-region-size"` MaxMergeRegionKeys uint64 `toml:"max-merge-region-keys" json:"max-merge-region-keys"` // SplitMergeInterval is the minimum interval time to permit merge after split. SplitMergeInterval typeutil.Duration `toml:"split-merge-interval" json:"split-merge-interval"` // SwitchWitnessInterval is the minimum interval that allows a peer to become a witness again after it is promoted to non-witness. SwitchWitnessInterval typeutil.Duration `toml:"switch-witness-interval" json:"switch-witness-interval"` // EnableOneWayMerge is the option to enable one way merge. This means a Region can only be merged into the next region of it. EnableOneWayMerge bool `toml:"enable-one-way-merge" json:"enable-one-way-merge,string"` // EnableCrossTableMerge is the option to enable cross table merge. This means two Regions can be merged with different table IDs. // This option only works when key type is "table". EnableCrossTableMerge bool `toml:"enable-cross-table-merge" json:"enable-cross-table-merge,string"` // PatrolRegionInterval is the interval for scanning region during patrol. PatrolRegionInterval typeutil.Duration `toml:"patrol-region-interval" json:"patrol-region-interval"` // MaxStoreDownTime is the max duration after which // a store will be considered to be down if it hasn't reported heartbeats. MaxStoreDownTime typeutil.Duration `toml:"max-store-down-time" json:"max-store-down-time"` // MaxStorePreparingTime is the max duration after which // a store will be considered to be preparing. MaxStorePreparingTime typeutil.Duration `toml:"max-store-preparing-time" json:"max-store-preparing-time"` // LeaderScheduleLimit is the max coexist leader schedules. LeaderScheduleLimit uint64 `toml:"leader-schedule-limit" json:"leader-schedule-limit"` // LeaderSchedulePolicy is the option to balance leader, there are some policies supported: ["count", "size"], default: "count" LeaderSchedulePolicy string `toml:"leader-schedule-policy" json:"leader-schedule-policy"` // RegionScheduleLimit is the max coexist region schedules. RegionScheduleLimit uint64 `toml:"region-schedule-limit" json:"region-schedule-limit"` // WitnessScheduleLimit is the max coexist witness schedules. WitnessScheduleLimit uint64 `toml:"witness-schedule-limit" json:"witness-schedule-limit"` // ReplicaScheduleLimit is the max coexist replica schedules. ReplicaScheduleLimit uint64 `toml:"replica-schedule-limit" json:"replica-schedule-limit"` // MergeScheduleLimit is the max coexist merge schedules. MergeScheduleLimit uint64 `toml:"merge-schedule-limit" json:"merge-schedule-limit"` // HotRegionScheduleLimit is the max coexist hot region schedules. HotRegionScheduleLimit uint64 `toml:"hot-region-schedule-limit" json:"hot-region-schedule-limit"` // HotRegionCacheHitThreshold is the cache hits threshold of the hot region. // If the number of times a region hits the hot cache is greater than this // threshold, it is considered a hot region. HotRegionCacheHitsThreshold uint64 `toml:"hot-region-cache-hits-threshold" json:"hot-region-cache-hits-threshold"` // StoreBalanceRate is the maximum of balance rate for each store. // WARN: StoreBalanceRate is deprecated. StoreBalanceRate float64 `toml:"store-balance-rate" json:"store-balance-rate,omitempty"` // StoreLimit is the limit of scheduling for stores. StoreLimit map[uint64]StoreLimitConfig `toml:"store-limit" json:"store-limit"` // TolerantSizeRatio is the ratio of buffer size for balance scheduler. TolerantSizeRatio float64 `toml:"tolerant-size-ratio" json:"tolerant-size-ratio"` // // high space stage transition stage low space stage // |--------------------|-----------------------------|-------------------------| // ^ ^ ^ ^ // 0 HighSpaceRatio * capacity LowSpaceRatio * capacity capacity // // LowSpaceRatio is the lowest usage ratio of store which regraded as low space. // When in low space, store region score increases to very large and varies inversely with available size. LowSpaceRatio float64 `toml:"low-space-ratio" json:"low-space-ratio"` // HighSpaceRatio is the highest usage ratio of store which regraded as high space. // High space means there is a lot of spare capacity, and store region score varies directly with used size. HighSpaceRatio float64 `toml:"high-space-ratio" json:"high-space-ratio"` // RegionScoreFormulaVersion is used to control the formula used to calculate region score. RegionScoreFormulaVersion string `toml:"region-score-formula-version" json:"region-score-formula-version"` // SchedulerMaxWaitingOperator is the max coexist operators for each scheduler. SchedulerMaxWaitingOperator uint64 `toml:"scheduler-max-waiting-operator" json:"scheduler-max-waiting-operator"` // WARN: DisableLearner is deprecated. // DisableLearner is the option to disable using AddLearnerNode instead of AddNode. DisableLearner bool `toml:"disable-raft-learner" json:"disable-raft-learner,string,omitempty"` // DisableRemoveDownReplica is the option to prevent replica checker from // removing down replicas. // WARN: DisableRemoveDownReplica is deprecated. DisableRemoveDownReplica bool `toml:"disable-remove-down-replica" json:"disable-remove-down-replica,string,omitempty"` // DisableReplaceOfflineReplica is the option to prevent replica checker from // replacing offline replicas. // WARN: DisableReplaceOfflineReplica is deprecated. DisableReplaceOfflineReplica bool `toml:"disable-replace-offline-replica" json:"disable-replace-offline-replica,string,omitempty"` // DisableMakeUpReplica is the option to prevent replica checker from making up // replicas when replica count is less than expected. // WARN: DisableMakeUpReplica is deprecated. DisableMakeUpReplica bool `toml:"disable-make-up-replica" json:"disable-make-up-replica,string,omitempty"` // DisableRemoveExtraReplica is the option to prevent replica checker from // removing extra replicas. // WARN: DisableRemoveExtraReplica is deprecated. DisableRemoveExtraReplica bool `toml:"disable-remove-extra-replica" json:"disable-remove-extra-replica,string,omitempty"` // DisableLocationReplacement is the option to prevent replica checker from // moving replica to a better location. // WARN: DisableLocationReplacement is deprecated. DisableLocationReplacement bool `toml:"disable-location-replacement" json:"disable-location-replacement,string,omitempty"` // EnableRemoveDownReplica is the option to enable replica checker to remove down replica. EnableRemoveDownReplica bool `toml:"enable-remove-down-replica" json:"enable-remove-down-replica,string"` // EnableReplaceOfflineReplica is the option to enable replica checker to replace offline replica. EnableReplaceOfflineReplica bool `toml:"enable-replace-offline-replica" json:"enable-replace-offline-replica,string"` // EnableMakeUpReplica is the option to enable replica checker to make up replica. EnableMakeUpReplica bool `toml:"enable-make-up-replica" json:"enable-make-up-replica,string"` // EnableRemoveExtraReplica is the option to enable replica checker to remove extra replica. EnableRemoveExtraReplica bool `toml:"enable-remove-extra-replica" json:"enable-remove-extra-replica,string"` // EnableLocationReplacement is the option to enable replica checker to move replica to a better location. EnableLocationReplacement bool `toml:"enable-location-replacement" json:"enable-location-replacement,string"` // EnableDebugMetrics is the option to enable debug metrics. EnableDebugMetrics bool `toml:"enable-debug-metrics" json:"enable-debug-metrics,string"` // EnableJointConsensus is the option to enable using joint consensus as an operator step. EnableJointConsensus bool `toml:"enable-joint-consensus" json:"enable-joint-consensus,string"` // EnableTiKVSplitRegion is the option to enable tikv split region. // on ebs-based BR we need to disable it with TTL EnableTiKVSplitRegion bool `toml:"enable-tikv-split-region" json:"enable-tikv-split-region,string"` // EnableHeartbeatBreakdownMetrics is the option to enable heartbeat stats metrics. EnableHeartbeatBreakdownMetrics bool `toml:"enable-heartbeat-breakdown-metrics" json:"enable-heartbeat-breakdown-metrics,string"` // EnableHeartbeatConcurrentRunner is the option to enable heartbeat concurrent runner. EnableHeartbeatConcurrentRunner bool `toml:"enable-heartbeat-concurrent-runner" json:"enable-heartbeat-concurrent-runner,string"` // Schedulers support for loading customized schedulers Schedulers SchedulerConfigs `toml:"schedulers" json:"schedulers-v2"` // json v2 is for the sake of compatible upgrade // Controls the time interval between write hot regions info into leveldb. HotRegionsWriteInterval typeutil.Duration `toml:"hot-regions-write-interval" json:"hot-regions-write-interval"` // The day of hot regions data to be reserved. 0 means close. HotRegionsReservedDays uint64 `toml:"hot-regions-reserved-days" json:"hot-regions-reserved-days"` // MaxMovableHotPeerSize is the threshold of region size for balance hot region and split bucket scheduler. // Hot region must be split before moved if it's region size is greater than MaxMovableHotPeerSize. MaxMovableHotPeerSize int64 `toml:"max-movable-hot-peer-size" json:"max-movable-hot-peer-size,omitempty"` // EnableDiagnostic is the option to enable using diagnostic EnableDiagnostic bool `toml:"enable-diagnostic" json:"enable-diagnostic,string"` // EnableWitness is the option to enable using witness EnableWitness bool `toml:"enable-witness" json:"enable-witness,string"` // SlowStoreEvictingAffectedStoreRatioThreshold is the affected ratio threshold when judging a store is slow // A store's slowness must affect more than `store-count * SlowStoreEvictingAffectedStoreRatioThreshold` to trigger evicting. SlowStoreEvictingAffectedStoreRatioThreshold float64 `toml:"slow-store-evicting-affected-store-ratio-threshold" json:"slow-store-evicting-affected-store-ratio-threshold,omitempty"` // StoreLimitVersion is the version of store limit. // v1: which is based on the region count by rate limit. // v2: which is based on region size by window size. StoreLimitVersion string `toml:"store-limit-version" json:"store-limit-version,omitempty"` // HaltScheduling is the option to halt the scheduling. Once it's on, PD will halt the scheduling, // and any other scheduling configs will be ignored. HaltScheduling bool `toml:"halt-scheduling" json:"halt-scheduling,string,omitempty"` // PatrolRegionWorkerCount is the number of workers to patrol region. PatrolRegionWorkerCount int `toml:"patrol-region-worker-count" json:"patrol-region-worker-count"` }
ScheduleConfig is the schedule configuration. NOTE: This type is exported by HTTP API. Please pay more attention when modifying it.
func (*ScheduleConfig) Adjust ¶
func (c *ScheduleConfig) Adjust(meta *configutil.ConfigMetaData, reloading bool) error
Adjust adjusts the config.
func (*ScheduleConfig) Clone ¶
func (c *ScheduleConfig) Clone() *ScheduleConfig
Clone returns a cloned scheduling configuration.
func (*ScheduleConfig) Deprecated ¶
func (c *ScheduleConfig) Deprecated() error
Deprecated is used to find if there is an option has been deprecated.
func (*ScheduleConfig) GetMaxMergeRegionKeys ¶
func (c *ScheduleConfig) GetMaxMergeRegionKeys() uint64
GetMaxMergeRegionKeys returns the max merge keys. it should keep consistent with tikv: https://github.com/tikv/tikv/pull/12484
func (*ScheduleConfig) MigrateDeprecatedFlags ¶
func (c *ScheduleConfig) MigrateDeprecatedFlags()
MigrateDeprecatedFlags updates new flags according to deprecated flags.
func (*ScheduleConfig) Validate ¶
func (c *ScheduleConfig) Validate() error
Validate is used to validate if some scheduling configurations are right.
type SchedulerConfig ¶
type SchedulerConfig struct { Type string `toml:"type" json:"type"` Args []string `toml:"args" json:"args"` Disable bool `toml:"disable" json:"disable"` ArgsPayload string `toml:"args-payload" json:"args-payload"` }
SchedulerConfig is customized scheduler configuration
type SchedulerConfigProvider ¶
type SchedulerConfigProvider interface { SharedConfigProvider SetSchedulingAllowanceStatus(bool, string) GetStoresLimit() map[uint64]StoreLimitConfig IsSchedulerDisabled(types.CheckerSchedulerType) bool AddSchedulerCfg(types.CheckerSchedulerType, []string) RemoveSchedulerCfg(types.CheckerSchedulerType) Persist(endpoint.ConfigStorage) error GetRegionScheduleLimit() uint64 GetLeaderScheduleLimit() uint64 GetHotRegionScheduleLimit() uint64 GetWitnessScheduleLimit() uint64 GetHotRegionCacheHitsThreshold() int GetMaxMovableHotPeerSize() int64 IsTraceRegionFlow() bool GetTolerantSizeRatio() float64 GetLeaderSchedulePolicy() constant.SchedulePolicy IsDebugMetricsEnabled() bool IsDiagnosticAllowed() bool GetSlowStoreEvictingAffectedStoreRatioThreshold() float64 GetScheduleConfig() *ScheduleConfig SetScheduleConfig(*ScheduleConfig) }
SchedulerConfigProvider is the interface for scheduler configurations.
type SchedulerConfigs ¶
type SchedulerConfigs []SchedulerConfig
SchedulerConfigs is a slice of customized scheduler configuration.
type SharedConfigProvider ¶
type SharedConfigProvider interface { // for test purpose }
SharedConfigProvider is the interface for shared configurations.
type Storage ¶
type Storage struct {
Engine string `json:"engine"`
}
Storage is the config for the tikv storage.
type StoreConfig ¶
type StoreConfig struct { Coprocessor `json:"coprocessor"` Storage `json:"storage"` RegionMaxSizeMB uint64 `json:"-"` RegionSplitSizeMB uint64 `json:"-"` RegionBucketSizeMB uint64 `json:"-"` }
StoreConfig is the config of store like TiKV. generated by https://mholt.github.io/json-to-go/.
func (*StoreConfig) Adjust ¶
func (c *StoreConfig) Adjust()
Adjust adjusts the config to calculate some fields.
func (*StoreConfig) CheckRegionKeys ¶
func (c *StoreConfig) CheckRegionKeys(keys, mergeKeys uint64) error
CheckRegionKeys return error if the smallest region's keys is less than mergeKeys
func (*StoreConfig) CheckRegionSize ¶
func (c *StoreConfig) CheckRegionSize(size, mergeSize uint64) error
CheckRegionSize return error if the smallest region's size is less than mergeSize
func (*StoreConfig) Clone ¶
func (c *StoreConfig) Clone() *StoreConfig
Clone makes a deep copy of the config.
func (*StoreConfig) Equal ¶
func (c *StoreConfig) Equal(other *StoreConfig) bool
Equal returns true if the two configs are equal.
func (*StoreConfig) GetRegionBucketSize ¶
func (c *StoreConfig) GetRegionBucketSize() uint64
GetRegionBucketSize returns region bucket size if enable region buckets.
func (*StoreConfig) GetRegionMaxKeys ¶
func (c *StoreConfig) GetRegionMaxKeys() uint64
GetRegionMaxKeys returns the region split keys
func (*StoreConfig) GetRegionMaxSize ¶
func (c *StoreConfig) GetRegionMaxSize() uint64
GetRegionMaxSize returns the max region size in MB
func (*StoreConfig) GetRegionSplitKeys ¶
func (c *StoreConfig) GetRegionSplitKeys() uint64
GetRegionSplitKeys returns the region split keys
func (*StoreConfig) GetRegionSplitSize ¶
func (c *StoreConfig) GetRegionSplitSize() uint64
GetRegionSplitSize returns the region split size in MB
func (*StoreConfig) IsEnableRegionBucket ¶
func (c *StoreConfig) IsEnableRegionBucket() bool
IsEnableRegionBucket return true if the region bucket is enabled.
func (*StoreConfig) IsRaftKV2 ¶
func (c *StoreConfig) IsRaftKV2() bool
IsRaftKV2 returns true if the raft kv is v2.
func (*StoreConfig) SetRegionBucketEnabled ¶
func (c *StoreConfig) SetRegionBucketEnabled(enabled bool)
SetRegionBucketEnabled sets if the region bucket is enabled.
func (*StoreConfig) String ¶
func (c *StoreConfig) String() string
String implements fmt.Stringer interface.
type StoreConfigProvider ¶
type StoreConfigProvider interface { GetRegionMaxSize() uint64 GetRegionMaxKeys() uint64 GetRegionSplitSize() uint64 GetRegionSplitKeys() uint64 CheckRegionSize(uint64, uint64) error CheckRegionKeys(uint64, uint64) error IsEnableRegionBucket() bool IsRaftKV2() bool }
StoreConfigProvider is the interface that wraps the StoreConfigProvider related methods.
type StoreLimit ¶
type StoreLimit struct { // AddPeer is the default rate of adding peers for store limit (per minute). AddPeer float64 // RemovePeer is the default rate of removing peers for store limit (per minute). RemovePeer float64 // contains filtered or unexported fields }
StoreLimit is the default limit of adding peer and removing peer when putting stores.
func (*StoreLimit) GetDefaultStoreLimit ¶
func (sl *StoreLimit) GetDefaultStoreLimit(typ storelimit.Type) float64
GetDefaultStoreLimit gets the default store limit for a given type.
func (*StoreLimit) SetDefaultStoreLimit ¶
func (sl *StoreLimit) SetDefaultStoreLimit(typ storelimit.Type, ratePerMin float64)
SetDefaultStoreLimit sets the default store limit for a given type.
type StoreLimitConfig ¶
type StoreLimitConfig struct { AddPeer float64 `toml:"add-peer" json:"add-peer"` RemovePeer float64 `toml:"remove-peer" json:"remove-peer"` }
StoreLimitConfig is a config about scheduling rate limit of different types for a store.