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:00:10 UTC

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

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


##########
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:
   Why don't why check whether the storage has been started anymore?



##########
modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/AbstractPageMemoryTableStorage.java:
##########
@@ -82,16 +87,20 @@ public TablesConfiguration tablesConfiguration() {
 
     @Override
     public void start() throws StorageException {
-        TableView tableView = tableCfg.value();
-
-        mvPartitions = new AtomicReferenceArray<>(tableView.partitions());
+        inBusyLock(busyLock, () -> {

Review Comment:
   Let's reference the busy lock in `inBusyLock()` method using the field directly instead of passing it via a parameter. We have only one busy lock in this object, so we can reference it directly. This will reduce the amount of syntactic noise.



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