You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2022/08/18 06:32:09 UTC

[GitHub] [ignite-3] vldpyatkov commented on a diff in pull request #1006: IGNITE-17428 fixed race between creating table and getting table, between creating schema and getting schema

vldpyatkov commented on code in PR #1006:
URL: https://github.com/apache/ignite-3/pull/1006#discussion_r948699639


##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java:
##########
@@ -1294,37 +1295,27 @@ public CompletableFuture<TableImpl> tableAsyncInternal(UUID id, boolean checkCon
 
         CompletableFuture<TableImpl> getTblFut = new CompletableFuture<>();
 
-        EventListener<TableEventParameters> clo = new EventListener<>() {
-            @Override
-            public CompletableFuture<Boolean> notify(@NotNull TableEventParameters parameters, @Nullable Throwable e) {
-                if (!id.equals(parameters.tableId())) {
-                    return completedFuture(false);
-                }
-
-                if (e == null) {
-                    tablesByIdVv.get(parameters.causalityToken()).thenRun(() -> getTblFut.complete(parameters.table()));
-                } else {
-                    getTblFut.completeExceptionally(e);
-                }
-
-                return completedFuture(true);
-            }
-
-            @Override
-            public void remove(@NotNull Throwable e) {
-                getTblFut.completeExceptionally(e);
+        IgniteTriConsumer<Long, Map<UUID, TableImpl>, Throwable> tablesListener = (token, tables, th) -> {
+            if (th == null) {
+                getTblFut.complete(tables.get(id));

Review Comment:
   You need to check that the completed change is applied to the table.
   I mean, you should be sure that tables.get(id) != null.



-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org