Skip to content

Commit fbf532a

Browse files
committed
Revert "Add global checkpoint assertion in index shard"
This reverts commit 89b305c.
1 parent d2c6970 commit fbf532a

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

core/src/main/java/org/elasticsearch/index/shard/IndexShard.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1515,8 +1515,6 @@ public long getGlobalCheckpoint() {
15151515
*/
15161516
public void updateGlobalCheckpointOnReplica(final long globalCheckpoint) {
15171517
verifyReplicationTarget();
1518-
// we sample the recovery stage before sampling the local checkpoint or we are subject to a race condition in the below assertion
1519-
final RecoveryState.Stage stage = recoveryState().getStage();
15201518
final SequenceNumbersService seqNoService = getEngine().seqNoService();
15211519
final long localCheckpoint = seqNoService.getLocalCheckpoint();
15221520
if (globalCheckpoint > localCheckpoint) {
@@ -1526,10 +1524,10 @@ public void updateGlobalCheckpointOnReplica(final long globalCheckpoint) {
15261524
* case that the global checkpoint update from the primary is ahead of the local checkpoint on this shard. In this case, we
15271525
* ignore the global checkpoint update. This can happen if we are in the translog stage of recovery. Prior to this, the engine
15281526
* is not opened and this shard will not receive global checkpoint updates, and after this the shard will be contributing to
1529-
* calculations of the the global checkpoint.
1527+
* calculations of the the global checkpoint. However, we can not assert that we are in the translog stage of recovery here as
1528+
* while the global checkpoint update may have emanated from the primary when we were in that state, we could subsequently move
1529+
* to recovery finalization, or even finished recovery before the update arrives here.
15301530
*/
1531-
assert stage == RecoveryState.Stage.TRANSLOG
1532-
: "expected recovery stage [" + RecoveryState.Stage.TRANSLOG + "] but was [" + stage + "]";
15331531
return;
15341532
}
15351533
seqNoService.updateGlobalCheckpointOnReplica(globalCheckpoint);

0 commit comments

Comments
 (0)