Skip to content

Commit

Permalink
kvserver: omit unnecessary campaign checks on leader unquiescence
Browse files Browse the repository at this point in the history
This patch changes a couple of `maybeUnquiesce()` call sites to not
attempt to campaign when we know the replica must already be the leader.

Epic: none
Release note: None
  • Loading branch information
erikgrinaker committed Jun 20, 2023
1 parent fdbef91 commit 50d7264
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/kv/kvserver/replica_raft_quiesce.go
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ func (r *Replica) quiesceAndNotifyRaftMuLockedReplicaMuLocked(
if log.V(4) {
log.Infof(ctx, "failed to quiesce: cannot find to replica (%d)", id)
}
r.maybeUnquiesceLocked(false /* wakeLeader */, true /* mayCampaign */)
r.maybeUnquiesceLocked(false /* wakeLeader */, false /* mayCampaign */) // already leader
return false
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/kv/kvserver/store_raft.go
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ func (s *Store) nodeIsLiveCallback(l livenesspb.Liveness) {
lagging := r.mu.laggingFollowersOnQuiesce
r.mu.RUnlock()
if quiescent && lagging.MemberStale(l) {
r.maybeUnquiesce(false /* wakeLeader */, true /* mayCampaign */)
r.maybeUnquiesce(false /* wakeLeader */, false /* mayCampaign */) // already leader
}
})
}
Expand Down

0 comments on commit 50d7264

Please sign in to comment.