From d4e0e4d3e32e928380b7125798e58103afe84ad8 Mon Sep 17 00:00:00 2001 From: Tanguy Leroux Date: Mon, 4 Oct 2021 15:35:21 +0200 Subject: [PATCH 1/2] Fix SearchableSnapshotsBlobStoreCacheIntegTests.testBlobStoreCache Closes #78512 --- .../blob/SearchableSnapshotsBlobStoreCacheIntegTests.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/cache/blob/SearchableSnapshotsBlobStoreCacheIntegTests.java b/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/cache/blob/SearchableSnapshotsBlobStoreCacheIntegTests.java index 8ff3b79164ded..aa9239ee67568 100644 --- a/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/cache/blob/SearchableSnapshotsBlobStoreCacheIntegTests.java +++ b/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/cache/blob/SearchableSnapshotsBlobStoreCacheIntegTests.java @@ -58,6 +58,7 @@ import java.util.Collection; import java.util.List; import java.util.Locale; +import java.util.concurrent.TimeUnit; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount; @@ -329,6 +330,10 @@ public Settings onNodeStopped(String nodeName) throws Exception { logger.info("--> deleting indices, maintenance service should clean up snapshot blob cache index"); assertAcked(client().admin().indices().prepareDelete("restored-*")); + // waits for the data node that hosts the .snapshot-blob-cache primary shard + // to process the cluster state update and to trigger a clean up + ensureClusterStateConsistency(); + assertBusy(() -> { refreshSystemIndex(); assertHitCount( @@ -338,7 +343,7 @@ public Settings onNodeStopped(String nodeName) throws Exception { .get(), 0L ); - }); + }, 30L, TimeUnit.SECONDS); } private void checkNoBlobStoreAccess() { From d810603c42e76455473af6e5730435a429b5f12e Mon Sep 17 00:00:00 2001 From: Tanguy Leroux Date: Thu, 7 Oct 2021 11:12:21 +0200 Subject: [PATCH 2/2] feedback --- .../blob/SearchableSnapshotsBlobStoreCacheIntegTests.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/cache/blob/SearchableSnapshotsBlobStoreCacheIntegTests.java b/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/cache/blob/SearchableSnapshotsBlobStoreCacheIntegTests.java index aa9239ee67568..3b07fb37eb8c4 100644 --- a/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/cache/blob/SearchableSnapshotsBlobStoreCacheIntegTests.java +++ b/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/cache/blob/SearchableSnapshotsBlobStoreCacheIntegTests.java @@ -328,11 +328,8 @@ public Settings onNodeStopped(String nodeName) throws Exception { logger.info("--> verifying number of documents in index [{}]", restoredAgainIndex); assertHitCount(client().prepareSearch(restoredAgainIndex).setSize(0).setTrackTotalHits(true).get(), numberOfDocs); - logger.info("--> deleting indices, maintenance service should clean up snapshot blob cache index"); + logger.info("--> deleting indices, maintenance service should clean up [{}] docs in system index", numberOfCachedBlobs); assertAcked(client().admin().indices().prepareDelete("restored-*")); - // waits for the data node that hosts the .snapshot-blob-cache primary shard - // to process the cluster state update and to trigger a clean up - ensureClusterStateConsistency(); assertBusy(() -> { refreshSystemIndex();