Skip to content

Commit 1eb0958

Browse files
committed
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 d89eaef commit 1eb0958

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,9 @@ public void testShrinkThenSplitWithFailedNode() throws Exception {
582582
.build()).setResizeType(ResizeType.SHRINK).get());
583583
ensureGreen();
584584

585+
final int nodeCount = cluster().size();
585586
internalCluster().stopRandomNode(InternalTestCluster.nameFilter(shrinkNode));
587+
ensureStableCluster(nodeCount - 1);
586588

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

0 commit comments

Comments
 (0)