Skip to content

Commit d023367

Browse files
authored
Wait for active shards when closing indices (#66415)
In 7.x the default for `wait_for_active_shards` on a close index request is `NONE`, so in cases where we want to wait for active shards we must be explicit. Closes #66411
1 parent f45a85e commit d023367

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotsIntegTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import org.elasticsearch.action.admin.indices.stats.IndicesStatsResponse;
2121
import org.elasticsearch.action.admin.indices.stats.ShardStats;
2222
import org.elasticsearch.action.index.IndexRequestBuilder;
23+
import org.elasticsearch.action.support.ActiveShardCount;
2324
import org.elasticsearch.cluster.ClusterState;
2425
import org.elasticsearch.cluster.metadata.DataStream;
2526
import org.elasticsearch.cluster.metadata.IndexMetadata;
@@ -797,7 +798,6 @@ public void testSnapshotMountedIndexWithTimestampsRecordsTimestampRangeInIndexMe
797798
}
798799
}
799800

800-
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/66411")
801801
public void testSnapshotOfSearchableSnapshotIncludesNoDataButCanBeRestored() throws Exception {
802802
final String indexName = randomAlphaOfLength(10).toLowerCase(Locale.ROOT);
803803
createAndPopulateIndex(
@@ -845,7 +845,7 @@ public void testSnapshotOfSearchableSnapshotIncludesNoDataButCanBeRestored() thr
845845

846846
if (randomBoolean()) {
847847
logger.info("--> closing index before snapshot");
848-
assertAcked(client().admin().indices().prepareClose(restoredIndexName));
848+
assertAcked(client().admin().indices().prepareClose(restoredIndexName).setWaitForActiveShards(ActiveShardCount.DEFAULT));
849849
}
850850

851851
logger.info("--> starting to take snapshot-2");

x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/AbstractSearchableSnapshotsRestTestCase.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ public void testSnapshotOfSearchableSnapshot() throws Exception {
219219
if (randomBoolean()) {
220220
logger.info("--> closing index [{}]", restoredIndexName);
221221
final Request closeRequest = new Request(HttpPost.METHOD_NAME, restoredIndexName + "/_close");
222+
closeRequest.addParameter("wait_for_active_shards", "all");
222223
assertOK(client().performRequest(closeRequest));
223224
}
224225

0 commit comments

Comments
 (0)