Skip to content

Commit

Permalink
adjuest step cost
Browse files Browse the repository at this point in the history
ref #5762

Signed-off-by: Wenbo Zhang <ethercflow@gmail.com>
  • Loading branch information
ethercflow committed Dec 27, 2022
1 parent f819315 commit a2258e8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions server/schedule/operator/step.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ func (ap AddPeer) Influence(opInfluence OpInfluence, region *core.RegionInfo) {
to.RegionSize += regionSize
}
to.RegionCount++
if ap.IsLightWeight {
if ap.IsLightWeight || ap.IsWitness {
return
}
to.AdjustStepCost(storelimit.AddPeer, regionSize)
Expand Down Expand Up @@ -264,7 +264,6 @@ func (bw BecomeWitness) Influence(opInfluence OpInfluence, region *core.RegionIn
regionSize := region.GetApproximateSize()
to.WitnessCount += 1
to.RegionSize -= regionSize
to.AdjustStepCost(storelimit.RemovePeer, regionSize)
}

// Timeout returns duration that current step may take.
Expand Down Expand Up @@ -496,7 +495,7 @@ func (al AddLearner) Influence(opInfluence OpInfluence, region *core.RegionInfo)
to.RegionSize += regionSize
}
to.RegionCount++
if al.IsLightWeight {
if al.IsLightWeight || al.IsWitness {
return
}
to.AdjustStepCost(storelimit.AddPeer, regionSize)
Expand Down Expand Up @@ -614,6 +613,7 @@ func (rp RemovePeer) Influence(opInfluence OpInfluence, region *core.RegionInfo)
peer := region.GetStorePeer(rp.FromStore)
if peer != nil && peer.IsWitness {
from.WitnessCount--
return
}

if rp.IsDownStore && regionSize > storelimit.SmallRegionThreshold {
Expand Down

0 comments on commit a2258e8

Please sign in to comment.