-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[feature](cache) support file cache admission control #59065
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
…ache_admission_control
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
|
run buildall |
Cloud UT Coverage ReportIncrement line coverage Increment coverage report
|
FE UT Coverage ReportIncrement line coverage |
TPC-H: Total hot run time: 35116 ms |
TPC-DS: Total hot run time: 178276 ms |
ClickBench: Total hot run time: 27.17 s |
BE UT Coverage ReportIncrement line coverage Increment coverage report
|
|
run buildall |
Cloud UT Coverage ReportIncrement line coverage Increment coverage report
|
TPC-H: Total hot run time: 36571 ms |
TPC-DS: Total hot run time: 178175 ms |
ClickBench: Total hot run time: 27.96 s |
Cloud UT Coverage ReportIncrement line coverage Increment coverage report
|
TPC-H: Total hot run time: 32051 ms |
TPC-DS: Total hot run time: 174278 ms |
ClickBench: Total hot run time: 27.6 s |
BE UT Coverage ReportIncrement line coverage Increment coverage report
|
|
run buildall |
f48b520 to
bc0ef08
Compare
|
run buildall |
|
run buildall |
Cloud UT Coverage ReportIncrement line coverage Increment coverage report
|
FE UT Coverage ReportIncrement line coverage |
TPC-H: Total hot run time: 31840 ms |
TPC-DS: Total hot run time: 174775 ms |
ClickBench: Total hot run time: 27.32 s |
|
run buildall |
| } | ||
| } | ||
|
|
||
| public static class ConcurrentRuleManager { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ConcurrentRuleManager 这个是否也直接改成 RuleManager
| List<AdmissionRule> allRules = new ArrayList<>(); | ||
|
|
||
| for (File jsonFile : jsonFiles) { | ||
| List<AdmissionRule> loadedRules = RuleLoader.loadRulesFromFile(jsonFile.getPath()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
如果出现重复的rule,会如何处理,行为是确定的吗?
| return this.scanParams; | ||
| } | ||
|
|
||
| protected boolean fileCacheAdmissionCheck() throws UserException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
存算分离场景的内表scan是走filequeryscannode吗?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
哪些类型catalog的scan会走filequeryscannode?
| protected FileSplitter fileSplitter; | ||
|
|
||
| private static final Set<String> CACHEABLE_CATALOGS = new HashSet<>( | ||
| Arrays.asList("hms", "iceberg", "paimon", "lakesoul") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
如何判断是这几种可以启用filecache?
Cloud UT Coverage ReportIncrement line coverage Increment coverage report
|
TPC-H: Total hot run time: 31828 ms |
TPC-DS: Total hot run time: 174466 ms |
ClickBench: Total hot run time: 27.12 s |
FE UT Coverage ReportIncrement line coverage |
BE UT Coverage ReportIncrement line coverage Increment coverage report
|
BE Regression && UT Coverage ReportIncrement line coverage Increment coverage report
|
FE Regression Coverage ReportIncrement line coverage |
To fully understand the implementation of the PR, please refer to the following link(It is a Chinese document): https://www.notion.so/V3-1-2c31293e1081807ca476dd5c87efb28e
1. PR Function Overview
The core function of this PR is the implementation of File Cache Admission Control.
2. Implementation Scheme Analysis
The implementation consists of the following key components:
2.1. FE Side: Admission Decision
The primary logic is located in the
createScanRangeLocationsmethod ofFileQueryScanNode.java.Config.enable_file_cache_admission_controlswitch.FileCacheAdmissionManager(Singleton) to execute the specific admission judgment logic.FileQueryScanNoderetrieves the current User Identity (userIdentity), Catalog, Database, and Table information.FileCacheAdmissionManager.getInstance().isAllowed(...)to obtain a boolean resultfileCacheAdmission.2.2. FE Side: Decision Propagation
The decision result needs to be propagated from the
FileQueryScanNodedown to the underlying split assignment logic.SplitAssignment Modification:
SplitAssignmentclass (located inorg.apache.doris.datasource) is modified to accept a newboolean fileCacheAdmissionparameter.SplitToScanRange Modification:
splitToScanRangemethod (or its corresponding Lambda expression) is updated to receive thefileCacheAdmissionparameter.2.3. Communication Protocol: Thrift Definition Update
To pass the FE's decision to the BE, the Thrift definition (likely
TFileRangeDescorTFileScanRangeParamsinPlanNodes.thrift) requires a new field.optional bool file_cache_admission, is added to theTFileRangeDescstruct.2.4. BE Side: Enforcement
Although the analysis focuses on the FE, the complete loop requires enforcement on the BE side:
FileReader(e.g.,HdfsFileReaderorS3FileReader) checks thefile_cache_admissionflag in the incomingTFileRangeDescduring initialization or reading.file_cache_admissionis true (default): It uses the standardFileCachePolicy, where data not found in the cache is written to the Block File Cache after reading.file_cache_admissionis false: It sets theFileCachePolicytoNO_CACHE, skips the cache writing step, reading directly from remote storage. This protects the existing cache from being polluted.3. Summary
This PR introduces an Admission Control Manager during the FE query planning phase and transparently passes this control signal through the Split Assignment and Scan Range Generation phases. This ultimately guides the BE side's file readers to selectively use the file cache.
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)