[fix](be) Include HDFS connection in file handle cache key#63516
Open
suxiaogang223 wants to merge 1 commit into
Open
[fix](be) Include HDFS connection in file handle cache key#63516suxiaogang223 wants to merge 1 commit into
suxiaogang223 wants to merge 1 commit into
Conversation
### What problem does this PR solve?
Issue Number: None
Related PR: None
Problem Summary: HDFS file handles were cached only by path and mtime, so a later query using a different hdfsFS authentication context could reuse a handle opened from another context when the same file path and mtime matched.
### Release note
None
### Check List (For Author)
- Test: Manual test
- `build-support/clang-format.sh be/src/io/fs/file_handle_cache.cpp be/src/io/fs/file_handle_cache.h be/test/io/fs/file_handle_cache_test.cpp`
- `git diff --cached --check`
- BE UT not run locally per request
- Behavior changed: No
- Does this need documentation: No
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
Member
Author
|
run be-ut |
Member
Author
|
run buildall |
Contributor
TPC-H: Total hot run time: 31854 ms |
Contributor
TPC-DS: Total hot run time: 169339 ms |
Contributor
BE UT Coverage ReportIncrement line coverage Increment coverage report
|
Contributor
BE Regression && UT Coverage ReportIncrement line coverage Increment coverage report
|
Gabriel39
approved these changes
May 25, 2026
Contributor
|
PR approved by at least one committer and no changes requested. |
Contributor
|
PR approved by anyone and no changes requested. |
Contributor
|
/review |
Contributor
There was a problem hiding this comment.
Automated review result: no blocking issues found.
Critical checkpoint conclusions:
- Goal and proof: The PR addresses HDFS file-handle cache reuse across different hdfsFS/authentication contexts by including hdfsFS in both the cache key and partition hash. The added BE unit test verifies key equality changes for hdfsFS, path, and mtime.
- Scope and clarity: The change is small and focused on the file-handle cache keying logic.
- Concurrency: The existing LruMultiCache locking model is preserved; the change only affects key construction and partition selection before acquiring the partition cache lock. No new shared mutable state or lock ordering is introduced.
- Lifecycle/static initialization: The existing function-local static cache in HdfsFileReader is unchanged. The hdfsFS handle is already owned by HdfsMgr/HdfsHandler, and this PR does not introduce new static/global objects.
- Configuration/compatibility: No new configuration, protocol, storage format, or FE-BE compatibility concerns.
- Parallel paths: The only HDFS reader cache entry point goes through HdfsFileReader::create -> get_file -> FileHandleCache::get_file_handle, so the changed path covers the relevant use.
- Tests: New BE unit test is included under be/test and should be picked up by the existing GLOB_RECURSE UT_FILES. I also ran
git diff --check cbe23a31d8d37f4e25bcc40e945d6559299903b7 origin/pr/63516with no whitespace errors. Full BE UT was not run in this review environment. - Observability: No additional observability appears necessary for this small keying fix; existing VLOG close/unbuffer logging remains intact.
- Data correctness/transactions/persistence: Not applicable; no transaction, version, MoW, or persistence behavior is modified.
- Performance: The additional pointer hash/key comparison is negligible and avoids incorrect cross-context reuse.
User focus points: no additional user-provided review focus was specified.
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?
HDFS file handles were cached only by file path and mtime. In a pipeline that runs multiple Hive catalog cases against the same HDFS path shape, a later query can use a different
hdfsFSauthentication context while still matching the old cache key. That can reuse a handle opened under another context and lead to HDFS auth failures such asSIMPLE authentication is not enabled. Available:[TOKEN, KERBEROS].This PR includes the
hdfsFSidentity in the file handle cache key and partition hash, so cached handles are only reused within the same filesystem/authentication context.Issue Number: None
Related PR: None
Release note
None
Check List (For Author)
build-support/clang-format.sh be/src/io/fs/file_handle_cache.cpp be/src/io/fs/file_handle_cache.h be/test/io/fs/file_handle_cache_test.cpp