Skip to content

Commit db7c2de

Browse files
committed
mmaprototype: remove shouldContinue flag from rebalanceState
Remove the shouldContinue flag since the function returns normally when it wants to skip to the next store, and the loop naturally continues to the next iteration.
1 parent b5ce551 commit db7c2de

File tree

1 file changed

+0
-10
lines changed

1 file changed

+0
-10
lines changed

pkg/kv/kvserver/allocator/mmaprototype/cluster_state_rebalance_stores.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ type rebalanceState struct {
3636
rangeMoveCount int
3737
// leaseTransferCount tracks the number of lease transfers made.
3838
leaseTransferCount int
39-
// shouldContinue indicates the outer loop should continue to the next iteration.
40-
shouldContinue bool
4139
// maxRangeMoveCount is the maximum number of range moves allowed.
4240
maxRangeMoveCount int
4341
// maxLeaseTransferCount is the maximum number of lease transfers allowed.
@@ -177,7 +175,6 @@ func (cs *clusterState) rebalanceStores(
177175
changes: []PendingRangeChange{},
178176
rangeMoveCount: 0,
179177
leaseTransferCount: 0,
180-
shouldContinue: false,
181178
maxRangeMoveCount: maxRangeMoveCount,
182179
maxLeaseTransferCount: maxLeaseTransferCount,
183180
lastFailedChangeDelayDuration: lastFailedChangeDelayDuration,
@@ -189,10 +186,6 @@ func (cs *clusterState) rebalanceStores(
189186
break
190187
}
191188
rs.rebalanceStore(store, ctx, localStoreID, now)
192-
if rs.shouldContinue {
193-
rs.shouldContinue = false
194-
continue
195-
}
196189
}
197190
return rs.changes
198191
}
@@ -412,7 +405,6 @@ func (rs *rebalanceState) rebalanceStore(
412405
// lease transfers -- so be it.
413406
log.KvDistribution.VInfof(ctx, 2, "skipping replica transfers for s%d: done shedding=%v, lease_transfers=%d",
414407
store.StoreID, doneShedding, rs.leaseTransferCount)
415-
rs.shouldContinue = true
416408
return
417409
}
418410
} else {
@@ -425,7 +417,6 @@ func (rs *rebalanceState) rebalanceStore(
425417
if store.StoreID != localStoreID && store.dimSummary[CPURate] >= overloadSlow &&
426418
now.Sub(ss.overloadStartTime) < remoteStoreLeaseSheddingGraceDuration {
427419
log.KvDistribution.VInfof(ctx, 2, "skipping remote store s%d: in lease shedding grace period", store.StoreID)
428-
rs.shouldContinue = true
429420
return
430421
}
431422
// If the node is cpu overloaded, or the store/node is not fdOK, exclude
@@ -620,7 +611,6 @@ func (rs *rebalanceState) rebalanceStore(
620611
// rebalancing to work well is not in scope.
621612
if doneShedding {
622613
log.KvDistribution.VInfof(ctx, 2, "store s%d is done shedding, moving to next store", store.StoreID)
623-
rs.shouldContinue = true
624614
return
625615
}
626616
}

0 commit comments

Comments
 (0)