diff --git a/docs/changelog/145209.yaml b/docs/changelog/145209.yaml new file mode 100644 index 0000000000000..1b6528bdf22a4 --- /dev/null +++ b/docs/changelog/145209.yaml @@ -0,0 +1,7 @@ +area: Distributed +issues: + - 123773 +pr: 145209 +summary: Do not attempt marking store as corrupted if the check is rejected due to + shutdown +type: bug diff --git a/muted-tests.yml b/muted-tests.yml index 63cb3fb8bfca8..c4e13b90c5013 100644 --- a/muted-tests.yml +++ b/muted-tests.yml @@ -51,9 +51,6 @@ tests: - class: org.elasticsearch.action.admin.cluster.node.tasks.CancellableTasksIT method: testChildrenTasksCancelledOnTimeout issue: https://github.com/elastic/elasticsearch/issues/123568 -- class: org.elasticsearch.xpack.searchablesnapshots.FrozenSearchableSnapshotsIntegTests - method: testCreateAndRestorePartialSearchableSnapshot - issue: https://github.com/elastic/elasticsearch/issues/123773 - class: org.elasticsearch.xpack.restart.MLModelDeploymentFullClusterRestartIT method: testDeploymentSurvivesRestart {cluster=OLD} issue: https://github.com/elastic/elasticsearch/issues/124160 diff --git a/server/src/main/java/org/elasticsearch/index/shard/IndexShard.java b/server/src/main/java/org/elasticsearch/index/shard/IndexShard.java index 21ba793098bc7..b7007a95069a7 100644 --- a/server/src/main/java/org/elasticsearch/index/shard/IndexShard.java +++ b/server/src/main/java/org/elasticsearch/index/shard/IndexShard.java @@ -61,6 +61,7 @@ import org.elasticsearch.common.util.CollectionUtils; import org.elasticsearch.common.util.concurrent.AbstractRunnable; import org.elasticsearch.common.util.concurrent.EsExecutors; +import org.elasticsearch.common.util.concurrent.EsRejectedExecutionException; import org.elasticsearch.common.xcontent.XContentHelper; import org.elasticsearch.core.Assertions; import org.elasticsearch.core.Booleans; @@ -3384,9 +3385,10 @@ void checkIndex() throws IOException { try { doCheckIndex(); } catch (IOException e) { - if (ExceptionsHelper.unwrap(e, AlreadyClosedException.class) != null) { + if (ExceptionsHelper.unwrap(e, AlreadyClosedException.class) != null || isRejectedDueToShutdown(e)) { // Cache-based read operations on Lucene files can throw an AlreadyClosedException wrapped into an IOException in case - // of evictions. We don't want to mark the store as corrupted for this. + // of evictions, or the read might be rejected if the node is shutting down. We don't want to mark the store as + // corrupted for this. } else { store.markStoreCorrupted(e); } @@ -4936,4 +4938,9 @@ private boolean assertNoEngineResetLock() { + "] to not hold the engine write lock (lock ordering should be: engineMutex -> engineResetLock -> mutex)"; return true; } + + private static boolean isRejectedDueToShutdown(IOException e) { + var rejected = ExceptionsHelper.unwrap(e, EsRejectedExecutionException.class); + return rejected instanceof EsRejectedExecutionException esRejected && esRejected.isExecutorShutdown(); + } }