From 02e900d465763b9b2411e59f1d5cefe9239daf3e Mon Sep 17 00:00:00 2001 From: Nathan VanBenschoten Date: Tue, 16 Jan 2024 18:01:31 -0500 Subject: [PATCH] roachpb: address review comments from #117840 I had missed a `git push` immediately before merging. This updates two comments. Epic: None Release note: None --- pkg/roachpb/data.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pkg/roachpb/data.go b/pkg/roachpb/data.go index d3b95c67412c..de5e651a0be8 100644 --- a/pkg/roachpb/data.go +++ b/pkg/roachpb/data.go @@ -1882,7 +1882,11 @@ func (l Lease) Speculative() bool { // // NB: Lease.Equivalent is NOT symmetric. For expiration-based // leases, a lease is equivalent to another with an equal or -// later expiration, but not an earlier expiration. +// later expiration, but not an earlier expiration. Similarly, +// an expiration-based lease is equivalent to an epoch-based +// lease with the same replica and start time (representing a +// promotion from expiration-based to epoch-based), but the +// reverse is not true. func (l Lease) Equivalent(newL Lease, expToEpochEquiv bool) bool { // Ignore proposed timestamp & deprecated start stasis. l.ProposedTS, newL.ProposedTS = nil, nil @@ -1921,7 +1925,9 @@ func (l Lease) Equivalent(newL Lease, expToEpochEquiv bool) bool { // Expiration-based leases carry a local expiration timestamp. Epoch-based // leases store their expiration indirectly in NodeLiveness. We assume that // this promotion is only proposed if the liveness expiration is later than - // previous expiration carried by the expiration-based lease. + // previous expiration carried by the expiration-based lease. This is a + // case where Equivalent is not commutative, as the reverse transition + // (from epoch-based to expiration-based) requires a sequence increment. // // Ignore epoch and expiration. The remaining fields which are compared // are Replica and Start.