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
|
||||
* to make sure that the store is not closed before
|
||||
* the searcher is acquired. */
|
||||
store.incRef();
|
||||
if (store.tryIncRef() == false) {
|
||||
throw new AlreadyClosedException(shardId + " store is closed", failedEngine.get());
|
||||
}
|
||||
Releasable releasable = store::decRef;
|
||||
try {
|
||||
final ReferenceManager<IndexSearcher> referenceManager;
|
||||
|
|
|
@ -5020,6 +5020,11 @@ public class InternalEngineTests extends EngineTestCase {
|
|||
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 {
|
||||
final Store store = config.getStore();
|
||||
final TranslogConfig translogConfig = config.getTranslogConfig();
|
||||
|
|
|
@ -125,7 +125,6 @@ public class PrimaryReplicaSyncerTests extends IndexShardTestCase {
|
|||
closeShards(shard);
|
||||
}
|
||||
|
||||
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/33330")
|
||||
public void testSyncerOnClosingShard() throws Exception {
|
||||
IndexShard shard = newStartedShard(true);
|
||||
AtomicBoolean syncActionCalled = new AtomicBoolean();
|
||||
|
|
Loading…
Reference in New Issue