Skip to content

Commit

Permalink
Merge 637c9c8 into blathers/backport-release-23.1-131845
Browse files Browse the repository at this point in the history
  • Loading branch information
blathers-crl[bot] authored Oct 4, 2024
2 parents 983e6fe + 637c9c8 commit 70142a1
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions pkg/kv/kvserver/replica_rangefeed_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1555,13 +1555,24 @@ func TestNewRangefeedForceLeaseRetry(t *testing.T) {
// Expire the lease. Given that the Raft leadership is on n2, only n2 will be
// eligible to acquire a new lease.
log.Infof(ctx, "test expiring lease")
nl := n2.NodeLiveness().(*liveness.NodeLiveness)
resumeHeartbeats := nl.PauseAllHeartbeatsForTest()
n2Liveness, ok := nl.Self()
nl2 := n2.NodeLiveness().(*liveness.NodeLiveness)
resumeHeartbeats := nl2.PauseAllHeartbeatsForTest()
n2Liveness, ok := nl2.Self()
require.True(t, ok)
manualClock.Increment(n2Liveness.Expiration.ToTimestamp().Add(1, 0).WallTime - manualClock.UnixNano())
atomic.StoreInt64(&rejectExtraneousRequests, 1)
// Ask another node to increment n2's liveness record.

// Ask another node to increment n2's liveness record, but first, wait until
// n1's liveness state is the same as n2's. Otherwise, the epoch below might
// get rejected because of mismatching liveness records.
testutils.SucceedsSoon(t, func() error {
nl1 := n1.NodeLiveness().(*liveness.NodeLiveness)
n2LivenessFromN1, _ := nl1.GetLiveness(n2.NodeID())
if n2Liveness != n2LivenessFromN1.Liveness {
return errors.Errorf("waiting for node 2 liveness to converge on both nodes 1 and 2")
}
return nil
})
require.NoError(t, n1.NodeLiveness().(*liveness.NodeLiveness).IncrementEpoch(ctx, n2Liveness))

resumeHeartbeats()
Expand Down

0 comments on commit 70142a1

Please sign in to comment.