Documentation ¶
Index ¶
- func AllowMerge(cluster opt.Cluster, region *core.RegionInfo, adjacent *core.RegionInfo) bool
- func SelectStoreToAddPeerByRule(scope string, cluster opt.Cluster, region *core.RegionInfo, ...) *core.StoreInfo
- func SelectStoreToReplacePeerByRule(scope string, cluster opt.Cluster, region *core.RegionInfo, ...) *core.StoreInfo
- type LearnerChecker
- type MergeChecker
- type ReplicaChecker
- type RuleChecker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllowMerge ¶
func AllowMerge(cluster opt.Cluster, region *core.RegionInfo, adjacent *core.RegionInfo) bool
AllowMerge returns true if two regions can be merged according to the key type.
func SelectStoreToAddPeerByRule ¶
func SelectStoreToAddPeerByRule(scope string, cluster opt.Cluster, region *core.RegionInfo, rf *placement.RuleFit, filters ...filter.Filter) *core.StoreInfo
SelectStoreToAddPeerByRule selects a store to add peer in order to fit the placement rule.
func SelectStoreToReplacePeerByRule ¶
func SelectStoreToReplacePeerByRule(scope string, cluster opt.Cluster, region *core.RegionInfo, fit *placement.RegionFit, rf *placement.RuleFit, peer *metapb.Peer, filters ...filter.Filter) *core.StoreInfo
SelectStoreToReplacePeerByRule selects a store to replace a region peer in order to fit the placement rule.
Types ¶
type LearnerChecker ¶
type LearnerChecker struct {
// contains filtered or unexported fields
}
LearnerChecker ensures region has a learner will be promoted.
func NewLearnerChecker ¶
func NewLearnerChecker(cluster opt.Cluster) *LearnerChecker
NewLearnerChecker creates a learner checker.
func (*LearnerChecker) Check ¶
func (l *LearnerChecker) Check(region *core.RegionInfo) *operator.Operator
Check verifies a region's role, creating an Operator if need.
type MergeChecker ¶
type MergeChecker struct {
// contains filtered or unexported fields
}
MergeChecker ensures region to merge with adjacent region when size is small
func NewMergeChecker ¶
func NewMergeChecker(ctx context.Context, cluster opt.Cluster) *MergeChecker
NewMergeChecker creates a merge checker.
func (*MergeChecker) Check ¶
func (m *MergeChecker) Check(region *core.RegionInfo) []*operator.Operator
Check verifies a region's replicas, creating an Operator if need.
func (*MergeChecker) RecordRegionSplit ¶
func (m *MergeChecker) RecordRegionSplit(regionIDs []uint64)
RecordRegionSplit put the recently split region into cache. MergeChecker will skip check it for a while.
type ReplicaChecker ¶
type ReplicaChecker struct {
// contains filtered or unexported fields
}
ReplicaChecker ensures region has the best replicas. Including the following: Replica number management. Unhealthy replica management, mainly used for disaster recovery of TiKV. Location management, mainly used for cross data center deployment.
func NewReplicaChecker ¶
func NewReplicaChecker(cluster opt.Cluster, n ...string) *ReplicaChecker
NewReplicaChecker creates a replica checker.
func (*ReplicaChecker) Check ¶
func (r *ReplicaChecker) Check(region *core.RegionInfo) *operator.Operator
Check verifies a region's replicas, creating an operator.Operator if need.
func (*ReplicaChecker) SelectBestReplacementStore ¶
func (r *ReplicaChecker) SelectBestReplacementStore(region *core.RegionInfo, oldPeer *metapb.Peer, filters ...filter.Filter) (uint64, float64)
SelectBestReplacementStore returns a store id that to be used to replace the old peer and distinct score.
type RuleChecker ¶
type RuleChecker struct {
// contains filtered or unexported fields
}
RuleChecker fix/improve region by placement rules.
func NewRuleChecker ¶
func NewRuleChecker(cluster opt.Cluster, ruleManager *placement.RuleManager) *RuleChecker
NewRuleChecker creates a checker instance.
func (*RuleChecker) Check ¶
func (c *RuleChecker) Check(region *core.RegionInfo) *operator.Operator
Check checks if the region matches placement rules and returns Operator to fix it.