-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
kvserver: ignore leaseholder replica type in DistSender
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. 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.
- Loading branch information
1 parent
811ca1f
commit 0251570
Showing
5 changed files
with
41 additions
and
10 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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