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

larsh pushed a commit to branch 5.1
in repository https://gitbox.apache.org/repos/asf/phoenix.git


The following commit(s) were added to refs/heads/5.1 by this push:
     new 4d8c976  PHOENIX-6436 OrderedResultIterator overestimates memory 
requirements.
4d8c976 is described below

commit 4d8c976841bcc37dc455a0b64c3766dab4f76934
Author: Lars <[email protected]>
AuthorDate: Sun Apr 4 15:42:54 2021 -0700

    PHOENIX-6436 OrderedResultIterator overestimates memory requirements.
---
 .../main/java/org/apache/phoenix/iterate/OrderedResultIterator.java    | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/iterate/OrderedResultIterator.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/iterate/OrderedResultIterator.java
index edc7cc0..ac05d02 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/iterate/OrderedResultIterator.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/iterate/OrderedResultIterator.java
@@ -197,7 +197,8 @@ public class OrderedResultIterator implements 
PeekingResultIterator {
         // Make sure we don't overflow Long, though this is really unlikely to 
happen.
         assert(limit == null || Long.MAX_VALUE / estimatedEntrySize >= limit + 
this.offset);
 
-        this.estimatedByteSize = limit == null ? 0 : (limit + this.offset) * 
estimatedEntrySize;
+        // Both BufferedSortedQueue and SizeBoundQueue won't allocate more 
than thresholdBytes.
+        this.estimatedByteSize = limit == null ? 0 : Math.min((limit + 
this.offset) * estimatedEntrySize, thresholdBytes);
         this.pageSizeMs = pageSizeMs;
     }
 

Reply via email to