|
@@ -104,6 +104,7 @@ import java.util.Set;
|
|
|
import java.util.concurrent.ExecutionException;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
import java.util.concurrent.atomic.AtomicBoolean;
|
|
|
+import java.util.concurrent.atomic.AtomicLong;
|
|
|
import java.util.concurrent.atomic.AtomicReference;
|
|
|
|
|
|
import static java.util.Collections.emptyMap;
|
|
@@ -637,12 +638,14 @@ public class IndexModuleTests extends ESTestCase {
|
|
|
Collections.emptyMap()
|
|
|
);
|
|
|
|
|
|
+ final AtomicLong lastAcquiredPrimaryTerm = new AtomicLong();
|
|
|
final AtomicReference<Engine.IndexCommitRef> lastAcquiredCommit = new AtomicReference<>();
|
|
|
final AtomicReference<IndexCommit> lastDeletedCommit = new AtomicReference<>();
|
|
|
|
|
|
module.setIndexCommitListener(new Engine.IndexCommitListener() {
|
|
|
@Override
|
|
|
- public void onNewCommit(ShardId shardId, Engine.IndexCommitRef indexCommitRef) {
|
|
|
+ public void onNewCommit(ShardId shardId, long primaryTerm, Engine.IndexCommitRef indexCommitRef) {
|
|
|
+ lastAcquiredPrimaryTerm.set(primaryTerm);
|
|
|
lastAcquiredCommit.set(indexCommitRef);
|
|
|
}
|
|
|
|
|
@@ -687,6 +690,7 @@ public class IndexModuleTests extends ESTestCase {
|
|
|
indexShard.recoverFromStore(recoveryFuture);
|
|
|
recoveryFuture.get();
|
|
|
|
|
|
+ assertThat(lastAcquiredPrimaryTerm.get(), equalTo(indexShard.getOperationPrimaryTerm()));
|
|
|
Engine.IndexCommitRef lastCommitRef = lastAcquiredCommit.get();
|
|
|
assertThat(lastCommitRef, notNullValue());
|
|
|
IndexCommit lastCommit = lastCommitRef.getIndexCommit();
|