From c0411f3f2b589ef871da84fbc773298757a94ff3 Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Thu, 9 Feb 2023 17:22:47 +0530 Subject: [PATCH] Fix flaky test RemoteStoreIT.testRemoteSegmentStoreRestore (#6252) (#6265) (cherry picked from commit 4f5fd9c4d9ab3bf92a010e659a07b8a372f10ecd) Signed-off-by: Sachin Kale --- .../java/org/opensearch/remotestore/RemoteStoreIT.java | 10 +++++----- .../org/opensearch/search/SearchWeightedRoutingIT.java | 6 ++---- .../java/org/opensearch/common/lucene/LuceneTests.java | 2 -- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/server/src/internalClusterTest/java/org/opensearch/remotestore/RemoteStoreIT.java b/server/src/internalClusterTest/java/org/opensearch/remotestore/RemoteStoreIT.java index 1936524d26c56..634880b1a1041 100644 --- a/server/src/internalClusterTest/java/org/opensearch/remotestore/RemoteStoreIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/remotestore/RemoteStoreIT.java @@ -113,8 +113,8 @@ private IndexResponse indexSingleDoc() { private Map indexData() { long totalOperations = 0; long refreshedOrFlushedOperations = 0; - long maxSeqNo = 0; - long maxSeqNoRefreshedOrFlushed = 0; + long maxSeqNo = -1; + long maxSeqNoRefreshedOrFlushed = -1; for (int i = 0; i < randomIntBetween(1, 10); i++) { if (randomBoolean()) { flush(INDEX_NAME); @@ -150,8 +150,8 @@ private void verifyRestoredData(Map indexStats, boolean checkTotal assertHitCount(client().prepareSearch(INDEX_NAME).setSize(0).get(), indexStats.get(statsGranularity) + 1); } - public void testRemoteStoreRestoreFromRemoteSegmentStore() throws IOException { - internalCluster().startNodes(3); + public void testRemoteSegmentStoreRestore() throws IOException { + internalCluster().startDataOnlyNodes(3); createIndex(INDEX_NAME, remoteStoreIndexSettings(0)); ensureYellowAndNoInitializingShards(INDEX_NAME); ensureGreen(INDEX_NAME); @@ -169,7 +169,7 @@ public void testRemoteStoreRestoreFromRemoteSegmentStore() throws IOException { @AwaitsFix(bugUrl = "https://github.com/opensearch-project/OpenSearch/issues/6188") public void testRemoteTranslogRestore() throws IOException { - internalCluster().startNodes(3); + internalCluster().startDataOnlyNodes(3); createIndex(INDEX_NAME, remoteTranslogIndexSettings(0)); ensureYellowAndNoInitializingShards(INDEX_NAME); ensureGreen(INDEX_NAME); diff --git a/server/src/internalClusterTest/java/org/opensearch/search/SearchWeightedRoutingIT.java b/server/src/internalClusterTest/java/org/opensearch/search/SearchWeightedRoutingIT.java index a1ccc3e3a1630..02b51f9e625d3 100644 --- a/server/src/internalClusterTest/java/org/opensearch/search/SearchWeightedRoutingIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/search/SearchWeightedRoutingIT.java @@ -804,9 +804,8 @@ public void testMultiGetWithNetworkDisruption_FailOpenDisabled() throws Exceptio /** * Assert that preference based search is not allowed with strict weighted shard routing - * @throws Exception throws exception */ - public void testStrictWeightedRouting() throws Exception { + public void testStrictWeightedRouting() { Settings commonSettings = Settings.builder() .put("cluster.routing.allocation.awareness.attributes", "zone") @@ -841,9 +840,8 @@ public void testStrictWeightedRouting() throws Exception { /** * Assert that preference based search works with non-strict weighted shard routing - * @throws Exception */ - public void testPreferenceSearchWithWeightedRouting() throws Exception { + public void testPreferenceSearchWithWeightedRouting() { Settings commonSettings = Settings.builder() .put("cluster.routing.allocation.awareness.attributes", "zone") .put("cluster.routing.allocation.awareness.force.zone.values", "a,b,c") diff --git a/server/src/test/java/org/opensearch/common/lucene/LuceneTests.java b/server/src/test/java/org/opensearch/common/lucene/LuceneTests.java index bcbe1b0320f49..dd468076370a8 100644 --- a/server/src/test/java/org/opensearch/common/lucene/LuceneTests.java +++ b/server/src/test/java/org/opensearch/common/lucene/LuceneTests.java @@ -379,8 +379,6 @@ public void testNumDocs() throws IOException { /** * Tests whether old segments are readable and queryable based on the data documented * in the README here. - * - * @throws IOException */ public void testReadSegmentInfosExtendedCompatibility() throws IOException { final String pathToTestIndex = "/indices/bwc/es-6.3.0/testIndex-es-6.3.0.zip";