kvserver: allow VOTER_INCOMING to receive the lease#74546
Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom Jan 7, 2022
Merged
kvserver: allow VOTER_INCOMING to receive the lease#74546craig[bot] merged 1 commit intocockroachdb:masterfrom
craig[bot] merged 1 commit intocockroachdb:masterfrom
Conversation
Previously, VOTER_INCOMING replicas joining the cluster weren't allowed to receive the lease, even though there is no actual problem with doing so. This change removes the restriction, as a step towards cockroachdb#74077 Release note: None
Member
nvb
approved these changes
Jan 6, 2022
Contributor
nvb
left a comment
There was a problem hiding this comment.
Reviewed 3 of 3 files at r1, all commit messages.
Reviewable status:complete! 1 of 0 LGTMs obtained (waiting on @aayushshah15)
aayushshah15
approved these changes
Jan 6, 2022
Contributor
Author
|
bors r+ |
Contributor
|
Build succeeded: |
This was referenced Jul 26, 2022
craig bot
pushed a commit
that referenced
this pull request
Jul 29, 2022
85140: kvserver: ignore leaseholder replica type in DistSender r=arulajmani a=erikgrinaker The DistSender could fail to prioritize a newly discovered leaseholder from a `NotLeaseHolderError` if the leaseholder had a non-`VOTER` replica type. Instead, it would continue to try replicas in order until possibly exhausting the transport and backing off, leading to increased tail latencies. This applies in particular to 22.1, where we allowed `VOTER_INCOMING` replicas to acquire the lease (see 22b4fb5). The primary reason is that `grpcTransport.MoveToFront()` would fail to compare the new leaseholder replica descriptor with the one in its range descriptor. There are two reasons why this can happen: 1. `ReplicaDescriptor.ReplicaType` is a pointer, where the zero-value `nil` is equivalent to `VOTER`. The equality comparison used in `MoveToFront()` is `==`, but pointer equality compares the memory address rather than the value. 2. The transport will keep using the initial range descriptor when it was created, and not updating it as we receive updated range descriptors. This means that the transport may e.g. have a `nil` replica type while the leaseholder has an `VOTER_INCOMING` replica type. This patch fixes both issues by adding `ReplicaDescriptor.IsSame()` which compares replica identities while ignoring the type. Resolves #85060. Touches #74546. Release note (bug fix): Fixed a bug where new leaseholders (with a `VOTER_INCOMING` type) would not always be detected properly during query execution, leading to occasional increased tail latencies due to unnecessary internal retries. Co-authored-by: Erik Grinaker <grinaker@cockroachlabs.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Previously, VOTER_INCOMING replicas joining the cluster weren't allowed
to receive the lease, even though there is no actual problem with doing so.
This change removes the restriction, as a step towards #74077
Release note: None