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


##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java:
##########
@@ -2181,22 +2181,24 @@ private static PeersAndLearners 
configurationFromAssignments(Collection<Assignme
      */
     // TODO: IGNITE-18619 Maybe we should wait here to create indexes, if you 
add now, then the tests start to hang
     private CompletableFuture<PartitionStorages> 
getOrCreatePartitionStorages(TableImpl table, int partitionId) {
-        return CompletableFuture
-                .supplyAsync(() -> {
-                    MvPartitionStorage mvPartitionStorage = 
table.internalTable().storage().getOrCreateMvPartition(partitionId);
-                    TxStateStorage txStateStorage = 
table.internalTable().txStateStorage().getOrCreateTxStateStorage(partitionId);
+        InternalTable internalTable = table.internalTable();
+
+        MvPartitionStorage mvPartition = 
internalTable.storage().getMvPartition(partitionId);
+
+        return (mvPartition != null ? completedFuture(mvPartition) : 
internalTable.storage().createMvPartition(partitionId))

Review Comment:
   Only one thread should create storage, and receive the rest.
   
   On the one hand, we will be able to catch those who are trying to create 
tables in parallel and reduce the number of code, on the other hand, we can 
divide it into two methods and use it correctly. Well, or store a map with 
storage futures and create them lazily.
   
   wdyt?



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

Reply via email to