You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vp...@apache.org on 2022/11/17 09:27:52 UTC
[ignite-3] branch main updated: IGNITE-18181 Fixed race during table creation (#1351)
This is an automated email from the ASF dual-hosted git repository.
vpyatkov pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git
The following commit(s) were added to refs/heads/main by this push:
new 3afbef5076 IGNITE-18181 Fixed race during table creation (#1351)
3afbef5076 is described below
commit 3afbef50768d5b4858498f2fc20c4743675fa669
Author: Roman Puchkovskiy <ro...@gmail.com>
AuthorDate: Thu Nov 17 13:27:48 2022 +0400
IGNITE-18181 Fixed race during table creation (#1351)
---
.../ignite/internal/table/distributed/TableManager.java | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java b/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java
index 163d4f60de..8b62691b85 100644
--- a/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java
+++ b/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java
@@ -680,6 +680,9 @@ public class TableManager extends Producer<TableEvent, TableEventParameters> imp
int partitions = newAssignments.size();
CompletableFuture<?>[] futures = new CompletableFuture<?>[partitions];
+ for (int i = 0; i < futures.length; i++) {
+ futures[i] = new CompletableFuture<>();
+ }
// TODO: IGNITE-16288 directAssignments should use async configuration API
CompletableFuture<List<Set<ClusterNode>>> assignmentsLatestFut = CompletableFuture.supplyAsync(() -> inBusyLock(busyLock, () ->
@@ -811,7 +814,7 @@ public class TableManager extends Producer<TableEvent, TableEventParameters> imp
}), ioExecutor);
}
- futures[partId] = startGroupFut
+ startGroupFut
.thenComposeAsync((v) -> {
try {
return raftMgr.startRaftGroupService(replicaGrpId, newPartAssignmentIds);
@@ -870,9 +873,16 @@ public class TableManager extends Producer<TableEvent, TableEventParameters> imp
LOG.warn("Unable to update raft groups on the node", th);
return null;
+ })
+ .whenComplete((res, ex) -> {
+ if (ex != null) {
+ futures[partId].completeExceptionally(ex);
+ } else {
+ futures[partId].complete(null);
+ }
});
- return completedFuture(tablesById);
+ return futures[partId].thenApply(unused -> tablesById);
});
}