Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1568,7 +1568,7 @@ public void publish(
clusterStatePublicationEvent.getSummary()
)
);
throw new FailedToCommitClusterStateException("publication " + currentPublication.get() + " already in progress");
throw new NotMasterException("publication " + currentPublication.get() + " already in progress");
}

assert assertPreviousStateConsistency(clusterStatePublicationEvent);
Expand All @@ -1587,7 +1587,7 @@ assert getLocalNode().equals(clusterState.getNodes().get(getLocalNode().getId())
} catch (Exception e) {
logger.debug(() -> "[" + clusterStatePublicationEvent.getSummary() + "] publishing failed during context creation", e);
becomeCandidate("publication context creation");
throw new FailedToCommitClusterStateException("publishing failed during context creation", e);
throw new NotMasterException("publishing failed during context creation", e);
}

try (Releasable ignored = publicationContext::decRef) {
Expand All @@ -1608,7 +1608,7 @@ assert getLocalNode().equals(clusterState.getNodes().get(getLocalNode().getId())
e
);
becomeCandidate("publication creation");
throw new FailedToCommitClusterStateException("publishing failed while starting", e);
throw new NotMasterException("publishing failed while starting", e);
}

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,19 @@
import java.io.IOException;

/**
* Thrown when a cluster state publication fails to commit the new cluster state. If publication fails then a new master is elected but the
* update might or might not take effect, depending on whether the newly-elected master accepted the published state that failed to
* be committed. This exception should only be used when there is <i>ambiguity</i> whether a state update took effect or not.
*
* This is different from {@link NotMasterException} where we know for certain that a state update never took effect.
*
* This exception is retryable within {@link TransportMasterNodeAction}.
*
* Exception indicating a cluster state update was published but not committed to all nodes.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conceptual nit: "committed" is a global property rather than something that happens on one or more nodes.

Suggested change
* Exception indicating a cluster state update was published but not committed to all nodes.
* Exception indicating a cluster state update was published and may or may not have been committed.

This exception indicates the publishing master doesn't think the update was committed, but it cannot tell for sure. It depends on which other master nodes accepted it and the winner of the next election.

* <p>
* If this exception is thrown, then the cluster state update was published, but is not guaranteed
* to be committed on any nodes, including the next master node. This exception should only be thrown when there is
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* to be committed on any nodes, including the next master node. This exception should only be thrown when there is
* to be committed, including the next master node. This exception should only be thrown when there is

* <i>ambiguity</i> whether a cluster state update has been committed.
* <p>
* For exceptions thrown prior to publication,
* when the cluster update has <i>definitely</i> failed, use a different exception.
* <p>
* If during a cluster state update the node is no longer master, use a {@link NotMasterException}
* <p>
* This is a retryable exception inside {@link TransportMasterNodeAction}
* <p>
* See {@link ClusterStatePublisher} for more details.
*/
public class FailedToCommitClusterStateException extends ElasticsearchException {
Expand Down