Skip to content

Commit

Permalink
Become candidate on publication failure
Browse files Browse the repository at this point in the history
If the publication fails before starting (e.g. due to one of the
precondition checks in `CoordinationState#handleClientValue`) then we
must explicitly stand down as leader.

Closes elastic#96273
  • Loading branch information
DaveCTurner committed Jun 1, 2023
1 parent ef7a6e8 commit db1fdcc
Showing 1 changed file with 3 additions and 0 deletions.
Expand Up @@ -1548,6 +1548,9 @@ assert getLocalNode().equals(clusterState.getNodes().get(getLocalNode().getId())
followersChecker.setCurrentNodes(publishNodes);
lagDetector.setTrackedNodes(publishNodes);
publication.start(followersChecker.getFaultyNodes());
} catch (Exception e) {
assert currentPublication.isEmpty() : e; // should not fail after setting currentPublication
becomeCandidate("publish");
} finally {
publicationContext.decRef();
}
Expand Down

0 comments on commit db1fdcc

Please sign in to comment.