This is an automated email from the ASF dual-hosted git repository. ibessonov pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/ignite-3.git
The following commit(s) were added to refs/heads/main by this push: new 0a797f0719 IGNITE-19740 Reduce amount of noise in the log on cluster stop (#2198) 0a797f0719 is described below commit 0a797f0719320a52ba438f51f580a23d15aa147c Author: Roman Puchkovskiy <roman.puchkovs...@gmail.com> AuthorDate: Thu Jun 15 16:36:21 2023 +0400 IGNITE-19740 Reduce amount of noise in the log on cluster stop (#2198) --- .../apache/ignite/internal/util/ExceptionUtils.java | 4 +++- .../ignite/network/DefaultMessagingService.java | 19 ++++++++++++++----- .../raft/client/TopologyAwareRaftGroupService.java | 5 ++++- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/ExceptionUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/util/ExceptionUtils.java index c0b277f54d..0b2f7e6b6c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/ExceptionUtils.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/ExceptionUtils.java @@ -79,6 +79,7 @@ public final class ExceptionUtils { * @param throwable The exception to examine. * @return The wrapped exception, or {@code null} if not found. */ + @Nullable private static Throwable getCauseUsingWellKnownTypes(Throwable throwable) { if (throwable instanceof SQLException) { return ((SQLException) throwable).getNextException(); @@ -216,7 +217,8 @@ public final class ExceptionUtils { * @param mtdNames The method names, null treated as default set. * @return The cause of the {@code Throwable}, {@code null} if none found or null throwable input. */ - public static Throwable getCause(Throwable throwable, String[] mtdNames) { + @Nullable + public static Throwable getCause(@Nullable Throwable throwable, String[] mtdNames) { if (throwable == null) { return null; } diff --git a/modules/network/src/main/java/org/apache/ignite/network/DefaultMessagingService.java b/modules/network/src/main/java/org/apache/ignite/network/DefaultMessagingService.java index f2bfa2102a..7ca5811863 100644 --- a/modules/network/src/main/java/org/apache/ignite/network/DefaultMessagingService.java +++ b/modules/network/src/main/java/org/apache/ignite/network/DefaultMessagingService.java @@ -317,11 +317,7 @@ public class DefaultMessagingService extends AbstractMessagingService { try { onMessage(obj); } catch (Throwable e) { - LOG.error("onMessage() failed while processing {} from {}", e, obj.message(), obj.consistentId()); - - if (e instanceof Error) { - throw e; - } + logAndRethrowIfError(obj, e); } }); @@ -363,6 +359,19 @@ public class DefaultMessagingService extends AbstractMessagingService { } } + private static void logAndRethrowIfError(InNetworkObject obj, Throwable e) { + if (e instanceof UnresolvableConsistentIdException && obj.message() instanceof InvokeRequest) { + LOG.info("onMessage() failed while processing {} from {} as the sender has left the topology", + obj.message(), obj.consistentId()); + } else { + LOG.error("onMessage() failed while processing {} from {}", e, obj.message(), obj.consistentId()); + } + + if (e instanceof Error) { + throw (Error) e; + } + } + /** * Handles a response to an invocation request. * diff --git a/modules/replicator/src/main/java/org/apache/ignite/internal/raft/client/TopologyAwareRaftGroupService.java b/modules/replicator/src/main/java/org/apache/ignite/internal/raft/client/TopologyAwareRaftGroupService.java index 6831025ca1..cc5a82c84f 100644 --- a/modules/replicator/src/main/java/org/apache/ignite/internal/raft/client/TopologyAwareRaftGroupService.java +++ b/modules/replicator/src/main/java/org/apache/ignite/internal/raft/client/TopologyAwareRaftGroupService.java @@ -43,6 +43,7 @@ import org.apache.ignite.internal.raft.service.RaftGroupService; import org.apache.ignite.internal.replicator.ReplicationGroupId; import org.apache.ignite.lang.ErrorGroups.Common; import org.apache.ignite.lang.IgniteException; +import org.apache.ignite.lang.NodeStoppingException; import org.apache.ignite.network.ClusterNode; import org.apache.ignite.network.ClusterService; import org.apache.ignite.raft.jraft.RaftMessagesFactory; @@ -229,7 +230,9 @@ public class TopologyAwareRaftGroupService implements RaftGroupService { } }, executor); } else { - LOG.error("Could not send the subscribe message to the node [node={}, msg={}]", th, node, msg); + if (!(th instanceof NodeStoppingException)) { + LOG.error("Could not send the subscribe message to the node [node={}, msg={}]", th, node, msg); + } msgSendFut.completeExceptionally(th); }