[ 
https://issues.apache.org/jira/browse/IGNITE-22971?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Aleksandr Polovtsev updated IGNITE-22971:
-----------------------------------------
    Description: 
If a Raft client tries to access a node that is not present in the physical 
topology, the following error is printed to the log:

{code}
Recoverable error during the request occurred (will be retried on the randomly 
selected node) [request=class 
org.apache.ignite.raft.jraft.rpc.GetLeaderRequestImpl, peer=Peer 
[consistentId=iest_teasd_2, idx=0], newPeer=Peer [consistentId=iest_teasd_1, 
idx=0]].
java.util.concurrent.CompletionException: java.net.ConnectException: Peer 
ijst_n_0 is unavailable
                                at 
java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:331)
 ~[?:?]
                                at 
java.base/java.util.concurrent.CompletableFuture.uniComposeStage(CompletableFuture.java:1099)
 ~[?:?]
                                at 
java.base/java.util.concurrent.CompletableFuture.thenCompose(CompletableFuture.java:2235)
 ~[?:?]
                                at 
org.apache.ignite.internal.raft.RaftGroupServiceImpl.sendWithRetry(RaftGroupServiceImpl.java:566)
 ~[ignite-raft-9.0.127-SNAPSHOT.jar:?]
                                at 
org.apache.ignite.internal.raft.RaftGroupServiceImpl.lambda$handleThrowable$41(RaftGroupServiceImpl.java:613)
 ~[ignite-raft-9.0.127-SNAPSHOT.jar:?]
                                at 
java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
 [?:?]
                                at 
java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
                                at 
java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
 [?:?]
                                at 
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
 [?:?]
                                at 
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
 [?:?]
                                at 
java.base/java.lang.Thread.run(Thread.java:834) [?:?]
                         Caused by: java.net.ConnectException: Peer ijst_n_0 is 
unavailable
                                at 
org.apache.ignite.internal.raft.RaftGroupServiceImpl.resolvePeer(RaftGroupServiceImpl.java:814)
 ~[ignite-raft-9.0.127-SNAPSHOT.jar:?]
                                at 
org.apache.ignite.internal.raft.RaftGroupServiceImpl.sendWithRetry(RaftGroupServiceImpl.java:565)
 ~[ignite-raft-9.0.127-SNAPSHOT.jar:?]
                                ... 7 more
{code}

There are two problems: the exception is wrapped into a {{CompletionException}} 
and the exception itself is a {{ConnectException}} that we create down the same 
chain of method calls, which means that this stacktrace is always the same and 
does not bring any useful information.

I propose to use a special exception in this case, which does not fill its 
stacktrace, so that the log will look like this:

{code}
Recoverable error during the request occurred (will be retried on the randomly 
selected node) [request=class 
org.apache.ignite.raft.jraft.rpc.GetLeaderRequestImpl, peer=Peer 
[consistentId=iest_teasd_2, idx=0], newPeer=Peer [consistentId=iest_teasd_1, 
idx=0]].
 org.apache.ignite.internal.raft.RaftGroupServiceImpl$PeerUnavailableException: 
Peer iest_teasd_2 is unavailable
{code}



> Reduce log pollution when a Raft peer cannot be resolved
> --------------------------------------------------------
>
>                 Key: IGNITE-22971
>                 URL: https://issues.apache.org/jira/browse/IGNITE-22971
>             Project: Ignite
>          Issue Type: Improvement
>            Reporter: Aleksandr Polovtsev
>            Assignee: Aleksandr Polovtsev
>            Priority: Minor
>              Labels: ignite-3
>
> If a Raft client tries to access a node that is not present in the physical 
> topology, the following error is printed to the log:
> {code}
> Recoverable error during the request occurred (will be retried on the 
> randomly selected node) [request=class 
> org.apache.ignite.raft.jraft.rpc.GetLeaderRequestImpl, peer=Peer 
> [consistentId=iest_teasd_2, idx=0], newPeer=Peer [consistentId=iest_teasd_1, 
> idx=0]].
> java.util.concurrent.CompletionException: java.net.ConnectException: Peer 
> ijst_n_0 is unavailable
>                               at 
> java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:331)
>  ~[?:?]
>                               at 
> java.base/java.util.concurrent.CompletableFuture.uniComposeStage(CompletableFuture.java:1099)
>  ~[?:?]
>                               at 
> java.base/java.util.concurrent.CompletableFuture.thenCompose(CompletableFuture.java:2235)
>  ~[?:?]
>                               at 
> org.apache.ignite.internal.raft.RaftGroupServiceImpl.sendWithRetry(RaftGroupServiceImpl.java:566)
>  ~[ignite-raft-9.0.127-SNAPSHOT.jar:?]
>                               at 
> org.apache.ignite.internal.raft.RaftGroupServiceImpl.lambda$handleThrowable$41(RaftGroupServiceImpl.java:613)
>  ~[ignite-raft-9.0.127-SNAPSHOT.jar:?]
>                               at 
> java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
>  [?:?]
>                               at 
> java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
>                               at 
> java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
>  [?:?]
>                               at 
> java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
>  [?:?]
>                               at 
> java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
>  [?:?]
>                               at 
> java.base/java.lang.Thread.run(Thread.java:834) [?:?]
>                        Caused by: java.net.ConnectException: Peer ijst_n_0 is 
> unavailable
>                               at 
> org.apache.ignite.internal.raft.RaftGroupServiceImpl.resolvePeer(RaftGroupServiceImpl.java:814)
>  ~[ignite-raft-9.0.127-SNAPSHOT.jar:?]
>                               at 
> org.apache.ignite.internal.raft.RaftGroupServiceImpl.sendWithRetry(RaftGroupServiceImpl.java:565)
>  ~[ignite-raft-9.0.127-SNAPSHOT.jar:?]
>                               ... 7 more
> {code}
> There are two problems: the exception is wrapped into a 
> {{CompletionException}} and the exception itself is a {{ConnectException}} 
> that we create down the same chain of method calls, which means that this 
> stacktrace is always the same and does not bring any useful information.
> I propose to use a special exception in this case, which does not fill its 
> stacktrace, so that the log will look like this:
> {code}
> Recoverable error during the request occurred (will be retried on the 
> randomly selected node) [request=class 
> org.apache.ignite.raft.jraft.rpc.GetLeaderRequestImpl, peer=Peer 
> [consistentId=iest_teasd_2, idx=0], newPeer=Peer [consistentId=iest_teasd_1, 
> idx=0]].
>  
> org.apache.ignite.internal.raft.RaftGroupServiceImpl$PeerUnavailableException:
>  Peer iest_teasd_2 is unavailable
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to