Skip to content

Commit 72d6753

Browse files
committed
Prevent invalid renewals of PRRLs
Today when a PRRL is created during peer recovery it retains history from the sequence number provided by the recovering peer. However this sequence number may be greater than the primary's knowledge of that peer's persisted global checkpoint. Subsequent renewals of this lease will attempt to set the retained sequence number back to the primary's knowledge of that peer's persisted global checkpoint tripping an assertion that retention leases must only advance. This commit accounts for this. Caught by [a failure of `RecoveryWhileUnderLoadIT.testRecoverWhileRelocating`](https://scans.gradle.com/s/wxccfrtfgjj3g/console-log?task=:server:integTest#L14) Relates elastic#41536
1 parent fbc4477 commit 72d6753

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

server/src/main/java/org/elasticsearch/index/seqno/ReplicationTracker.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ public synchronized void renewPeerRecoveryRetentionLeases() {
499499
if (retentionLease != null) {
500500
final CheckpointState checkpointState = checkpoints.get(shardRouting.allocationId().getId());
501501
renewRetentionLease(getPeerRecoveryRetentionLeaseId(shardRouting),
502-
Math.max(0L, checkpointState.globalCheckpoint + 1L),
502+
Math.max(retentionLease.retainingSequenceNumber(), checkpointState.globalCheckpoint + 1L),
503503
PEER_RECOVERY_RETENTION_LEASE_SOURCE);
504504
}
505505
}

0 commit comments

Comments
 (0)