forked from tikv/pd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is an automated cherry-pick of tikv#6314
close tikv#6297, ref tikv#6328, ref tikv/tikv#14458 Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
- Loading branch information
1 parent
bd94a98
commit 0261305
Showing
12 changed files
with
575 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
package config | ||
|
||
import ( | ||
"sync" | ||
"time" | ||
|
||
"github.com/coreos/go-semver/semver" | ||
"github.com/pingcap/kvproto/pkg/metapb" | ||
"github.com/tikv/pd/pkg/core/constant" | ||
"github.com/tikv/pd/pkg/core/storelimit" | ||
) | ||
|
||
// RejectLeader is the label property type that suggests a store should not | ||
// have any region leaders. | ||
const RejectLeader = "reject-leader" | ||
|
||
var schedulerMap sync.Map | ||
|
||
// RegisterScheduler registers the scheduler type. | ||
func RegisterScheduler(typ string) { | ||
schedulerMap.Store(typ, struct{}{}) | ||
} | ||
|
||
// IsSchedulerRegistered checks if the named scheduler type is registered. | ||
func IsSchedulerRegistered(name string) bool { | ||
_, ok := schedulerMap.Load(name) | ||
return ok | ||
} | ||
|
||
// Config is the interface that wraps the Config related methods. | ||
type Config interface { | ||
GetReplicaScheduleLimit() uint64 | ||
GetRegionScheduleLimit() uint64 | ||
GetMergeScheduleLimit() uint64 | ||
GetLeaderScheduleLimit() uint64 | ||
GetHotRegionScheduleLimit() uint64 | ||
GetWitnessScheduleLimit() uint64 | ||
|
||
GetHotRegionCacheHitsThreshold() int | ||
GetMaxMovableHotPeerSize() int64 | ||
IsTraceRegionFlow() bool | ||
|
||
GetSplitMergeInterval() time.Duration | ||
GetMaxMergeRegionSize() uint64 | ||
GetMaxMergeRegionKeys() uint64 | ||
GetKeyType() constant.KeyType | ||
IsOneWayMergeEnabled() bool | ||
IsCrossTableMergeEnabled() bool | ||
|
||
IsPlacementRulesEnabled() bool | ||
IsPlacementRulesCacheEnabled() bool | ||
|
||
GetMaxReplicas() int | ||
GetPatrolRegionInterval() time.Duration | ||
GetMaxStoreDownTime() time.Duration | ||
GetLocationLabels() []string | ||
GetIsolationLevel() string | ||
IsReplaceOfflineReplicaEnabled() bool | ||
IsMakeUpReplicaEnabled() bool | ||
IsRemoveExtraReplicaEnabled() bool | ||
IsLocationReplacementEnabled() bool | ||
IsRemoveDownReplicaEnabled() bool | ||
|
||
GetSwitchWitnessInterval() time.Duration | ||
IsWitnessAllowed() bool | ||
|
||
GetLowSpaceRatio() float64 | ||
GetHighSpaceRatio() float64 | ||
GetTolerantSizeRatio() float64 | ||
GetLeaderSchedulePolicy() constant.SchedulePolicy | ||
GetRegionScoreFormulaVersion() string | ||
|
||
GetMaxSnapshotCount() uint64 | ||
GetMaxPendingPeerCount() uint64 | ||
GetSchedulerMaxWaitingOperator() uint64 | ||
GetStoreLimitByType(uint64, storelimit.Type) float64 | ||
SetAllStoresLimit(storelimit.Type, float64) | ||
GetSlowStoreEvictingAffectedStoreRatioThreshold() float64 | ||
IsUseJointConsensus() bool | ||
CheckLabelProperty(string, []*metapb.StoreLabel) bool | ||
IsDebugMetricsEnabled() bool | ||
GetClusterVersion() *semver.Version | ||
GetStoreLimitVersion() string | ||
// for test purpose | ||
SetPlacementRuleEnabled(bool) | ||
SetSplitMergeInterval(time.Duration) | ||
SetMaxReplicas(int) | ||
SetPlacementRulesCacheEnabled(bool) | ||
SetWitnessEnabled(bool) | ||
// only for store configuration | ||
UseRaftV2() | ||
} | ||
|
||
// StoreConfig is the interface that wraps the StoreConfig related methods. | ||
type StoreConfig interface { | ||
GetRegionMaxSize() uint64 | ||
CheckRegionSize(uint64, uint64) error | ||
CheckRegionKeys(uint64, uint64) error | ||
IsEnableRegionBucket() bool | ||
IsRaftKV2() bool | ||
// for test purpose | ||
SetRegionBucketEnabled(bool) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.