Skip to content

Commit

Permalink
[RCI] Adapt NoOpEngine to latest FrozenEngine changes
Browse files Browse the repository at this point in the history
Changes were made in #34357 and #36467
  • Loading branch information
tlrx committed Jan 29, 2019
1 parent 528fdb6 commit c3a8ead
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Expand Up @@ -75,7 +75,8 @@ public NoOpEngine(EngineConfig engineConfig) {
}

@Override
protected DirectoryReader open(final Directory directory) throws IOException {
protected DirectoryReader open(final IndexCommit commit) throws IOException {
final Directory directory = commit.getDirectory();
final List<IndexCommit> indexCommits = DirectoryReader.listCommits(directory);
assert indexCommits.size() == 1 : "expected only one commit point";
IndexCommit indexCommit = indexCommits.get(indexCommits.size() - 1);
Expand Down
Expand Up @@ -116,7 +116,7 @@ public void testNoopEngineWithInvalidTranslogUUID() throws IOException {
for (int i = 0; i < numDocs; i++) {
ParsedDocument doc = testParsedDocument(Integer.toString(i), null, testDocument(), new BytesArray("{}"), null);
engine.index(new Engine.Index(newUid(doc), doc, i, primaryTerm.get(), 1, null, Engine.Operation.Origin.REPLICA,
System.nanoTime(), -1, false));
System.nanoTime(), -1, false, SequenceNumbers.UNASSIGNED_SEQ_NO, 0));
if (rarely()) {
engine.flush();
}
Expand Down Expand Up @@ -147,7 +147,7 @@ public void testNoopEngineWithNonZeroTranslogOperations() throws IOException {
for (int i = 0; i < numDocs; i++) {
ParsedDocument doc = testParsedDocument(Integer.toString(i), null, testDocument(), new BytesArray("{}"), null);
engine.index(new Engine.Index(newUid(doc), doc, i, primaryTerm.get(), 1, null, Engine.Operation.Origin.REPLICA,
System.nanoTime(), -1, false));
System.nanoTime(), -1, false, SequenceNumbers.UNASSIGNED_SEQ_NO, 0));
if (rarely()) {
engine.flush();
}
Expand All @@ -167,7 +167,8 @@ public void testNoOpEngineDocStats() throws Exception {
IOUtils.close(engine, store);
final AtomicLong globalCheckpoint = new AtomicLong(SequenceNumbers.NO_OPS_PERFORMED);
try (Store store = createStore()) {
EngineConfig config = config(defaultSettings, store, createTempDir(), newMergePolicy(), null, null, globalCheckpoint::get);
Path translogPath = createTempDir();
EngineConfig config = config(defaultSettings, store, translogPath, NoMergePolicy.INSTANCE, null, null, globalCheckpoint::get);
final int numDocs = scaledRandomIntBetween(10, 3000);
int deletions = 0;
try (InternalEngine engine = createEngine(config)) {
Expand All @@ -190,7 +191,6 @@ public void testNoOpEngineDocStats() throws Exception {
}
engine.waitForOpsToComplete(numDocs + deletions - 1);
flushAndTrimTranslog(engine);
engine.close();
}

final DocsStats expectedDocStats;
Expand Down
Expand Up @@ -38,7 +38,6 @@
import org.elasticsearch.cluster.routing.RecoverySource;
import org.elasticsearch.cluster.routing.ShardRouting;
import org.elasticsearch.cluster.routing.ShardRoutingState;
import org.elasticsearch.cluster.routing.TestShardRouting;
import org.elasticsearch.cluster.routing.UnassignedInfo;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.CheckedRunnable;
Expand Down

0 comments on commit c3a8ead

Please sign in to comment.