Skip to content

[fix](be) Include HDFS connection in file handle cache key#63516

Open
suxiaogang223 wants to merge 1 commit into
masterfrom
codex/fix-hdfs-file-handle-cache-key
Open

[fix](be) Include HDFS connection in file handle cache key#63516
suxiaogang223 wants to merge 1 commit into
masterfrom
codex/fix-hdfs-file-handle-cache-key

Conversation

@suxiaogang223
Copy link
Copy Markdown
Member

@suxiaogang223 suxiaogang223 commented May 22, 2026

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 hdfsFS authentication context while still matching the old cache key. That can reuse a handle opened under another context and lead to HDFS auth failures such as SIMPLE authentication is not enabled. Available:[TOKEN, KERBEROS].

This PR includes the hdfsFS identity 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)

  • 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
  • Behavior changed: No
  • Does this need documentation: No

### 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
@hello-stephen
Copy link
Copy Markdown
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@suxiaogang223
Copy link
Copy Markdown
Member Author

run be-ut

@suxiaogang223
Copy link
Copy Markdown
Member Author

run buildall

@suxiaogang223 suxiaogang223 marked this pull request as ready for review May 22, 2026 06:05
@hello-stephen
Copy link
Copy Markdown
Contributor

TPC-H: Total hot run time: 31854 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit d6e069d74dcbb43bdc7d7e876f480fd3e0aad528, data reload: false

------ Round 1 ----------------------------------
orders	Doris	NULL	NULL	0	0	0	NULL	0	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	17743	4112	4110	4110
q2	q3	10763	1379	838	838
q4	4686	480	350	350
q5	7597	2295	2121	2121
q6	238	179	141	141
q7	956	815	644	644
q8	9406	1713	1691	1691
q9	5144	4981	4957	4957
q10	6396	2049	1789	1789
q11	437	282	247	247
q12	642	431	304	304
q13	18107	3381	2816	2816
q14	274	256	233	233
q15	q16	816	785	712	712
q17	944	899	954	899
q18	7000	5740	5531	5531
q19	1312	1251	1138	1138
q20	652	468	308	308
q21	6481	2957	2647	2647
q22	476	378	438	378
Total cold run time: 100070 ms
Total hot run time: 31854 ms

----- Round 2, with runtime_filter_mode=off -----
orders	Doris	NULL	NULL	150000000	42	6422171781	NULL	22778155	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	4791	4641	4641	4641
q2	q3	4908	5238	4693	4693
q4	2244	2322	1439	1439
q5	5036	4755	4724	4724
q6	233	186	136	136
q7	1831	1746	1515	1515
q8	2510	2213	2272	2213
q9	7829	7320	7343	7320
q10	4479	4442	4047	4047
q11	569	413	377	377
q12	735	724	512	512
q13	3050	3372	2837	2837
q14	275	275	254	254
q15	q16	698	704	611	611
q17	1283	1260	1254	1254
q18	7583	6830	6958	6830
q19	1131	1127	1082	1082
q20	2227	2237	1944	1944
q21	5536	4841	4655	4655
q22	546	501	432	432
Total cold run time: 57494 ms
Total hot run time: 51516 ms

@hello-stephen
Copy link
Copy Markdown
Contributor

TPC-DS: Total hot run time: 169339 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit d6e069d74dcbb43bdc7d7e876f480fd3e0aad528, data reload: false

query5	4320	659	522	522
query6	320	217	197	197
query7	4284	577	315	315
query8	341	241	224	224
query9	8851	3973	3996	3973
query10	468	352	288	288
query11	5769	2419	2153	2153
query12	188	127	124	124
query13	1319	613	440	440
query14	5935	5335	5046	5046
query14_1	4390	4370	4342	4342
query15	212	205	184	184
query16	1021	469	430	430
query17	965	731	603	603
query18	2444	482	354	354
query19	219	202	168	168
query20	136	134	132	132
query21	218	140	134	134
query22	13684	13536	13389	13389
query23	17246	16345	15983	15983
query23_1	16205	16188	16226	16188
query24	7513	1744	1308	1308
query24_1	1317	1276	1319	1276
query25	569	494	442	442
query26	1314	318	174	174
query27	2700	551	351	351
query28	4479	1938	1942	1938
query29	1009	626	522	522
query30	316	236	202	202
query31	1114	1062	941	941
query32	94	80	75	75
query33	555	363	320	320
query34	1176	1119	634	634
query35	763	781	670	670
query36	1322	1347	1164	1164
query37	150	104	84	84
query38	3188	3171	3053	3053
query39	916	919	891	891
query39_1	887	890	873	873
query40	224	162	123	123
query41	69	65	63	63
query42	112	107	106	106
query43	318	328	280	280
query44	
query45	209	200	190	190
query46	1056	1176	715	715
query47	2202	2310	2121	2121
query48	412	416	295	295
query49	635	485	373	373
query50	901	349	247	247
query51	4307	4280	4175	4175
query52	102	102	93	93
query53	261	284	202	202
query54	317	267	261	261
query55	92	88	84	84
query56	284	292	297	292
query57	1398	1384	1305	1305
query58	300	263	266	263
query59	1560	1640	1382	1382
query60	321	325	299	299
query61	155	152	152	152
query62	665	634	540	540
query63	245	190	210	190
query64	2378	795	639	639
query65	
query66	1772	463	349	349
query67	30037	30005	29782	29782
query68	
query69	463	336	315	315
query70	1004	1039	981	981
query71	298	278	266	266
query72	3020	2720	2446	2446
query73	864	747	432	432
query74	5041	4928	4709	4709
query75	2658	2573	2279	2279
query76	2282	1146	786	786
query77	392	413	335	335
query78	12082	12078	11714	11714
query79	1469	1032	705	705
query80	644	557	470	470
query81	457	276	241	241
query82	1379	161	127	127
query83	356	268	254	254
query84	302	151	109	109
query85	874	555	474	474
query86	402	326	323	323
query87	3430	3391	3238	3238
query88	3494	2676	2648	2648
query89	440	384	337	337
query90	1893	184	187	184
query91	182	178	148	148
query92	81	79	76	76
query93	1443	1452	859	859
query94	546	358	281	281
query95	681	461	371	371
query96	1034	867	326	326
query97	2715	2692	2549	2549
query98	234	234	227	227
query99	1119	1090	983	983
Total cold run time: 252561 ms
Total hot run time: 169339 ms

@hello-stephen
Copy link
Copy Markdown
Contributor

BE UT Coverage Report

Increment line coverage 53.85% (7/13) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 53.66% (20757/38679)
Line Coverage 37.25% (196606/527774)
Region Coverage 33.58% (154105/458909)
Branch Coverage 34.58% (67114/194094)

@hello-stephen
Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 88.89% (8/9) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 73.71% (27925/37884)
Line Coverage 57.61% (303298/526424)
Region Coverage 54.89% (254329/463337)
Branch Coverage 56.34% (109757/194821)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants