Skip to content

Commit be8f0ee

Browse files
committed
allocator: move ctx to first position in rebalance methods
Move `ctx context.Context` to the first parameter position in `rebalanceStore` and `rebalanceLeases` to follow Go conventions. All rebalance methods in this file now consistently have `ctx` as the first parameter. Updated all call sites accordingly.
1 parent 682cc51 commit be8f0ee

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
@@ -188,13 +188,13 @@ func (cs *clusterState) rebalanceStores(
188188
if rs.rangeMoveCount >= rs.maxRangeMoveCount || rs.leaseTransferCount >= rs.maxLeaseTransferCount {
189189
break
190190
}
191-
rs.rebalanceStore(store, ctx, localStoreID)
191+
rs.rebalanceStore(ctx, store, localStoreID)
192192
}
193193
return rs.changes
194194
}
195195

196196
func (rs *rebalanceState) rebalanceStore(
197-
store sheddingStore, ctx context.Context, localStoreID roachpb.StoreID,
197+
ctx context.Context, store sheddingStore, localStoreID roachpb.StoreID,
198198
) {
199199
log.KvDistribution.Infof(ctx, "start processing shedding store s%d: cpu node load %s, store load %s, worst dim %s",
200200
store.StoreID, store.nls, store.sls, store.worstDim)
@@ -229,7 +229,7 @@ func (rs *rebalanceState) rebalanceStore(
229229
// behalf of a particular store (vs. being called on behalf of the set
230230
// of local store IDs)?
231231
if ss.StoreID == localStoreID && store.dimSummary[CPURate] >= overloadSlow {
232-
shouldSkipReplicaMoves := rs.rebalanceLeases(ss, store, ctx, localStoreID)
232+
shouldSkipReplicaMoves := rs.rebalanceLeases(ctx, ss, store, localStoreID)
233233
if shouldSkipReplicaMoves {
234234
return
235235
}
@@ -451,9 +451,9 @@ func (rs *rebalanceState) rebalanceReplicas(
451451
}
452452

453453
func (rs *rebalanceState) rebalanceLeases(
454+
ctx context.Context,
454455
ss *storeState,
455456
store sheddingStore,
456-
ctx context.Context,
457457
localStoreID roachpb.StoreID,
458458
) bool {
459459
log.KvDistribution.VInfof(ctx, 2, "local store s%d is CPU overloaded (%v >= %v), attempting lease transfers first",

0 commit comments

Comments
 (0)