Skip to content

Commit 1a36437

Browse files
committed
mmaprototype: add store parameter to shedStore function
Add store sheddingStore as a parameter to the shedStore function instead of capturing it from the loop. Remove idx parameter as it was only used for logging and is not needed.
1 parent 81ef547 commit 1a36437

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,8 @@ func (cs *clusterState) rebalanceStores(
175175
maxLeaseTransferCount: maxLeaseTransferCount,
176176
lastFailedChangeDelayDuration: lastFailedChangeDelayDuration,
177177
}
178-
for idx /*logging only*/, store := range sheddingStores {
179-
func(rs *rebalanceState) {
178+
for _, store := range sheddingStores {
179+
func(rs *rebalanceState, store sheddingStore) {
180180
log.KvDistribution.Infof(ctx, "start processing shedding store s%d: cpu node load %s, store load %s, worst dim %s",
181181
store.StoreID, store.nls, store.sls, store.worstDim)
182182
ss := rs.cs.stores[store.StoreID]
@@ -581,7 +581,7 @@ func (cs *clusterState) rebalanceStores(
581581
"result(success): rebalancing r%v from s%v to s%v [change: %v] with resulting loads source: %v target: %v",
582582
rangeID, removeTarget.StoreID, addTarget.StoreID, rs.changes[len(rs.changes)-1], ss.adjusted.load, targetSS.adjusted.load)
583583
if rs.rangeMoveCount >= rs.maxRangeMoveCount {
584-
log.KvDistribution.VInfof(ctx, 2, "s%d has reached max range move count %d: mma returning with %d stores left in shedding stores", store.StoreID, rs.maxRangeMoveCount, len(sheddingStores)-(idx+1))
584+
log.KvDistribution.VInfof(ctx, 2, "s%d has reached max range move count %d: mma returning", store.StoreID, rs.maxRangeMoveCount)
585585
rs.shouldReturnEarly = true
586586
return
587587
}
@@ -602,7 +602,7 @@ func (cs *clusterState) rebalanceStores(
602602
rs.shouldContinue = true
603603
return
604604
}
605-
}(rs)
605+
}(rs, store)
606606
if rs.shouldReturnEarly {
607607
return rs.changes
608608
}

0 commit comments

Comments
 (0)