diff --git a/server/src/main/java/org/elasticsearch/cluster/service/ClusterApplierService.java b/server/src/main/java/org/elasticsearch/cluster/service/ClusterApplierService.java index b4a626faf79b3..4ae799afff655 100644 --- a/server/src/main/java/org/elasticsearch/cluster/service/ClusterApplierService.java +++ b/server/src/main/java/org/elasticsearch/cluster/service/ClusterApplierService.java @@ -469,9 +469,6 @@ private void runTask(String source, Function updateF ); warnAboutSlowTaskIfNeeded(executionTime, source, stopWatch); } catch (Exception e) { - // failing to apply a cluster state with an exception indicates a bug in validation or in one of the appliers; if we - // continue we will retry with the same cluster state but that might not help. - assert applicationMayFail(); timedListener.onFailure(e); TimeValue executionTime = getTimeSince(startTimeMillis); if (logger.isTraceEnabled()) { @@ -492,6 +489,9 @@ private void runTask(String source, Function updateF e ); } + // failing to apply a cluster state with an exception indicates a bug in validation or in one of the appliers; if we + // continue we will retry with the same cluster state but that might not help. + assert applicationMayFail(); } finally { clearIsApplyingClusterState(); }