Andrew Kyle Purtell created PHOENIX-8056:
--------------------------------------------

             Summary: Top-N queries incur an unnecessary round-trip per region
                 Key: PHOENIX-8056
                 URL: https://issues.apache.org/jira/browse/PHOENIX-8056
             Project: Phoenix
          Issue Type: Bug
          Components: core
    Affects Versions: 5.3.2
            Reporter: Andrew Kyle Purtell
            Assignee: Andrew Kyle Purtell
             Fix For: 5.4.0, 5.3.3


Global index scans executing Top-N queries can incur an unnecessary round-trip 
per region following PHOENIX-7707. During scanner initialization, range scans 
using the default read type that exceed {{hbase.storescanner.pread.max.bytes}} 
trigger HBase's {{returnImmediately}} flag (HBASE-20457) on the open scanner 
context. 

An extra RPC returns a buffered dummy tuple without advancing the delegate 
scanner. For uncovered index scans, this inflated communication costs to three 
RPCs per region where two should suffice.

To eliminate the redundant network hop, the scanner lifecycle adopts an eager 
"pull-first" strategy on all invocations after the initial call whenever a 
dummy tuple is held.

This change also corrects tenant memory tracking during deferred aggregation. 
Previously, the Top-N memory chunk size was determined from the iterator's byte 
size after fetching the first tuple. When that first tuple was an incomplete 
dummy due to early pagination, the byte size registered as zero and was never 
subsequently adjusted. As a result, scans that paged out during scanner open 
held a 0-byte memory reservation for the entire Top-N heap.

The the fix is to recalculate and resize the allocation chunk once when the 
build actually concludes, either upon consuming the first real tuple or upon 
exhausting the scan.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to