From 66836ecc43d031c9aa0ab620ad4388922eac8f65 Mon Sep 17 00:00:00 2001 From: Suraj Singh Date: Thu, 1 Jun 2023 14:57:09 -0700 Subject: [PATCH] [Segment Replication] Wait for shard relocation before building node to shard allocation map Signed-off-by: Suraj Singh --- .../src/test/java/org/opensearch/upgrades/IndexingIT.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/qa/rolling-upgrade/src/test/java/org/opensearch/upgrades/IndexingIT.java b/qa/rolling-upgrade/src/test/java/org/opensearch/upgrades/IndexingIT.java index 36a90d0c3ce6d..0303e85136ce8 100644 --- a/qa/rolling-upgrade/src/test/java/org/opensearch/upgrades/IndexingIT.java +++ b/qa/rolling-upgrade/src/test/java/org/opensearch/upgrades/IndexingIT.java @@ -43,7 +43,9 @@ import org.opensearch.client.ResponseException; import org.opensearch.cluster.metadata.IndexMetadata; import org.opensearch.common.Booleans; +import org.opensearch.common.Strings; import org.opensearch.common.settings.Settings; +import org.opensearch.common.xcontent.XContentType; import org.opensearch.index.seqno.SeqNoStats; import org.opensearch.indices.replication.common.ReplicationType; import org.opensearch.rest.action.document.RestBulkAction; @@ -95,7 +97,8 @@ private void printClusterNodes() throws IOException, ParseException, URISyntaxEx private void waitForSearchableDocs(String index, int shardCount) throws Exception { Map primaryShardToNodeIDMap = new HashMap<>(); Map replicaShardToNodeIDMap = new HashMap<>(); - logger.info("--> _cat/shards \n{}", EntityUtils.toString(client().performRequest(new Request("GET", "/_cat/shards?v")).getEntity())); + waitForClusterHealthWithNoShardMigration(index, "green"); + logger.info("--> _cat/shards before search \n{}", EntityUtils.toString(client().performRequest(new Request("GET", "/_cat/shards?v")).getEntity())); Request request = new Request("GET", index + "/_stats"); request.addParameter("level", "shards");