denis-chudov commented on code in PR #4329:
URL: https://github.com/apache/ignite-3/pull/4329#discussion_r1755011204
##########
modules/placement-driver/src/main/java/org/apache/ignite/internal/placementdriver/LeaseUpdater.java:
##########
@@ -230,23 +253,60 @@ private CompletableFuture<Boolean>
denyLease(ReplicationGroupId grpId, Lease lea
Collection<Lease> leases = leasesCurrent.leaseByGroupId().values();
+ return denyLeaseImMetaStorage(deniedLease, leases,
leasesCurrent.leasesBytes());
+ }
+
+ private CompletableFuture<Boolean> denyLeaseImMetaStorage(
+ Lease deniedLease,
+ Collection<Lease> currentLeases,
+ byte[] currentLeasesBytes
+ ) {
+ ByteArray key = PLACEMENTDRIVER_LEASES_KEY;
+
+ IgniteBiTuple<List<Lease>, Boolean> renewedLeasesTup =
replaceLeaseInCollection(currentLeases, deniedLease);
+
+ if (!renewedLeasesTup.get2()) {
+ return falseCompletedFuture();
+ } else {
+ return msManager.invoke(
+ or(notExists(key), value(key).eq(currentLeasesBytes)),
+ put(key, new LeaseBatch(renewedLeasesTup.get1()).bytes()),
+ noop()
+ ).thenCompose(res -> {
+ if (res) {
+ return trueCompletedFuture();
+ } else {
+ return refreshLeasesFromMetaStorage()
Review Comment:
reworked to client side retries
--
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]