Relates #31213
This commit is contained in:
Nhat Nguyen 2018-06-09 20:04:45 -04:00
parent afe02a3cac
commit 9feff9809b
3 changed files with 7 additions and 7 deletions

View File

@ -1361,7 +1361,7 @@ public class InternalEngineTests extends EngineTestCase {
liveDocs.add(doc.id());
}
}
long localCheckpoint = engine.getLocalCheckpointTracker().getCheckpoint();
long localCheckpoint = engine.getLocalCheckpoint();
globalCheckpoint.set(randomLongBetween(0, localCheckpoint));
engine.getTranslog().sync();
engine.forceMerge(true, 1, false, false, false);
@ -1427,7 +1427,7 @@ public class InternalEngineTests extends EngineTestCase {
liveDocs.add(doc.id());
}
}
long localCheckpoint = engine.getLocalCheckpointTracker().getCheckpoint();
long localCheckpoint = engine.getLocalCheckpoint();
globalCheckpoint.set(randomLongBetween(0, localCheckpoint));
engine.getTranslog().sync();
long keptIndex = globalCheckpoint.get() + 1 - retainedExtraOps;

View File

@ -236,8 +236,8 @@ public class LuceneChangesSnapshotTests extends EngineTestCase {
}
void pullOperations(Engine follower) throws IOException {
long leaderCheckpoint = leader.getLocalCheckpointTracker().getCheckpoint();
long followerCheckpoint = follower.getLocalCheckpointTracker().getCheckpoint();
long leaderCheckpoint = leader.getLocalCheckpoint();
long followerCheckpoint = follower.getLocalCheckpoint();
if (followerCheckpoint < leaderCheckpoint) {
long fromSeqNo = followerCheckpoint + 1;
long batchSize = randomLongBetween(0, 100);
@ -255,7 +255,7 @@ public class LuceneChangesSnapshotTests extends EngineTestCase {
readLatch.countDown();
readLatch.await();
while (isDone.get() == false ||
follower.getLocalCheckpointTracker().getCheckpoint() < leader.getLocalCheckpointTracker().getCheckpoint()) {
follower.getLocalCheckpointTracker().getCheckpoint() < leader.getLocalCheckpoint()) {
pullOperations(follower);
}
assertConsistentHistoryBetweenTranslogAndLuceneIndex(follower, mapperService);

View File

@ -802,7 +802,7 @@ public abstract class EngineTestCase extends ESTestCase {
*/
public static List<Translog.Operation> readAllOperationsInLucene(Engine engine, MapperService mapper) throws IOException {
final List<Translog.Operation> operations = new ArrayList<>();
long maxSeqNo = Math.max(0, engine.getLocalCheckpointTracker().getMaxSeqNo());
long maxSeqNo = Math.max(0, ((InternalEngine)engine).getLocalCheckpointTracker().getMaxSeqNo());
try (Translog.Snapshot snapshot = engine.newLuceneChangesSnapshot("test", mapper, 0, maxSeqNo, false)) {
Translog.Operation op;
while ((op = snapshot.next()) != null){
@ -838,7 +838,7 @@ public abstract class EngineTestCase extends ESTestCase {
.collect(Collectors.toMap(Translog.Operation::seqNo, Function.identity()));
final long globalCheckpoint = engine.getTranslog().getLastSyncedGlobalCheckpoint();
final long retainedOps = engine.config().getIndexSettings().getSoftDeleteRetentionOperations();
final long maxSeqNo = engine.getLocalCheckpointTracker().getMaxSeqNo();
long maxSeqNo = Math.max(0, ((InternalEngine)engine).getLocalCheckpointTracker().getMaxSeqNo());
for (Translog.Operation translogOp : translogOps.values()) {
final Translog.Operation luceneOp = luceneOps.get(translogOp.seqNo());
if (luceneOp == null) {