Lalant commented on code in PR #7379:
URL: https://github.com/apache/ignite-3/pull/7379#discussion_r2697968316


##########
modules/replicator/src/main/java/org/apache/ignite/internal/replicator/PlacementDriverMessageProcessor.java:
##########
@@ -172,15 +175,13 @@ private CompletableFuture<LeaseGrantedMessageResponse> 
processLeaseGrantedMessag
                     assert leaseExpirationTime == null || 
clockService.after(msg.leaseExpirationTime(), leaseExpirationTime)
                             : "Invalid lease expiration time in message, msg=" 
+ msg;
 
+                    Supplier<CompletableFuture<Void>> 
waitForStateAndSendPrimaryReplicaChanged =

Review Comment:
   There was repeating code in the if/else underneath, but here it's better to 
use method, I think you are proposing this in the next comment.



##########
modules/replicator/src/main/java/org/apache/ignite/internal/replicator/PlacementDriverMessageProcessor.java:
##########
@@ -172,15 +175,13 @@ private CompletableFuture<LeaseGrantedMessageResponse> 
processLeaseGrantedMessag
                     assert leaseExpirationTime == null || 
clockService.after(msg.leaseExpirationTime(), leaseExpirationTime)
                             : "Invalid lease expiration time in message, msg=" 
+ msg;
 
+                    Supplier<CompletableFuture<Void>> 
waitForStateAndSendPrimaryReplicaChanged =
+                            () -> 
getWaitForStateAndSendPrimaryReplicaChanged(msg);
+
                     if (msg.force()) {
                         // Replica must wait till storage index reaches the 
current leader's index to make sure that all updates made on the
                         // group leader are received.
-                        return waitForActualState(msg.leaseStartTime(), 
msg.leaseExpirationTime().getPhysical())
-                                .thenCompose(v -> 
sendPrimaryReplicaChangeToReplicationGroup(
-                                        msg.leaseStartTime().longValue(),
-                                        localNode.id(),
-                                        localNode.name()
-                                ))
+                        return waitForStateAndSendPrimaryReplicaChanged.get()

Review Comment:
   Done



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