From 06b2acd570ded296f6bc6a7404325cc033b06664 Mon Sep 17 00:00:00 2001 From: Rishab Nahata Date: Wed, 22 Jun 2022 12:25:41 +0530 Subject: [PATCH 1/2] Fixing flaky test org.opensearch.cluster.allocation.AwarenessAllocationIT.testThreeZoneOneReplicaWithForceZoneValueAndLoadAwareness by adding dedicated cluster manager node Signed-off-by: Rishab Nahata --- .../allocation/AwarenessAllocationIT.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/server/src/internalClusterTest/java/org/opensearch/cluster/allocation/AwarenessAllocationIT.java b/server/src/internalClusterTest/java/org/opensearch/cluster/allocation/AwarenessAllocationIT.java index 2b73c5da27606..4e3bdc766260d 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/allocation/AwarenessAllocationIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/allocation/AwarenessAllocationIT.java @@ -366,16 +366,19 @@ public void testThreeZoneOneReplicaWithForceZoneValueAndLoadAwareness() throws E .put("cluster.routing.allocation.load_awareness.provisioned_capacity", Integer.toString(nodeCountPerAZ * 3)) .build(); + logger.info("--> starting a dedicated cluster manager node"); + internalCluster().startClusterManagerOnlyNode(); + logger.info("--> starting 15 nodes on zones 'a' & 'b' & 'c'"); - List nodes_in_zone_a = internalCluster().startNodes( + List nodes_in_zone_a = internalCluster().startDataOnlyNodes( nodeCountPerAZ, Settings.builder().put(commonSettings).put("node.attr.zone", "a").build() ); - List nodes_in_zone_b = internalCluster().startNodes( + List nodes_in_zone_b = internalCluster().startDataOnlyNodes( nodeCountPerAZ, Settings.builder().put(commonSettings).put("node.attr.zone", "b").build() ); - List nodes_in_zone_c = internalCluster().startNodes( + List nodes_in_zone_c = internalCluster().startDataOnlyNodes( nodeCountPerAZ, Settings.builder().put(commonSettings).put("node.attr.zone", "c").build() ); @@ -395,7 +398,7 @@ public void testThreeZoneOneReplicaWithForceZoneValueAndLoadAwareness() throws E .setIndices("test-1") .setWaitForEvents(Priority.LANGUID) .setWaitForGreenStatus() - .setWaitForNodes(Integer.toString(nodeCountPerAZ * 3)) + .setWaitForNodes(Integer.toString(nodeCountPerAZ * 3 + 1)) .setWaitForNoRelocatingShards(true) .setWaitForNoInitializingShards(true) .execute() @@ -431,7 +434,7 @@ public void testThreeZoneOneReplicaWithForceZoneValueAndLoadAwareness() throws E .prepareHealth() .setIndices("test-1") .setWaitForEvents(Priority.LANGUID) - .setWaitForNodes(Integer.toString(nodeCountPerAZ * 3 - nodesToStop)) + .setWaitForNodes(Integer.toString(nodeCountPerAZ * 3 - nodesToStop + 1)) .setWaitForNoRelocatingShards(true) .setWaitForNoInitializingShards(true) .execute() @@ -452,7 +455,7 @@ public void testThreeZoneOneReplicaWithForceZoneValueAndLoadAwareness() throws E .prepareHealth() .setIndices("test-1", "test-2") .setWaitForEvents(Priority.LANGUID) - .setWaitForNodes(Integer.toString(nodeCountPerAZ * 3 - nodesToStop)) + .setWaitForNodes(Integer.toString(nodeCountPerAZ * 3 - nodesToStop + 1)) .setWaitForNoRelocatingShards(true) .setWaitForNoInitializingShards(true) .execute() @@ -477,7 +480,7 @@ public void testThreeZoneOneReplicaWithForceZoneValueAndLoadAwareness() throws E .prepareHealth() .setIndices("test-1", "test-2") .setWaitForEvents(Priority.LANGUID) - .setWaitForNodes(Integer.toString(nodeCountPerAZ * 3)) + .setWaitForNodes(Integer.toString(nodeCountPerAZ * 3 + 1)) .setWaitForGreenStatus() .setWaitForActiveShards(2 * numOfShards * (numOfReplica + 1)) .setWaitForNoRelocatingShards(true) From 7095265add9337d0e481721d6e9e61c2f4ac5463 Mon Sep 17 00:00:00 2001 From: Rishab Nahata Date: Wed, 22 Jun 2022 20:36:00 +0530 Subject: [PATCH 2/2] Updating rebalance setting for testThreeZoneOneReplicaWithForceZoneValueAndLoadAwareness Signed-off-by: Rishab Nahata --- .../org/opensearch/cluster/allocation/AwarenessAllocationIT.java | 1 + 1 file changed, 1 insertion(+) diff --git a/server/src/internalClusterTest/java/org/opensearch/cluster/allocation/AwarenessAllocationIT.java b/server/src/internalClusterTest/java/org/opensearch/cluster/allocation/AwarenessAllocationIT.java index 4e3bdc766260d..87d15bf9d3750 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/allocation/AwarenessAllocationIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/allocation/AwarenessAllocationIT.java @@ -364,6 +364,7 @@ public void testThreeZoneOneReplicaWithForceZoneValueAndLoadAwareness() throws E .put("cluster.routing.allocation.awareness.force.zone.values", "a,b,c") .put("cluster.routing.allocation.load_awareness.skew_factor", "0.0") .put("cluster.routing.allocation.load_awareness.provisioned_capacity", Integer.toString(nodeCountPerAZ * 3)) + .put("cluster.routing.allocation.allow_rebalance", "indices_primaries_active") .build(); logger.info("--> starting a dedicated cluster manager node");