From 89c61cde4a1c4003aeacb3740530029f3f5c1504 Mon Sep 17 00:00:00 2001 From: Armin Braun Date: Thu, 22 Feb 2024 19:24:33 +0100 Subject: [PATCH] Fix noisy logging from HealthNodeTaskExecutor (#105695) No need to log more than debug here on node shutdown. This causes an incredibly amount of log spam in some tests that frequently restart nodes. --- .../health/node/selection/HealthNodeTaskExecutor.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server/src/main/java/org/elasticsearch/health/node/selection/HealthNodeTaskExecutor.java b/server/src/main/java/org/elasticsearch/health/node/selection/HealthNodeTaskExecutor.java index 209bb45891dea..cc908cd7cad2c 100644 --- a/server/src/main/java/org/elasticsearch/health/node/selection/HealthNodeTaskExecutor.java +++ b/server/src/main/java/org/elasticsearch/health/node/selection/HealthNodeTaskExecutor.java @@ -23,6 +23,7 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.features.FeatureService; import org.elasticsearch.health.HealthFeatures; +import org.elasticsearch.node.NodeClosedException; import org.elasticsearch.persistent.AllocatedPersistentTask; import org.elasticsearch.persistent.PersistentTaskParams; import org.elasticsearch.persistent.PersistentTaskState; @@ -166,6 +167,10 @@ void startTask(ClusterChangedEvent event) { new HealthNodeTaskParams(), null, ActionListener.wrap(r -> logger.debug("Created the health node task"), e -> { + if (e instanceof NodeClosedException) { + logger.debug("Failed to create health node task because node is shutting down", e); + return; + } Throwable t = e instanceof RemoteTransportException ? e.getCause() : e; if (t instanceof ResourceAlreadyExistsException == false) { logger.error("Failed to create the health node task", e);