-
Notifications
You must be signed in to change notification settings - Fork 25.5k
Changes FailedToCommitClusterStateException to NotMasterException #135548
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 3 commits
0a0418d
5afa6b7
5c5a3d9
b65be1a
0ee7bf6
9848f0e
e296628
9569902
7088362
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 |
---|---|---|
|
@@ -415,13 +415,30 @@ public void onResponse(Void unused) { | |
|
||
@Override | ||
public void onFailure(Exception exception) { | ||
if (exception instanceof FailedToCommitClusterStateException failedToCommitClusterStateException) { | ||
if (exception instanceof FailedToCommitClusterStateException || exception instanceof NotMasterException) { | ||
final long notificationStartTime = threadPool.rawRelativeTimeInMillis(); | ||
final long version = newClusterState.version(); | ||
logger.warn(() -> format("failing [%s]: failed to commit cluster state version [%s]", summary, version), exception); | ||
|
||
if (exception instanceof FailedToCommitClusterStateException) { | ||
logger.warn( | ||
() -> format("failing [%s]: failed to commit cluster state version [%s]", summary, version), | ||
exception | ||
); | ||
} else { | ||
logger.debug( | ||
() -> format( | ||
"node is no longer the master prior to publication of cluster state version [%s]: [%s]", | ||
version, | ||
summary | ||
), | ||
exception | ||
); | ||
} | ||
|
||
for (final var executionResult : executionResults) { | ||
executionResult.onPublishFailure(failedToCommitClusterStateException); | ||
executionResult.onPublishFailure(exception); | ||
} | ||
|
||
final long notificationMillis = threadPool.rawRelativeTimeInMillis() - notificationStartTime; | ||
clusterStateUpdateStatsTracker.onPublicationFailure( | ||
threadPool.rawRelativeTimeInMillis(), | ||
|
@@ -985,11 +1002,17 @@ void onClusterStateUnchanged(ClusterState clusterState) { | |
} | ||
} | ||
|
||
void onPublishFailure(FailedToCommitClusterStateException e) { | ||
void onPublishFailure(Exception e) { | ||
Comment on lines
-988
to
+1005
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. I see this is only called with 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. Unfortunately, the parameter But, since this method is currently called from within this
I know that currently the type must be either |
||
if (publishedStateConsumer == null && onPublicationSuccess == null) { | ||
assert failure != null; | ||
var taskFailure = failure; | ||
failure = new FailedToCommitClusterStateException(e.getMessage(), e); | ||
|
||
if (e instanceof FailedToCommitClusterStateException) { | ||
failure = new FailedToCommitClusterStateException(e.getMessage(), e); | ||
} else { | ||
failure = new NotMasterException(e.getMessage(), e); | ||
} | ||
|
||
failure.addSuppressed(taskFailure); | ||
notifyFailure(); | ||
return; | ||
|
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.
Is there any loss in understanding of the log message moving the summary to the end after the colon, without the 'failing' prefix, for the
NotMasterException
case?