branch-4.1: [feature](file-cache) Disable cache writes after remote scan threshold - #66479
Open
bobhan1 wants to merge 1 commit into
Open
branch-4.1: [feature](file-cache) Disable cache writes after remote scan threshold#66479bobhan1 wants to merge 1 commit into
bobhan1 wants to merge 1 commit into
Conversation
apache#65058) (cherry picked from commit f5c30d7)
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
bobhan1
marked this pull request as ready for review
August 5, 2026 08:20
Contributor
Author
|
run buildall |
Contributor
Author
|
run feut |
Contributor
Cloud UT Coverage ReportIncrement line coverage Increment coverage report
|
Contributor
FE UT Coverage ReportIncrement line coverage |
Contributor
FE Regression Coverage ReportIncrement line coverage |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What problem does this PR solve?
Issue Number: None
Related PR: #65058
Problem Summary:
This backports #65058 to
branch-4.1.Remote scans can read a large amount of data from object storage. Before this change, a query that had already exceeded its useful cache-write budget could still keep writing later remote cache misses into file cache, increasing cache churn and IO overhead.
This PR adds the session variable
file_cache_query_limit_bytesto control remote-scan read-through file-cache writes per query on each BE:< 0: disabled. This is the default.= 0: do not write remote-scan cache misses into local file cache from the start of the query.> 0: allow remote-scan cache writes until the next cache block would exceed the byte threshold. Once the threshold is exceeded, later cache misses continue reading from remote storage but skip additional local file-cache writes.The limiter is query-wide within a BE and is propagated through scan, segment loading, preload, segment footer, column-reader metadata, and inverted-index metadata paths. The BE dynamic config
file_cache_query_limit_segment_meta, defaultfalse, optionally includes segment footer and segment metadata cache writes in the same limit. Profile counters expose the threshold, whether remote-only-on-miss was triggered, and specialized cache-write bytes and timers.The backport keeps the
branch-4.1scanner and short-circuit layouts: it wires the shared file-scan IO context throughOlapScanner::preparewithReaderType::READER_QUERY, preserves the target branch's short-circuit schema/version lifecycle, and does not pull in unrelated master-only refactors.Release note
Add
file_cache_query_limit_bytesfor query-level remote-scan file-cache write limiting, and add optional segment metadata accounting withfile_cache_query_limit_segment_meta.Check List (For Author)
Test
Validation:
git diff --checkbuild-support/check-format.sh./build.sh --be --fe --cloud -j100./run-fe-ut.sh --run org.apache.doris.qe.SessionVariablesTest,org.apache.doris.qe.ShortCircuitQueryContextTest(15 tests passed)-j100(22 tests across 9 suites passed)env -u HTTP_PROXY -u HTTPS_PROXY -u http_proxy -u https_proxy -u ALL_PROXY -u all_proxy ./run-regression-test.sh --run -d cloud_p0/cache/remote_scan_no_write_file_cache -s test_remote_scan_no_write_file_cache_threshold -g docker -runMode=cloud -dockerSuiteParallel 1(passed)env -u HTTP_PROXY -u HTTPS_PROXY -u http_proxy -u https_proxy -u ALL_PROXY -u all_proxy ./run-regression-test.sh --run -d cloud_p0/cache/remote_scan_no_write_file_cache -s test_file_cache_query_limit_segment_meta_profile -g docker -runMode=cloud -dockerSuiteParallel 1(passed)Behavior changed:
file_cache_query_limit_bytesis reached while continuing to read misses from remote storage. Optional segment metadata accounting can include segment footer and metadata cache writes in the same query-wide threshold.Does this need documentation?
Check List (For Reviewer who merge this PR)