File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
server/src/main/java/org/elasticsearch/cluster/coordination Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -1298,18 +1298,22 @@ public void onSuccess(String source) {
12981298 updateMaxTermSeen (getCurrentTerm ());
12991299
13001300 if (mode == Mode .LEADER ) {
1301+ // if necessary, abdicate to another node or improve the voting configuration
1302+ boolean attemptReconfiguration = true ;
13011303 final ClusterState state = getLastAcceptedState (); // committed state
1302- if (localNodeMayWinElection (state )) {
1303- scheduleReconfigurationIfNeeded ();
1304- } else {
1304+ if (localNodeMayWinElection (state ) == false ) {
13051305 final List <DiscoveryNode > masterCandidates = completedNodes ().stream ()
13061306 .filter (DiscoveryNode ::isMasterNode )
13071307 .filter (node -> nodeMayWinElection (state , node ))
13081308 .collect (Collectors .toList ());
13091309 if (masterCandidates .isEmpty () == false ) {
13101310 abdicateTo (masterCandidates .get (random .nextInt (masterCandidates .size ())));
1311+ attemptReconfiguration = false ;
13111312 }
13121313 }
1314+ if (attemptReconfiguration ) {
1315+ scheduleReconfigurationIfNeeded ();
1316+ }
13131317 }
13141318 lagDetector .startLagDetector (publishRequest .getAcceptedState ().version ());
13151319 }
You can’t perform that action at this time.
0 commit comments