Skip to content

Commit

Permalink
Merge #76974 #77003
Browse files Browse the repository at this point in the history
76974: kvserver: consider VOTER_INCOMING for lease transfer even if current … r=shralex a=shralex

…leaseholder isn't the Raft leader

This was previously done as part of #74077
but a check for leader-leaseholder collocation was missed by that patch. This check is removed
in this PR, as this case is already covered by replicaMayNeedSnapshot.

With this PR, restoreTPCCInc/nodes=10 passed 85 times in a row.

In future PRs, we will make the error returned by maybeTransferLeaseDuringLeaveJoint retriable by
AdminSplit.

Release note: None

77003: authors: add Xiang Gu to authors r=rickystewart a=Xiang-Gu

Release note: None

Co-authored-by: shralex <[email protected]>
Co-authored-by: Xiang Gu <[email protected]>
  • Loading branch information
3 people committed Feb 25, 2022
3 parents 94e64ce + cd98815 + 21e4efe commit d6e02c5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ Vy Ton <[email protected]> <[email protected]>
Wade Waldron <[email protected]>
wenyong-h <[email protected]>
Will Haack <[email protected]> <[email protected]>
Xiang Gu <[email protected]>
Xiang Li <[email protected]>
Xin Hao Zhang <[email protected]> <[email protected]>
Xinyu Zhou (Joe) <[email protected]>
Expand Down
14 changes: 3 additions & 11 deletions pkg/kv/kvserver/allocator.go
Original file line number Diff line number Diff line change
Expand Up @@ -2030,20 +2030,12 @@ func replicaMayNeedSnapshot(raftStatus *raft.Status, replica roachpb.ReplicaDesc
}

// excludeReplicasInNeedOfSnapshots filters out the `replicas` that may be in
// need of a raft snapshot. If this function is called with the `raftStatus` of
// a non-raft leader replica, an empty slice is returned.
// need of a raft snapshot. VOTER_INCOMING replicas are not filtered out.
// Other replicas may be filtered out if this function is called with the
// `raftStatus` of a non-raft leader replica.
func excludeReplicasInNeedOfSnapshots(
ctx context.Context, raftStatus *raft.Status, replicas []roachpb.ReplicaDescriptor,
) []roachpb.ReplicaDescriptor {
if raftStatus == nil || len(raftStatus.Progress) == 0 {
log.VEventf(
ctx,
5,
"raft leader not collocated with the leaseholder; will not produce any lease transfer targets",
)
return []roachpb.ReplicaDescriptor{}
}

filled := 0
for _, repl := range replicas {
if replicaMayNeedSnapshot(raftStatus, repl) {
Expand Down

0 comments on commit d6e02c5

Please sign in to comment.