You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
154499: allocatorimpl: consult with mma for replicate queue rebalancing r=wenyihu6 a=wenyihu6
Part of: #153520
Epic: CRDB-55052
Release note: none
---
**allocatorimpl: plumb allocatorSync to Allocator**
This commit adds allocatorSync to the Allocator struct. In the future, Allocator
will call mma directly to check if a change conflicts with mma's goals and could
cause thrashing, skipping candidates that do.
---
**allocatorimpl: consult with mma for replicate queue rebalancing**
Previously, LBRebalancingMultiMetricAndCount allowed both MMA- and count-based
rebalancing, which could lead to conflicting goals and thrashing. This commit
updates the replicate queue to consult MMA on the final rebalancing target
selected. Critical rebalances that repair constraints, disk fullness, or
diversity bypass the MMA check; all other rebalances consult MMA before
proceeding.
Some asim tests showed even more thrashing, possibly due to two factors:
1. The replicate queue may have a stale view of in-progress changes.
2. The mean calculation of replica count now includes overloaded stores that
might not be viable targets, leading to suboptimal decisions. For example,
the queue may rebalance from a slightly overfull store toward an
around-the-mean store, but the mean can be deflated by overloaded stores with
very low range counts. As a result, slightly overfull store might appear to
deserve a rebalance even though it won't be able to pick a very good
candidate in the end.
We are okay with this for now and will revisit if needed.
The lease queue does not yet apply this check; future commits will extend it.
I plan to add more data-driven tests to ensure that constraints are still
repaired even when MMA rejects certain actions. These will be included in
follow-up PRs.
---
**mmaintegration: add TestingKnobs to AllocatorSync**
This commit adds a TestingKnobs field to AllocatorSync and plumbs it through,
enabling future commits to add tests that override decisions in
InConflictWithMMA.
---
**allocatorimpl: add TestAllocatorRebalanceMMAConflict**
This commit adds TestAllocatorRebalanceMMAConflict, which verifies that
allocator.RebalanceTarget allows critical rebalances to proceed even when they
conflict with MMA's goals, and ensures it consults MMA correctly for
non-critical rebalances.
---
**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.
---
**allocatorimpl: remove leftover log lines**
This commit removes leftover fmt.Println debug logs.
---
**mmaprototype: return a pointer for BuildMMARebalanceAdvisor**
This commit updates BuildMMARebalanceAdvisor to return a pointer, since future
changes will require passing it around and modifying its fields.
---
**allocatorimpl: populate advisor under rebalanceOptions**
Previously, `bestRebalanceTarget` took a map and populated it with (option
index->advisor) during the loop. This commit changes it to populate the advisor
directly within the `rebalanceOptions` struct as a field.
---
**mmaprototype: lazily initialize existingStoreSLS**
Previously, `MMARebalanceAdvisor` built `existingStoreSLS` during
`BuildMMARebalanceAdvisor`. This commit changes it to store only
`existingStoreID` at `BuildMMARebalanceAdvisor`, and construct the actual
`existingStoreSLS` during the first call to `IsInConflictWithMMA`. This has two
advantages: (1) `existingStoreID` is now part of the advisor struct, making it
available for logging in `IsInConflictWithMMA`; and (2) only
`IsInConflictWithMMA` needs a context for logging, which makes sense for it to
have one.
---
**mmaprototype: pass context properly**
This commit ensures `IsInConflictWithMMA` receives a proper context so that
its logs appear in traces.
---
**mmaprototype: improve logs with IsInConflictWithMMA**
This commit enhances `IsInConflictWithMMA` logs so they appear in traces and
under vmodule, improving visibility into MMA rejections.
---
**allocatorimpl: improve comments for recent changes**
This commit updates comments to reflect changes made in previous commits.
---
**allocatorimpl: fixes TestBestRebalanceTarget**
This commit fixes a test that previously panic because `nil` was passed for
`allocatorSync` in `bestRebalanceTarget`.
---
**mmaprototype: move MMARebalanceAdvisor to rebalance_advisor.go**
This commit moves `MMARebalanceAdvisor` related code from `allocator_state.go` to
`rebalance_advisor.go`.
---
**allocatorimpl: remove CountBasedRebalancingOnlyEnabledByMMA**
This commit removes `CountBasedRebalancingOnlyEnabledByMMA`, which was left
unused.
---
**mmaprototype: improve comments and logs**
This commit resolves misc comments from PR review.
Co-authored-by: wenyihu6 <[email protected]>
0 commit comments