Skip to content

Commit 54d110b

Browse files
committed
[RCI] Adapt NoOpEngine to latest FrozenEngine changes
Changes were made in #34357 and #36467
1 parent c63fd69 commit 54d110b

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

server/src/main/java/org/elasticsearch/index/engine/NoOpEngine.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ public NoOpEngine(EngineConfig engineConfig) {
7575
}
7676

7777
@Override
78-
protected DirectoryReader open(final Directory directory) throws IOException {
78+
protected DirectoryReader open(final IndexCommit commit) throws IOException {
79+
final Directory directory = commit.getDirectory();
7980
final List<IndexCommit> indexCommits = DirectoryReader.listCommits(directory);
8081
assert indexCommits.size() == 1 : "expected only one commit point";
8182
IndexCommit indexCommit = indexCommits.get(indexCommits.size() - 1);

server/src/test/java/org/elasticsearch/index/engine/NoOpEngineTests.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public void testNoopEngineWithInvalidTranslogUUID() throws IOException {
116116
for (int i = 0; i < numDocs; i++) {
117117
ParsedDocument doc = testParsedDocument(Integer.toString(i), null, testDocument(), new BytesArray("{}"), null);
118118
engine.index(new Engine.Index(newUid(doc), doc, i, primaryTerm.get(), 1, null, Engine.Operation.Origin.REPLICA,
119-
System.nanoTime(), -1, false));
119+
System.nanoTime(), -1, false, SequenceNumbers.UNASSIGNED_SEQ_NO, 0));
120120
if (rarely()) {
121121
engine.flush();
122122
}
@@ -147,7 +147,7 @@ public void testNoopEngineWithNonZeroTranslogOperations() throws IOException {
147147
for (int i = 0; i < numDocs; i++) {
148148
ParsedDocument doc = testParsedDocument(Integer.toString(i), null, testDocument(), new BytesArray("{}"), null);
149149
engine.index(new Engine.Index(newUid(doc), doc, i, primaryTerm.get(), 1, null, Engine.Operation.Origin.REPLICA,
150-
System.nanoTime(), -1, false));
150+
System.nanoTime(), -1, false, SequenceNumbers.UNASSIGNED_SEQ_NO, 0));
151151
if (rarely()) {
152152
engine.flush();
153153
}
@@ -167,7 +167,8 @@ public void testNoOpEngineDocStats() throws Exception {
167167
IOUtils.close(engine, store);
168168
final AtomicLong globalCheckpoint = new AtomicLong(SequenceNumbers.NO_OPS_PERFORMED);
169169
try (Store store = createStore()) {
170-
EngineConfig config = config(defaultSettings, store, createTempDir(), newMergePolicy(), null, null, globalCheckpoint::get);
170+
Path translogPath = createTempDir();
171+
EngineConfig config = config(defaultSettings, store, translogPath, NoMergePolicy.INSTANCE, null, null, globalCheckpoint::get);
171172
final int numDocs = scaledRandomIntBetween(10, 3000);
172173
int deletions = 0;
173174
try (InternalEngine engine = createEngine(config)) {
@@ -190,7 +191,6 @@ public void testNoOpEngineDocStats() throws Exception {
190191
}
191192
engine.waitForOpsToComplete(numDocs + deletions - 1);
192193
flushAndTrimTranslog(engine);
193-
engine.close();
194194
}
195195

196196
final DocsStats expectedDocStats;

server/src/test/java/org/elasticsearch/index/shard/IndexShardIT.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
import org.elasticsearch.cluster.routing.RecoverySource;
3939
import org.elasticsearch.cluster.routing.ShardRouting;
4040
import org.elasticsearch.cluster.routing.ShardRoutingState;
41-
import org.elasticsearch.cluster.routing.TestShardRouting;
4241
import org.elasticsearch.cluster.routing.UnassignedInfo;
4342
import org.elasticsearch.cluster.service.ClusterService;
4443
import org.elasticsearch.common.CheckedRunnable;

0 commit comments

Comments
 (0)