@@ -1568,7 +1568,8 @@ public void publish(
1568
1568
clusterStatePublicationEvent .getSummary ()
1569
1569
)
1570
1570
);
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" );
1572
1573
}
1573
1574
1574
1575
assert assertPreviousStateConsistency (clusterStatePublicationEvent );
@@ -1586,8 +1587,9 @@ assert getLocalNode().equals(clusterState.getNodes().get(getLocalNode().getId())
1586
1587
publicationContext = publicationHandler .newPublicationContext (clusterStatePublicationEvent );
1587
1588
} catch (Exception e ) {
1588
1589
logger .debug (() -> "[" + clusterStatePublicationEvent .getSummary () + "] publishing failed during context creation" , e );
1590
+ // Calling becomeCandidate here means this node steps down from being master
1589
1591
becomeCandidate ("publication context creation" );
1590
- throw new FailedToCommitClusterStateException ("publishing failed during context creation" , e );
1592
+ throw new NotMasterException ("publishing failed during context creation" , e );
1591
1593
}
1592
1594
1593
1595
try (Releasable ignored = publicationContext ::decRef ) {
@@ -1607,8 +1609,9 @@ assert getLocalNode().equals(clusterState.getNodes().get(getLocalNode().getId())
1607
1609
+ "]" ,
1608
1610
e
1609
1611
);
1612
+ // Calling becomeCandidate here means this node steps down from being master
1610
1613
becomeCandidate ("publication creation" );
1611
- throw new FailedToCommitClusterStateException ("publishing failed while starting" , e );
1614
+ throw new NotMasterException ("publishing failed while starting" , e );
1612
1615
}
1613
1616
1614
1617
try {
0 commit comments