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


##########
modules/index/build.gradle:
##########
@@ -81,6 +81,7 @@ dependencies {
     integrationTestImplementation testFixtures(project(':ignite-table'))
     integrationTestImplementation testFixtures(project(':ignite-storage-api'))
     integrationTestImplementation testFixtures(project(':ignite-catalog'))
+    integrationTestImplementation testFixtures(project(':ignite-replicator'))

Review Comment:
   Why do we need this dependency? 



##########
modules/partition-replicator/src/main/java/org/apache/ignite/internal/partition/replicator/PartitionReplicaLifecycleManager.java:
##########
@@ -967,19 +1008,63 @@ private CompletableFuture<Void> changePeersOnRebalance(
 
                                 PeersAndLearners newConfiguration = 
fromAssignments(pendingAssignments);
 
-                                CompletableFuture<Void> voidCompletableFuture 
= partGrpSvc.changePeersAsync(newConfiguration,
+                                CompletableFuture<Void> voidCompletableFuture 
= raftClient.changePeersAsync(newConfiguration,
                                         leaderWithTerm.term()).exceptionally(e 
-> {
                                             return null;
                                         });
                                 return voidCompletableFuture;
                             });
-                });
+                }));
     }
 
     private boolean isLocalPeer(Peer peer) {
         return peer.consistentId().equals(localNode().name());
     }
 
+    private boolean isLocalNodeInAssignments(Collection<Assignment> 
assignments) {
+        return assignments.stream().anyMatch(isLocalNodeAssignment);
+    }
+
+    private CompletableFuture<Boolean> 
isLocalNodeLeaseholder(ReplicationGroupId replicationGroupId) {

Review Comment:
   Could you please add javadoc explaning contract of the method. Especially 
it's important to clarify how do we evaluate base timestamp for leaseholder 
detection. 



##########
modules/partition-replicator/src/main/java/org/apache/ignite/internal/partition/replicator/PartitionReplicaLifecycleManager.java:
##########
@@ -190,6 +205,9 @@ public PartitionReplicaLifecycleManager(
         this.lowWatermark = lowWatermark;
         this.ioExecutor = ioExecutor;
         this.rebalanceScheduler = rebalanceScheduler;
+        this.clockService = clockService;
+        // should it be ExecutorInclinedPlacementDriver as in TableManager?

Review Comment:
   Yes it should. And don't forget to remove the comment.



##########
modules/partition-replicator/src/main/java/org/apache/ignite/internal/partition/replicator/PartitionReplicaLifecycleManager.java:
##########
@@ -967,19 +1008,63 @@ private CompletableFuture<Void> changePeersOnRebalance(
 
                                 PeersAndLearners newConfiguration = 
fromAssignments(pendingAssignments);
 
-                                CompletableFuture<Void> voidCompletableFuture 
= partGrpSvc.changePeersAsync(newConfiguration,
+                                CompletableFuture<Void> voidCompletableFuture 
= raftClient.changePeersAsync(newConfiguration,
                                         leaderWithTerm.term()).exceptionally(e 
-> {
                                             return null;
                                         });
                                 return voidCompletableFuture;
                             });
-                });
+                }));
     }
 
     private boolean isLocalPeer(Peer peer) {
         return peer.consistentId().equals(localNode().name());
     }
 
+    private boolean isLocalNodeInAssignments(Collection<Assignment> 
assignments) {
+        return assignments.stream().anyMatch(isLocalNodeAssignment);
+    }
+
+    private CompletableFuture<Boolean> 
isLocalNodeLeaseholder(ReplicationGroupId replicationGroupId) {

Review Comment:
   I'd rather use isLocalNodeIsPrimary instead of "...Leaseholder".



##########
modules/partition-replicator/src/main/java/org/apache/ignite/internal/partition/replicator/PartitionReplicaLifecycleManager.java:
##########
@@ -180,8 +195,8 @@ public PartitionReplicaLifecycleManager(
             TopologyService topologyService,
             LowWatermark lowWatermark,
             ExecutorService ioExecutor,
-            ScheduledExecutorService rebalanceScheduler
-    ) {
+            ScheduledExecutorService rebalanceScheduler,
+            ClockService clockService, PlacementDriver placementDriver) {

Review Comment:
   One at a row, please. Please also move `) { `to a separate row.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to