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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]