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


##########
modules/placement-driver/src/main/java/org/apache/ignite/internal/placementdriver/LeaseUpdater.java:
##########
@@ -207,17 +215,25 @@ public void deactivate() {
      * @return Future completes true when the lease will not prolong in the 
future, false otherwise.
      */
     public CompletableFuture<Boolean> denyLease(ReplicationGroupId grpId, 
Lease lease) {
-        var leaseKey = ByteArray.fromString(PLACEMENTDRIVER_PREFIX + grpId);
-
-        byte[] leaseRaw = lease.bytes();
-
         Lease deniedLease = lease.denyLease();
 
         leaseNegotiator.onLeaseRemoved(grpId);
 
+        Collection<Lease> leases = leaseTracker.leasesCurrent();
+        List<Lease> renewedLeases = new ArrayList<>();
+        for (Lease ls : leases) {
+            if (ls.replicationGroupId().equals(grpId)) {
+                renewedLeases.add(deniedLease);
+            } else {
+                renewedLeases.add(ls);
+            }
+        }
+
+        var key = PLACEMENTDRIVER_LEASES_KEY;
+
         return msManager.invoke(
-                value(leaseKey).eq(leaseRaw),
-                put(leaseKey, deniedLease.bytes()),
+                or(notExists(key), value(key).eq(new 
LeaseBatch(leaseTracker.leasesCurrent()).bytes())),
+                put(key, new LeaseBatch(renewedLeases).bytes()),

Review Comment:
   here different collections are serialized



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