Skip to content

Commit 6fa6b81

Browse files
authored
Fix CoordinatorTests.testUnresponsiveLeaderDetectedEventually (#64490)
Take into account messy scenarios of 5 node clusters elections where multiple nodes can trigger an election concurrently, meaning that it takes longer to stabilize the cluster and elect a leader. Fixes #63918 Backport of #64462
1 parent 2a4582f commit 6fa6b81

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,14 @@ public void testUnresponsiveLeaderDetectedEventually() {
541541
+ defaultMillis(PUBLISH_TIMEOUT_SETTING)
542542
// there might be a term bump causing another election
543543
+ DEFAULT_ELECTION_DELAY
544+
// in clusters with 5 nodes the chances of concurrent elections
545+
// increase, meaning that it takes longer to get a leader elected
546+
// so we should take into account those cases to ensure that the
547+
// cluster stabilises over time. See #63918 for a really messy scenario.
548+
+ DEFAULT_ELECTION_DELAY
549+
// additionally take into account that publications might take longer
550+
// until the new leader detects that the old leader is unresponsive
551+
+ defaultMillis(PUBLISH_TIMEOUT_SETTING)
544552

545553
// then wait for both of:
546554
+ Math.max(

0 commit comments

Comments
 (0)