sanpwc commented on code in PR #2488:
URL: https://github.com/apache/ignite-3/pull/2488#discussion_r1318351202


##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/replicator/PartitionReplicaListener.java:
##########
@@ -2328,19 +2345,25 @@ private CompletableFuture<Boolean> 
ensureReplicaIsPrimary(ReplicaRequest request
         }
 
         if (expectedTerm != null) {
-            return raftClient.refreshAndGetLeaderWithTerm()
-                    .thenCompose(replicaAndTerm -> {
-                                long currentTerm = replicaAndTerm.term();
-
-                                if (expectedTerm == currentTerm) {
-                                    return completedFuture(null);
+            return placementDriver.getPrimaryReplica(replicationGroupId, 
hybridClock.now().addPhysicalTime(HybridTimestamp.CLOCK_SKEW))
+                    .thenCompose(primaryReplica -> {
+                                long currentEnlistmentConsistencyToken = 
primaryReplica.getStartTime().longValue();
+
+                                if 
(expectedTerm.equals(currentEnlistmentConsistencyToken)) {
+                                    if 
(primaryReplica.getExpirationTime().before(hybridClock.now())) {
+                                        return failedFuture(
+                                                new 
PrimaryReplicaMissException(expectedTerm, currentEnlistmentConsistencyToken));

Review Comment:
   Yep, added https://issues.apache.org/jira/browse/IGNITE-20377



-- 
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

Reply via email to