Skip to content

Commit 9013e0d

Browse files
Remove FailedToCommitClusterStateException from TransportClusterHealthAction (elastic#136613)
Removes a boolean check on incorrectly thrown FailedToCommitClusterStateException's since these were replaced with NotMasterExceptions Relates to: ES-13061
1 parent 30d4573 commit 9013e0d

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

server/src/main/java/org/elasticsearch/action/admin/cluster/health/TransportClusterHealthAction.java

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import org.elasticsearch.cluster.LocalMasterServiceTask;
2525
import org.elasticsearch.cluster.NotMasterException;
2626
import org.elasticsearch.cluster.block.ClusterBlockException;
27-
import org.elasticsearch.cluster.coordination.FailedToCommitClusterStateException;
2827
import org.elasticsearch.cluster.health.ClusterHealthStatus;
2928
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
3029
import org.elasticsearch.cluster.metadata.ProcessClusterEventTimeoutException;
@@ -36,7 +35,6 @@
3635
import org.elasticsearch.cluster.service.ClusterService;
3736
import org.elasticsearch.common.Strings;
3837
import org.elasticsearch.common.util.CollectionUtils;
39-
import org.elasticsearch.common.util.concurrent.EsRejectedExecutionException;
4038
import org.elasticsearch.core.SuppressForbidden;
4139
import org.elasticsearch.core.TimeValue;
4240
import org.elasticsearch.index.IndexNotFoundException;
@@ -233,21 +231,13 @@ public void onFailure(Exception e) {
233231
)
234232
);
235233
} else {
236-
final Level level = isExpectedFailure(e) ? Level.TRACE : Level.ERROR;
234+
final Level level = e instanceof NotMasterException ? Level.TRACE : Level.ERROR;
237235
logger.log(level, () -> "unexpected failure during [" + source + "]", e);
238-
assert isExpectedFailure(e) : e; // task cannot fail, nor will it trigger a publication which fails
236+
assert e instanceof NotMasterException : e; // task cannot fail, nor will it trigger a publication which fails
239237
// TransportMasterNodeAction implements the retry logic, which is triggered by passing a NotMasterException
240238
listener.onFailure(e);
241239
}
242240
}
243-
244-
static boolean isExpectedFailure(Exception e) {
245-
return e instanceof NotMasterException
246-
|| e instanceof FailedToCommitClusterStateException
247-
&& e.getCause() instanceof EsRejectedExecutionException esre
248-
&& esre.isExecutorShutdown();
249-
}
250-
251241
});
252242
}
253243
}

0 commit comments

Comments
 (0)