This is an automated email from the ASF dual-hosted git repository.

korlov 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 52187f657a IGNITE-23734 Sql. Fix race in RootNode between requesting 
first batch and exceptional termination (#4786)
52187f657a is described below

commit 52187f657ac4b1470c8fb9ed9baeade22a63c038
Author: korlov42 <[email protected]>
AuthorDate: Tue Nov 26 11:53:33 2024 +0200

    IGNITE-23734 Sql. Fix race in RootNode between requesting first batch and 
exceptional termination (#4786)
---
 .../ignite/internal/sql/engine/exec/rel/AsyncRootNode.java   | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git 
a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/rel/AsyncRootNode.java
 
b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/rel/AsyncRootNode.java
index c8f7322be1..9490d6d991 100644
--- 
a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/rel/AsyncRootNode.java
+++ 
b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/rel/AsyncRootNode.java
@@ -124,15 +124,15 @@ public class AsyncRootNode<InRowT, OutRowT> implements 
Downstream<InRowT>, Async
     public CompletableFuture<BatchedResult<OutRowT>> requestNextAsync(int 
rows) {
         CompletableFuture<BatchedResult<OutRowT>> next = new 
CompletableFuture<>();
 
-        Throwable t = ex.get();
+        synchronized (lock) {
+            Throwable t = ex.get();
 
-        if (t != null) {
-            next.completeExceptionally(t);
+            if (t != null) {
+                next.completeExceptionally(t);
 
-            return next;
-        }
+                return next;
+            }
 
-        synchronized (lock) {
             if (closed) {
                 next.completeExceptionally(new CursorClosedException());
 

Reply via email to