sanpwc commented on code in PR #4446: URL: https://github.com/apache/ignite-3/pull/4446#discussion_r1871891119
########## modules/table/src/main/java/org/apache/ignite/internal/table/distributed/replicator/PartitionReplicaListener.java: ########## @@ -589,6 +602,67 @@ private CompletableFuture<Void> processTxRecoveryMessage(TxRecoveryMessage reque return triggerTxRecovery(txId, senderId); } + private CompletableFuture<Void> processChangePeersAndLearnersReplicaRequest(ChangePeersAndLearnersAsyncReplicaRequest request) { + TablePartitionId replicaGrpId = (TablePartitionId) request.groupId().asReplicationGroupId(); + + RaftGroupService raftClient = raftCommandRunner instanceof RaftGroupService + ? (RaftGroupService) raftCommandRunner + : ((RaftGroupService) ((ExecutorInclinedRaftCommandRunner) raftCommandRunner).decoratedCommandRunner()); + + return raftClient.refreshAndGetLeaderWithTerm() + .exceptionally(throwable -> { + throwable = unwrapCause(throwable); + + if (throwable instanceof TimeoutException) { + LOG.info( + "Node couldn't get the leader within timeout so the changing peers is skipped [grp={}].", + replicaGrpId + ); + + return LeaderWithTerm.NO_LEADER; + } + + throw new IgniteInternalException( + INTERNAL_ERR, + "Failed to get a leader for the RAFT replication group [get=" + replicaGrpId + "].", + throwable + ); + }) + .thenCompose(leaderWithTerm -> { + if (leaderWithTerm.isEmpty() || !isTokenStillValidPrimary(request.enlistmentConsistencyToken())) { + return nullCompletedFuture(); Review Comment: Let's log it with [DEBUG] level I guess. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@ignite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org