Browse Source

Unmute `FrozenSearchableSnapshotsIntegTests#testCreateAndRestorePartialSearchableSnapshot` (#122831)

* Unmute `FrozenSearchableSnapshotsIntegTests#testCreateAndRestorePartialSearchableSnapshot`

The underlying failure `java.lang.AssertionError: Searchable snapshot directory does not support the operation [createOutput`
was fixed in https://github.com/elastic/elasticsearch/pull/122006.

The automation bot was too aggressive in re-opening this issue.

Resolve #122693

* Add a check for the CLOSED state along with STOPPED

* Update x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/cache/full/CacheService.java

Co-authored-by: Tanguy Leroux <tlrx.dev@gmail.com>

---------

Co-authored-by: Tanguy Leroux <tlrx.dev@gmail.com>
Artem Prigoda 7 months ago
parent
commit
b4e95dc40a

+ 0 - 3
muted-tests.yml

@@ -315,9 +315,6 @@ tests:
 - class: org.elasticsearch.xpack.autoscaling.storage.ReactiveStorageIT
   method: testScaleWhileShrinking
   issue: https://github.com/elastic/elasticsearch/issues/122119
-- class: org.elasticsearch.xpack.searchablesnapshots.FrozenSearchableSnapshotsIntegTests
-  method: testCreateAndRestorePartialSearchableSnapshot
-  issue: https://github.com/elastic/elasticsearch/issues/122693
 - class: org.elasticsearch.search.basic.SearchWithRandomDisconnectsIT
   method: testSearchWithRandomDisconnects
   issue: https://github.com/elastic/elasticsearch/issues/122707

+ 2 - 2
x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/cache/full/CacheService.java

@@ -245,8 +245,8 @@ public class CacheService extends AbstractLifecycleComponent {
         final Lifecycle.State state = lifecycleState();
         assert state != Lifecycle.State.INITIALIZED : state;
         if (state != Lifecycle.State.STARTED) {
-            if (state == Lifecycle.State.STOPPED) {
-                throw new AlreadyClosedException("Failed to read data from cache: cache service is stopped");
+            if (state == Lifecycle.State.STOPPED || state == Lifecycle.State.CLOSED) {
+                throw new AlreadyClosedException("Failed to read data from cache: cache service is [" + state + ']');
             } else {
                 throw new IllegalStateException("Failed to read data from cache: cache service is not started [" + state + "]");
             }