korlov42 commented on code in PR #2241:
URL: https://github.com/apache/ignite-3/pull/2241#discussion_r1246229842


##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/ExecutionServiceImpl.java:
##########
@@ -826,45 +826,69 @@ private void enlist(SourceAwareIgniteRel rel) {
 
         private CompletableFuture<Void> close(boolean cancel) {
             if (!cancelled.compareAndSet(false, true)) {
-                return cancelFut.thenApply(Function.identity());
+                return cancelFut;
             }
 
             CompletableFuture<Void> start = closeExecNode(cancel);
 
-            start
-                    .thenCompose(tmp -> {
-                        CompletableFuture<Void> cancelResult = coordinator
-                                ? awaitFragmentInitialisationAndClose()
-                                : closeLocalFragments();
+            start.thenCompose(tmp -> {
+                CompletableFuture<Void> cancelResult = coordinator
+                        ? awaitFragmentInitialisationAndClose()
+                        : closeLocalFragments();
 
-                        var finalStepFut = cancelResult.whenComplete((r, e) -> 
{
-                            queryManagerMap.remove(ctx.queryId());
+                var finalStepFut = cancelResult.whenComplete((r, e) -> {
+                    if (e != null) {
+                        Throwable ex = unwrapCause(e);
 
-                            try {
-                                ctx.cancel().cancel();
-                            } catch (Exception ignored) {
-                                // NO-OP
-                            }
+                        LOG.warn("Exception raised during close", ex);
+                    }
 
-                            cancelFut.complete(null);
-                        });
+                    queryManagerMap.remove(ctx.queryId());
 
-                        return cancelResult.thenCombine(finalStepFut, (none1, 
none2) -> null);
-                    });
+                    ctx.cancel().cancel();
+
+                    cancelFut.complete(null);
+                });
+
+                return cancelResult.thenCombine(finalStepFut, (none1, none2) 
-> null);
+            })
+                    .thenRun(() -> localFragments.forEach(f -> 
f.context().cancel()));

Review Comment:
   any reason to reformat this part?



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