Skip to content

Commit

Permalink
kv: use max timestamp during below-Raft scan to gossip liveness
Browse files Browse the repository at this point in the history
This commit switches `MaybeGossipNodeLivenessRaftMuLocked` to evaluate its scan
at the maximum timestamp instead of at the local node's HLC time. This ensures
that we gossip the most recent liveness record, regardless of what timestamp it
is written at.
  • Loading branch information
nvanbenschoten committed Aug 9, 2022
1 parent 24906bd commit 51c5a38
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/kv/kvserver/replica_gossip.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"github.com/cockroachdb/cockroach/pkg/kv/kvserver/uncertainty"
"github.com/cockroachdb/cockroach/pkg/roachpb"
"github.com/cockroachdb/cockroach/pkg/storage"
"github.com/cockroachdb/cockroach/pkg/util/hlc"
"github.com/cockroachdb/cockroach/pkg/util/log"
"github.com/cockroachdb/errors"
)
Expand Down Expand Up @@ -83,7 +84,9 @@ func (r *Replica) MaybeGossipNodeLivenessRaftMuLocked(
}

ba := roachpb.BatchRequest{}
ba.Timestamp = r.store.Clock().Now()
// Read at the maximum timestamp to ensure that we see the most recent
// liveness record, regardless of what timestamp it is written at.
ba.Timestamp = hlc.MaxTimestamp
ba.Add(&roachpb.ScanRequest{RequestHeader: roachpb.RequestHeaderFromSpan(span)})
// Call evaluateBatch instead of Send to avoid reacquiring latches.
rec := NewReplicaEvalContext(
Expand Down

0 comments on commit 51c5a38

Please sign in to comment.