Close first engine instance before creating second (#1457)
When creating the second instance of an InternalEngine using the same translog config of the default InternalEngine instance, the second instance will attempt to delete all the existing translog files. I found a deterministic test failure when running with the seed `E3E6AAD95ABD299B`. As opposed to creating a second engine instance with a different translog location, just close the first one before creating the second. Signed-off-by: Andrew Ross <andrross@amazon.com>
This commit is contained in:
parent
37ac3788a3
commit
12789f89a3
|
@ -3807,15 +3807,13 @@ public class InternalEngineTests extends EngineTestCase {
|
||||||
}
|
}
|
||||||
TranslogDeletionPolicyFactory translogDeletionPolicyFactory = CustomTranslogDeletionPolicy::new;
|
TranslogDeletionPolicyFactory translogDeletionPolicyFactory = CustomTranslogDeletionPolicy::new;
|
||||||
|
|
||||||
try (Store store = createStore()) {
|
|
||||||
EngineConfig config = engine.config();
|
EngineConfig config = engine.config();
|
||||||
|
|
||||||
EngineConfig configWithCustomTranslogDeletionPolicyFactory = new EngineConfig(
|
EngineConfig configWithCustomTranslogDeletionPolicyFactory = new EngineConfig(
|
||||||
config.getShardId(),
|
config.getShardId(),
|
||||||
config.getThreadPool(),
|
config.getThreadPool(),
|
||||||
config.getIndexSettings(),
|
config.getIndexSettings(),
|
||||||
config.getWarmer(),
|
config.getWarmer(),
|
||||||
store,
|
config.getStore(),
|
||||||
config.getMergePolicy(),
|
config.getMergePolicy(),
|
||||||
config.getAnalyzer(),
|
config.getAnalyzer(),
|
||||||
config.getSimilarity(),
|
config.getSimilarity(),
|
||||||
|
@ -3835,11 +3833,10 @@ public class InternalEngineTests extends EngineTestCase {
|
||||||
config.getPrimaryTermSupplier(),
|
config.getPrimaryTermSupplier(),
|
||||||
config.getTombstoneDocSupplier()
|
config.getTombstoneDocSupplier()
|
||||||
);
|
);
|
||||||
try (InternalEngine engine = createEngine(configWithCustomTranslogDeletionPolicyFactory)) {
|
engine.close();
|
||||||
|
engine = createEngine(configWithCustomTranslogDeletionPolicyFactory);
|
||||||
assertTrue(engine.getTranslog().getDeletionPolicy() instanceof CustomTranslogDeletionPolicy);
|
assertTrue(engine.getTranslog().getDeletionPolicy() instanceof CustomTranslogDeletionPolicy);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testShardNotAvailableExceptionWhenEngineClosedConcurrently() throws IOException, InterruptedException {
|
public void testShardNotAvailableExceptionWhenEngineClosedConcurrently() throws IOException, InterruptedException {
|
||||||
AtomicReference<Exception> exception = new AtomicReference<>();
|
AtomicReference<Exception> exception = new AtomicReference<>();
|
||||||
|
|
Loading…
Reference in New Issue