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

[GitHub] [ignite-3] sanpwc commented on a diff in pull request #2079: IGNITE-19278 Multiple partition scan requests return an unexpected number of rows.

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: notifications-unsubscribe@ignite.apache.org

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