bobhan1 opened a new pull request, #70859:
URL: https://github.com/apache/doris/pull/70859

   ### Background
   
   Cloud scans can prefetch data-page ranges while the foreground decodes 
pages, and consumed ranges can feed asynchronous file-cache writeback. The 
current implementation enables this with a BE-wide switch and passes separate 
read-ahead resources alongside ordinary read options. Short-circuit point 
queries also use the same machinery for row-store and missing-column reads.
   
   ### What problem does this PR solve?
   
   Issue Number: None
   Related PR: #69982 (review feedback addressed here), #70563 (builds on), 
#67292 (introduced read-ahead)
   PR Type: Enhancement
   
   Problem Summary:
   
   Read-ahead setup reaches back from storage into QueryContext/ExecEnv, 
duplicates IO state in iterator interfaces, and enrolls point queries. This PR 
removes the point-query integration and carries scan read-ahead through a 
query-owned IOContext, controlled by the session variable 
`enable_query_read_ahead` with default `false`. The diff also removes the 
dedicated rowid APIs and tests, and migrates the scan/resource tests to the new 
interface. Existing BE-config users must explicitly enable the session variable 
after upgrading.
   
   ```sql
   SET enable_query_read_ahead = true;
   ```
   
   ### Details
   
   - **Change map:** Production: +447/-618 lines across 37 files; tests: 
+314/-369 across 6 files. No generated, documentation, build or submodule 
changes.
   
   | Part | Purpose | Approximate size |
   | --- | --- | --- |
   | Point-query removal | Delete scheduler/profile integration and dedicated 
rowid APIs; restore ordinary reads and retain schema/default/segment-reuse 
behavior | 300 production lines; 250 test lines |
   | Query/file IOContext | Propagate shared query admission/cancellation 
downward, bind reader-local resources, remove parallel factory/init arguments 
and detach async snapshots | 754 production lines; 348 test lines |
   | Session control | Replace the BE switch with the forwarded default-off 
session variable and optional Thrift field | 11 production lines; 85 test lines 
|
   - **Before and after:** Point queries return to the ordinary synchronous 
row-store and per-column paths. Scans share query admission/cancellation 
through IOContext, then bind file and reader-local statistics at the segment 
boundary. ColumnReader factories and ColumnIteratorOptions no longer receive 
separate read-ahead arguments. The existing scan planning, initial all-column 
submission order, fallback and file-cache writeback algorithms remain.
   - **Configs and defaults:** Replace the BE config `enable_query_read_ahead` 
with a same-named session variable, default `false`, forwarded between FEs. It 
affects subsequent queries without restarting BEs. Cloud mode and BE config 
`enable_async_file_cache_write=true` remain prerequisites; existing window and 
byte-budget configs remain.
   - **Impact on existing users:** Scan read-ahead stays off unless the new 
session variable is enabled, including when an older FE omits the new optional 
field. A new FE talking to an older BE cannot override that BE's existing 
config policy; consistent session control requires upgraded BEs. Data files and 
query-result semantics are unchanged. Point-query read-ahead profile output is 
removed.
   - **Migration:** Remove the old BE config entry and use `SET 
enable_query_read_ahead=true`, or `SET GLOBAL enable_query_read_ahead=true` for 
new sessions. Rolling back to an older BE restores its BE-config policy.
   
   ### Testing
   
   Focused BE tests and the production FE build are in progress; no test pass 
is claimed yet. Local cluster regression has not run. This section will be 
updated with actual results.
   
   ### Notes for Reviewers
   
   - QueryContext creates immutable query resources once; scanner/reader 
options carry them downward. File bindings and foreground statistics remain 
reader-local. Async IO snapshots detach the file binding and own their query ID.
   - Storage Page Cache probing remains in storage; the IO resource types do 
not depend on ColumnReader or SegmentIterator.
   - Optional Thrift field 1008 was checked against master and release branches 
3.1/4.0/4.1/4.2, including reservations; it is unused on all of them.
   - Point-query-specific read-ahead APIs and tests are deleted. Existing 
slot-default, RowCache and resolved-segment reuse coverage is retained.
   
   ### Release note
   
   Cloud scan page read-ahead is controlled by session variable 
`enable_query_read_ahead`, default `false`, instead of the BE config of the 
same name. Set it per session or globally for new sessions; asynchronous 
file-cache writes must also be enabled. Short-circuit point queries use their 
ordinary synchronous read paths.
   
   ### Check List (For Author)
   
   - Behavior changed: Yes (see Details)
   - Does this need documentation: Yes (document the session variable and 
migration in apache/doris-website before leaving Draft)
   - Pre-submission status: Partially verified: focused BE/FE tests are 
pending; local cluster regression has not run.
   
   ### AI Disclosure
   
   - Tool: Codex (GPT-6)
   - Generated: implementation, tests and this description
   - Human review: not stated; opened as a Draft for author review
   


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to