SammyVimes commented on code in PR #1666:
URL: https://github.com/apache/ignite-3/pull/1666#discussion_r1115312673
##########
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:
Can partition be created in a parallel thread at the same time, so that
getMvPartition returns null, but at the moment when we call `createMvPartition`
we already called it in another thread? Why can't we just use creation future
and return it?
--
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]