Skip to content

Commit

Permalink
Revert "Add global checkpoint assertion in index shard"
Browse files Browse the repository at this point in the history
This reverts commit 89b305c.
  • Loading branch information
jasontedor committed May 10, 2017
1 parent d2c6970 commit fbf532a
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1515,8 +1515,6 @@ public long getGlobalCheckpoint() {
*/
public void updateGlobalCheckpointOnReplica(final long globalCheckpoint) {
verifyReplicationTarget();
// we sample the recovery stage before sampling the local checkpoint or we are subject to a race condition in the below assertion
final RecoveryState.Stage stage = recoveryState().getStage();
final SequenceNumbersService seqNoService = getEngine().seqNoService();
final long localCheckpoint = seqNoService.getLocalCheckpoint();
if (globalCheckpoint > localCheckpoint) {
Expand All @@ -1526,10 +1524,10 @@ public void updateGlobalCheckpointOnReplica(final long globalCheckpoint) {
* case that the global checkpoint update from the primary is ahead of the local checkpoint on this shard. In this case, we
* ignore the global checkpoint update. This can happen if we are in the translog stage of recovery. Prior to this, the engine
* is not opened and this shard will not receive global checkpoint updates, and after this the shard will be contributing to
* calculations of the the global checkpoint.
* calculations of the the global checkpoint. However, we can not assert that we are in the translog stage of recovery here as
* while the global checkpoint update may have emanated from the primary when we were in that state, we could subsequently move
* to recovery finalization, or even finished recovery before the update arrives here.
*/
assert stage == RecoveryState.Stage.TRANSLOG
: "expected recovery stage [" + RecoveryState.Stage.TRANSLOG + "] but was [" + stage + "]";
return;
}
seqNoService.updateGlobalCheckpointOnReplica(globalCheckpoint);
Expand Down

0 comments on commit fbf532a

Please sign in to comment.