Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release-21.1: kvserver: add safeguard against spurious calls to AdminRelocateRange #64303

Merged

Conversation

aayushshah15
Copy link
Contributor

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 the
lists 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 that
was 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.

This commit adds checks inside of `AdminRelocateRange` to fail if the
lists 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
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 that
was 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 cockroachdb#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.
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@aayushshah15 aayushshah15 changed the title kvserver: add safeguard against spurious calls to AdminRelocateRange release-21.1: kvserver: add safeguard against spurious calls to AdminRelocateRange Apr 27, 2021
@aayushshah15 aayushshah15 merged commit 6a6659e into cockroachdb:release-21.1 Apr 28, 2021
@aayushshah15 aayushshah15 deleted the backport21.1-64170 branch April 28, 2021 00:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants