Skip to content

Commit 12122d1

Browse files
authored
Suppress testDiscoveryUsesNodesFromLastClusterState again (#95414)
This test was reinstated in #95409 but in fact it sometimes fails, and that is in fact the desired behaviour. With this commit we move it to the suite of tests that intentionally do not work with atomic register coordinators.
1 parent 8daa0f1 commit 12122d1

File tree

2 files changed

+32
-23
lines changed

2 files changed

+32
-23
lines changed

server/src/test/java/org/elasticsearch/cluster/coordination/CoordinatorTests.java

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@
5858

5959
import static java.util.Collections.emptyMap;
6060
import static org.elasticsearch.cluster.coordination.AbstractCoordinatorTestCase.Cluster.DEFAULT_DELAY_VARIABILITY;
61-
import static org.elasticsearch.cluster.coordination.AbstractCoordinatorTestCase.Cluster.EXTREME_DELAY_VARIABILITY;
6261
import static org.elasticsearch.cluster.coordination.Coordinator.Mode.CANDIDATE;
6362
import static org.elasticsearch.cluster.coordination.Coordinator.PUBLISH_TIMEOUT_SETTING;
6463
import static org.elasticsearch.cluster.coordination.ElectionSchedulerFactory.ELECTION_INITIAL_TIMEOUT_SETTING;
@@ -1422,28 +1421,6 @@ public void assertMatched() {
14221421
}
14231422
}
14241423

1425-
public void testDiscoveryUsesNodesFromLastClusterState() {
1426-
try (Cluster cluster = new Cluster(randomIntBetween(3, 5))) {
1427-
cluster.runRandomly();
1428-
cluster.stabilise();
1429-
1430-
final ClusterNode partitionedNode = cluster.getAnyNode();
1431-
if (randomBoolean()) {
1432-
logger.info("--> blackholing {}", partitionedNode);
1433-
partitionedNode.blackhole();
1434-
} else {
1435-
logger.info("--> disconnecting {}", partitionedNode);
1436-
partitionedNode.disconnect();
1437-
}
1438-
cluster.setEmptySeedHostsList();
1439-
cluster.stabilise();
1440-
1441-
partitionedNode.heal();
1442-
cluster.runRandomly(false, true, EXTREME_DELAY_VARIABILITY);
1443-
cluster.stabilise();
1444-
}
1445-
}
1446-
14471424
public void testFollowerRemovedIfUnableToSendRequestsToMaster() {
14481425
try (Cluster cluster = new Cluster(3)) {
14491426
cluster.runRandomly();

server/src/test/java/org/elasticsearch/cluster/coordination/CoordinatorVotingConfigurationTests.java

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import java.util.stream.Collectors;
2323

2424
import static org.elasticsearch.cluster.coordination.AbstractCoordinatorTestCase.Cluster.DEFAULT_DELAY_VARIABILITY;
25+
import static org.elasticsearch.cluster.coordination.AbstractCoordinatorTestCase.Cluster.EXTREME_DELAY_VARIABILITY;
2526
import static org.elasticsearch.cluster.coordination.Coordinator.Mode.CANDIDATE;
2627
import static org.elasticsearch.cluster.coordination.ElectionSchedulerFactory.ELECTION_INITIAL_TIMEOUT_SETTING;
2728
import static org.elasticsearch.cluster.coordination.Reconfigurator.CLUSTER_AUTO_SHRINK_VOTING_CONFIGURATION;
@@ -488,4 +489,35 @@ public void testClusterUUIDLogging() {
488489
mockAppender.assertAllExpectationsMatched();
489490
}
490491
}
492+
493+
public void testDiscoveryUsesNodesFromLastClusterState() {
494+
495+
// This test only applies when using proper majority-based voting configurations. If we permit non-overlapping configurations then
496+
// the isolated node can form a one-node cluster when it is healed, and the other nodes won't know be able to discover it without a
497+
// proper discovery config since it wasn't in their last cluster states.
498+
//
499+
// (if we wanted this to work without a proper discovery config then we could e.g. record the master's publish address in the
500+
// heartbeat blob, but we can assume that discovery is properly configured when using an atomic-register coordinator, and therefore
501+
// there's no need for this extra complexity)
502+
503+
try (Cluster cluster = new Cluster(randomIntBetween(3, 5))) {
504+
cluster.runRandomly();
505+
cluster.stabilise();
506+
507+
final Cluster.ClusterNode partitionedNode = cluster.getAnyNode();
508+
if (randomBoolean()) {
509+
logger.info("--> blackholing {}", partitionedNode);
510+
partitionedNode.blackhole();
511+
} else {
512+
logger.info("--> disconnecting {}", partitionedNode);
513+
partitionedNode.disconnect();
514+
}
515+
cluster.setEmptySeedHostsList();
516+
cluster.stabilise();
517+
518+
partitionedNode.heal();
519+
cluster.runRandomly(false, true, EXTREME_DELAY_VARIABILITY);
520+
cluster.stabilise();
521+
}
522+
}
491523
}

0 commit comments

Comments
 (0)