From b52a183873c1abece5d451a1e8ed43ea8759579b Mon Sep 17 00:00:00 2001 From: Tobias Grieger Date: Mon, 8 Aug 2022 13:47:19 +0200 Subject: [PATCH] kvserver: only pause followers when holding active lease If the raft leader is not the leaseholder (which includes the case in which we just transferred the lease away), leave all followers unpaused. Otherwise, the leaseholder won't learn that the entries it submitted were committed which effectively causes range unavailability. Fixes #84884. Release note: None --- pkg/kv/kvserver/replica_raft_overload.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkg/kv/kvserver/replica_raft_overload.go b/pkg/kv/kvserver/replica_raft_overload.go index 98e9a9ac33e2..2b343b7b0a68 100644 --- a/pkg/kv/kvserver/replica_raft_overload.go +++ b/pkg/kv/kvserver/replica_raft_overload.go @@ -230,6 +230,15 @@ func (r *Replica) updatePausedFollowersLocked( return } + status := r.leaseStatusAtRLocked(ctx, r.Clock().NowAsClockTimestamp()) + if !status.IsValid() || status.OwnedBy(r.StoreID()) { + // If we're not the leaseholder (which includes the case in which we just + // transferred the lease away), leave all followers unpaused. Otherwise, the + // leaseholder won't learn that the entries it submitted were committed + // which effectively causes range unavailability. + return + } + // When multiple followers are overloaded, we may not be able to exclude all // of them from replication traffic due to quorum constraints. We would like // a given Range to deterministically exclude the same store (chosen