Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4313,17 +4313,15 @@ public void resetEngine() {
assert waitForEngineOrClosedShardListeners.isDone();
try {
synchronized (engineMutex) {
final var currentEngine = getEngine();
currentEngine.prepareForEngineReset();
var engineConfig = newEngineConfig(replicationTracker);
verifyNotClosed();
IOUtils.close(currentEngine);
var newEngine = createEngine(engineConfig);
currentEngineReference.set(newEngine);
getEngine().prepareForEngineReset();
var newEngine = createEngine(newEngineConfig(replicationTracker));
IOUtils.close(currentEngineReference.getAndSet(newEngine));
onNewEngine(newEngine);
}
onSettingsChanged();
} catch (Exception e) {
// we want to fail the shard in the case prepareForEngineReset throws
failShard("unable to reset engine", e);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4563,11 +4563,9 @@ public void testResetEngine() throws Exception {
var newEngineCreated = new CountDownLatch(2);
var indexShard = newStartedShard(true, Settings.EMPTY, config -> {
try {
return new ReadOnlyEngine(config, null, null, true, Function.identity(), true, true) {
return new ReadOnlyEngine(config, null, new TranslogStats(), false, Function.identity(), true, true) {
@Override
public void prepareForEngineReset() throws IOException {
;
}
public void prepareForEngineReset() throws IOException {}
};
} finally {
newEngineCreated.countDown();
Expand Down