Acquire seacher on closing engine should throw ACE (#33331)
Closes #33330
This commit is contained in:
parent
b697f485bb
commit
41839cf9a8
|
@ -2014,7 +2014,9 @@ public class InternalEngine extends Engine {
|
||||||
/* Acquire order here is store -> manager since we need
|
/* Acquire order here is store -> manager since we need
|
||||||
* to make sure that the store is not closed before
|
* to make sure that the store is not closed before
|
||||||
* the searcher is acquired. */
|
* the searcher is acquired. */
|
||||||
store.incRef();
|
if (store.tryIncRef() == false) {
|
||||||
|
throw new AlreadyClosedException(shardId + " store is closed", failedEngine.get());
|
||||||
|
}
|
||||||
Releasable releasable = store::decRef;
|
Releasable releasable = store::decRef;
|
||||||
try {
|
try {
|
||||||
final ReferenceManager<IndexSearcher> referenceManager;
|
final ReferenceManager<IndexSearcher> referenceManager;
|
||||||
|
|
|
@ -5020,6 +5020,11 @@ public class InternalEngineTests extends EngineTestCase {
|
||||||
assertThat(engine.lastRefreshedCheckpoint(), equalTo(engine.getLocalCheckpoint()));
|
assertThat(engine.lastRefreshedCheckpoint(), equalTo(engine.getLocalCheckpoint()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testAcquireSearcherOnClosingEngine() throws Exception {
|
||||||
|
engine.close();
|
||||||
|
expectThrows(AlreadyClosedException.class, () -> engine.acquireSearcher("test"));
|
||||||
|
}
|
||||||
|
|
||||||
private static void trimUnsafeCommits(EngineConfig config) throws IOException {
|
private static void trimUnsafeCommits(EngineConfig config) throws IOException {
|
||||||
final Store store = config.getStore();
|
final Store store = config.getStore();
|
||||||
final TranslogConfig translogConfig = config.getTranslogConfig();
|
final TranslogConfig translogConfig = config.getTranslogConfig();
|
||||||
|
|
|
@ -125,7 +125,6 @@ public class PrimaryReplicaSyncerTests extends IndexShardTestCase {
|
||||||
closeShards(shard);
|
closeShards(shard);
|
||||||
}
|
}
|
||||||
|
|
||||||
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/33330")
|
|
||||||
public void testSyncerOnClosingShard() throws Exception {
|
public void testSyncerOnClosingShard() throws Exception {
|
||||||
IndexShard shard = newStartedShard(true);
|
IndexShard shard = newStartedShard(true);
|
||||||
AtomicBoolean syncActionCalled = new AtomicBoolean();
|
AtomicBoolean syncActionCalled = new AtomicBoolean();
|
||||||
|
|
Loading…
Reference in New Issue