@@ -1568,7 +1568,8 @@ public void publish(
15681568 clusterStatePublicationEvent .getSummary ()
15691569 )
15701570 );
1571- throw new FailedToCommitClusterStateException ("publication " + currentPublication .get () + " already in progress" );
1571+ // If there is another publication in progress then we are not the master node
1572+ throw new NotMasterException ("publication " + currentPublication .get () + " already in progress" );
15721573 }
15731574
15741575 assert assertPreviousStateConsistency (clusterStatePublicationEvent );
@@ -1586,8 +1587,9 @@ assert getLocalNode().equals(clusterState.getNodes().get(getLocalNode().getId())
15861587 publicationContext = publicationHandler .newPublicationContext (clusterStatePublicationEvent );
15871588 } catch (Exception e ) {
15881589 logger .debug (() -> "[" + clusterStatePublicationEvent .getSummary () + "] publishing failed during context creation" , e );
1590+ // Calling becomeCandidate here means this node steps down from being master
15891591 becomeCandidate ("publication context creation" );
1590- throw new FailedToCommitClusterStateException ("publishing failed during context creation" , e );
1592+ throw new NotMasterException ("publishing failed during context creation" , e );
15911593 }
15921594
15931595 try (Releasable ignored = publicationContext ::decRef ) {
@@ -1607,8 +1609,9 @@ assert getLocalNode().equals(clusterState.getNodes().get(getLocalNode().getId())
16071609 + "]" ,
16081610 e
16091611 );
1612+ // Calling becomeCandidate here means this node steps down from being master
16101613 becomeCandidate ("publication creation" );
1611- throw new FailedToCommitClusterStateException ("publishing failed while starting" , e );
1614+ throw new NotMasterException ("publishing failed while starting" , e );
16121615 }
16131616
16141617 try {
0 commit comments