You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by la...@apache.org on 2021/04/05 06:19:33 UTC

[phoenix] branch 4.x updated: PHOENIX-6436 OrderedResultIterator overestimates memory requirements.

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

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


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

commit 5c57004e2717736370aaec208112e197940e5cc2
Author: Lars <la...@apache.org>
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 bb0607c..4179730 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
@@ -196,7 +196,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;
     }