Skip to content

Commit f115d02

Browse files
Update exception messages (elastic#135017)
Modifies the Javadoc descriptions of `FailedToCommitClusterStateException` and `NotMasterException` to better distinguish between the two
1 parent e95971d commit f115d02

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

server/src/main/java/org/elasticsearch/cluster/NotMasterException.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,20 @@
99
package org.elasticsearch.cluster;
1010

1111
import org.elasticsearch.ElasticsearchException;
12+
import org.elasticsearch.action.support.master.TransportMasterNodeAction;
13+
import org.elasticsearch.cluster.coordination.FailedToCommitClusterStateException;
1214
import org.elasticsearch.common.io.stream.StreamInput;
1315

1416
import java.io.IOException;
1517

1618
/**
17-
* Exception which indicates that an operation failed because the node stopped being the elected master.
19+
* Exception indicating that a cluster state update operation failed because the node stopped being the elected master.
20+
* Since this exception is thrown prior to the cluster state publication, it should only be used when the cluster state update
21+
* <i>definitely</i> did not happen, and there is no possibility the next master committed the cluster state update.
22+
*
23+
* This is different from {@link FailedToCommitClusterStateException}.
24+
*
25+
* This exception is retryable within {@link TransportMasterNodeAction}.
1826
*/
1927
public class NotMasterException extends ElasticsearchException {
2028

server/src/main/java/org/elasticsearch/cluster/coordination/FailedToCommitClusterStateException.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,20 @@
99
package org.elasticsearch.cluster.coordination;
1010

1111
import org.elasticsearch.ElasticsearchException;
12+
import org.elasticsearch.action.support.master.TransportMasterNodeAction;
13+
import org.elasticsearch.cluster.NotMasterException;
1214
import org.elasticsearch.common.io.stream.StreamInput;
1315

1416
import java.io.IOException;
1517

1618
/**
1719
* Thrown when a cluster state publication fails to commit the new cluster state. If publication fails then a new master is elected but the
18-
* update might or might not take effect, depending on whether or not the newly-elected master accepted the published state that failed to
19-
* be committed.
20+
* update might or might not take effect, depending on whether the newly-elected master accepted the published state that failed to
21+
* be committed. This exception should only be used when there is <i>ambiguity</i> whether a state update took effect or not.
22+
*
23+
* This is different from {@link NotMasterException} where we know for certain that a state update never took effect.
24+
*
25+
* This exception is retryable within {@link TransportMasterNodeAction}.
2026
*
2127
* See {@link ClusterStatePublisher} for more details.
2228
*/

0 commit comments

Comments
 (0)