Skip to content

Commit 49e5b1c

Browse files
committed
mmaprototype: refactor computeMeansForStoreSet
Previously, we updated computeMeansForStoreSet to take meansLoad and []roachpb.StoreID directly instead of a meansForStoreSet struct. This commit updates the call sites that only require meansLoad to use it directly, removing unnecessary use of meansForStoreSet.
1 parent bbcb7d0 commit 49e5b1c

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -473,10 +473,9 @@ func (a *allocatorState) rebalanceStores(
473473
if len(candsPL) <= 1 {
474474
continue // leaseholder is the only candidate
475475
}
476-
var means meansForStoreSet
476+
var means meansLoad
477477
clear(scratchNodes)
478-
means.stores = candsPL
479-
computeMeansForStoreSet(a.cs, &means.meansLoad, means.stores, scratchNodes)
478+
computeMeansForStoreSet(a.cs, &means, candsPL, scratchNodes)
480479
sls := a.cs.computeLoadSummary(ctx, store.StoreID, &means.storeLoad, &means.nodeLoad)
481480
log.KvDistribution.VInfof(ctx, 2, "considering lease-transfer r%v from s%v: candidates are %v", rangeID, store.StoreID, candsPL)
482481
if sls.dimSummary[CPURate] < overloadSlow {
@@ -948,7 +947,7 @@ type candidateInfo struct {
948947

949948
type candidateSet struct {
950949
candidates []candidateInfo
951-
means *meansForStoreSet
950+
means *meansLoad
952951
}
953952

954953
type ignoreLevel uint8
@@ -1390,7 +1389,7 @@ func (a *allocatorState) computeCandidatesForRange(
13901389
storeLoadSummary: csls,
13911390
})
13921391
}
1393-
cset.means = means
1392+
cset.means = &means.meansLoad
13941393
return cset, sheddingSLS
13951394
}
13961395

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1949,7 +1949,7 @@ func (cs *clusterState) canShedAndAddLoad(
19491949
srcSS *storeState,
19501950
targetSS *storeState,
19511951
delta LoadVector,
1952-
means *meansForStoreSet,
1952+
means *meansLoad,
19531953
onlyConsiderTargetCPUSummary bool,
19541954
overloadedDim LoadDimension,
19551955
) (canAddLoad bool) {

0 commit comments

Comments
 (0)