sanpwc commented on code in PR #2488: URL: https://github.com/apache/ignite-3/pull/2488#discussion_r1318356739
########## modules/table/src/main/java/org/apache/ignite/internal/table/distributed/storage/InternalTableImpl.java: ########## @@ -1553,19 +1559,20 @@ public void close() { * @return Cluster node to evalute read-only request. */ protected CompletableFuture<ClusterNode> evaluateReadOnlyRecipientNode(int partId) { - RaftGroupService svc = raftGroupServiceByPartitionId.get(partId); + TablePartitionId tablePartitionId = new TablePartitionId(tableId, partId); - return svc.refreshAndGetLeaderWithTerm().handle((res, e) -> { - if (e != null) { - throw withCause(TransactionException::new, REPLICA_UNAVAILABLE_ERR, e); - } else { - if (res == null || res.leader() == null) { - throw withCause(TransactionException::new, REPLICA_UNAVAILABLE_ERR, e); - } else { - return clusterNodeResolver.apply(res.leader().consistentId()); - } - } - }); + return placementDriver.awaitPrimaryReplica(tablePartitionId, clock.now()) + .orTimeout(AWAIT_PRIMARY_REPLICA_TIMEOUT, TimeUnit.SECONDS).handle((res, e) -> { + if (e != null) { + throw withCause(TransactionException::new, REPLICA_UNAVAILABLE_ERR, e); + } else { + if (res == null || res.getLeaseholder() == null) { Review Comment: `|| res.getLeaseholder() == null` removed. -- 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