|
24 | 24 | import org.elasticsearch.cluster.LocalMasterServiceTask; |
25 | 25 | import org.elasticsearch.cluster.NotMasterException; |
26 | 26 | import org.elasticsearch.cluster.block.ClusterBlockException; |
27 | | -import org.elasticsearch.cluster.coordination.FailedToCommitClusterStateException; |
28 | 27 | import org.elasticsearch.cluster.health.ClusterHealthStatus; |
29 | 28 | import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; |
30 | 29 | import org.elasticsearch.cluster.metadata.ProcessClusterEventTimeoutException; |
|
36 | 35 | import org.elasticsearch.cluster.service.ClusterService; |
37 | 36 | import org.elasticsearch.common.Strings; |
38 | 37 | import org.elasticsearch.common.util.CollectionUtils; |
39 | | -import org.elasticsearch.common.util.concurrent.EsRejectedExecutionException; |
40 | 38 | import org.elasticsearch.core.SuppressForbidden; |
41 | 39 | import org.elasticsearch.core.TimeValue; |
42 | 40 | import org.elasticsearch.index.IndexNotFoundException; |
@@ -233,21 +231,13 @@ public void onFailure(Exception e) { |
233 | 231 | ) |
234 | 232 | ); |
235 | 233 | } else { |
236 | | - final Level level = isExpectedFailure(e) ? Level.TRACE : Level.ERROR; |
| 234 | + final Level level = e instanceof NotMasterException ? Level.TRACE : Level.ERROR; |
237 | 235 | 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 |
239 | 237 | // TransportMasterNodeAction implements the retry logic, which is triggered by passing a NotMasterException |
240 | 238 | listener.onFailure(e); |
241 | 239 | } |
242 | 240 | } |
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 | | - |
251 | 241 | }); |
252 | 242 | } |
253 | 243 | } |
|
0 commit comments