Skip to content

Commit e29fc62

Browse files
authored
Fix CoordinatorTests.testUnresponsiveLeaderDetectedEventually (#64462)
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
1 parent d061c11 commit e29fc62

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
@@ -539,6 +539,14 @@ public void testUnresponsiveLeaderDetectedEventually() {
539539
+ defaultMillis(PUBLISH_TIMEOUT_SETTING)
540540
// there might be a term bump causing another election
541541
+ DEFAULT_ELECTION_DELAY
542+
// in clusters with 5 nodes the chances of concurrent elections
543+
// increase, meaning that it takes longer to get a leader elected
544+
// so we should take into account those cases to ensure that the
545+
// cluster stabilises over time. See #63918 for a really messy scenario.
546+
+ DEFAULT_ELECTION_DELAY
547+
// additionally take into account that publications might take longer
548+
// until the new leader detects that the old leader is unresponsive
549+
+ defaultMillis(PUBLISH_TIMEOUT_SETTING)
542550

543551
// then wait for both of:
544552
+ Math.max(

0 commit comments

Comments
 (0)