-
Notifications
You must be signed in to change notification settings - Fork 25.7k
Replace pre publication failed to commit cluster state exceptions #135706
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 10 commits
0a0418d
f2c836d
350da55
eec4c8f
812ce64
8df45c6
01ffa86
4911606
b76a1e5
7376b9d
4152c42
0eb27a8
f886182
a277c2e
a67d869
700ae31
5cd8fdd
147e8f8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,6 +24,7 @@ | |
| import org.elasticsearch.cluster.ClusterStatePublicationEvent; | ||
| import org.elasticsearch.cluster.ClusterStateUpdateTask; | ||
| import org.elasticsearch.cluster.LocalMasterServiceTask; | ||
| import org.elasticsearch.cluster.NotMasterException; | ||
| import org.elasticsearch.cluster.block.ClusterBlocks; | ||
| import org.elasticsearch.cluster.coordination.ClusterFormationFailureHelper.ClusterFormationState; | ||
| import org.elasticsearch.cluster.coordination.CoordinationMetadata.VotingConfigExclusion; | ||
|
|
@@ -1552,7 +1553,7 @@ public void publish( | |
| clusterStatePublicationEvent.getNewState().term() | ||
| ) | ||
| ); | ||
| throw new FailedToCommitClusterStateException( | ||
| throw new NotMasterException( | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changed as part of #135548 and will disappear when I rebase |
||
| "node is no longer master for term " | ||
| + clusterStatePublicationEvent.getNewState().term() | ||
| + " while handling publication" | ||
|
|
@@ -1567,7 +1568,7 @@ public void publish( | |
| clusterStatePublicationEvent.getSummary() | ||
| ) | ||
| ); | ||
| throw new FailedToCommitClusterStateException("publication " + currentPublication.get() + " already in progress"); | ||
| throw new FailedToPublishClusterStateException("publication " + currentPublication.get() + " already in progress"); | ||
| } | ||
|
|
||
| assert assertPreviousStateConsistency(clusterStatePublicationEvent); | ||
|
|
@@ -1586,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 FailedToPublishClusterStateException("publishing failed during context creation", e); | ||
| } | ||
|
|
||
| try (Releasable ignored = publicationContext::decRef) { | ||
|
|
@@ -1607,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 FailedToPublishClusterStateException("publishing failed while starting", e); | ||
| } | ||
|
|
||
| try { | ||
|
|
@@ -1638,12 +1639,12 @@ assert getLocalNode().equals(clusterState.getNodes().get(getLocalNode().getId()) | |
| } | ||
| } | ||
| } | ||
| } catch (FailedToCommitClusterStateException failedToCommitClusterStateException) { | ||
| publishListener.onFailure(failedToCommitClusterStateException); | ||
| } catch (FailedToPublishClusterStateException | FailedToCommitClusterStateException | NotMasterException e) { | ||
| publishListener.onFailure(e); | ||
| } catch (Exception e) { | ||
| assert false : e; // all exceptions should already be caught and wrapped in a FailedToCommitClusterStateException | ||
| assert false : e; // all exceptions should already be caught and wrapped in a FailedToPublishClusterStateException | | ||
| logger.error(() -> "[" + clusterStatePublicationEvent.getSummary() + "] publishing unexpectedly failed", e); | ||
| publishListener.onFailure(new FailedToCommitClusterStateException("publishing unexpectedly failed", e)); | ||
| publishListener.onFailure(new FailedToPublishClusterStateException("publishing unexpectedly failed", e)); | ||
| } | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the "Elastic License | ||
| * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side | ||
| * Public License v 1"; you may not use this file except in compliance with, at | ||
| * your election, the "Elastic License 2.0", the "GNU Affero General Public | ||
| * License v3.0 only", or the "Server Side Public License, v 1". | ||
| */ | ||
| package org.elasticsearch.cluster.coordination; | ||
|
|
||
| import org.elasticsearch.ElasticsearchException; | ||
| import org.elasticsearch.action.support.master.TransportMasterNodeAction; | ||
| import org.elasticsearch.common.io.stream.StreamInput; | ||
|
|
||
| import java.io.IOException; | ||
|
|
||
| /** | ||
| * Exception indicating a cluster state update failed prior to publication. | ||
| * <p> | ||
| * If this exception is thrown, then the cluster state update was <i>not</i> published to any node. | ||
| * It is therefore impossible for the new master to have committed this state. | ||
| * <p> | ||
| * For exceptions thrown <i>after</i> publication, when the cluster state update may or may not have been committed, | ||
| * use a {@link FailedToCommitClusterStateException}. | ||
| * <p> | ||
| * This is a retryable exception inside {@link TransportMasterNodeAction} | ||
| */ | ||
| public class FailedToPublishClusterStateException extends ElasticsearchException { | ||
|
||
|
|
||
| public FailedToPublishClusterStateException(String msg) { | ||
| super(msg); | ||
| } | ||
|
|
||
| public FailedToPublishClusterStateException(StreamInput in) throws IOException { | ||
| super(in); | ||
| } | ||
|
|
||
| public FailedToPublishClusterStateException(String msg, Throwable cause, Object... args) { | ||
| super(msg, cause, args); | ||
| } | ||
|
|
||
| @Override | ||
| public Throwable fillInStackTrace() { | ||
| return this; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 9187000 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| esql_plan_with_no_columns,9186000 | ||
| failed_to_publish_cluster_state_exception,9187000 |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed as part of #135548 and will disappear once I rebase