From 66836ecc43d031c9aa0ab620ad4388922eac8f65 Mon Sep 17 00:00:00 2001 From: Suraj Singh Date: Thu, 1 Jun 2023 14:57:09 -0700 Subject: [PATCH 1/2] [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"); From 431a6ae3129aa8a42b376d7263dd330dca35ba86 Mon Sep 17 00:00:00 2001 From: Suraj Singh Date: Thu, 1 Jun 2023 18:17:27 -0700 Subject: [PATCH 2/2] Remove unused imports Signed-off-by: Suraj Singh --- .../test/java/org/opensearch/upgrades/IndexingIT.java | 11 ----------- 1 file changed, 11 deletions(-) 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 0303e85136ce8..a758b8e4ccd72 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 @@ -31,30 +31,20 @@ package org.opensearch.upgrades; -import org.apache.hc.core5.http.HttpHost; import org.apache.hc.core5.http.ParseException; import org.apache.hc.core5.http.io.entity.EntityUtils; -import org.apache.lucene.tests.util.LuceneTestCase; -import org.opensearch.LegacyESVersion; import org.opensearch.Version; -import org.opensearch.action.search.SearchResponse; import org.opensearch.client.Request; import org.opensearch.client.Response; -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; import org.opensearch.test.rest.yaml.ObjectPath; import java.io.IOException; import java.net.URISyntaxException; import java.nio.charset.StandardCharsets; -import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -248,7 +238,6 @@ public void testIndexing() throws IOException, ParseException { * * @throws Exception */ - @AwaitsFix(bugUrl = "https://github.com/opensearch-project/OpenSearch/issues/7679") public void testIndexingWithSegRep() throws Exception { final String indexName = "test-index-segrep"; final int shardCount = 3;