Versions in this module Expand all Collapse all v0 v0.1.0 Jun 15, 2023 Changes in this version + const DefaultFastExecutorRate + const DefaultSlowExecutorRate + const FastStepWaitTime + const OpDescLeaveJointState + const OperatorExpireTime + const SlowStepWaitTime + var OperatorExceededStoreLimitCounter = prometheus.NewCounterVec(prometheus.CounterOpts{ ... }, []string{ ... }) + var OperatorLimitCounter = prometheus.NewCounterVec(prometheus.CounterOpts{ ... }, []string{ ... }) + func IsEndStatus(s OpStatus) bool + func OpStatusToPDPB(s OpStatus) pdpb.OperatorStatus + func OpStatusToString(s OpStatus) string + func SkipOriginJointStateCheck(b *Builder) + func SkipPlacementRulesCheck(b *Builder) + type AddLearner struct + IsLightWeight bool + IsWitness bool + PeerID uint64 + SendStore uint64 + ToStore uint64 + func (al AddLearner) CheckInProgress(ci ClusterInformer, region *core.RegionInfo) error + func (al AddLearner) ConfVerChanged(region *core.RegionInfo) uint64 + func (al AddLearner) GetCmd(region *core.RegionInfo, useConfChangeV2 bool) *pdpb.RegionHeartbeatResponse + func (al AddLearner) Influence(opInfluence OpInfluence, region *core.RegionInfo) + func (al AddLearner) IsFinish(region *core.RegionInfo) bool + func (al AddLearner) String() string + func (al AddLearner) Timeout(regionSize int64) time.Duration + type AddPeer struct + IsLightWeight bool + IsWitness bool + PeerID uint64 + ToStore uint64 + func (ap AddPeer) CheckInProgress(ci ClusterInformer, region *core.RegionInfo) error + func (ap AddPeer) ConfVerChanged(region *core.RegionInfo) uint64 + func (ap AddPeer) GetCmd(region *core.RegionInfo, useConfChangeV2 bool) *pdpb.RegionHeartbeatResponse + func (ap AddPeer) Influence(opInfluence OpInfluence, region *core.RegionInfo) + func (ap AddPeer) IsFinish(region *core.RegionInfo) bool + func (ap AddPeer) String() string + func (ap AddPeer) Timeout(regionSize int64) time.Duration + type BatchSwitchWitness struct + ToNonWitnesses []BecomeNonWitness + ToWitnesses []BecomeWitness + func (bsw BatchSwitchWitness) CheckInProgress(ci ClusterInformer, region *core.RegionInfo) error + func (bsw BatchSwitchWitness) ConfVerChanged(region *core.RegionInfo) uint64 + func (bsw BatchSwitchWitness) GetCmd(region *core.RegionInfo, useConfChangeV2 bool) *pdpb.RegionHeartbeatResponse + func (bsw BatchSwitchWitness) Influence(opInfluence OpInfluence, region *core.RegionInfo) + func (bsw BatchSwitchWitness) IsFinish(region *core.RegionInfo) bool + func (bsw BatchSwitchWitness) String() string + func (bsw BatchSwitchWitness) Timeout(regionSize int64) time.Duration + type BecomeNonWitness struct + PeerID uint64 + SendStore uint64 + StoreID uint64 + func (bn BecomeNonWitness) CheckInProgress(ci ClusterInformer, region *core.RegionInfo) error + func (bn BecomeNonWitness) ConfVerChanged(region *core.RegionInfo) uint64 + func (bn BecomeNonWitness) GetCmd(region *core.RegionInfo, useConfChangeV2 bool) *pdpb.RegionHeartbeatResponse + func (bn BecomeNonWitness) Influence(opInfluence OpInfluence, region *core.RegionInfo) + func (bn BecomeNonWitness) IsFinish(region *core.RegionInfo) bool + func (bn BecomeNonWitness) String() string + func (bn BecomeNonWitness) Timeout(regionSize int64) time.Duration + type BecomeWitness struct + PeerID uint64 + StoreID uint64 + func (bw BecomeWitness) CheckInProgress(ci ClusterInformer, region *core.RegionInfo) error + func (bw BecomeWitness) ConfVerChanged(region *core.RegionInfo) uint64 + func (bw BecomeWitness) GetCmd(_ *core.RegionInfo, _ bool) *pdpb.RegionHeartbeatResponse + func (bw BecomeWitness) Influence(opInfluence OpInfluence, region *core.RegionInfo) + func (bw BecomeWitness) IsFinish(region *core.RegionInfo) bool + func (bw BecomeWitness) String() string + func (bw BecomeWitness) Timeout(regionSize int64) time.Duration + type Builder struct + func NewBuilder(desc string, ci ClusterInformer, region *core.RegionInfo, ...) *Builder + func (b *Builder) AddPeer(peer *metapb.Peer) *Builder + func (b *Builder) BecomeNonWitness(storeID uint64) *Builder + func (b *Builder) BecomeWitness(storeID uint64) *Builder + func (b *Builder) Build(kind OpKind) (*Operator, error) + func (b *Builder) DemoteVoter(storeID uint64) *Builder + func (b *Builder) EnableForceTargetLeader() *Builder + func (b *Builder) EnableLightWeight() *Builder + func (b *Builder) PromoteLearner(storeID uint64) *Builder + func (b *Builder) RemovePeer(storeID uint64) *Builder + func (b *Builder) SetExpectedRoles(roles map[uint64]placement.PeerRoleType) *Builder + func (b *Builder) SetLeader(storeID uint64) *Builder + func (b *Builder) SetLeaders(storeIDs []uint64) *Builder + func (b *Builder) SetPeers(peers map[uint64]*metapb.Peer) *Builder + type BuilderOption func(*Builder) + type ChangePeerV2Enter struct + DemoteVoters []DemoteVoter + PromoteLearners []PromoteLearner + func (cpe ChangePeerV2Enter) CheckInProgress(_ ClusterInformer, region *core.RegionInfo) error + func (cpe ChangePeerV2Enter) ConfVerChanged(region *core.RegionInfo) uint64 + func (cpe ChangePeerV2Enter) GetCmd(region *core.RegionInfo, useConfChangeV2 bool) *pdpb.RegionHeartbeatResponse + func (cpe ChangePeerV2Enter) Influence(_ OpInfluence, _ *core.RegionInfo) + func (cpe ChangePeerV2Enter) IsFinish(region *core.RegionInfo) bool + func (cpe ChangePeerV2Enter) String() string + func (cpe ChangePeerV2Enter) Timeout(regionSize int64) time.Duration + type ChangePeerV2Leave struct + DemoteVoters []DemoteVoter + PromoteLearners []PromoteLearner + func (cpl ChangePeerV2Leave) CheckInProgress(_ ClusterInformer, region *core.RegionInfo) error + func (cpl ChangePeerV2Leave) ConfVerChanged(region *core.RegionInfo) uint64 + func (cpl ChangePeerV2Leave) GetCmd(region *core.RegionInfo, useConfChangeV2 bool) *pdpb.RegionHeartbeatResponse + func (cpl ChangePeerV2Leave) Influence(_ OpInfluence, _ *core.RegionInfo) + func (cpl ChangePeerV2Leave) IsFinish(region *core.RegionInfo) bool + func (cpl ChangePeerV2Leave) String() string + func (cpl ChangePeerV2Leave) Timeout(regionSize int64) time.Duration + type ClusterInformer interface + GetAllocator func() id.Allocator + GetBasicCluster func() *core.BasicCluster + GetOpts func() config.Config + GetRuleManager func() *placement.RuleManager + GetStoreConfig func() config.StoreConfig + type DemoteVoter struct + IsWitness bool + PeerID uint64 + ToStore uint64 + func (dv DemoteVoter) ConfVerChanged(region *core.RegionInfo) uint64 + func (dv DemoteVoter) GetCmd(_ *core.RegionInfo, useConfChangeV2 bool) *pdpb.RegionHeartbeatResponse + func (dv DemoteVoter) IsFinish(region *core.RegionInfo) bool + func (dv DemoteVoter) String() string + func (dv DemoteVoter) Timeout(regionSize int64) time.Duration + type MergeRegion struct + FromRegion *metapb.Region + IsPassive bool + ToRegion *metapb.Region + func (mr MergeRegion) CheckInProgress(_ ClusterInformer, _ *core.RegionInfo) error + func (mr MergeRegion) ConfVerChanged(_ *core.RegionInfo) uint64 + func (mr MergeRegion) GetCmd(region *core.RegionInfo, useConfChangeV2 bool) *pdpb.RegionHeartbeatResponse + func (mr MergeRegion) Influence(opInfluence OpInfluence, region *core.RegionInfo) + func (mr MergeRegion) IsFinish(region *core.RegionInfo) bool + func (mr MergeRegion) String() string + func (mr MergeRegion) Timeout(regionSize int64) time.Duration + type OpHistory struct + FinishTime time.Time + From uint64 + Kind constant.ResourceKind + To uint64 + type OpInfluence struct + StoresInfluence map[uint64]*StoreInfluence + func NewOpInfluence() *OpInfluence + func (m *OpInfluence) Add(other *OpInfluence) + func (m OpInfluence) GetStoreInfluence(id uint64) *StoreInfluence + type OpKind uint32 + const OpAdmin + const OpHotRegion + const OpLeader + const OpMerge + const OpRange + const OpRegion + const OpReplica + const OpSplit + const OpWitness + const OpWitnessLeader + func ParseOperatorKind(str string) (OpKind, error) + func (k OpKind) String() string + type OpRecord struct + FinishTime time.Time + func (o *OpRecord) MarshalJSON() ([]byte, error) + func (o *OpRecord) String() string + type OpStatus = uint32 + const CANCELED + const CREATED + const EXPIRED + const REPLACED + const STARTED + const SUCCESS + const TIMEOUT + type OpStatusTracker struct + func NewOpStatusTracker() OpStatusTracker + func (trk *OpStatusTracker) CheckExpired(exp time.Duration) bool + func (trk *OpStatusTracker) CheckTimeout(duration time.Duration) bool + func (trk *OpStatusTracker) IsEnd() bool + func (trk *OpStatusTracker) ReachTime() time.Time + func (trk *OpStatusTracker) ReachTimeOf(s OpStatus) time.Time + func (trk *OpStatusTracker) Status() OpStatus + func (trk *OpStatusTracker) String() string + func (trk *OpStatusTracker) To(dst OpStatus) bool + type OpStep interface + CheckInProgress func(ci ClusterInformer, region *core.RegionInfo) error + ConfVerChanged func(region *core.RegionInfo) uint64 + GetCmd func(region *core.RegionInfo, useConfChangeV2 bool) *pdpb.RegionHeartbeatResponse + Influence func(opInfluence OpInfluence, region *core.RegionInfo) + IsFinish func(region *core.RegionInfo) bool + Timeout func(regionSize int64) time.Duration + type Operator struct + AdditionalInfos map[string]string + ApproximateSize int64 + Counters []prometheus.Counter + FinishedCounters []prometheus.Counter + func CreateAddPeerOperator(desc string, ci ClusterInformer, region *core.RegionInfo, peer *metapb.Peer, ...) (*Operator, error) + func CreateDemoteVoterOperator(desc string, ci ClusterInformer, region *core.RegionInfo, peer *metapb.Peer) (*Operator, error) + func CreateForceTransferLeaderOperator(desc string, ci ClusterInformer, region *core.RegionInfo, sourceStoreID uint64, ...) (*Operator, error) + func CreateLeaveJointStateOperator(desc string, ci ClusterInformer, origin *core.RegionInfo) (*Operator, error) + func CreateMergeRegionOperator(desc string, ci ClusterInformer, source *core.RegionInfo, ...) ([]*Operator, error) + func CreateMoveLeaderOperator(desc string, ci ClusterInformer, region *core.RegionInfo, kind OpKind, ...) (*Operator, error) + func CreateMovePeerOperator(desc string, ci ClusterInformer, region *core.RegionInfo, kind OpKind, ...) (*Operator, error) + func CreateMoveRegionOperator(desc string, ci ClusterInformer, region *core.RegionInfo, kind OpKind, ...) (*Operator, error) + func CreateMoveWitnessOperator(desc string, ci ClusterInformer, region *core.RegionInfo, sourceStoreID uint64, ...) (*Operator, error) + func CreateNonWitnessPeerOperator(desc string, ci ClusterInformer, region *core.RegionInfo, peer *metapb.Peer) (*Operator, error) + func CreatePromoteLearnerOperator(desc string, ci ClusterInformer, region *core.RegionInfo, peer *metapb.Peer) (*Operator, error) + func CreateRemovePeerOperator(desc string, ci ClusterInformer, kind OpKind, region *core.RegionInfo, ...) (*Operator, error) + func CreateReplaceLeaderPeerOperator(desc string, ci ClusterInformer, region *core.RegionInfo, kind OpKind, ...) (*Operator, error) + func CreateScatterRegionOperator(desc string, ci ClusterInformer, origin *core.RegionInfo, ...) (*Operator, error) + func CreateSplitRegionOperator(desc string, region *core.RegionInfo, kind OpKind, policy pdpb.CheckPolicy, ...) (*Operator, error) + func CreateTransferLeaderOperator(desc string, ci ClusterInformer, region *core.RegionInfo, sourceStoreID uint64, ...) (*Operator, error) + func CreateWitnessPeerOperator(desc string, ci ClusterInformer, region *core.RegionInfo, peer *metapb.Peer) (*Operator, error) + func NewOperator(desc, brief string, regionID uint64, regionEpoch *metapb.RegionEpoch, ...) *Operator + func NewTestOperator(regionID uint64, regionEpoch *metapb.RegionEpoch, kind OpKind, steps ...OpStep) *Operator + func (o *Operator) AttachKind(kind OpKind) + func (o *Operator) Brief() string + func (o *Operator) Cancel() bool + func (o *Operator) Check(region *core.RegionInfo) OpStep + func (o *Operator) CheckAndGetStatus() OpStatus + func (o *Operator) CheckExpired() bool + func (o *Operator) CheckSuccess() bool + func (o *Operator) CheckTimeout() bool + func (o *Operator) ConfVerChanged(region *core.RegionInfo) (total uint64) + func (o *Operator) ContainNonWitnessStep() bool + func (o *Operator) Desc() string + func (o *Operator) ElapsedTime() time.Duration + func (o *Operator) GetAdditionalInfo() string + func (o *Operator) GetCreateTime() time.Time + func (o *Operator) GetPriorityLevel() constant.PriorityLevel + func (o *Operator) GetReachTimeOf(st OpStatus) time.Time + func (o *Operator) GetStartTime() time.Time + func (o *Operator) HasStarted() bool + func (o *Operator) History() []OpHistory + func (o *Operator) IsEnd() bool + func (o *Operator) IsLeaveJointStateOperator() bool + func (o *Operator) Kind() OpKind + func (o *Operator) Len() int + func (o *Operator) MarshalJSON() ([]byte, error) + func (o *Operator) Record(finishTime time.Time) *OpRecord + func (o *Operator) RegionEpoch() *metapb.RegionEpoch + func (o *Operator) RegionID() uint64 + func (o *Operator) Replace() bool + func (o *Operator) RunningTime() time.Duration + func (o *Operator) SchedulerKind() OpKind + func (o *Operator) SetDesc(desc string) + func (o *Operator) SetPriorityLevel(level constant.PriorityLevel) + func (o *Operator) SetStatusReachTime(st OpStatus, t time.Time) + func (o *Operator) Start() bool + func (o *Operator) Status() OpStatus + func (o *Operator) Step(i int) OpStep + func (o *Operator) String() string + func (o *Operator) Sync(other *Operator) + func (o *Operator) TotalInfluence(opInfluence OpInfluence, region *core.RegionInfo) + func (o *Operator) UnfinishedInfluence(opInfluence OpInfluence, region *core.RegionInfo) + type PromoteLearner struct + IsWitness bool + PeerID uint64 + ToStore uint64 + func (pl PromoteLearner) CheckInProgress(_ ClusterInformer, region *core.RegionInfo) error + func (pl PromoteLearner) ConfVerChanged(region *core.RegionInfo) uint64 + func (pl PromoteLearner) GetCmd(_ *core.RegionInfo, useConfChangeV2 bool) *pdpb.RegionHeartbeatResponse + func (pl PromoteLearner) Influence(_ OpInfluence, _ *core.RegionInfo) + func (pl PromoteLearner) IsFinish(region *core.RegionInfo) bool + func (pl PromoteLearner) String() string + func (pl PromoteLearner) Timeout(regionSize int64) time.Duration + type RemovePeer struct + FromStore uint64 + IsDownStore bool + PeerID uint64 + func (rp RemovePeer) CheckInProgress(_ ClusterInformer, region *core.RegionInfo) error + func (rp RemovePeer) ConfVerChanged(region *core.RegionInfo) uint64 + func (rp RemovePeer) GetCmd(region *core.RegionInfo, useConfChangeV2 bool) *pdpb.RegionHeartbeatResponse + func (rp RemovePeer) Influence(opInfluence OpInfluence, region *core.RegionInfo) + func (rp RemovePeer) IsFinish(region *core.RegionInfo) bool + func (rp RemovePeer) String() string + func (rp RemovePeer) Timeout(regionSize int64) time.Duration + type SplitRegion struct + EndKey []byte + Policy pdpb.CheckPolicy + SplitKeys [][]byte + StartKey []byte + func (sr SplitRegion) CheckInProgress(_ ClusterInformer, _ *core.RegionInfo) error + func (sr SplitRegion) ConfVerChanged(_ *core.RegionInfo) uint64 + func (sr SplitRegion) GetCmd(region *core.RegionInfo, useConfChangeV2 bool) *pdpb.RegionHeartbeatResponse + func (sr SplitRegion) Influence(opInfluence OpInfluence, region *core.RegionInfo) + func (sr SplitRegion) IsFinish(region *core.RegionInfo) bool + func (sr SplitRegion) String() string + func (sr SplitRegion) Timeout(regionSize int64) time.Duration + type StoreInfluence struct + LeaderCount int64 + LeaderSize int64 + RegionCount int64 + RegionSize int64 + StepCost map[storelimit.Type]int64 + WitnessCount int64 + func (s *StoreInfluence) AddStepCost(limitType storelimit.Type, cost int64) + func (s *StoreInfluence) AdjustStepCost(limitType storelimit.Type, regionSize int64) + func (s *StoreInfluence) GetStepCost(limitType storelimit.Type) int64 + func (s *StoreInfluence) ResourceProperty(kind constant.ScheduleKind) int64 + type TransferLeader struct + FromStore uint64 + ToStore uint64 + ToStores []uint64 + func (tl TransferLeader) CheckInProgress(ci ClusterInformer, region *core.RegionInfo) error + func (tl TransferLeader) ConfVerChanged(_ *core.RegionInfo) uint64 + func (tl TransferLeader) GetCmd(region *core.RegionInfo, useConfChangeV2 bool) *pdpb.RegionHeartbeatResponse + func (tl TransferLeader) Influence(opInfluence OpInfluence, region *core.RegionInfo) + func (tl TransferLeader) IsFinish(region *core.RegionInfo) bool + func (tl TransferLeader) String() string + func (tl TransferLeader) Timeout(regionSize int64) time.Duration