Skip to content

Commit

Permalink
Skip PRRL renewal on UNASSIGNED_SEQ_NO
Browse files Browse the repository at this point in the history
Today when renewing PRRLs we assert that any invalid "backwards" renewals must
be because we are recovering the shard. In fact it's also possible to have
`checkpointState.globalCheckpoint == SequenceNumbers.UNASSIGNED_SEQ_NO` on a
tracked shard copy if the primary was just promoted and hasn't received
checkpoints from all of its peers too.

This commit weakens the assertion to match.

Caught by a [failure of the full cluster restart
tests](https://scans.gradle.com/s/5lllzgqtuegty/console-log#L8605)

Relates elastic#41536
  • Loading branch information
DaveCTurner committed Jul 5, 2019
1 parent 76ff6e8 commit 199ef03
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -508,10 +508,9 @@ public synchronized void renewPeerRecoveryRetentionLeases() {
PEER_RECOVERY_RETENTION_LEASE_SOURCE);
} else {
// the retention lease is tied to the node, not the shard copy, so it's possible a copy was removed and now
// we are in the process of recovering it again. The recovery process will fix the lease before initiating
// tracking on this copy:
assert checkpointState.tracked == false
&& checkpointState.globalCheckpoint == SequenceNumbers.UNASSIGNED_SEQ_NO :
// we are in the process of recovering it again, or maybe we were just promoted and have not yet received the
// global checkpoints from our peers.
assert checkpointState.globalCheckpoint == SequenceNumbers.UNASSIGNED_SEQ_NO :
"cannot renew " + retentionLease + " according to " + checkpointState + " for " + shardRouting;
}
}
Expand Down

0 comments on commit 199ef03

Please sign in to comment.