You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2023/01/18 14:06:26 UTC

[GitHub] [ignite-3] tkalkirill commented on a diff in pull request #1545: IGNITE-18571 Fix busyLock usage in AbstractPageMemoryTableStorage and related

tkalkirill commented on code in PR #1545:
URL: https://github.com/apache/ignite-3/pull/1545#discussion_r1073578819


##########
modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/AbstractPageMemoryTableStorage.java:
##########
@@ -167,86 +180,94 @@ public CompletableFuture<Void> destroy() {
 
     @Override
     public AbstractPageMemoryMvPartitionStorage getOrCreateMvPartition(int partitionId) throws StorageException {
-        AbstractPageMemoryMvPartitionStorage partition = getMvPartition(partitionId);
+        return inBusyLock(busyLock, () -> {
+            AbstractPageMemoryMvPartitionStorage partition = getMvPartitionBusy(partitionId);
 
-        if (partition != null) {
-            return partition;
-        }
+            if (partition != null) {
+                return partition;
+            }
 
-        partition = createMvPartitionStorage(partitionId);
+            partition = createMvPartitionStorage(partitionId);
 
-        partition.start();
+            partition.start();
 
-        mvPartitions.set(partitionId, partition);
+            mvPartitions.set(partitionId, partition);
 
-        return partition;
+            return partition;
+        });
     }
 
     @Override
     public @Nullable AbstractPageMemoryMvPartitionStorage getMvPartition(int partitionId) {
-        assert started : "Storage has not started yet";

Review Comment:
   I think we no longer need this check, if we have not started, then field `AbstractPageMemoryTableStorage#mvPartitions` will be `null`.



-- 
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-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org