This is an automated email from the ASF dual-hosted git repository.

sk0x50 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git


The following commit(s) were added to refs/heads/main by this push:
     new 3f0316c85fc IGNITE-25468 Fix TableManager.tablesPerZoneLocks releasing 
(#5892)
3f0316c85fc is described below

commit 3f0316c85fc2062a4e642c88d8d703c08de26c16
Author: Slava Koptilin <[email protected]>
AuthorDate: Fri May 23 15:06:02 2025 +0300

    IGNITE-25468 Fix TableManager.tablesPerZoneLocks releasing (#5892)
---
 .../internal/table/distributed/TableManager.java   | 25 ++++++++++------------
 1 file changed, 11 insertions(+), 14 deletions(-)

diff --git 
a/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java
 
b/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java
index d979ce6ecd2..91f01fcd62e 100644
--- 
a/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java
+++ 
b/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java
@@ -712,11 +712,10 @@ public class TableManager implements 
IgniteTablesInternal, IgniteComponent {
                 return readLockAcquisitionFuture.thenCompose(stamp -> {
                     Set<TableImpl> zoneTables = 
zoneTablesRawSet(zonePartitionId.zoneId());
 
-                    return 
createPartitionsAndLoadResourcesToZoneReplica(zonePartitionId, zoneTables, 
parameters.onRecovery())
-                            .whenComplete((unused, t) -> 
zoneLock.unlockRead(stamp));
-                });
+                    return 
createPartitionsAndLoadResourcesToZoneReplica(zonePartitionId, zoneTables, 
parameters.onRecovery());
+                }).whenComplete((unused, t) -> 
readLockAcquisitionFuture.thenAccept(zoneLock::unlockRead));
             } catch (Throwable t) {
-                readLockAcquisitionFuture.whenComplete((stamp, ex) -> 
zoneLock.unlockRead(stamp));
+                readLockAcquisitionFuture.thenAccept(zoneLock::unlockRead);
 
                 return failedFuture(t);
             }
@@ -792,7 +791,7 @@ public class TableManager implements IgniteTablesInternal, 
IgniteComponent {
                 return allOf(futures);
             }).whenComplete((v, t) -> 
readLockAcquisitionFuture.thenAccept(zoneLock::unlockRead)).thenApply(v -> 
false);
         } catch (Throwable t) {
-            readLockAcquisitionFuture.whenComplete((stamp, ex) -> 
zoneLock.unlockRead(stamp));
+            readLockAcquisitionFuture.thenAccept(zoneLock::unlockRead);
 
             return failedFuture(t);
         }
@@ -827,10 +826,10 @@ public class TableManager implements 
IgniteTablesInternal, IgniteComponent {
                             .toArray(CompletableFuture[]::new);
 
                     return allOf(futures);
-                }).whenComplete((v, t) -> 
readLockAcquisitionFuture.thenAccept(zoneLock::unlockRead)).thenApply((unused) 
-> false);
-            });
+                });
+            }).whenComplete((v, t) -> 
readLockAcquisitionFuture.thenAccept(zoneLock::unlockRead)).thenApply((unused) 
-> false);
         } catch (Throwable t) {
-            readLockAcquisitionFuture.whenComplete((stamp, ex) -> 
zoneLock.unlockRead(stamp));
+            readLockAcquisitionFuture.thenAccept(zoneLock::unlockRead);
 
             return failedFuture(t);
         }
@@ -2903,12 +2902,10 @@ public class TableManager implements 
IgniteTablesInternal, IgniteComponent {
 
                 return allOf(stopReplicaAndDestroyFutures).whenComplete((res, 
th) -> {
                     tablesPerZone.getOrDefault(internalTable.zoneId(), 
emptySet()).remove(table);
-
-                    zoneLock.unlockWrite(stamp);
                 });
-            });
+            }).whenComplete((unused, t) -> 
writeLockAcquisitionFuture.thenAccept(zoneLock::unlockWrite));
         } catch (Throwable t) {
-            writeLockAcquisitionFuture.whenComplete((stamp, ex) -> 
zoneLock.unlockWrite(stamp));
+            writeLockAcquisitionFuture.thenAccept(zoneLock::unlockWrite);
 
             throw t;
         }
@@ -3307,7 +3304,7 @@ public class TableManager implements 
IgniteTablesInternal, IgniteComponent {
                 return res;
             }).get();
         } catch (Throwable t) {
-            readLockAcquisitionFuture.whenComplete((stamp, ex) -> 
zoneLock.unlockRead(stamp));
+            readLockAcquisitionFuture.thenAccept(zoneLock::unlockRead);
 
             if (t instanceof InterruptedException) {
                 Thread.currentThread().interrupt();
@@ -3355,7 +3352,7 @@ public class TableManager implements 
IgniteTablesInternal, IgniteComponent {
                 zoneLock.unlockWrite(stamp);
             }).get();
         } catch (Throwable t) {
-            writeLockAcquisitionFuture.whenComplete((stamp, ex) -> 
zoneLock.unlockWrite(stamp));
+            writeLockAcquisitionFuture.thenAccept(zoneLock::unlockWrite);
 
             if (t instanceof InterruptedException) {
                 Thread.currentThread().interrupt();

Reply via email to