rpuch commented on code in PR #5774:
URL: https://github.com/apache/ignite-3/pull/5774#discussion_r2084322948


##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java:
##########
@@ -689,33 +696,48 @@ private CompletableFuture<Boolean> 
beforeZoneReplicaStarted(LocalPartitionReplic
                 .thenCompose(v -> {
                     ZonePartitionId zonePartitionId = 
parameters.zonePartitionId();
 
-                    Set<TableImpl> zoneTables = 
zoneTablesRawSet(zonePartitionId.zoneId());
-
-                    int partitionIndex = zonePartitionId.partitionId();
-                    PartitionSet singlePartitionIdSet = 
PartitionSet.of(partitionIndex);
-
-                    CompletableFuture<?>[] futures = zoneTables.stream()
-                            .map(tbl -> inBusyLockAsync(busyLock, () -> {
-                                return getOrCreatePartitionStorages(tbl, 
singlePartitionIdSet)
-                                        .thenRun(() -> {
-                                            localPartsByTableId.compute(
-                                                    tbl.tableId(),
-                                                    (tableId, oldPartitionSet) 
-> extendPartitionSet(oldPartitionSet, partitionIndex)
-                                            );
-                                        })
-                                        .thenRunAsync(() -> 
inBusyLock(busyLock, () -> {
-                                            
lowWatermark.getLowWatermarkSafe(lwm ->
-                                                    
registerIndexesToTable(tbl, catalogService, singlePartitionIdSet, 
tbl.schemaView(), lwm)
-                                            );
-
-                                            
preparePartitionResourcesAndLoadToZoneReplica(tbl, zonePartitionId, false);
-                                        }), ioExecutor)
-                                        // If the table is already closed, 
it's not a problem (probably the node is stopping).
-                                        
.exceptionally(ignoreTableClosedException());
-                            }))
-                            .toArray(CompletableFuture[]::new);
+                    StampedLock zoneLock = 
tablesPerZoneLocks.computeIfAbsent(zonePartitionId.zoneId(), id -> new 
StampedLock());

Review Comment:
   Could you please switch to async RW locks? Long-term locks that block 
threads cause problems



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