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


##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/rel/AsyncRootNode.java:
##########
@@ -255,11 +253,17 @@ private void flush() throws Exception {
             currentReq.fut.complete(new BatchedResult<>(currentReq.buff, 
hasMore == HasMore.YES));
         }
 
-        if (waiting == 0 && buff.isEmpty()) {
-            //noinspection NestedAssignment
-            source.request(waiting = IN_BUFFER_SIZE);
-        } else if (hasMore == HasMore.NO) {
-            closeAsync();
+        if (buff.isEmpty()) {
+            if (waiting == 0) {
+                //noinspection NestedAssignment
+                source.request(waiting = IN_BUFFER_SIZE);
+            } else if (waiting == -1) {
+                assert hasMore == HasMore.NO : hasMore;
+
+                closeAsync();
+            }
+        } else if (!pendingRequests.isEmpty()) {
+            source.context().execute(this::flush, source::onError);
         }

Review Comment:
   Why do you enqueue more than one flush task?
   Should it be
   ```suggestion
           } else if (!pendingRequests.isEmpty()) {
               scheduleTask();
           }
   ```



-- 
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-unsubscr...@ignite.apache.org

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

Reply via email to