Skip to content

Fix ScaleIndexIT testFullSearchOnlyReplicasFullLifecycle flaky test #17848

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 8, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,7 @@ public void testFullSearchOnlyReplicasFullLifecycle() throws Exception {
// Test cluster health when one search replica is down
internalCluster().stopRandomNode(InternalTestCluster.nameFilter(findNodesWithSearchOnlyReplicas()[0]));

assertEquals(
"Index health should be YELLOW with one search replica down",
"YELLOW",
client().admin().cluster().prepareHealth(TEST_INDEX).get().getStatus().name()
);
ensureYellow(TEST_INDEX);

// Start a replacement search node and wait for recovery
internalCluster().startSearchOnlyNode();
Expand Down Expand Up @@ -332,14 +328,12 @@ private String[] findNodesWithSearchOnlyReplicas() {
ClusterState state = client().admin().cluster().prepareState().get().getState();
IndexRoutingTable indexRoutingTable = state.routingTable().index(TEST_INDEX);

// Use a set to avoid duplicates if multiple shards are on the same node
Set<String> nodeNames = new HashSet<>();

for (IndexShardRoutingTable shardTable : indexRoutingTable) {
for (ShardRouting searchReplica : shardTable.searchOnlyReplicas()) {
if (searchReplica.active()) {
String nodeId = searchReplica.currentNodeId();
nodeNames.add(state.nodes().get(nodeId).getName());
nodeNames.add(state.nodes().get(searchReplica.currentNodeId()).getName());
}
}
}
Expand Down
Loading