Skip to content

Commit 968713d

Browse files
committed
mmaprototype: use meansLoad in MMARebalanceAdvisor
This commit switches to using meansLoad and passes the stores slice directly to computeMeansForStoreSet. Once the other PR is merged and this one is rebased, we should fix-up this commit to allocatorimpl: consult with mma for replicate queue rebalancing.
1 parent 03f862a commit 968713d

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1305,7 +1305,7 @@ type MMARebalanceAdvisor struct {
13051305
// existingStoreSLS is the load summary for the existing store.
13061306
existingStoreSLS storeLoadSummary
13071307
// means is the means for the candidate set.
1308-
means meansForStoreSet
1308+
means meansLoad
13091309
}
13101310

13111311
// NoopMMARebalanceAdvisor is a no-op MMARebalanceAdvisor that always returns
@@ -1325,14 +1325,12 @@ func NoopMMARebalanceAdvisor() MMARebalanceAdvisor {
13251325
func (a *allocatorState) BuildMMARebalanceAdvisor(
13261326
existing roachpb.StoreID, cands []roachpb.StoreID,
13271327
) MMARebalanceAdvisor {
1328-
var means meansForStoreSet
13291328
// TODO(wenyihu6): for simplicity, we create a new scratchNodes every call.
13301329
// We should reuse the scratchNodes instead.
13311330
scratchNodes := map[roachpb.NodeID]*NodeLoad{}
1332-
storeIDs := makeStoreIDPostingList(cands)
1333-
storeIDs.insert(existing)
1334-
means.stores = storeIDs
1335-
computeMeansForStoreSet(a.cs, &means, scratchNodes)
1331+
scratchStores := map[roachpb.StoreID]struct{}{}
1332+
cands = append(cands, existing)
1333+
means := computeMeansForStoreSet(a.cs, cands, scratchNodes, scratchStores)
13361334
// TODO(wenyihu6): pass in the actual ctx here
13371335
existingSLS := a.cs.computeLoadSummary(context.Background(), existing,
13381336
&means.storeLoad, &means.nodeLoad)

0 commit comments

Comments
 (0)