Skip to content

Commit

Permalink
kvserver: log system range lease acquisition
Browse files Browse the repository at this point in the history
This patch logs acquisition of meta/liveness range leases to the health
log. These leases are critical to cluster health, and during debugging
it's useful to know their location over time.

Epic: none
Release note: None
  • Loading branch information
erikgrinaker committed May 28, 2023
1 parent 71117b1 commit b9148c7
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pkg/kv/kvserver/replica_proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,17 @@ func (r *Replica) leasePostApplyLocked(
r.gossipFirstRangeLocked(ctx)
}

// Log acquisition of meta and liveness range leases. These are critical to
// cluster health, so it's useful to know their location over time.
if leaseChangingHands && iAmTheLeaseHolder &&
r.descRLocked().StartKey.Less(roachpb.RKey(keys.NodeLivenessKeyMax)) {
if r.ownsValidLeaseRLocked(ctx, now) {
log.Health.Infof(ctx, "acquired system range lease: %s", newLease)
} else {
log.Health.Warningf(ctx, "applied system range lease after it expired: %s", newLease)
}
}

st := r.leaseStatusAtRLocked(ctx, now)
if leaseChangingHands && newLease.Type() == roachpb.LeaseExpiration &&
r.ownsValidLeaseRLocked(ctx, now) && !r.shouldUseExpirationLeaseRLocked() {
Expand Down

0 comments on commit b9148c7

Please sign in to comment.