sanpwc commented on code in PR #2079:
URL: https://github.com/apache/ignite-3/pull/2079#discussion_r1197696774


##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/storage/InternalTableImpl.java:
##########
@@ -1408,8 +1408,12 @@ private void scanBatch(int n) {
 
                     if (binaryRows.size() < n) {
                         cancel();
-                    } else if 
(requestedItemsCnt.addAndGet(Math.negateExact(binaryRows.size())) > 0) {
-                        scanBatch(Math.min(n, INTERNAL_BATCH_SIZE));
+                    } else {
+                        long remaining = 
requestedItemsCnt.addAndGet(Math.negateExact(binaryRows.size()));
+
+                        if (remaining > 0) {
+                            scanBatch((int) Math.min(remaining, 
INTERNAL_BATCH_SIZE));

Review Comment:
   I believe that it's not correct to request remaining if user specified n < 
INTERNAL_BATCH_SIZE, so it's actually should be `Math.min(Math.min(remaining, 
n), INTERNAL_BATCH_SIZE);` What do you think?



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