Documentation ¶
Index ¶
- Constants
- Variables
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- type ChangePeerV2Enter
- 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
- 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
- type DemoteVoter
- 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
- 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
- type OpInfluence
- type OpKind
- type OpRecord
- type OpStatus
- type 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
- type Operator
- 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
- 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
- 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
- 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
- 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
- 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
Constants ¶
const ( // DefaultSlowExecutorRate is the fast rate of the step executor. // default: 6 s/Mb DefaultSlowExecutorRate = 6 // DefaultFastExecutorRate is the slow rate of the step executor. // default: 0.6 s/Mb DefaultFastExecutorRate = 0.6 // FastStepWaitTime is the duration that the OpStep may take. // there are some steps that may take a short time, such as transfer leader, remove peer etc. // It should consider the latency of handling region heartbeat especially big cluster. // The update duration of region heartbeat should be less than the region heartbeat interval(default 60s). FastStepWaitTime = 60 * time.Second // SlowStepWaitTime is the duration that the OpStep may take. // there are some steps that may take a long time, such as add peer, merge region etc. SlowStepWaitTime = 10 * time.Minute )
const OpDescLeaveJointState = "leave-joint-state"
OpDescLeaveJointState is the expected desc for LeaveJointStateOperator.
const ( // OperatorExpireTime is the duration that when an operator is not started // after it, the operator will be considered expired. OperatorExpireTime = 3 * time.Second )
Variables ¶
var ( // OperatorLimitCounter exposes the counter when meeting limit. OperatorLimitCounter = prometheus.NewCounterVec( prometheus.CounterOpts{ Namespace: "pd", Subsystem: "schedule", Name: "operator_limit", Help: "Counter of operator meeting limit", }, []string{"type", "name"}) // OperatorExceededStoreLimitCounter exposes the counter when operator meet exceeded store limit. OperatorExceededStoreLimitCounter = prometheus.NewCounterVec( prometheus.CounterOpts{ Namespace: "pd", Subsystem: "schedule", Name: "operator_exceeded_store_limit", Help: "Counter of operator meeting store limit", }, []string{"desc"}) )
Functions ¶
func OpStatusToPDPB ¶
func OpStatusToPDPB(s OpStatus) pdpb.OperatorStatus
OpStatusToPDPB converts OpStatus to pdpb.OperatorStatus.
func OpStatusToString ¶
OpStatusToString converts Status to string.
func SkipOriginJointStateCheck ¶
func SkipOriginJointStateCheck(b *Builder)
SkipOriginJointStateCheck lets the builder skip the joint state check for origin peers.
func SkipPlacementRulesCheck ¶
func SkipPlacementRulesCheck(b *Builder)
SkipPlacementRulesCheck lets the builder skip the placement rules check for origin and target peers.
Types ¶
type AddLearner ¶
AddLearner is an OpStep that adds a region learner peer.
func (AddLearner) CheckInProgress ¶
func (al AddLearner) CheckInProgress(ci ClusterInformer, region *core.RegionInfo) error
CheckInProgress checks if the step is in the progress of advancing.
func (AddLearner) ConfVerChanged ¶
func (al AddLearner) ConfVerChanged(region *core.RegionInfo) uint64
ConfVerChanged returns the delta value for version increased by this step.
func (AddLearner) GetCmd ¶
func (al AddLearner) GetCmd(region *core.RegionInfo, useConfChangeV2 bool) *pdpb.RegionHeartbeatResponse
GetCmd returns the schedule command for heartbeat response.
func (AddLearner) Influence ¶
func (al AddLearner) Influence(opInfluence OpInfluence, region *core.RegionInfo)
Influence calculates the store difference that current step makes.
func (AddLearner) IsFinish ¶
func (al AddLearner) IsFinish(region *core.RegionInfo) bool
IsFinish checks if current step is finished.
func (AddLearner) String ¶
func (al AddLearner) String() string
type AddPeer ¶
AddPeer is an OpStep that adds a region peer.
func (AddPeer) CheckInProgress ¶
func (ap AddPeer) CheckInProgress(ci ClusterInformer, region *core.RegionInfo) error
CheckInProgress checks if the step is in the progress of advancing.
func (AddPeer) ConfVerChanged ¶
func (ap AddPeer) ConfVerChanged(region *core.RegionInfo) uint64
ConfVerChanged returns the delta value for version increased by this step.
func (AddPeer) GetCmd ¶
func (ap AddPeer) GetCmd(region *core.RegionInfo, useConfChangeV2 bool) *pdpb.RegionHeartbeatResponse
GetCmd returns the schedule command for heartbeat response.
func (AddPeer) Influence ¶
func (ap AddPeer) Influence(opInfluence OpInfluence, region *core.RegionInfo)
Influence calculates the store difference that current step makes.
type BatchSwitchWitness ¶
type BatchSwitchWitness struct { ToWitnesses []BecomeWitness ToNonWitnesses []BecomeNonWitness }
BatchSwitchWitness is an OpStep that batch switch witness.
func (BatchSwitchWitness) CheckInProgress ¶
func (bsw BatchSwitchWitness) CheckInProgress(ci ClusterInformer, region *core.RegionInfo) error
CheckInProgress checks if the step is in the progress of advancing.
func (BatchSwitchWitness) ConfVerChanged ¶
func (bsw BatchSwitchWitness) ConfVerChanged(region *core.RegionInfo) uint64
ConfVerChanged returns the delta value for version increased by this step.
func (BatchSwitchWitness) GetCmd ¶
func (bsw BatchSwitchWitness) GetCmd(region *core.RegionInfo, useConfChangeV2 bool) *pdpb.RegionHeartbeatResponse
GetCmd returns the schedule command for heartbeat response.
func (BatchSwitchWitness) Influence ¶
func (bsw BatchSwitchWitness) Influence(opInfluence OpInfluence, region *core.RegionInfo)
Influence calculates the store difference that current step makes.
func (BatchSwitchWitness) IsFinish ¶
func (bsw BatchSwitchWitness) IsFinish(region *core.RegionInfo) bool
IsFinish checks if current step is finished.
func (BatchSwitchWitness) String ¶
func (bsw BatchSwitchWitness) String() string
type BecomeNonWitness ¶
type BecomeNonWitness struct {
PeerID, StoreID, SendStore uint64
}
BecomeNonWitness is an OpStep that makes a peer become a non-witness.
func (BecomeNonWitness) CheckInProgress ¶
func (bn BecomeNonWitness) CheckInProgress(ci ClusterInformer, region *core.RegionInfo) error
CheckInProgress checks if the step is in the progress of advancing.
func (BecomeNonWitness) ConfVerChanged ¶
func (bn BecomeNonWitness) ConfVerChanged(region *core.RegionInfo) uint64
ConfVerChanged returns the delta value for version increased by this step.
func (BecomeNonWitness) GetCmd ¶
func (bn BecomeNonWitness) GetCmd(region *core.RegionInfo, useConfChangeV2 bool) *pdpb.RegionHeartbeatResponse
GetCmd returns the schedule command for heartbeat response.
func (BecomeNonWitness) Influence ¶
func (bn BecomeNonWitness) Influence(opInfluence OpInfluence, region *core.RegionInfo)
Influence calculates the store difference that current step makes.
func (BecomeNonWitness) IsFinish ¶
func (bn BecomeNonWitness) IsFinish(region *core.RegionInfo) bool
IsFinish checks if current step is finished.
func (BecomeNonWitness) String ¶
func (bn BecomeNonWitness) String() string
type BecomeWitness ¶
type BecomeWitness struct {
PeerID, StoreID uint64
}
BecomeWitness is an OpStep that makes a peer become a witness.
func (BecomeWitness) CheckInProgress ¶
func (bw BecomeWitness) CheckInProgress(ci ClusterInformer, region *core.RegionInfo) error
CheckInProgress checks if the step is in the progress of advancing.
func (BecomeWitness) ConfVerChanged ¶
func (bw BecomeWitness) ConfVerChanged(region *core.RegionInfo) uint64
ConfVerChanged returns the delta value for version increased by this step.
func (BecomeWitness) GetCmd ¶
func (bw BecomeWitness) GetCmd(_ *core.RegionInfo, _ bool) *pdpb.RegionHeartbeatResponse
GetCmd returns the schedule command for heartbeat response.
func (BecomeWitness) Influence ¶
func (bw BecomeWitness) Influence(opInfluence OpInfluence, region *core.RegionInfo)
Influence calculates the store difference that current step makes.
func (BecomeWitness) IsFinish ¶
func (bw BecomeWitness) IsFinish(region *core.RegionInfo) bool
IsFinish checks if current step is finished.
func (BecomeWitness) String ¶
func (bw BecomeWitness) String() string
type Builder ¶
type Builder struct { // basic info ClusterInformer // contains filtered or unexported fields }
Builder is used to create operators. Usage:
op, err := NewBuilder(desc, cluster, region). RemovePeer(store1). AddPeer(peer1). SetLeader(store2). Build(kind)
The generated Operator will choose the most appropriate execution order according to various constraints.
func NewBuilder ¶
func NewBuilder(desc string, ci ClusterInformer, region *core.RegionInfo, opts ...BuilderOption) *Builder
NewBuilder creates a Builder.
func (*Builder) AddPeer ¶
AddPeer records an add Peer operation in Builder. If peer.Id is 0, the builder will allocate a new peer ID later.
func (*Builder) BecomeNonWitness ¶
BecomeNonWitness records a switch to non-witness operation in Builder.
func (*Builder) BecomeWitness ¶
BecomeWitness records a switch to witness operation in Builder.
func (*Builder) DemoteVoter ¶
DemoteVoter records a demote voter operation in Builder.
func (*Builder) EnableForceTargetLeader ¶
EnableForceTargetLeader marks the step of transferring leader to target is forcible.
func (*Builder) EnableLightWeight ¶
EnableLightWeight marks the region as light weight. It is used for scatter regions.
func (*Builder) PromoteLearner ¶
PromoteLearner records a promote learner operation in Builder.
func (*Builder) RemovePeer ¶
RemovePeer records a remove peer operation in Builder.
func (*Builder) SetExpectedRoles ¶
func (b *Builder) SetExpectedRoles(roles map[uint64]placement.PeerRoleType) *Builder
SetExpectedRoles records expected roles of target peers. It may update `targetLeaderStoreID` if there is a peer has role `leader` or `follower`.
func (*Builder) SetLeaders ¶
SetLeaders records all valid target leaders in Builder.
type BuilderOption ¶
type BuilderOption func(*Builder)
BuilderOption is used to create operator builder.
type ChangePeerV2Enter ¶
type ChangePeerV2Enter struct { PromoteLearners []PromoteLearner DemoteVoters []DemoteVoter }
ChangePeerV2Enter is an OpStep that uses joint consensus to request all PromoteLearner and DemoteVoter.
func (ChangePeerV2Enter) CheckInProgress ¶
func (cpe ChangePeerV2Enter) CheckInProgress(_ ClusterInformer, region *core.RegionInfo) error
CheckInProgress checks if the step is in the progress of advancing.
func (ChangePeerV2Enter) ConfVerChanged ¶
func (cpe ChangePeerV2Enter) ConfVerChanged(region *core.RegionInfo) uint64
ConfVerChanged returns the delta value for version increased by this step.
func (ChangePeerV2Enter) GetCmd ¶
func (cpe ChangePeerV2Enter) GetCmd(region *core.RegionInfo, useConfChangeV2 bool) *pdpb.RegionHeartbeatResponse
GetCmd returns the schedule command for heartbeat response.
func (ChangePeerV2Enter) Influence ¶
func (cpe ChangePeerV2Enter) Influence(_ OpInfluence, _ *core.RegionInfo)
Influence calculates the store difference that current step makes.
func (ChangePeerV2Enter) IsFinish ¶
func (cpe ChangePeerV2Enter) IsFinish(region *core.RegionInfo) bool
IsFinish checks if current step is finished.
func (ChangePeerV2Enter) String ¶
func (cpe ChangePeerV2Enter) String() string
type ChangePeerV2Leave ¶
type ChangePeerV2Leave struct { PromoteLearners []PromoteLearner DemoteVoters []DemoteVoter }
ChangePeerV2Leave is an OpStep that leaves the joint state.
func (ChangePeerV2Leave) CheckInProgress ¶
func (cpl ChangePeerV2Leave) CheckInProgress(_ ClusterInformer, region *core.RegionInfo) error
CheckInProgress checks if the step is in the progress of advancing.
func (ChangePeerV2Leave) ConfVerChanged ¶
func (cpl ChangePeerV2Leave) ConfVerChanged(region *core.RegionInfo) uint64
ConfVerChanged returns the delta value for version increased by this step.
func (ChangePeerV2Leave) GetCmd ¶
func (cpl ChangePeerV2Leave) GetCmd(region *core.RegionInfo, useConfChangeV2 bool) *pdpb.RegionHeartbeatResponse
GetCmd returns the schedule command for heartbeat response.
func (ChangePeerV2Leave) Influence ¶
func (cpl ChangePeerV2Leave) Influence(_ OpInfluence, _ *core.RegionInfo)
Influence calculates the store difference that current step makes.
func (ChangePeerV2Leave) IsFinish ¶
func (cpl ChangePeerV2Leave) IsFinish(region *core.RegionInfo) bool
IsFinish checks if current step is finished.
func (ChangePeerV2Leave) String ¶
func (cpl ChangePeerV2Leave) String() string
type ClusterInformer ¶
type ClusterInformer interface { GetBasicCluster() *core.BasicCluster GetOpts() config.Config GetStoreConfig() config.StoreConfig GetRuleManager() *placement.RuleManager GetAllocator() id.Allocator }
ClusterInformer provides the necessary information for building operator.
type DemoteVoter ¶
DemoteVoter is very similar to DemoteFollower. But it allows Demote Leader. Note: It is not an OpStep, only a sub step in ChangePeerV2Enter and ChangePeerV2Leave.
func (DemoteVoter) ConfVerChanged ¶
func (dv DemoteVoter) ConfVerChanged(region *core.RegionInfo) uint64
ConfVerChanged returns the delta value for version increased by this step.
func (DemoteVoter) GetCmd ¶
func (dv DemoteVoter) GetCmd(_ *core.RegionInfo, useConfChangeV2 bool) *pdpb.RegionHeartbeatResponse
GetCmd returns the schedule command for heartbeat response.
func (DemoteVoter) IsFinish ¶
func (dv DemoteVoter) IsFinish(region *core.RegionInfo) bool
IsFinish checks if current step is finished.
func (DemoteVoter) String ¶
func (dv DemoteVoter) String() string
type MergeRegion ¶
type MergeRegion struct { FromRegion *metapb.Region ToRegion *metapb.Region // there are two regions involved in merge process, // so to keep them from other scheduler, // both of them should add MerRegion operatorStep. // But actually, TiKV just needs the region want to be merged to get the merge request, // thus use a IsPassive mark to indicate that // this region doesn't need to send merge request to TiKV. IsPassive bool }
MergeRegion is an OpStep that merge two regions.
func (MergeRegion) CheckInProgress ¶
func (mr MergeRegion) CheckInProgress(_ ClusterInformer, _ *core.RegionInfo) error
CheckInProgress checks if the step is in the progress of advancing.
func (MergeRegion) ConfVerChanged ¶
func (mr MergeRegion) ConfVerChanged(_ *core.RegionInfo) uint64
ConfVerChanged returns the delta value for version increased by this step.
func (MergeRegion) GetCmd ¶
func (mr MergeRegion) GetCmd(region *core.RegionInfo, useConfChangeV2 bool) *pdpb.RegionHeartbeatResponse
GetCmd returns the schedule command for heartbeat response.
func (MergeRegion) Influence ¶
func (mr MergeRegion) Influence(opInfluence OpInfluence, region *core.RegionInfo)
Influence calculates the store difference that current step makes.
func (MergeRegion) IsFinish ¶
func (mr MergeRegion) IsFinish(region *core.RegionInfo) bool
IsFinish checks if current step is finished.
func (MergeRegion) String ¶
func (mr MergeRegion) String() string
type OpHistory ¶
type OpHistory struct { FinishTime time.Time From, To uint64 Kind constant.ResourceKind }
OpHistory is used to log and visualize completed operators.
type OpInfluence ¶
type OpInfluence struct {
StoresInfluence map[uint64]*StoreInfluence
}
OpInfluence records the influence of the cluster.
func (OpInfluence) GetStoreInfluence ¶
func (m OpInfluence) GetStoreInfluence(id uint64) *StoreInfluence
GetStoreInfluence get storeInfluence of specific store.
type OpKind ¶
type OpKind uint32
OpKind is a bit field to identify operator types.
const ( // Initiated by admin. OpAdmin OpKind = 1 << iota // Initiated by merge checker or merge scheduler. Note that it may not include region merge. // the order describe the operator's producer and is very helpful to decouple scheduler or checker limit OpMerge // Initiated by range scheduler. OpRange // Initiated by replica checker. OpReplica // Include region split. Initiated by rule checker if `kind & OpAdmin == 0`. OpSplit // Initiated by hot region scheduler. OpHotRegion // Include peer addition or removal or switch witness. This means that this operator may take a long time. OpRegion // Include leader transfer. OpLeader // Include witness leader transfer. OpWitnessLeader // Include witness transfer. OpWitness )
Flags for operators.
func ParseOperatorKind ¶
ParseOperatorKind converts string (flag name list concat by ',') to OpKind.
type OpRecord ¶
OpRecord is used to log and visualize completed operators. NOTE: This type is exported by HTTP API. Please pay more attention when modifying it.
func (*OpRecord) MarshalJSON ¶
MarshalJSON returns the status of operator as a JSON string
type OpStatus ¶
type OpStatus = uint32
OpStatus represents the status of an Operator.
const ( // Status list // Just created. Next status: {RUNNING, CANCELED, EXPIRED}. CREATED OpStatus = iota // Started and not finished. Next status: {SUCCESS, CANCELED, REPLACED, TIMEOUT}. STARTED // Followings are end status, i.e. no next status. SUCCESS // Finished successfully CANCELED // Canceled due to some reason REPLACED // Replaced by an higher priority operator EXPIRED // Didn't start to run for too long TIMEOUT // Running for too long )
Status list
type OpStatusTracker ¶
type OpStatusTracker struct {
// contains filtered or unexported fields
}
OpStatusTracker represents the status of an operator.
func NewOpStatusTracker ¶
func NewOpStatusTracker() OpStatusTracker
NewOpStatusTracker creates an OpStatus.
func (*OpStatusTracker) CheckExpired ¶
func (trk *OpStatusTracker) CheckExpired(exp time.Duration) bool
CheckExpired checks if expired, and update the current status.
func (*OpStatusTracker) CheckTimeout ¶
func (trk *OpStatusTracker) CheckTimeout(duration time.Duration) bool
CheckTimeout returns true if timeout, and update the current status.
func (*OpStatusTracker) IsEnd ¶
func (trk *OpStatusTracker) IsEnd() bool
IsEnd checks whether the current status is an end status.
func (*OpStatusTracker) ReachTime ¶
func (trk *OpStatusTracker) ReachTime() time.Time
ReachTime returns the reach time of current status.
func (*OpStatusTracker) ReachTimeOf ¶
func (trk *OpStatusTracker) ReachTimeOf(s OpStatus) time.Time
ReachTimeOf returns the time when reached given status. If didn't reached the given status, return zero.
func (*OpStatusTracker) Status ¶
func (trk *OpStatusTracker) Status() OpStatus
Status returns current status.
func (*OpStatusTracker) String ¶
func (trk *OpStatusTracker) String() string
String implements fmt.Stringer.
func (*OpStatusTracker) To ¶
func (trk *OpStatusTracker) To(dst OpStatus) bool
To transfer the current status to dst if this transition is valid, returns whether transferred.
type OpStep ¶
type OpStep interface { fmt.Stringer ConfVerChanged(region *core.RegionInfo) uint64 IsFinish(region *core.RegionInfo) bool CheckInProgress(ci ClusterInformer, region *core.RegionInfo) error Influence(opInfluence OpInfluence, region *core.RegionInfo) Timeout(regionSize int64) time.Duration GetCmd(region *core.RegionInfo, useConfChangeV2 bool) *pdpb.RegionHeartbeatResponse }
OpStep describes the basic scheduling steps that can not be subdivided.
type Operator ¶
type Operator struct { Counters []prometheus.Counter FinishedCounters []prometheus.Counter AdditionalInfos map[string]string ApproximateSize int64 // contains filtered or unexported fields }
Operator contains execution steps generated by scheduler. NOTE: This type is exported by HTTP API. Please pay more attention when modifying it.
func CreateAddPeerOperator ¶
func CreateAddPeerOperator(desc string, ci ClusterInformer, region *core.RegionInfo, peer *metapb.Peer, kind OpKind) (*Operator, error)
CreateAddPeerOperator creates an operator that adds a new peer.
func CreateDemoteVoterOperator ¶
func CreateDemoteVoterOperator(desc string, ci ClusterInformer, region *core.RegionInfo, peer *metapb.Peer) (*Operator, error)
CreateDemoteVoterOperator creates an operator that demotes a voter
func CreateForceTransferLeaderOperator ¶
func CreateForceTransferLeaderOperator(desc string, ci ClusterInformer, region *core.RegionInfo, sourceStoreID uint64, targetStoreID uint64, kind OpKind) (*Operator, error)
CreateForceTransferLeaderOperator creates an operator that transfers the leader from a source store to a target store forcible.
func CreateLeaveJointStateOperator ¶
func CreateLeaveJointStateOperator(desc string, ci ClusterInformer, origin *core.RegionInfo) (*Operator, error)
CreateLeaveJointStateOperator creates an operator that let region leave joint state.
func CreateMergeRegionOperator ¶
func CreateMergeRegionOperator(desc string, ci ClusterInformer, source *core.RegionInfo, target *core.RegionInfo, kind OpKind) ([]*Operator, error)
CreateMergeRegionOperator creates an operator that merge two region into one.
func CreateMoveLeaderOperator ¶
func CreateMoveLeaderOperator(desc string, ci ClusterInformer, region *core.RegionInfo, kind OpKind, oldStore uint64, peer *metapb.Peer) (*Operator, error)
CreateMoveLeaderOperator creates an operator that replaces an old leader with a new leader.
func CreateMovePeerOperator ¶
func CreateMovePeerOperator(desc string, ci ClusterInformer, region *core.RegionInfo, kind OpKind, oldStore uint64, peer *metapb.Peer) (*Operator, error)
CreateMovePeerOperator creates an operator that replaces an old peer with a new peer.
func CreateMoveRegionOperator ¶
func CreateMoveRegionOperator(desc string, ci ClusterInformer, region *core.RegionInfo, kind OpKind, roles map[uint64]placement.PeerRoleType) (*Operator, error)
CreateMoveRegionOperator creates an operator that moves a region to specified stores.
func CreateMoveWitnessOperator ¶
func CreateMoveWitnessOperator(desc string, ci ClusterInformer, region *core.RegionInfo, sourceStoreID uint64, targetStoreID uint64) (*Operator, error)
CreateMoveWitnessOperator creates an operator that replaces an old witness with a new witness.
func CreateNonWitnessPeerOperator ¶
func CreateNonWitnessPeerOperator(desc string, ci ClusterInformer, region *core.RegionInfo, peer *metapb.Peer) (*Operator, error)
CreateNonWitnessPeerOperator creates an operator that set a peer with non-witness
func CreatePromoteLearnerOperator ¶
func CreatePromoteLearnerOperator(desc string, ci ClusterInformer, region *core.RegionInfo, peer *metapb.Peer) (*Operator, error)
CreatePromoteLearnerOperator creates an operator that promotes a learner.
func CreateRemovePeerOperator ¶
func CreateRemovePeerOperator(desc string, ci ClusterInformer, kind OpKind, region *core.RegionInfo, storeID uint64) (*Operator, error)
CreateRemovePeerOperator creates an operator that removes a peer from region.
func CreateReplaceLeaderPeerOperator ¶
func CreateReplaceLeaderPeerOperator(desc string, ci ClusterInformer, region *core.RegionInfo, kind OpKind, oldStore uint64, peer *metapb.Peer, leader *metapb.Peer) (*Operator, error)
CreateReplaceLeaderPeerOperator creates an operator that replaces an old peer with a new peer, and move leader from old store firstly.
func CreateScatterRegionOperator ¶
func CreateScatterRegionOperator(desc string, ci ClusterInformer, origin *core.RegionInfo, targetPeers map[uint64]*metapb.Peer, targetLeader uint64) (*Operator, error)
CreateScatterRegionOperator creates an operator that scatters the specified region.
func CreateSplitRegionOperator ¶
func CreateSplitRegionOperator(desc string, region *core.RegionInfo, kind OpKind, policy pdpb.CheckPolicy, keys [][]byte) (*Operator, error)
CreateSplitRegionOperator creates an operator that splits a region.
func CreateTransferLeaderOperator ¶
func CreateTransferLeaderOperator(desc string, ci ClusterInformer, region *core.RegionInfo, sourceStoreID uint64, targetStoreID uint64, targetStoreIDs []uint64, kind OpKind) (*Operator, error)
CreateTransferLeaderOperator creates an operator that transfers the leader from a source store to a target store.
func CreateWitnessPeerOperator ¶
func CreateWitnessPeerOperator(desc string, ci ClusterInformer, region *core.RegionInfo, peer *metapb.Peer) (*Operator, error)
CreateWitnessPeerOperator creates an operator that set a follower or learner peer with witness
func NewOperator ¶
func NewOperator(desc, brief string, regionID uint64, regionEpoch *metapb.RegionEpoch, kind OpKind, approximateSize int64, steps ...OpStep) *Operator
NewOperator creates a new operator.
func NewTestOperator ¶
func NewTestOperator(regionID uint64, regionEpoch *metapb.RegionEpoch, kind OpKind, steps ...OpStep) *Operator
NewTestOperator creates a test operator, only used for unit test.
func (*Operator) AttachKind ¶
AttachKind attaches an operator kind for the operator.
func (*Operator) Check ¶
func (o *Operator) Check(region *core.RegionInfo) OpStep
Check checks if current step is finished, returns next step to take action. If operator is at an end status, check returns nil. It's safe to be called by multiple goroutine concurrently.
func (*Operator) CheckAndGetStatus ¶
CheckAndGetStatus returns operator status after `CheckExpired` and `CheckTimeout`.
func (*Operator) CheckExpired ¶
CheckExpired checks if the operator is expired, and update the status.
func (*Operator) CheckSuccess ¶
CheckSuccess checks if all steps are finished, and update the status.
func (*Operator) CheckTimeout ¶
CheckTimeout returns true if the operator is timeout, and update the status.
func (*Operator) ConfVerChanged ¶
func (o *Operator) ConfVerChanged(region *core.RegionInfo) (total uint64)
ConfVerChanged returns the number of confver has consumed by steps
func (*Operator) ContainNonWitnessStep ¶
ContainNonWitnessStep returns true if it contains the target OpStep
func (*Operator) ElapsedTime ¶
ElapsedTime returns duration since it was created.
func (*Operator) GetAdditionalInfo ¶
GetAdditionalInfo returns additional info with string
func (*Operator) GetCreateTime ¶
GetCreateTime gets the create time of operator.
func (*Operator) GetPriorityLevel ¶
func (o *Operator) GetPriorityLevel() constant.PriorityLevel
GetPriorityLevel gets the priority level.
func (*Operator) GetReachTimeOf ¶
GetReachTimeOf returns the time when operator reaches the given status.
func (*Operator) GetStartTime ¶
GetStartTime gets the start time of operator.
func (*Operator) HasStarted ¶
HasStarted returns whether operator has started.
func (*Operator) IsLeaveJointStateOperator ¶
IsLeaveJointStateOperator returns true if the desc is OpDescLeaveJointState.
func (*Operator) MarshalJSON ¶
MarshalJSON serializes custom types to JSON.
func (*Operator) RegionEpoch ¶
func (o *Operator) RegionEpoch() *metapb.RegionEpoch
RegionEpoch returns the region's epoch that is attached to the operator.
func (*Operator) RunningTime ¶
RunningTime returns duration since it started.
func (*Operator) SchedulerKind ¶
SchedulerKind return the highest OpKind even if the operator has many OpKind fix #3778
func (*Operator) SetPriorityLevel ¶
func (o *Operator) SetPriorityLevel(level constant.PriorityLevel)
SetPriorityLevel sets the priority level for operator.
func (*Operator) SetStatusReachTime ¶
SetStatusReachTime sets the reach time of the operator, only for test purpose.
func (*Operator) TotalInfluence ¶
func (o *Operator) TotalInfluence(opInfluence OpInfluence, region *core.RegionInfo)
TotalInfluence calculates the store difference which whole operator steps make.
func (*Operator) UnfinishedInfluence ¶
func (o *Operator) UnfinishedInfluence(opInfluence OpInfluence, region *core.RegionInfo)
UnfinishedInfluence calculates the store difference which unfinished operator steps make.
type PromoteLearner ¶
PromoteLearner is an OpStep that promotes a region learner peer to normal voter.
func (PromoteLearner) CheckInProgress ¶
func (pl PromoteLearner) CheckInProgress(_ ClusterInformer, region *core.RegionInfo) error
CheckInProgress checks if the step is in the progress of advancing.
func (PromoteLearner) ConfVerChanged ¶
func (pl PromoteLearner) ConfVerChanged(region *core.RegionInfo) uint64
ConfVerChanged returns the delta value for version increased by this step. It is also used by ChangePeerV2Leave. Since there are currently four roles, we need to confirm whether it is a Voter, not a DemotingVoter, etc.
func (PromoteLearner) GetCmd ¶
func (pl PromoteLearner) GetCmd(_ *core.RegionInfo, useConfChangeV2 bool) *pdpb.RegionHeartbeatResponse
GetCmd returns the schedule command for heartbeat response.
func (PromoteLearner) Influence ¶
func (pl PromoteLearner) Influence(_ OpInfluence, _ *core.RegionInfo)
Influence calculates the store difference that current step makes.
func (PromoteLearner) IsFinish ¶
func (pl PromoteLearner) IsFinish(region *core.RegionInfo) bool
IsFinish checks if current step is finished. It is also used by ChangePeerV2Leave.
func (PromoteLearner) String ¶
func (pl PromoteLearner) String() string
type RemovePeer ¶
RemovePeer is an OpStep that removes a region peer.
func (RemovePeer) CheckInProgress ¶
func (rp RemovePeer) CheckInProgress(_ ClusterInformer, region *core.RegionInfo) error
CheckInProgress checks if the step is in the progress of advancing.
func (RemovePeer) ConfVerChanged ¶
func (rp RemovePeer) ConfVerChanged(region *core.RegionInfo) uint64
ConfVerChanged returns the delta value for version increased by this step.
func (RemovePeer) GetCmd ¶
func (rp RemovePeer) GetCmd(region *core.RegionInfo, useConfChangeV2 bool) *pdpb.RegionHeartbeatResponse
GetCmd returns the schedule command for heartbeat response.
func (RemovePeer) Influence ¶
func (rp RemovePeer) Influence(opInfluence OpInfluence, region *core.RegionInfo)
Influence calculates the store difference that current step makes.
func (RemovePeer) IsFinish ¶
func (rp RemovePeer) IsFinish(region *core.RegionInfo) bool
IsFinish checks if current step is finished.
func (RemovePeer) String ¶
func (rp RemovePeer) String() string
type SplitRegion ¶
type SplitRegion struct {
StartKey, EndKey []byte
Policy pdpb.CheckPolicy
SplitKeys [][]byte
}
SplitRegion is an OpStep that splits a region.
func (SplitRegion) CheckInProgress ¶
func (sr SplitRegion) CheckInProgress(_ ClusterInformer, _ *core.RegionInfo) error
CheckInProgress checks if the step is in the progress of advancing.
func (SplitRegion) ConfVerChanged ¶
func (sr SplitRegion) ConfVerChanged(_ *core.RegionInfo) uint64
ConfVerChanged returns the delta value for version increased by this step.
func (SplitRegion) GetCmd ¶
func (sr SplitRegion) GetCmd(region *core.RegionInfo, useConfChangeV2 bool) *pdpb.RegionHeartbeatResponse
GetCmd returns the schedule command for heartbeat response.
func (SplitRegion) Influence ¶
func (sr SplitRegion) Influence(opInfluence OpInfluence, region *core.RegionInfo)
Influence calculates the store difference that current step makes.
func (SplitRegion) IsFinish ¶
func (sr SplitRegion) IsFinish(region *core.RegionInfo) bool
IsFinish checks if current step is finished.
func (SplitRegion) String ¶
func (sr SplitRegion) String() string
type StoreInfluence ¶
type StoreInfluence struct { RegionSize int64 RegionCount int64 LeaderSize int64 LeaderCount int64 WitnessCount int64 StepCost map[storelimit.Type]int64 }
StoreInfluence records influences that pending operators will make.
func (*StoreInfluence) AddStepCost ¶
func (s *StoreInfluence) AddStepCost(limitType storelimit.Type, cost int64)
AddStepCost add cost to the influence.
func (*StoreInfluence) AdjustStepCost ¶
func (s *StoreInfluence) AdjustStepCost(limitType storelimit.Type, regionSize int64)
AdjustStepCost adjusts the step cost of specific type store limit according to region size
func (*StoreInfluence) GetStepCost ¶
func (s *StoreInfluence) GetStepCost(limitType storelimit.Type) int64
GetStepCost returns the specific type step cost
func (*StoreInfluence) ResourceProperty ¶
func (s *StoreInfluence) ResourceProperty(kind constant.ScheduleKind) int64
ResourceProperty returns delta size of leader/region by influence.
type TransferLeader ¶
type TransferLeader struct {
// Compatible with old TiKV's TransferLeader.
FromStore, ToStore uint64
// Multi-target transfer leader.
ToStores []uint64
}
TransferLeader is an OpStep that transfers a region's leader.
func (TransferLeader) CheckInProgress ¶
func (tl TransferLeader) CheckInProgress(ci ClusterInformer, region *core.RegionInfo) error
CheckInProgress checks if the step is in the progress of advancing.
func (TransferLeader) ConfVerChanged ¶
func (tl TransferLeader) ConfVerChanged(_ *core.RegionInfo) uint64
ConfVerChanged returns the delta value for version increased by this step.
func (TransferLeader) GetCmd ¶
func (tl TransferLeader) GetCmd(region *core.RegionInfo, useConfChangeV2 bool) *pdpb.RegionHeartbeatResponse
GetCmd returns the schedule command for heartbeat response.
func (TransferLeader) Influence ¶
func (tl TransferLeader) Influence(opInfluence OpInfluence, region *core.RegionInfo)
Influence calculates the store difference that current step makes.
func (TransferLeader) IsFinish ¶
func (tl TransferLeader) IsFinish(region *core.RegionInfo) bool
IsFinish checks if current step is finished.
func (TransferLeader) String ¶
func (tl TransferLeader) String() string