SammyVimes commented on code in PR #2177:
URL: https://github.com/apache/ignite-3/pull/2177#discussion_r1230543701


##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java:
##########
@@ -2337,32 +2389,49 @@ private static PeersAndLearners 
configurationFromAssignments(Collection<Assignme
     }
 
     /**
-     * Creates partition stores. If one of the storages has not completed the 
rebalance, then the storages are cleared.
+     * Gets partition stores.
      *
      * @param table Table.
      * @param partitionId Partition ID.
-     * @return Future of creating or getting partition stores.
+     * @return PartitionStorages.
      */
-    // TODO: IGNITE-18939 Create storages only once, then only get them
-    private CompletableFuture<PartitionStorages> 
getOrCreatePartitionStorages(TableImpl table, int partitionId) {
+    private PartitionStorages getPartitionStorages(TableImpl table, int 
partitionId) {
         InternalTable internalTable = table.internalTable();
 
         MvPartitionStorage mvPartition = 
internalTable.storage().getMvPartition(partitionId);
 
-        return (mvPartition != null ? completedFuture(mvPartition) : 
internalTable.storage().createMvPartition(partitionId))
-                .thenComposeAsync(mvPartitionStorage -> {
-                    TxStateStorage txStateStorage = 
internalTable.txStateStorage().getOrCreateTxStateStorage(partitionId);
+        assert mvPartition != null;
 
-                    if (mvPartitionStorage.persistedIndex() == 
MvPartitionStorage.REBALANCE_IN_PROGRESS
-                            || txStateStorage.persistedIndex() == 
TxStateStorage.REBALANCE_IN_PROGRESS) {
-                        return allOf(
-                                
internalTable.storage().clearPartition(partitionId),
-                                txStateStorage.clear()
-                        ).thenApply(unused -> new 
PartitionStorages(mvPartitionStorage, txStateStorage));
-                    } else {
-                        return completedFuture(new 
PartitionStorages(mvPartitionStorage, txStateStorage));
-                    }
-                }, ioExecutor);
+        TxStateStorage txStateStorage = 
internalTable.txStateStorage().getTxStateStorage(partitionId);
+
+        assert txStateStorage != null;
+
+        return new PartitionStorages(mvPartition, txStateStorage);
+    }
+
+    private CompletableFuture<Void> createPartitionStorages(TableImpl table, 
PartitionSet partitions) {

Review Comment:
   This is not in the scope of this ticket, however it will be done in the 
consequent ticket



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