denis-chudov commented on code in PR #4798:
URL: https://github.com/apache/ignite-3/pull/4798#discussion_r1868289269


##########
modules/placement-driver/src/main/java/org/apache/ignite/internal/placementdriver/LeaseUpdater.java:
##########
@@ -535,6 +542,24 @@ private void updateLeaseBatchInternal() {
                 );
             }
 
+            leasesCurrent.leaseByGroupId().forEach(renewedLeases::putIfAbsent);
+
+            for (Iterator<Entry<ReplicationGroupId, Lease>> iter = 
renewedLeases.entrySet().iterator(); iter.hasNext(); ) {
+                Map.Entry<ReplicationGroupId, Lease> entry = iter.next();
+                ReplicationGroupId groupId = entry.getKey();
+                Lease lease = entry.getValue();
+
+                if (clockService.before(lease.getExpirationTime(), currentTime)
+                        && 
!groupsAmongCurrentStableAndPendingAssignments.contains(groupId)) {
+                    iter.remove();
+                } else if (prolongableLeaseGroupIds.contains(groupId)
+                        && 
!lease.getExpirationTime().equals(newExpirationTimestamp)) {
+                    entry.setValue(prolongLease(groupId, lease, null, 
newExpirationTimestamp));
+                }
+            }
+
+            byte[] renewedValue = new 
LeaseBatch(renewedLeases.values()).bytes();
+
             if (Arrays.equals(leasesCurrent.leasesBytes(), renewedValue)) {

Review Comment:
   No, the meaning of this `if` is to remove excessive invokes. If the final 
renewed value differs from leasesCurrent, then invoke makes sense, otherwise 
not.
   It should be fixed in another way.



##########
modules/placement-driver/src/main/java/org/apache/ignite/internal/placementdriver/LeaseUpdater.java:
##########
@@ -535,6 +542,24 @@ private void updateLeaseBatchInternal() {
                 );
             }
 
+            leasesCurrent.leaseByGroupId().forEach(renewedLeases::putIfAbsent);
+
+            for (Iterator<Entry<ReplicationGroupId, Lease>> iter = 
renewedLeases.entrySet().iterator(); iter.hasNext(); ) {
+                Map.Entry<ReplicationGroupId, Lease> entry = iter.next();
+                ReplicationGroupId groupId = entry.getKey();
+                Lease lease = entry.getValue();
+
+                if (clockService.before(lease.getExpirationTime(), currentTime)
+                        && 
!groupsAmongCurrentStableAndPendingAssignments.contains(groupId)) {
+                    iter.remove();
+                } else if (prolongableLeaseGroupIds.contains(groupId)
+                        && 
!lease.getExpirationTime().equals(newExpirationTimestamp)) {

Review Comment:
   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

Reply via email to