apurtell opened a new pull request, #2668:
URL: https://github.com/apache/phoenix/pull/2668

   Global index scans executing Top-N queries can incur an unnecessary 
round-trip per region following 
[PHOENIX-7707](https://issues.apache.org/jira/browse/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](https://issues.apache.org/jira/browse/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 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