release-21.1: kvserver: add safeguard against spurious calls to AdminRelocateRange #64303
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Backport 2/2 commits from #64170.
/cc @cockroachdb/release
This PR contains 2 commits:
kvserver: add safeguard against spurious calls to AdminRelocateRange
This commit adds checks inside of
AdminRelocateRange
to fail if thelists of relocation targets passed in by the caller contain duplicates.
This is supposed to act as a safeguard against catastrophic outcomes
like a range getting spuriously downreplicated due to malformed input.
Release note: None
kvserver: prevent the StoreRebalancer from downreplicating a range
Prior to this commit, we had a bug inside one of the methods used by the
StoreRebalancer
where we had two variables referring to a slice thatwas subsequently being appended to.
The code was making the implicit assumption that both of these slices
would point to the same underlying array, which is not true since any of
the additions mentioned above could result in the underlying array for
one of the slices being resized.
This commit fixes this bug.
Resolves #64064
Release note (bug fix): A bug in previous 21.1 betas allowed the store
rebalancer to spuriously downreplicate a range during normal operation.
This bug is now fixed.