Skip to content

Commit 0d150b9

Browse files
committed
mmaprototype: add rebalanceReplicas method scaffolding with IIF wrapper
Wrap the replica rebalancing logic in an immediately invoked function (IIF) and add a call to a new rebalanceReplicas method (currently a no-op). This sets up both the call site and method signature, making it straightforward to move the code into the method in the next step.
1 parent b4bd06c commit 0d150b9

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

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

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,8 @@ func (rs *rebalanceState) rebalanceStore(
236236
}
237237

238238
log.KvDistribution.VInfof(ctx, 2, "attempting to shed replicas next")
239-
{
239+
rs.rebalanceReplicas(ctx, store, ss, localStoreID, now)
240+
func(rs *rebalanceState, ctx context.Context, store sheddingStore, ss *storeState, localStoreID roachpb.StoreID, now time.Time) {
240241
doneShedding := false
241242
if store.StoreID != localStoreID && store.dimSummary[CPURate] >= overloadSlow &&
242243
now.Sub(ss.overloadStartTime) < remoteStoreLeaseSheddingGraceDuration {
@@ -437,7 +438,17 @@ func (rs *rebalanceState) rebalanceStore(
437438
log.KvDistribution.VInfof(ctx, 2, "store s%d is done shedding, moving to next store", store.StoreID)
438439
return
439440
}
440-
}
441+
}(rs, ctx, store, ss, localStoreID, now)
442+
}
443+
444+
func (rs *rebalanceState) rebalanceReplicas(
445+
ctx context.Context,
446+
store sheddingStore,
447+
ss *storeState,
448+
localStoreID roachpb.StoreID,
449+
now time.Time,
450+
) {
451+
// TODO: code will be moved here in next step.
441452
}
442453

443454
func (rs *rebalanceState) rebalanceLeases(

0 commit comments

Comments
 (0)