Skip to content

Commit 70f4e7c

Browse files
Move ClusterApplierService assertion after logging exception (#132446)
#120087 moved the assertion to the beginning of the catch block, before the warning log message. To ease future development, this PR moves the assertion back, so the warning will be available in the logs if a dev unexpectedly runs into this assertion.
1 parent 311a722 commit 70f4e7c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

server/src/main/java/org/elasticsearch/cluster/service/ClusterApplierService.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -469,9 +469,6 @@ private void runTask(String source, Function<ClusterState, ClusterState> updateF
469469
);
470470
warnAboutSlowTaskIfNeeded(executionTime, source, stopWatch);
471471
} catch (Exception e) {
472-
// failing to apply a cluster state with an exception indicates a bug in validation or in one of the appliers; if we
473-
// continue we will retry with the same cluster state but that might not help.
474-
assert applicationMayFail();
475472
timedListener.onFailure(e);
476473
TimeValue executionTime = getTimeSince(startTimeMillis);
477474
if (logger.isTraceEnabled()) {
@@ -492,6 +489,9 @@ private void runTask(String source, Function<ClusterState, ClusterState> updateF
492489
e
493490
);
494491
}
492+
// failing to apply a cluster state with an exception indicates a bug in validation or in one of the appliers; if we
493+
// continue we will retry with the same cluster state but that might not help.
494+
assert applicationMayFail();
495495
} finally {
496496
clearIsApplyingClusterState();
497497
}

0 commit comments

Comments
 (0)