Skip to content

Commit

Permalink
CCR side of #31213
Browse files Browse the repository at this point in the history
Relates #31213
  • Loading branch information
dnhatn committed Jun 10, 2018
1 parent 7ab6f92 commit 97743f3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1361,7 +1361,7 @@ public void testForceMergeWithSoftDeletesRetention() throws Exception {
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);
Expand Down Expand Up @@ -1427,7 +1427,7 @@ public void testForceMergeWithSoftDeletesRetentionAndRecoverySource() throws Exc
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,8 @@ class Follower extends Thread {
}

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);
Expand All @@ -255,7 +255,7 @@ public void run() {
readLatch.countDown();
readLatch.await();
while (isDone.get() == false ||
follower.getLocalCheckpointTracker().getCheckpoint() < leader.getLocalCheckpointTracker().getCheckpoint()) {
follower.getLocalCheckpointTracker().getCheckpoint() < leader.getLocalCheckpoint()) {
pullOperations(follower);
}
assertConsistentHistoryBetweenTranslogAndLuceneIndex(follower, mapperService);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,7 @@ public static Set<String> getDocIds(Engine engine, boolean refresh) throws IOExc
*/
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){
Expand Down Expand Up @@ -850,7 +850,7 @@ public static void assertConsistentHistoryBetweenTranslogAndLuceneIndex(Engine e
.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) {
Expand Down

0 comments on commit 97743f3

Please sign in to comment.