You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "AMashenkov (via GitHub)" <gi...@apache.org> on 2023/04/26 08:14:51 UTC

[GitHub] [ignite-3] AMashenkov commented on a diff in pull request #1980: IGNITE-17685 Sql. SQL engine should send messages asynchronously

AMashenkov commented on code in PR #1980:
URL: https://github.com/apache/ignite-3/pull/1980#discussion_r1177507705


##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/ExecutionServiceImpl.java:
##########
@@ -467,15 +467,22 @@ private void sendFragment(
                     .schemaVersion(ctx.schemaVersion())
                     .build();
 
-            var fut = new CompletableFuture<Void>();
-            remoteFragmentInitCompletion.put(new RemoteFragmentKey(targetNodeName, fragment.fragmentId()), fut);
+            CompletableFuture<Void> remoteFragmentInitializationCompletionFuture = new CompletableFuture<>();
 
-            try {
-                messageService.send(targetNodeName, req);
-            } catch (Exception ex) {
-                fut.complete(null);
+            remoteFragmentInitCompletion.put(
+                    new RemoteFragmentKey(targetNodeName, fragment.fragmentId()),
+                    remoteFragmentInitializationCompletionFuture
+            );
 
-                throw ex;
+            try {
+                return messageService.send(targetNodeName, request);
+            } catch (Throwable th) {
+                // it's not expected MessageService to throw any exception, yet it may be possible
+                // due to unpredictable side effects of different implementations. To avoid blocking
+                // of node on stopping, let's complete initialization future.
+                remoteFragmentInitializationCompletionFuture.complete(null);

Review Comment:
   Should we also remove future from remoteFragmentInitCompletion map if exception is re-thrown.



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