Skip to content

Commit

Permalink
TEST: Skip asserting Lucene history for an empty index
Browse files Browse the repository at this point in the history
This maximization is not correct if the Lucene index is empty.
  • Loading branch information
dnhatn committed Jun 26, 2018
1 parent 2c56df6 commit 3cd8392
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -827,6 +827,10 @@ public static void assertConsistentHistoryBetweenTranslogAndLuceneIndex(Engine e
if (mapper.documentMapper() == null || engine.config().getIndexSettings().isSoftDeleteEnabled() == false) {
return;
}
final long maxSeqNo = ((InternalEngine) engine).getLocalCheckpointTracker().getMaxSeqNo();
if (maxSeqNo < 0) {
return; // nothing to check
}
final Map<Long, Translog.Operation> translogOps = new HashMap<>();
try (Translog.Snapshot snapshot = EngineTestCase.getTranslog(engine).newSnapshot()) {
Translog.Operation op;
Expand All @@ -838,7 +842,6 @@ public static void assertConsistentHistoryBetweenTranslogAndLuceneIndex(Engine e
.collect(Collectors.toMap(Translog.Operation::seqNo, Function.identity()));
final long globalCheckpoint = EngineTestCase.getTranslog(engine).getLastSyncedGlobalCheckpoint();
final long retainedOps = engine.config().getIndexSettings().getSoftDeleteRetentionOperations();
long maxSeqNo = Math.max(0, ((InternalEngine)engine).getLocalCheckpointTracker().getMaxSeqNo());
final long seqNoForRecovery;
try (Engine.IndexCommitRef safeCommit = engine.acquireSafeIndexCommit()) {
seqNoForRecovery = Long.parseLong(safeCommit.getIndexCommit().getUserData().get(SequenceNumbers.LOCAL_CHECKPOINT_KEY)) + 1;
Expand Down

0 comments on commit 3cd8392

Please sign in to comment.