Skip to content

Commit e3997c6

Browse files
authored
Ensure cluster is stable in ShrinkIndexIT.testShrinkThenSplitWithFailedNode (#44860)
The test ShrinkIndexIT.testShrinkThenSplitWithFailedNode sometimes fails because the resize operation is not acknowledged (see #44736). This resize operation creates a new index "splitagain" and it results in a cluster state update (TransportResizeAction uses MetaDataCreateIndexService.createIndex() to create the resized index). This cluster state update is expected to be acknowledged by all nodes (see IndexCreationTask.onAllNodesAcked()) but this is not always true: the data node that was just stopped in the test before executing the resize operation might still be considered as a "faulty" node (and not yet removed from the cluster nodes) by the FollowersChecker. The cluster state is then acked on all nodes but one, and it results in a non acknowledged resize operation. This commit adds an ensureStableCluster() check after stopping the node in the test. The goal is to ensure that the data node has been correctly removed from the cluster and that all nodes are fully connected to each before moving forward with the resize operation. Closes #44736
1 parent 16a4aa5 commit e3997c6

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

server/src/test/java/org/elasticsearch/action/admin/indices/create/ShrinkIndexIT.java

+2
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,9 @@ public void testShrinkThenSplitWithFailedNode() throws Exception {
580580
.build()).setResizeType(ResizeType.SHRINK).get());
581581
ensureGreen();
582582

583+
final int nodeCount = cluster().size();
583584
internalCluster().stopRandomNode(InternalTestCluster.nameFilter(shrinkNode));
585+
ensureStableCluster(nodeCount - 1);
584586

585587
// demonstrate that the index.routing.allocation.initial_recovery setting from the shrink doesn't carry over into the split index,
586588
// because this would cause the shrink to fail as the initial_recovery node is no longer present.

0 commit comments

Comments
 (0)