Skip to content

[fix](be) Route glibc allocation entry points through jemalloc - #69819

Merged
yiguolei merged 4 commits into
apache:masterfrom
hubgeter:fix/glibc-dynamic-tls-memalign
Nov 4, 2026
Merged

yiguolei merged 4 commits into
apache:masterfrom
hubgeter:fix/glibc-dynamic-tls-memalign

Conversation

@hubgeter

@hubgeter hubgeter commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Problem Summary:
On glibc < 2.25, dynamic TLS can be allocated by libc and freed by jemalloc, crashing during thread cleanup. Route all seven glibc allocation entry points through the existing jemalloc wrappers, preserve allocator API semantics, and add native interposition tests.

Release note

Fix a BE crash during dynamic TLS cleanup on older glibc systems and keep glibc allocation entry points paired with jemalloc.

Check List (For Author)

  • Test

    • Regression test
    • Unit Test
    • Manual test (add detailed scripts or steps below)
    • No need to test or manual test. Explain why:
      • This is a refactor/code format and no logic has been changed.
      • Previous test can cover this change.
      • No code files have been changed.
      • Other reason

    ./run-be-ut.sh --jemalloc-hook --run -j 2: 12/12 passed on Linux x86_64/glibc 2.32. Full BE, older glibc, ARM64 and customer JNI E2E were not run.

  • Behavior changed:

    • No.
    • Yes. Glibc allocation entry points now consistently use jemalloc, with allocator boundary semantics preserved.
  • Does this need documentation?

    • No.
    • Yes.

Check List (For Reviewer who merge this PR)

  • Confirm the release note
  • Confirm test cases
  • Confirm document
  • Add branch pick label

### What problem does this PR solve?

Issue Number: N/A

Related PR: N/A

Problem Summary: Before glibc 2.25, the dynamic loader allocates TLS for
late-loaded native libraries with __libc_memalign and releases it through
public free. BE redirects public allocation functions to jemalloc but
leaves this internal entry point on libc, so thread cleanup can pass a
libc allocation to jemalloc and crash the BE. Alias __libc_memalign to the
existing doris_memalign implementation.

Add standalone native allocator tests through run-be-ut.sh --jemalloc-hook.
The regular BE UT disables jemalloc and uses sanitizer interceptors, so it
cannot validate this allocation/free pair. The tests cover the legacy
pair in a subprocess, alignment and error semantics, cross-thread frees,
and dynamic TLS cleanup from a late-loaded shared library.

### Release note

Fix a BE crash when threads clean up dynamic TLS from native libraries on
older glibc systems.

### Check List (For Author)

- Test: Unit Test - ./run-be-ut.sh --jemalloc-hook --clean --run -j 2
    - Four native tests passed on glibc 2.32; the unpatched hook triggers
      SIGSEGV in the legacy allocation/free subprocess.
    - clang-format v16, clang-tidy, build hygiene, and bash syntax checks passed.
    - CentOS 7 / Jindo / DLF end-to-end testing was not run.
- Behavior changed: Yes - legacy glibc TLS allocations now use jemalloc
  consistently with their deallocation.
- 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?

@hubgeter
hubgeter marked this pull request as draft October 29, 2026 07:40
@hubgeter

Copy link
Copy Markdown
Contributor Author

run buildall

@hubgeter

Copy link
Copy Markdown
Contributor Author

/review

@github-actions

Copy link
Copy Markdown
Contributor

Codex automated review failed and did not complete.

Error: Selected model is at capacity. Please try a different model.
Workflow run: https://github.com/apache/doris/actions/runs/40837011354

Please inspect the workflow logs and rerun the review after the underlying issue is resolved.

@hello-stephen

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

------ Round 1 ----------------------------------
============================================
q1	17602	5147	5051	5051
q2	2179	297	250	250
q3	10242	1390	838	838
q4	4690	466	360	360
q5	7437	783	533	533
q6	181	181	151	151
q7	741	786	588	588
q8	9261	1344	1076	1076
q9	5531	4191	4143	4143
q10	6826	1274	995	995
q11	435	245	226	226
q12	634	402	274	274
q13	18094	3624	3075	3075
q14	271	269	241	241
q15	q16	804	728	677	677
q17	1210	757	592	592
q18	6940	6177	6082	6082
q19	1096	959	589	589
q20	405	330	230	230
q21	4480	2116	2275	2116
q22	340	299	249	249
Total cold run time: 99399 ms
Total hot run time: 28336 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	5580	5541	5552	5541
q2	674	563	547	547
q3	5190	5340	4910	4910
q4	1973	2115	1542	1542
q5	5241	5133	5395	5133
q6	245	201	160	160
q7	2392	2056	1856	1856
q8	2988	2760	2880	2760
q9	8095	8066	8057	8057
q10	3707	3670	3239	3239
q11	616	428	392	392
q12	682	681	512	512
q13	3661	3833	3249	3249
q14	303	301	290	290
q15	q16	729	713	635	635
q17	8339	7484	6877	6877
q18	13001	12146	12851	12146
q19	1033	780	786	780
q20	2143	2144	1918	1918
q21	5540	4553	4718	4553
q22	500	438	401	401
Total cold run time: 72632 ms
Total hot run time: 65498 ms

// and release it through free. Route both to jemalloc so thread exit does not
// pass a glibc allocation to doris_free.
void* __libc_memalign(size_t align, size_t size) __THROW ALIAS(doris_memalign);
#endif

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does jemalloc hook still useful?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current master still includes this hook in Linux builds with USE_JEMALLOC=ON, and jemalloc still uses the je symbol prefix. I ran a minimal link test using the current master sources: with the hook, public malloc/free calls resolve to the jemalloc wrappers; without it, they resolve to libc. So the hook still provides allocator interposition. This PR fixes the mismatch between TLS allocation and deallocation under the existing configuration.

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-DS: Total hot run time: 151332 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 b2e65a83244a3f0059e07a60734b4d72739c6a61, data reload: false

query5	4326	573	434	434
query6	423	217	188	188
query7	4794	443	226	226
query8	324	158	153	153
query9	8774	3211	3173	3173
query10	476	303	276	276
query11	6010	3889	3565	3565
query12	151	98	89	89
query13	1267	442	323	323
query14	6126	3963	3660	3660
query14_1	3416	3434	3458	3434
query15	209	197	179	179
query16	945	471	463	463
query17	868	659	533	533
query18	2416	431	317	317
query19	195	164	137	137
query20	88	84	84	84
query21	212	127	106	106
query22	12959	13064	12824	12824
query23	13527	12999	12359	12359
query23_1	12507	12544	12433	12433
query24	7350	816	467	467
query24_1	473	486	482	482
query25	507	396	335	335
query26	1262	255	133	133
query27	2771	447	286	286
query28	4605	2044	2033	2033
query29	1533	580	431	431
query30	301	213	186	186
query31	1019	919	813	813
query32	145	94	93	93
query33	515	296	254	254
query34	910	849	491	491
query35	752	748	636	636
query36	818	811	729	729
query37	124	103	80	80
query38	1788	1746	1660	1660
query39	781	778	733	733
query39_1	733	719	726	719
query40	217	116	96	96
query41	64	63	63	63
query42	89	83	83	83
query43	344	361	314	314
query44	1329	701	712	701
query45	177	174	164	164
query46	833	1007	565	565
query47	2955	2910	2828	2828
query48	300	313	222	222
query49	571	400	291	291
query50	682	284	206	206
query51	10594	10444	10405	10405
query52	81	85	70	70
query53	183	212	153	153
query54	257	195	172	172
query55	71	69	62	62
query56	226	225	203	203
query57	1637	1618	1602	1602
query58	294	275	279	275
query59	2122	2149	1966	1966
query60	310	255	241	241
query61	170	175	172	172
query62	397	337	289	289
query63	193	164	161	161
query64	2895	1073	901	901
query65	3332	3282	3286	3282
query66	1815	435	326	326
query67	20444	20106	20026	20026
query68	3270	1002	672	672
query69	405	291	239	239
query70	843	763	764	763
query71	304	230	206	206
query72	2825	2595	2342	2342
query73	523	534	297	297
query74	4629	4528	4314	4314
query75	2340	2299	1913	1913
query76	2383	1011	604	604
query77	345	363	277	277
query78	9770	9739	9188	9188
query79	993	858	535	535
query80	807	440	343	343
query81	581	321	279	279
query82	582	148	106	106
query83	307	195	178	178
query84	307	132	112	112
query85	859	420	380	380
query86	354	238	230	230
query87	1997	1926	1781	1781
query88	3742	2756	2712	2712
query89	330	274	242	242
query90	1789	170	162	162
query91	161	154	123	123
query92	97	91	93	91
query93	997	1004	580	580
query94	515	325	273	273
query95	580	412	308	308
query96	683	481	237	237
query97	2473	2451	2285	2285
query98	161	150	146	146
query99	777	759	669	669
Total cold run time: 235475 ms
Total hot run time: 151332 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
ClickBench: Total hot run time: 24.26 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit b2e65a83244a3f0059e07a60734b4d72739c6a61, data reload: false

query1	0.00	0.01	0.01
query2	0.09	0.05	0.05
query3	0.26	0.08	0.09
query4	1.61	0.10	0.11
query5	0.23	0.24	0.25
query6	1.16	0.69	0.67
query7	0.04	0.00	0.00
query8	0.05	0.04	0.03
query9	0.41	0.35	0.35
query10	0.56	0.58	0.60
query11	0.20	0.14	0.13
query12	0.19	0.15	0.16
query13	0.49	0.49	0.49
query14	1.02	1.01	1.00
query15	0.63	0.61	0.61
query16	0.35	0.34	0.35
query17	1.15	1.13	1.10
query18	0.21	0.19	0.20
query19	2.10	1.95	1.93
query20	0.01	0.01	0.02
query21	15.50	0.19	0.13
query22	4.96	0.06	0.05
query23	16.33	0.32	0.12
query24	3.11	0.55	0.44
query25	0.09	0.08	0.06
query26	1.41	0.22	0.15
query27	0.03	0.05	0.06
query28	3.81	0.73	0.35
query29	12.48	4.09	3.24
query30	0.28	0.14	0.11
query31	2.77	0.56	0.32
query32	3.22	0.58	0.51
query33	3.21	3.24	3.18
query34	15.30	3.97	3.39
query35	3.33	3.30	3.31
query36	0.55	0.43	0.43
query37	0.10	0.06	0.06
query38	0.05	0.04	0.04
query39	0.04	0.03	0.03
query40	0.18	0.15	0.15
query41	0.09	0.03	0.03
query42	0.03	0.03	0.03
query43	0.04	0.03	0.04
Total cold run time: 97.67 s
Total hot run time: 24.26 s

@hello-stephen

Copy link
Copy Markdown
Contributor

BE UT Coverage Report

Increment line coverage 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 67.22% (32554/48426)
Line Coverage 52.11% (344919/661957)
Region Coverage 47.53% (280331/589842)
Branch Coverage 49.25% (132494/269025)

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 100% (0/0) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 77.56% (36397/46928)
Line Coverage 62.83% (411466/654924)
Region Coverage 59.35% (348781/587703)
Branch Coverage 60.24% (161662/268367)

@hubgeter

Copy link
Copy Markdown
Contributor Author

/review

@hubgeter
hubgeter marked this pull request as ready for review October 30, 2026 06:50
@github-actions

Copy link
Copy Markdown
Contributor

Codex automated review failed and did not complete.

Error: Selected model is at capacity. Please try a different model.
Workflow run: https://github.com/apache/doris/actions/runs/41016470551

Please inspect the workflow logs and rerun the review after the underlying issue is resolved.

@hubgeter

Copy link
Copy Markdown
Contributor Author

/review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review of PR #69819 at head b2e65a8 is complete. The change's production goal is coherent: on pre-2.25 glibc, the hook supplies the documented two-size_t __libc_memalign entry point and production CMake includes the hook only for Linux jemalloc builds. The standalone native tests cover aligned allocation, error behavior, thread-exit frees, and late-loaded TLS, but their symbol lookup is not tied to the executable definition; see the inline P2 finding.

Critical checkpoints: the production alias is a small, focused change with no configuration, thrift/protobuf, storage, transaction, or FE/BE protocol impact. The test exercises concurrent threads with per-index writes and joins before reads; the dlopen handle remains alive through worker-thread teardown and is released afterward. No new background thread, lock, tracked allocation, status path, static cross-TU initializer, or observability surface was added. Linux/glibc gating, jemalloc-only selection, macOS/non-jemalloc exclusion, runner option parsing, CMake library discovery, and the XML output path were rechecked. The XML concern was dismissed because the bundled GoogleTest writer creates parent directories. No additional user-provided focus was supplied.

This invocation performed static review only; it did not run builds or tests. One new P2 finding is included below. Existing inline comments were reviewed; neither is a P0/P1 finding that still applies, so existing_blocking_comment_ids is empty. The review converged in round 2 after the full changed-file sweep and duplicate-aware rechecks.

Review converged after 2 round(s).

using MemalignFunction = void* (*)(size_t, size_t);

void SetUp() override {
void* symbol = dlsym(RTLD_DEFAULT, "__libc_memalign");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Ensure this test actually calls the hook defined by this PR. jemalloc_hook_test intentionally leaves ENABLE_EXPORTS off, but SetUp() obtains __libc_memalign only through dlsym(RTLD_DEFAULT). That lookup searches the dynamic symbol scope and can select libc's implementation (or vary with the linker), while the ordinary alias in the executable is not guaranteed to be visible. In that case the allocation/free assertions and the TLS test can pass without exercising the new alias. Call the linked hook directly or assert with dladdr/the executable's dynamic symbol table that the resolved address is the hook, and keep the DSO path tied to that verified interposition.

### What problem does this PR solve?

Issue Number: N/A

Related PR: apache#69819

Problem Summary: The native allocator tests used RTLD_DEFAULT without
proving that the resolved symbols belonged to the linked production hook.
A matching libc allocation/free pair could otherwise pass without testing
jemalloc interposition. Anchor dladdr checks to doris_memalign and verify
that __libc_memalign, malloc, and free come from the executable. Also check
the late-loaded DSO's actual allocator bindings before exercising TLS.

### Release note

None

### Check List (For Author)

- Test: Unit Test - ./run-be-ut.sh --jemalloc-hook --run -j 2 (4/4 passed)
    - Removing the alias fails the executable-owner assertion.
    - Resolving the DSO allocator from libc fails the DSO binding assertion.
    - clang-format v16, clang-tidy, build hygiene, and git diff --check passed.
- Behavior changed: No production behavior change.
- Does this need documentation: No
@hubgeter

Copy link
Copy Markdown
Contributor Author

run buildall

@hubgeter

Copy link
Copy Markdown
Contributor Author

/review

@github-actions

Copy link
Copy Markdown
Contributor

Codex automated review failed and did not complete.

Error: Selected model is at capacity. Please try a different model.
Workflow run: https://github.com/apache/doris/actions/runs/41040659281

Please inspect the workflow logs and rerun the review after the underlying issue is resolved.

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 100% (0/0) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 77.66% (36695/47252)
Line Coverage 63.01% (415628/659635)
Region Coverage 59.46% (351962/591900)
Branch Coverage 60.31% (163103/270454)

@hello-stephen

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

------ Round 1 ----------------------------------
============================================
q1	17585	5162	5062	5062
q2	2194	304	248	248
q3	10211	1382	830	830
q4	4686	471	335	335
q5	7445	802	515	515
q6	186	190	155	155
q7	744	795	599	599
q8	9264	1371	1108	1108
q9	5426	4202	4194	4194
q10	6819	1282	1052	1052
q11	432	251	227	227
q12	631	400	279	279
q13	18107	3656	3043	3043
q14	280	277	243	243
q15	q16	743	724	654	654
q17	1206	743	583	583
q18	6955	6158	6088	6088
q19	1095	969	595	595
q20	383	341	229	229
q21	4755	2173	2260	2173
q22	343	298	257	257
Total cold run time: 99490 ms
Total hot run time: 28469 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	5648	5610	5658	5610
q2	701	568	558	558
q3	5167	5387	4970	4970
q4	2042	2197	1584	1584
q5	5340	5299	5759	5299
q6	269	199	146	146
q7	2343	2094	1813	1813
q8	2959	2776	2703	2703
q9	8083	7961	7952	7952
q10	3817	3674	3260	3260
q11	645	453	429	429
q12	715	702	525	525
q13	3509	3859	3324	3324
q14	318	304	274	274
q15	q16	695	753	654	654
q17	8250	7135	6802	6802
q18	13009	12144	12797	12144
q19	932	841	837	837
q20	2158	2142	1916	1916
q21	5663	4726	4644	4644
q22	497	452	402	402
Total cold run time: 72760 ms
Total hot run time: 65846 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-DS: Total hot run time: 151276 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 71e74a911844e449ab103691a1197b285f765810, data reload: false

query5	4298	612	436	436
query6	425	213	191	191
query7	4808	440	247	247
query8	325	166	155	155
query9	8788	3242	3266	3242
query10	515	304	262	262
query11	5877	3836	3564	3564
query12	152	91	88	88
query13	1258	468	307	307
query14	6118	3949	3610	3610
query14_1	3397	3396	3407	3396
query15	209	194	176	176
query16	933	431	444	431
query17	853	644	516	516
query18	2399	400	301	301
query19	198	162	128	128
query20	86	84	81	81
query21	210	124	103	103
query22	13033	13112	12716	12716
query23	13555	12814	12397	12397
query23_1	12665	12374	12526	12374
query24	7362	847	484	484
query24_1	493	489	482	482
query25	539	428	362	362
query26	1262	262	143	143
query27	2761	443	283	283
query28	4588	2037	2007	2007
query29	1565	601	461	461
query30	302	226	185	185
query31	1017	928	820	820
query32	147	94	92	92
query33	575	318	240	240
query34	885	860	510	510
query35	737	757	678	678
query36	818	822	743	743
query37	135	100	84	84
query38	1803	1746	1676	1676
query39	800	780	751	751
query39_1	722	719	740	719
query40	221	121	101	101
query41	75	69	69	69
query42	94	86	88	86
query43	367	381	334	334
query44	1446	725	723	723
query45	185	183	170	170
query46	867	1061	594	594
query47	3047	2672	2827	2672
query48	314	321	233	233
query49	593	413	310	310
query50	733	308	230	230
query51	10655	10591	10569	10569
query52	79	86	79	79
query53	199	220	157	157
query54	262	208	212	208
query55	76	75	65	65
query56	259	239	219	219
query57	1672	1623	1577	1577
query58	292	278	260	260
query59	2109	2180	1959	1959
query60	288	251	235	235
query61	170	171	160	160
query62	393	347	298	298
query63	201	165	173	165
query64	2846	953	748	748
query65	3328	3271	3279	3271
query66	1772	419	291	291
query67	20182	20041	19921	19921
query68	2950	1022	603	603
query69	394	285	258	258
query70	852	778	810	778
query71	297	237	210	210
query72	2720	2527	2479	2479
query73	525	546	292	292
query74	4649	4505	4337	4337
query75	2338	2283	1938	1938
query76	2311	1037	633	633
query77	374	392	274	274
query78	9840	9721	9097	9097
query79	1023	874	544	544
query80	1004	449	337	337
query81	602	331	272	272
query82	581	140	106	106
query83	293	205	180	180
query84	323	121	100	100
query85	1036	425	371	371
query86	369	239	230	230
query87	1993	1931	1805	1805
query88	3886	2785	2800	2785
query89	354	287	234	234
query90	1706	177	177	177
query91	158	155	127	127
query92	93	86	88	86
query93	1041	1027	582	582
query94	512	307	267	267
query95	570	387	310	310
query96	691	518	247	247
query97	2454	2428	2336	2336
query98	173	156	146	146
query99	768	751	639	639
Total cold run time: 236026 ms
Total hot run time: 151276 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
ClickBench: Total hot run time: 24.19 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 71e74a911844e449ab103691a1197b285f765810, data reload: false

query1	0.00	0.00	0.01
query2	0.10	0.05	0.04
query3	0.26	0.09	0.08
query4	1.61	0.09	0.10
query5	0.24	0.24	0.23
query6	1.17	0.70	0.67
query7	0.05	0.01	0.01
query8	0.05	0.03	0.04
query9	0.41	0.34	0.33
query10	0.58	0.61	0.61
query11	0.21	0.14	0.14
query12	0.18	0.15	0.15
query13	0.50	0.51	0.49
query14	1.03	1.01	0.99
query15	0.64	0.63	0.61
query16	0.35	0.36	0.33
query17	1.16	1.17	1.10
query18	0.20	0.20	0.19
query19	2.12	2.05	1.98
query20	0.02	0.02	0.01
query21	15.49	0.19	0.13
query22	4.83	0.06	0.06
query23	16.27	0.32	0.13
query24	3.15	0.60	0.37
query25	0.11	0.07	0.04
query26	0.80	0.21	0.16
query27	0.05	0.04	0.05
query28	3.37	0.76	0.36
query29	12.48	4.14	3.24
query30	0.28	0.14	0.10
query31	2.77	0.59	0.32
query32	3.22	0.61	0.50
query33	3.17	3.18	3.16
query34	15.29	4.06	3.35
query35	3.34	3.34	3.35
query36	0.55	0.44	0.46
query37	0.10	0.06	0.06
query38	0.05	0.04	0.04
query39	0.04	0.04	0.03
query40	0.18	0.15	0.14
query41	0.09	0.04	0.03
query42	0.04	0.04	0.04
query43	0.04	0.04	0.03
Total cold run time: 96.59 s
Total hot run time: 24.19 s

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 100% (0/0) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 77.66% (36695/47252)
Line Coverage 63.01% (415628/659635)
Region Coverage 59.46% (351962/591900)
Branch Coverage 60.31% (163103/270454)

@hubgeter

hubgeter commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

/review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed all five changed files in PR #69819 at 71e74a911844e449ab103691a1197b285f765810. One new P2 is included inline: the standalone allocator test omits libunwind's zlib dependency on Linux ARM64 with modern ELF headers. No P0/P1 finding was identified.

The production alias follows the documented pre-2.25 allocator replacement requirement and pairs legacy TLS allocations with the existing jemalloc free hook. This is supported by the glibc allocator replacement contract and the glibc 2.17 TLS allocation/cleanup implementation.

Critical checkpoint conclusions:

Checkpoint Conclusion
Goal and proof The alias supplies the missing legacy allocation entry point. Four native tests cover the intended allocation and TLS behaviors; their source was inspected, not executed.
Scope and reuse Focused production alias reuses doris_memalign; native tests and runner dispatch are isolated.
Concurrency and locks No new production shared state or locks. Workers write separate elements; joins synchronize reads and frees. No new lock-order issue found.
Lifecycle and initialization Workers finish before DSO closure. The alias has no initializer; no new ownership cycle or cross-TU initialization dependency found.
Configuration No Doris configuration added. The new runner option validates incompatible test modes.
ABI and compatibility Additive glibc-only symbol, with no new production undefined libc API. Archive selection, selective exports, and legacy symbol-version lookup were traced. Final release ELF compatibility was not audited.
Thrift/protobuf No changes; cross-branch field-ID review is not applicable.
Parallel paths macOS/non-jemalloc hook exclusion remains coherent; regular ASAN UT excludes the standalone directory. Newer glibc retains its existing malloc/free path.
Conditions and comments The glibc guard and native test dispatch explain the concrete allocator mismatch and sanitizer constraints.
Test coverage Inspected hook identity, alignment/zero/non-multiple sizes, EINVAL/ENOMEM, cross-thread free and late-loaded TLS. ARM64 native linkage needs the inline fix. No legacy-glibc end-to-end run performed.
Expected test results Assertions were inspected; no golden result files changed and no execution results are claimed.
Observability Existing allocator behavior is reused; test diagnostics identify symbol-resolution failures. No additional production logging or metrics requirement found.
Transactions and persistence No affected code; not applicable.
Data writes and atomicity No database write-path changes; allocator and worker memory lifetimes were reviewed.
FE/BE variable passing No variables or protocol fields added; not applicable.
Performance Alias adds no per-call lookup, allocation, copying, or locking.
Other checks No header/PCH/template/unity-gate changes. Static-library dependency review produced the single inline finding.

Existing P2 comment 4422480037 is addressed at this head: fixture setup anchors lookup to the linked hook image and the DSO checks its actual allocator relocations. It is not reposted. The hook-usefulness discussion was checked against current Linux jemalloc inclusion. No existing P0/P1 finding applies, so existing_blocking_comment_ids is empty. No additional user focus was supplied.

All three reviewers returned NO_NEW_VALUABLE_FINDINGS in round 2. Every risk and candidate has an evidence-backed disposition, and the final five-file coverage and inline-anchor sweep is complete. No unresolved static-review question or uncovered changed file remains. Validation limits: no builds, tests, benchmarks, completed ELF audits, or CentOS 7/Jindo end-to-end execution were performed; repository source was not modified.

Review converged after 2 round(s).

Comment thread be/test/jemalloc_hook/CMakeLists.txt Outdated
# executable's default symbol visibility.
target_link_libraries(jemalloc_hook_test PRIVATE
"${gtest_main_LIBRARY}" "${gtest_LIBRARY}" "${jemalloc_doris_LIBRARY}"
"${unwind_LIBRARY}" "${lzma_LIBRARY}" Threads::Threads ${CMAKE_DL_LIBS})

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Link zlib for the standalone ARM64 test. On Linux aarch64 with modern ELF headers (SHF_COMPRESSED), the repository's default libunwind 1.8.3 build enables debug-frame and zlib support, so its dwarf lookup object references uncompress. The prof-enabled jemalloc dependency pulls that object in through unw_backtrace and local address-space initialization even when profiling is disabled at runtime. This target links libunwind and liblzma but never libz, so ./run-be-ut.sh --jemalloc-hook --run fails at link time with an undefined reference to uncompress, before the tests can run. Find the installed z library and link it after unwind, or consume dependency metadata that carries it.

### What problem does this PR solve?

Issue Number: N/A

Related PR: apache#69819

Problem Summary: Static libunwind builds with compressed debug-frame support
can reference zlib's uncompress, including Linux ARM64 builds. The standalone
allocator tests linked unwind and lzma but omitted zlib, causing a link
failure before tests could run. Find zlib in the same thirdparty installation
and link it after libunwind and liblzma.

### Release note

None

### Check List (For Author)

- Test: Unit Test - ./run-be-ut.sh --jemalloc-hook --run -j 2 (4/4 on x86_64)
    - Manual link probe: an injected uncompress reference fails without the
      dependency and links successfully with installed libz after the fix.
    - Verified the final link order and git diff --check.
    - Native ARM64 execution was not performed.
- Behavior changed: No production behavior change.
- Does this need documentation: No
@hubgeter

hubgeter commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

run buildall

@hello-stephen

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

------ Round 1 ----------------------------------
============================================
q1	17603	5135	5045	5045
q2	2149	312	250	250
q3	10246	1377	819	819
q4	4680	460	335	335
q5	7443	808	536	536
q6	181	186	158	158
q7	742	794	593	593
q8	9261	1347	1117	1117
q9	5740	4223	4221	4221
q10	6830	1288	1025	1025
q11	433	257	232	232
q12	635	406	286	286
q13	18108	3682	3055	3055
q14	275	280	241	241
q15	q16	744	708	678	678
q17	1217	739	576	576
q18	7099	6190	6103	6103
q19	1252	945	605	605
q20	411	347	246	246
q21	5141	2165	2282	2165
q22	352	298	262	262
Total cold run time: 100542 ms
Total hot run time: 28548 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	5621	5611	5604	5604
q2	688	574	532	532
q3	5205	5397	4910	4910
q4	1999	2150	1602	1602
q5	5261	5169	5170	5169
q6	239	188	144	144
q7	2116	1835	1688	1688
q8	2859	2525	2568	2525
q9	7537	7507	7509	7507
q10	3645	3593	3123	3123
q11	590	428	397	397
q12	671	660	511	511
q13	3302	3587	3054	3054
q14	292	298	270	270
q15	q16	671	684	639	639
q17	7730	7115	6845	6845
q18	12920	12217	12951	12217
q19	894	781	791	781
q20	2140	2181	1920	1920
q21	5607	4622	4671	4622
q22	531	454	428	428
Total cold run time: 70518 ms
Total hot run time: 64488 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-DS: Total hot run time: 151432 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 cfee583affa5b48294e55e2c28e645ee4a7efe28, data reload: false

query5	4306	578	442	442
query6	429	205	194	194
query7	4801	451	230	230
query8	314	168	151	151
query9	8763	3188	3203	3188
query10	463	324	263	263
query11	5968	3873	3622	3622
query12	150	89	84	84
query13	1245	446	348	348
query14	6140	3902	3654	3654
query14_1	3383	3455	3403	3403
query15	210	197	180	180
query16	955	452	446	446
query17	854	643	553	553
query18	2446	425	326	326
query19	213	162	141	141
query20	85	83	82	82
query21	209	127	107	107
query22	13052	12995	12920	12920
query23	13529	12897	12523	12523
query23_1	12530	12720	12494	12494
query24	7409	830	474	474
query24_1	478	493	496	493
query25	539	418	368	368
query26	1255	262	136	136
query27	2768	443	272	272
query28	4628	2047	2044	2044
query29	1569	591	463	463
query30	300	230	181	181
query31	1016	944	821	821
query32	173	94	98	94
query33	525	304	242	242
query34	915	866	519	519
query35	742	741	652	652
query36	813	808	743	743
query37	123	101	87	87
query38	1776	1715	1689	1689
query39	794	795	734	734
query39_1	740	744	735	735
query40	227	121	103	103
query41	77	70	70	70
query42	95	98	90	90
query43	352	364	315	315
query44	1310	699	711	699
query45	178	177	164	164
query46	876	956	558	558
query47	2948	2945	2861	2861
query48	315	302	214	214
query49	573	390	291	291
query50	679	265	204	204
query51	10655	10429	10470	10429
query52	79	77	76	76
query53	191	207	145	145
query54	241	194	173	173
query55	69	66	65	65
query56	226	209	220	209
query57	1648	1596	1568	1568
query58	292	266	249	249
query59	2184	2258	2008	2008
query60	292	244	225	225
query61	147	143	146	143
query62	400	326	278	278
query63	183	157	160	157
query64	2838	983	768	768
query65	3361	3295	3253	3253
query66	1797	422	301	301
query67	20133	20297	19944	19944
query68	3044	1007	619	619
query69	380	297	232	232
query70	883	778	818	778
query71	302	230	210	210
query72	2703	2569	2235	2235
query73	519	520	296	296
query74	4632	4518	4345	4345
query75	2324	2300	1901	1901
query76	2316	1010	583	583
query77	347	366	264	264
query78	9988	9740	9167	9167
query79	1739	845	540	540
query80	1213	430	337	337
query81	602	316	273	273
query82	843	140	103	103
query83	308	192	181	181
query84	312	127	109	109
query85	855	421	376	376
query86	427	237	229	229
query87	1994	1936	1792	1792
query88	3832	2778	2738	2738
query89	332	284	235	235
query90	1928	165	166	165
query91	164	144	132	132
query92	101	89	91	89
query93	1136	993	581	581
query94	709	296	257	257
query95	574	315	368	315
query96	681	488	244	244
query97	2465	2420	2328	2328
query98	164	153	148	148
query99	773	768	646	646
Total cold run time: 237371 ms
Total hot run time: 151432 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
ClickBench: Total hot run time: 24.47 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit cfee583affa5b48294e55e2c28e645ee4a7efe28, data reload: false

query1	0.01	0.01	0.01
query2	0.09	0.06	0.05
query3	0.26	0.09	0.09
query4	1.61	0.10	0.10
query5	0.23	0.24	0.24
query6	1.18	0.68	0.67
query7	0.04	0.01	0.01
query8	0.06	0.04	0.04
query9	0.41	0.36	0.35
query10	0.58	0.59	0.57
query11	0.20	0.15	0.14
query12	0.19	0.15	0.14
query13	0.50	0.48	0.50
query14	1.02	1.02	1.01
query15	0.62	0.62	0.61
query16	0.34	0.36	0.35
query17	1.12	1.12	1.14
query18	0.20	0.19	0.20
query19	2.14	2.02	2.03
query20	0.02	0.02	0.01
query21	15.47	0.19	0.14
query22	4.90	0.06	0.05
query23	16.27	0.34	0.12
query24	2.84	0.52	0.51
query25	0.12	0.06	0.06
query26	1.53	0.22	0.14
query27	0.04	0.04	0.03
query28	3.54	0.80	0.36
query29	12.54	4.15	3.22
query30	0.28	0.13	0.10
query31	2.76	0.56	0.32
query32	3.22	0.59	0.51
query33	3.16	3.18	3.28
query34	15.41	4.03	3.38
query35	3.34	3.36	3.35
query36	0.55	0.46	0.44
query37	0.09	0.07	0.06
query38	0.04	0.04	0.03
query39	0.04	0.03	0.03
query40	0.17	0.15	0.15
query41	0.10	0.03	0.03
query42	0.04	0.03	0.03
query43	0.04	0.04	0.03
Total cold run time: 97.31 s
Total hot run time: 24.47 s

@hello-stephen

Copy link
Copy Markdown
Contributor

BE UT Coverage Report

Increment line coverage 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 67.16% (32020/47677)
Line Coverage 52.00% (336623/647367)
Region Coverage 47.53% (273516/575478)
Branch Coverage 49.37% (128969/261204)

@hubgeter

hubgeter commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

Local pipeline review — ✅ PASS

schema: doris-repo-review/v1
status: PASS
pr: apache/doris#69819
commit: cfee583affa5b48294e55e2c28e645ee4a7efe28
base: 8d88f1cc6f738a331ecfe024a2f1560c770068bb
reviewed_at: 2026-11-02T17:27+08:00
reviewer: hubgeter
model: gpt-6-astra
effort: xhigh
findings: {blocker: 0, major: 0, minor: 0, nit: 0}
rounds: 1
converged: true

Notes for maintainers

  • be/src/runtime/memory/jemalloc_hook.cpp:85 — Source review only: no fresh build/test, production ELF audit, glibc 2.17 or ARM64 execution, profiling stress, or customer JNI E2E was performed in this review. Existing native test logs were treated as historical evidence.

Reviewed locally with the doris-repo-review pipeline. Repository policy may accept this receipt for the matching commit; it is not a human Apache approval.

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 100% (0/0) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 77.66% (35872/46191)
Line Coverage 62.99% (403315/640301)
Region Coverage 59.61% (341457/572794)
Branch Coverage 60.70% (157985/260259)

### What problem does this PR solve?

Problem Summary: Keep glibc's exported allocation entry points on the same jemalloc wrappers as the public interfaces, so callers can mix allocation, reallocation and release entry points safely. Preserve realloc failure errno and valloc/pvalloc page alignment and rounding semantics. Extend native tests to verify symbol ownership, cross-entry operations, boundary cases and late-loaded DSO bindings.

### Release note

Keep glibc allocation entry points paired with jemalloc and preserve allocation API semantics.

### Check List (For Author)

- Test: Unit Test - ./run-be-ut.sh --jemalloc-hook --run -j 2 passed 12/12 on Linux x86_64/glibc 2.32; the new binding check rejects the previous hook. Full BE, older glibc, ARM64 and customer JNI E2E were not run.
- Behavior changed: Yes. Route the remaining glibc allocation entry points to jemalloc and preserve allocator boundary semantics.
- Does this need documentation: No
@hubgeter hubgeter changed the title [fix](be) Keep legacy glibc TLS allocations on jemalloc [fix](be) Route glibc allocation entry points through jemalloc Nov 3, 2026
@hubgeter

hubgeter commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

run buildall

@hubgeter

hubgeter commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

/review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review of PR #69819 at head eed21b8 found no new inline finding that is verified for this head.

Critical checkpoints: the production change is focused on Linux jemalloc/glibc allocator interposition. The realloc errno repair, valloc/pvalloc alignment and overflow paths, zero-size behavior, allocator ownership, and the additive _libc* aliases were traced through the hook and standalone tests. No new production thread, lock, tracked allocation, status path, static initializer, configuration, transaction/persistence path, thrift/protobuf field, FE/BE variable, or observability surface was added. The existing macOS and non-jemalloc exclusions remain coherent, and the runner's standalone dependency discovery and option parsing were reviewed. The native tests cover cross-entry allocation, realloc, alignment, overflow, thread-exit frees, symbol ownership, and late-loaded TLS; their source was inspected only.

Existing review context was revalidated at this head. The prior hook-identity concern is addressed by the dladdr checks and the DSO relocation comparison. The prior ARM64 zlib linkage concern is addressed by linking z. The XML-output-directory concern raised in the prior review body was rechecked there and is not reposted. No existing P0/P1 inline finding still applies, so existing_blocking_comment_ids is empty. No additional user-provided focus was supplied.

This was a static review only; no builds, tests, benchmarks, ELF audits, or end-to-end runs were executed. The review reached the third-round delivery limit. The main agent completed the final changed-file and anchor sweep and found no additional issue, but the required symbol/DSO-focused subagent could not return after repeated model-capacity failures. The delivery is therefore explicit and verified as converged=false; this remaining subagent-coverage gap is the incomplete reason.

Review did not converge after 3 rounds. This automated review cannot pass the review check.

The symbol/DSO-focused subagent did not return after repeated model-capacity failures. The main agent directly rechecked that scope and found no additional issue, but the contract requires every assigned latest-round subagent to return NO_NEW_VALUABLE_FINDINGS before convergence can be true.

@hubgeter

hubgeter commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

Local pipeline review — ✅ PASS

schema: doris-repo-review/v1
status: PASS
pr: apache/doris#69819
commit: eed21b8c1e0e84327d4a4c78c017a797ce90fcc5
base: 8d88f1cc6f738a331ecfe024a2f1560c770068bb
reviewed_at: 2026-11-03T13:13+08:00
reviewer: hubgeter
model: gpt-6.1-sol
effort: max
findings: {blocker: 0, major: 0, minor: 0, nit: 0}
rounds: 1
converged: true

Notes for maintainers

  • be/src/runtime/memory/jemalloc_hook.cpp:101-111 — Source/static-artifact review only; no builds or tests were run. Final shipped-ELF GLIBC_2.17 audit, old-glibc/ARM64 execution, profiling stress and customer JNI E2E remain unverified by this run.

Reviewed locally with the doris-repo-review pipeline. Repository policy may accept this receipt for the matching commit; it is not a human Apache approval.

@hello-stephen

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

------ Round 1 ----------------------------------
============================================
q1	17598	5430	5303	5303
q2	2145	323	278	278
q3	10207	1441	862	862
q4	4675	476	351	351
q5	7451	832	538	538
q6	207	205	160	160
q7	794	823	587	587
q8	9262	1384	1186	1186
q9	5647	4347	4292	4292
q10	6841	1320	1052	1052
q11	449	253	231	231
q12	656	414	301	301
q13	18099	3639	3075	3075
q14	274	277	253	253
q15	q16	756	725	669	669
q17	1208	746	567	567
q18	7079	6196	6141	6141
q19	1259	958	605	605
q20	388	354	232	232
q21	5883	2485	2579	2485
q22	418	355	287	287
Total cold run time: 101296 ms
Total hot run time: 29455 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	6238	6261	6447	6261
q2	794	674	610	610
q3	5690	5849	5396	5396
q4	2199	2311	1741	1741
q5	5699	5806	5574	5574
q6	261	201	153	153
q7	2310	2084	1844	1844
q8	3139	2752	2756	2752
q9	7895	7493	7493	7493
q10	3789	3741	3235	3235
q11	615	444	426	426
q12	731	722	550	550
q13	3424	3658	3072	3072
q14	292	297	269	269
q15	q16	695	711	649	649
q17	7960	7134	7124	7124
q18	13134	12167	12935	12167
q19	960	839	853	839
q20	2190	2182	1971	1971
q21	6155	5132	5155	5132
q22	553	470	437	437
Total cold run time: 74723 ms
Total hot run time: 67695 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-DS: Total hot run time: 151637 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 eed21b8c1e0e84327d4a4c78c017a797ce90fcc5, data reload: false

query5	4300	603	454	454
query6	432	199	195	195
query7	4805	448	225	225
query8	323	166	154	154
query9	8781	3194	3235	3194
query10	473	308	261	261
query11	6050	3896	3611	3611
query12	147	94	88	88
query13	1259	467	327	327
query14	6151	3993	3660	3660
query14_1	3442	3430	3404	3404
query15	209	199	181	181
query16	942	419	417	417
query17	838	641	507	507
query18	2401	408	301	301
query19	201	150	125	125
query20	85	83	81	81
query21	218	128	103	103
query22	12988	13079	12921	12921
query23	13489	13038	12341	12341
query23_1	12642	12564	12536	12536
query24	7323	833	476	476
query24_1	478	471	485	471
query25	503	394	335	335
query26	1244	253	135	135
query27	2787	442	271	271
query28	4606	2050	2047	2047
query29	1526	565	439	439
query30	309	229	188	188
query31	1029	943	820	820
query32	164	88	95	88
query33	519	299	260	260
query34	894	848	506	506
query35	730	747	657	657
query36	831	811	718	718
query37	118	89	75	75
query38	1765	1752	1676	1676
query39	805	782	747	747
query39_1	725	730	737	730
query40	218	110	96	96
query41	64	66	60	60
query42	83	83	79	79
query43	342	366	316	316
query44	1332	714	725	714
query45	176	170	172	170
query46	828	966	570	570
query47	2961	2988	2778	2778
query48	296	305	219	219
query49	569	394	285	285
query50	671	274	214	214
query51	10480	10500	10485	10485
query52	79	83	70	70
query53	185	209	151	151
query54	238	188	173	173
query55	72	75	59	59
query56	226	205	203	203
query57	1680	1629	1572	1572
query58	284	263	253	253
query59	2136	2174	2000	2000
query60	271	243	228	228
query61	155	142	144	142
query62	390	339	285	285
query63	186	162	167	162
query64	2772	1085	919	919
query65	3360	3292	3259	3259
query66	1777	435	316	316
query67	20356	20272	20103	20103
query68	3029	1015	637	637
query69	391	300	253	253
query70	858	774	778	774
query71	301	246	217	217
query72	2888	2731	2254	2254
query73	510	526	303	303
query74	4668	4521	4347	4347
query75	2356	2291	1905	1905
query76	2313	1024	596	596
query77	346	370	269	269
query78	9865	9862	9170	9170
query79	979	906	519	519
query80	1128	441	327	327
query81	592	325	282	282
query82	788	128	105	105
query83	277	193	181	181
query84	314	122	102	102
query85	1088	438	362	362
query86	350	237	233	233
query87	1990	1975	1831	1831
query88	3859	2819	2772	2772
query89	334	290	247	247
query90	1702	180	174	174
query91	170	151	128	128
query92	91	88	86	86
query93	1004	1013	584	584
query94	534	310	281	281
query95	580	409	292	292
query96	689	488	244	244
query97	2480	2489	2341	2341
query98	167	152	145	145
query99	778	769	657	657
Total cold run time: 235740 ms
Total hot run time: 151637 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
ClickBench: Total hot run time: 24.41 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit eed21b8c1e0e84327d4a4c78c017a797ce90fcc5, data reload: false

query1	0.00	0.00	0.00
query2	0.09	0.05	0.05
query3	0.26	0.08	0.08
query4	1.61	0.10	0.10
query5	0.23	0.24	0.24
query6	1.16	0.67	0.69
query7	0.04	0.01	0.01
query8	0.05	0.03	0.03
query9	0.40	0.34	0.37
query10	0.56	0.61	0.57
query11	0.20	0.14	0.15
query12	0.18	0.14	0.14
query13	0.51	0.51	0.49
query14	1.02	1.00	1.02
query15	0.64	0.61	0.61
query16	0.31	0.36	0.35
query17	1.16	1.16	1.14
query18	0.20	0.18	0.18
query19	2.05	2.04	1.92
query20	0.02	0.01	0.02
query21	15.43	0.19	0.14
query22	5.00	0.06	0.05
query23	16.33	0.32	0.12
query24	3.11	0.47	0.51
query25	0.12	0.06	0.04
query26	1.36	0.22	0.15
query27	0.05	0.04	0.04
query28	3.32	0.72	0.37
query29	12.48	4.17	3.25
query30	0.29	0.13	0.10
query31	2.78	0.56	0.33
query32	3.22	0.60	0.52
query33	3.16	3.18	3.18
query34	15.27	4.08	3.41
query35	3.36	3.36	3.38
query36	0.54	0.49	0.45
query37	0.09	0.07	0.06
query38	0.05	0.04	0.04
query39	0.04	0.03	0.03
query40	0.16	0.15	0.14
query41	0.08	0.03	0.03
query42	0.04	0.02	0.02
query43	0.04	0.04	0.04
Total cold run time: 97.01 s
Total hot run time: 24.41 s

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 100% (0/0) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 77.68% (35894/46206)
Line Coverage 63.01% (403618/640526)
Region Coverage 59.63% (341817/573193)
Branch Coverage 60.74% (158157/260393)

@yiguolei
yiguolei merged commit b65a564 into apache:master Nov 4, 2026
46 of 47 checks passed
github-actions Bot pushed a commit that referenced this pull request Nov 4, 2026
### What problem does this PR solve?

Problem Summary:
On glibc < 2.25, dynamic TLS can be allocated by libc and freed by
jemalloc, crashing during thread cleanup. Route all seven glibc
allocation entry points through the existing jemalloc wrappers, preserve
allocator API semantics, and add native interposition tests.

### Release note

Fix a BE crash during dynamic TLS cleanup on older glibc systems and
keep glibc allocation entry points paired with jemalloc.

### Check List (For Author)

- Test
    - [ ] Regression test
    - [x] Unit Test
    - [ ] Manual test (add detailed scripts or steps below)
    - [ ] No need to test or manual test. Explain why:
- [ ] This is a refactor/code format and no logic has been changed.
        - [ ] Previous test can cover this change.
        - [ ] No code files have been changed.
        - [ ] Other reason

`./run-be-ut.sh --jemalloc-hook --run -j 2`: 12/12 passed on Linux
x86_64/glibc 2.32. Full BE, older glibc, ARM64 and customer JNI E2E were
not run.

- Behavior changed:
    - [ ] No.
- [x] Yes. Glibc allocation entry points now consistently use jemalloc,
with allocator boundary semantics preserved.

- Does this need documentation?
    - [x] No.
    - [ ] Yes.

### Check List (For Reviewer who merge this PR)

- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label
github-actions Bot pushed a commit that referenced this pull request Nov 4, 2026
### What problem does this PR solve?

Problem Summary:
On glibc < 2.25, dynamic TLS can be allocated by libc and freed by
jemalloc, crashing during thread cleanup. Route all seven glibc
allocation entry points through the existing jemalloc wrappers, preserve
allocator API semantics, and add native interposition tests.

### Release note

Fix a BE crash during dynamic TLS cleanup on older glibc systems and
keep glibc allocation entry points paired with jemalloc.

### Check List (For Author)

- Test
    - [ ] Regression test
    - [x] Unit Test
    - [ ] Manual test (add detailed scripts or steps below)
    - [ ] No need to test or manual test. Explain why:
- [ ] This is a refactor/code format and no logic has been changed.
        - [ ] Previous test can cover this change.
        - [ ] No code files have been changed.
        - [ ] Other reason

`./run-be-ut.sh --jemalloc-hook --run -j 2`: 12/12 passed on Linux
x86_64/glibc 2.32. Full BE, older glibc, ARM64 and customer JNI E2E were
not run.

- Behavior changed:
    - [ ] No.
- [x] Yes. Glibc allocation entry points now consistently use jemalloc,
with allocator boundary semantics preserved.

- Does this need documentation?
    - [x] No.
    - [ ] Yes.

### Check List (For Reviewer who merge this PR)

- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label
yiguolei pushed a commit that referenced this pull request Nov 5, 2026
…alloc #69819 (#70153)

Cherry-picked from #69819

Co-authored-by: daidai <changyuwei@selectdb.com>
yiguolei pushed a commit that referenced this pull request Nov 6, 2026
### What problem does this PR solve?

Issue Number: None

Related PR: #65730 #66608 #66805 #66841 #66999 #67005 #67011 #67110
#67268 #67289 #67325 #67650 #67921 #68028 #68335 #68375 #68615 #68690
#68813 #68815 #68707 #68649

Problem Summary:

**In short.** This ports the Lance BE read path of branch-4.1 /
branch-4.2 to master, in its branch-4.2 form as of `cabcf45c1af`, plus
the BE side of three 4.x changes merged after that snapshot: the search
filter `prefilter` flag and profile layout (#68813), distance bounds for
`vector_search` (#68815), and the split-level index rule of #68707 that
#68815 relies on. It gathers the BE parts of the PRs listed above.
Master links `liblance_c` but has no Lance reader, so every
`FORMAT_LANCE` scan fails today. With this PR the BE reads Lance
datasets through FileScannerV2: plain scans, vector search and full-text
search, predicate and runtime-filter pushdown, the schema fetch of a
local Lance TVF, and the second phase of TopN lazy materialization. The
PR is BE only. The FE connector plugin and the regression suites come in
separate PRs, so until then nothing on master plans a Lance scan, and
the BE unit tests carry the proof.

Original authors: @zhangstar333 @Gabriel39 @wangzhaobo957-cloud @Jay-ju
@FANNG1

**Background.** Lance shipped in 4.1.4: the Lance catalog, `local()` /
`s3()` with `format=lance`, and the `vector_search` / `full_text_search`
TVFs. On master the FE side is being rebuilt as a connector plugin
(`fe-connector-lance`), and the BE needs the reader from 4.x. The thrift
ids are the branch-4.1 / 4.2 ones, including `TExternalSearchRequest.5`
(`prefilter`) and `TVectorSearchParams.6/7` (distance bounds) added
after the snapshot, so a BE built from master also reads the Lance scan
ranges and search requests that a 4.x FE sends during a rolling upgrade.
The one exception is `TVectorSearchOptions` 6, branch-4.2's
`approx_mode` (#69852, merged into branch-4.2 after the snapshot and not
ported): it is reserved in a comment, and a master BE ignores it, so
during a rolling upgrade a 4.2 FE that asks for `fast` or `accurate`
gets Lance's default (`normal`).

**The problem, and what it cost.**

| | master today | with this PR |
|---|---|---|
| A `FORMAT_LANCE` scan | FileScannerV2 has no Lance reader, so the scan
fails with "FileScannerV2 does not support file format" | read by
`LanceTableReader` in FileScannerV2 |
| `fetch_table_schema` for a local Lance TVF | not handled | returns the
Arrow schema mapped to Doris types; Null leaves keep `NULL_TYPE` |
| The row location of a Lance row in TopN lazy materialization |
`GlobalRowLoacationV2` only has a 32-bit row id, but a Lance row id is a
64-bit id within the snapshot | a version 1 layout carries the 64-bit
row id; phase two reads the rows with the dataset's `take_rows` |

**How this PR fixes it.**

- Reader: `be/src/format_v2/lance/*` and
`be/src/format_v2/table/lance_reader.*`, as on branch-4.2 except one
local renamed for master's `-Wshadow`. The unit tests construct
`RuntimeState(TQueryOptions(), globals)`, because master removed the
globals-only constructor.
- FileScannerV2: the reader dispatch and `_to_file_format` handle
`FORMAT_LANCE` / `"lance"`; `FileFormat::LANCE` is added to its two
exhaustive switches. Since #69723 every file scan uses FileScannerV2, so
nothing else routes Lance scans (on branch-4.2 a Lance query fails with
NotSupported when `enable_file_scanner_v2` is off).
- Row locations: `ROW_VERSION {FILE_LOCAL_ROW_ID = 0,
LANCE_DATASET_ROW_ID = 1}` and a union layout for
`GlobalRowLoacationV2`. Version 0 keeps its byte layout, which static
asserts pin. `PRequestBlockDesc.row_id` becomes `uint64` (a proto2
varint, so the wire format is compatible). The materialization operator
decodes row locations by version, rejects an unknown version or a wrong
size, and stamps `row_location_version`. `RowIdStorageReader` validates
the counts and the version, range-checks internal row ids against
`uint32`, and groups Lance rows by plan node, snapshot version and
dataset URI, so each dataset is read with one `take_rows`. Master's
segment batching, scan-slot dedup and fetch concurrency stay as they
are.
- Thrift (`PlanNodes.thrift`): the external search request body
(`TVectorElementType`, `TVectorMetric`, `TSearchVector`,
`TVectorSearchParams` 1-7, `TFtsCoverageMode`, `TFtsQueryType`,
`TFtsMatchOperator`, `TFullTextSearchParams`, `TSearchFilterFormat`,
`TSearchFilter`, `TVectorSearchOptions`, `TExternalSearchQuery`),
`TExternalSearchRequest` 2-5 and `TLanceFileDesc` 4-6, all with the
branch-4.1 / 4.2 ids. The enums spell out their 4.x values. No id is
reused. On master, #70075 reserved `TExternalSearchRequest` 2-5 in
comments and added 6 (`paimon_options`); this PR replaces those comments
with the fields and leaves 6 as it is. `TVectorSearchOptions` 6 is
reserved in a comment for branch-4.2's `approx_mode` (#69852).
- After the snapshot (one commit each):
- #68813: `prefilter` decides whether the TVF search filter runs before
(true) or after (unset / false) candidate selection, for vector and
full-text search. The profile groups the Lance counters under
`LanceTiming`, `LanceIO`, `LanceIndex`, `LanceVectorIndex`,
`LanceScalarIndex`, `LanceExecutionPlan`, `LanceScan`, `LanceSearchPlan`
and `LanceDataCache`, uses the 4.x counter names, and registers every
scan metric before the statistics callback is installed, so the
callback, which Lance invokes from its execution streams, never adds
counters. #68813's FE tweak that hides `TUnit.NONE` labels in
`AggCounter` belongs to the FE port.
- #68707 (part): a vector split searches exactly the index segments FE
planned for it, and a split without segments is searched flat whatever
`use_index` says; a split with segments under `use_index = false` is
rejected. 4.x FEs plan segments only when `use_index` allows them.
- #68815: `distance_lower_bound` (inclusive) and `distance_upper_bound`
(exclusive) are validated (finite FLOAT values, lower < upper at FLOAT
precision, single-vector only) and installed with
`lance_scanner_set_distance_range()`, which master's pinned lance-c
provides.
- Review fixes:
- A nested array goes to the Doris SerDes without a copy only when it
and every descendant start at offset 0 and reference exactly their child
ranges. Lance's legacy (v1) decoder can return a struct or list that is
tight at its own level over a Boolean child with a bit offset (a batch
that starts mid-byte in the bitmap), and the SerDes reject that under
Arrow input validation.
- A zero-field `STRUCT<>`, which Lance decodes, is reported as an
unsupported column at any nesting level, like the other unsupported
Lance types. It used to be typed as a STRUCT that `ColumnStruct` cannot
hold (its row count comes from its first child).
- A Lance Decimal256 field with precision <= 38 is narrowed to
Decimal128 by a safe Arrow cast before decoding. Doris types it
DECIMAL32/64/128I by precision, and those SerDes read only Decimal128
arrays; the BE used to crash on the first value, also for nested leaves.
Only values a reader can see are cast: before a nested leaf is narrowed,
every child slot that no visible row references (under a NULL list,
fixed-size-list, map or struct row, or outside a sliced parent) is
marked NULL, so a hidden value does not fail the cast and a visible
value outside the declared precision still does; map keys, which cannot
be NULL, stay checked.
- FLOAT / DOUBLE `>=` runtime filters stay residual-only. Lance compares
floats by totalOrder, so a pushed `x >= c` dropped negative-NaN rows
that Doris keeps.
- Runtime filters that mention INT64_MIN stay residual-only. The pinned
Lance SQL parser reads `-9223372036854775808` as the negation of a
magnitude that it parses as i64 first; the overflow turns the literal
into a Float64, which the planner cannot coerce to Int64 or Decimal, so
a pushed IN, `>=` or `<=` filter on an INT64 or scale-zero decimal
column failed planning and the query failed. Every other i64 is still
pushed.
- The shared Arrow DATE32 decoding
(`DataTypeDateV2SerDe::read_column_from_arrow`) rejects days outside
0000-01-01..9999-12-31 instead of returning a non-null `0000-00-00`,
skips null slots and adds the epoch in 64 bits: the DATE32 range part of
branch-4.1 / 4.2 #68649. It also changes ADBC, Arrow stream load and
paimon-rust reads.
- Child values hidden by a NULL list, fixed-size-list, map or struct row
are not decoded: the array, map and struct SerDes give the element SerDe
a validity bitmap that also clears those slots
(`mask_arrow_children_hidden_by_null_parents()`). Arrow leaves them
unspecified, and Lance's v2.1 miniblock encoding keeps them, so a hidden
10000-01-01 under a NULL fixed-size list used to fail the DATE32 range
check above. Visible values are unchanged; this applies to ADBC, Arrow
stream load and paimon-rust as well. The masks come from ExecEnv's
tracked Arrow pool. A nested Lance array that is compacted before
decoding is masked the same way, at every level, before its
`ValidateFull()`, so a hidden invalid UTF-8 string, out-of-precision
decimal, Date64 or time no longer fails the batch while a visible one
still does. Since #69697 the same masks keep hidden DATETIMEV2 /
TIMESTAMPTZ values out of its range checks. A mask costs at most one
pass per batch: a NULL row that owns no child slots, or only NULL ones,
allocates nothing, and Arrow stream load masks each retained IPC batch
once (`mask_arrow_descendants_not_visible()`) before it hands row ranges
to the SerDes, so its per-block reads allocate nothing. The one
per-block mask left is for map keys under a NULL map row that still owns
entries, since a MapArray cannot hold NULL keys; Arrow's map builder
writes NULL map rows without entries.
- Core: `to_protobuf` keeps `NULL_TYPE` for a NULL literal type, so a
Null leaf in ARRAY / MAP / STRUCT no longer comes back as BOOLEAN. The
nullable serde reads an Arrow Null array as NULLs without touching
buffers that the array does not have.
- Configs, caches and metrics, with the 4.x names and defaults:

  | Config | Default |
  |---|---|
  | `lance_index_cache_size_bytes` | 10 GiB |
  | `lance_metadata_cache_size_bytes` | 1 GiB |
  | `enable_lance_data_cache` | true |
  | `lance_data_cache_path` | `${DORIS_HOME}/lance_data_cache` |
  | `lance_data_cache_disk_capacity_bytes` | 100 GiB |
  | `lance_data_cache_read_block_size_bytes` | 1 MiB |
  | `lance_io_buffer_size_bytes` (mutable) | 2 GiB |
  | `lance_batch_readahead` (mutable) | 5 |
  | `lance_fragment_readahead` (mutable) | 5 |

The BE-wide Lance session (index cache, metadata cache and the optional
Foyer disk cache) is created by the first Lance scan, so a BE that never
reads Lance creates no cache directory. The first six configs take
effect after a restart. A negative cache size (and, while the data cache
is enabled, a negative disk capacity or read block size) fails the first
Lance scan with a message that names the setting, as does any data-cache
value lance-c rejects; the rest of the BE keeps serving. Ten
`lance_session_*` metrics report the two in-memory caches. With the
defaults, the disk tier keeps 51,200 sparse 2 MiB block files open from
the first Lance scan on (100 GiB in blocks of twice the read block
size), the same as on branch-4.1 / 4.2. Size
`lance_data_cache_disk_capacity_bytes` and
`lance_data_cache_read_block_size_bytes` against the BE's open-file
limit, or set `enable_lance_data_cache = false`.

The index and metadata caches live in lance-c memory: they are not
charged to a MemTracker or registered with CacheManager, so memory GC,
the cache capacity adjustment under memory pressure and
`/api/clear_cache/all` do not shrink them, and `enable_lance_data_cache
= false` does not turn them off. lance-c has no call to clear, evict or
resize them, so size them with the two configs. The disk tier keys
blocks by Lance's store prefix (`scheme$bucket` for S3, GCS and OSS,
without the endpoint) and the object path
(`thirdparty/patches/lance-c-foyer.patch`). Several endpoints that serve
the same bucket name and data-file path with different bytes (data files
registered under chosen names or replaced in place; Lance's writers use
random file names) share entries, also across a BE restart; such a
deployment should set `enable_lance_data_cache = false`. Both are as on
branch-4.1 / 4.2 and tracked as follow-ups.

A Lance scan's native working set, that is the I/O buffered up to
`lance_io_buffer_size_bytes` per scanner, the decode readahead and the
operators of a search plan such as the top-k of a flat vector search, is
allocated inside lance-c and is charged to neither the query nor its
workload group. It counts toward the BE process memory only, so memory
GC, which ranks queries by tracked memory, does not attribute it to the
Lance query. lance-c accepts no memory budget, so on BEs with little
memory headroom size `lance_io_buffer_size_bytes`,
`lance_batch_readahead` and `lance_fragment_readahead` for the number of
concurrent Lance scanners. As on branch-4.1 / 4.2; tracked as a
follow-up.
- Build: macOS links `-framework IOKit`. This is the first time objects
of `liblance_c.a` are pulled into `doris_be`, so the binary and the link
time grow. With this PR `util/rle_encoding.h` reaches 231 TUs and
`util/threadpool.h` 589, the same as master `315c2e00331` alone (limits
275 and 660 since #69717), and `gen_cpp/internal_service.pb.h` 562
(master alone 559, limit 660); the reach budgets are unchanged.

Not included: the Lance index metadata scanner (`LANCE_INDEX_ENTRIES`);
the FE side, including the rolling-upgrade guard that keeps Lance lazy
materialization off while an old BE could decode a version 1 row
location as version 0; the regression suites; the rest of #68707
(searching historical versions, tags and branches, rejecting fragment
ids missing from the snapshot, naming the snapshot in errors and the
profile). The `InitReaderAvgTime` / `GetBlockAvgTime` profile fix that
#67005 carried goes in a separate PR.

**Results.**

| | master | with this PR |
|---|---|---|
| A `FORMAT_LANCE` query | fails before reading anything | read by
`LanceTableReader` in FileScannerV2 |
| A Lance row in the second phase of TopN lazy materialization | cannot
be represented | a version 1 row location, read back with `take_rows` |
| A row location of an unknown version or size in phase two | decoded as
version 0 | rejected with an error |
| An Arrow DATE32 day outside 0000-01-01..9999-12-31 (ADBC, Arrow stream
load, paimon-rust, Lance) | read as a non-null `0000-00-00` | the read
fails with `InvalidArgument` |

BE unit tests (ASAN, macOS arm64, against master's pinned lance-c), on
the head rebased onto master `378404eeb12`: 1029 cases in 54 suites run,
1027 pass and 2 Parquet microbenchmarks skip by design. They cover the
Lance suites (107: `LanceTableReader*` 83, `LanceNestedNullTest` 10,
`LanceRuntimeFilterHelperTest` 10, `LanceSessionManagerTest` 4); the
row-location protocol (`MaterializationSharedStateTest`,
`RowIdStorageReaderTest`, and the new `RowIdFetchRequestValidationTest`:
count mismatch, unknown version, a Lance version on an internal mapping,
an internal row id of 2^32); `FileScannerV2Test` (28); the ORC and
Parquet reader suites (`NewOrcReaderTest`, `NewParquetReaderTest`,
`ParquetScanTest` and the other `Parquet*` suites), whose row ids now go
through `file_local`; and the Arrow / protobuf / DATE serde suites with
the new `ArrowParentNullsTest`, plus the Iceberg and Parquet reader
suites that decode Arrow dates. Reverting any of the review fixes, the
#68813 flag, the #68707 split rule or the #68815 bounds makes its new
tests fail. The sixth review round adds 13 cases (`ArrowParentNullsTest`
10, `LanceTableReaderTypeTest` 3) and extends one; with them the Arrow
SerDe, Lance, ADBC and `IcebergV2ReaderTest` suites run 317 cases: 310
pass and the 7 ADBC SQLite cases skip without a local SQLite driver. The
ninth review round adds
`LanceRuntimeFilterHelperTest.KeepsInt64MinFiltersResidualOnly` and
`LanceTableReaderFilterTest.KeepsInt64MinRuntimeFiltersOutOfLanceScanner`:
both pass with the 106 Lance cases (`Lance*`) on the branch rebased onto
`339e087b11f`, and restoring `parse_int64()` in either check makes
exactly these two fail. On the head rebased onto master `315c2e00331`,
with the per-block mask fix (`42cf4e3e5d1`), 328 cases in 24 suites
pass: the Arrow SerDe and validation suites, `ArrowParentNullsTest`
(15), `LoadArrowPipeTest` (47), the DATETIMEV2 / TIMESTAMPTZ SerDe
suites, `ArrowColumnToDorisColumnTest`, `ArrowBlockConvertorTest`,
`AdbcReaderTest`, `RemoteDorisV2ReaderTest`, `PaimonRustTableReaderTest`
and the Lance suites. Allocating at the first NULL row of each call
again fails the new `ArrowParentNullsTest` case and the four new
`LoadArrowPipeTest` block cases, dropping the per-batch mask fails the
LIST and STRUCT block cases, and returning the child unmasked fails the
new timestamp case, four `ArrowParentNullsTest` cases and
`LanceTableReaderTypeTest.IgnoresDate32PayloadHiddenByNullParents`.

### Release note

Add nine `lance_*` BE configs and `lance_session_*` BE metrics. They
take effect once the FE can plan Lance scans. Reading an Arrow DATE32
value outside 0000-01-01..9999-12-31 through ADBC, Arrow stream load or
paimon-rust now fails instead of returning 0000-00-00.

### Check List (For Author)

- Test <!-- At least one of them must be included. -->
    - [ ] Regression test
    - [x] Unit Test
- `run-be-ut.sh --run --filter=...` with the suites listed under
Results: 420 of 420 pass on macOS arm64 (ASAN) on the content before the
rebases, and the Lance and Arrow SerDe suites pass again with the
nested-offset, zero-field struct, hidden-child, hidden-Decimal256 and
compaction-mask fixes (the ADBC SQLite cases skip without a local SQLite
driver). Rebased onto master `43f9ceb48d7`: #69668 conflicted in the
scanner selection and in `fetch_table_schema`, which now hands every
file format to `format::fetch_file_schema()`, so the Lance branch runs
ahead of that call; #69646 added a TopN row-group test that reads the
version 0 row location fields, which now go through `file_local` (the
earlier rebase onto `5caaeb3e3d4` resolved #69614 and #69601 in the
scanner selection, the `FileFormat` enum, its test and the reach budget
table). The 95 TUs that this PR changes or that master changed since
`5caaeb3e3d4` were syntax-checked against the rebased tree with the UT
build flags, and CI runs the suites again. Rebased again onto master
`8d88f1cc6f7`: the only conflict was the budget table, where #65858
moved the `util/rle_encoding.h` baseline to 828, and the 163 TUs that
this PR changes or that master changed since `43f9ceb48d7` pass the same
syntax check. Rebased again onto master `339e087b11f`: the only conflict
was the budget table again, where #67292 moved the `util/rle_encoding.h`
baseline to 834; #69872 added Arrow type checks ahead of the NULL-parent
masking in the map and struct readers and merged cleanly. Of the 114
sources that this PR changes or that master changed since `8d88f1cc6f7`,
111 pass the same syntax check. The other three are master's: two new
#67292 files under `storage/segment` fail the same way on master alone,
since they compile only inside their unity batch, and this PR adds no
source to that target; the #69818 benchmark is not in the UT build and
includes only `util/simd` headers that this PR does not touch. Reverting
any of the review fixes, the #68813 flag, the #68707 split rule or the
#68815 bounds makes its new tests fail. Rebased again onto master
`378404eeb12`, which removed the legacy file scanner (#69723): the
conflicts were in the scanner-selection code and tests that #69723
deleted, so this PR's Lance lines there went with them (including its
`LanceQueriesAlwaysUseScannerV2` test), in the profile keys of
`materialization_opertor.cpp`, and in the row fetch of
`rowid_fetcher.cpp`, whose non-Lance path is now only
`FileScannerV2::read_by_rows`; the deleted V1 ORC / Parquet row id tests
took this PR's `file_local` rename with them, and the
`util/rle_encoding.h` budget commit is dropped because master is no
longer near that limit. Of the 100 sources that this PR changes or that
master changed since `339e087b11f`, 99 pass the same syntax check; the
other, `format_v2/orc/orc_reader.cpp`, fails the same way on master
alone. On the rebased head the suites listed under Results run 1029
cases: 1027 pass and 2 microbenchmarks skip. The test-utility fix that
`DataTypeDateTimeV2SerDeTest` needed on macOS (#69695) is now on master.
Rebased again onto master `315c2e00331`: the only conflict was
`TExternalSearchRequest` in `PlanNodes.thrift`, where #70075 had
reserved fields 2-5 in comments; the two commits that add the fields
replace those comments, and field 6 stays #70075's `paimon_options`.
#69717 cut transitive includes from shared headers: of the 160 sources
that this PR changes or that master changed since `378404eeb12`, 156
pass the same syntax check; the two `jemalloc_hook` tests have no
compile command on macOS, `runtime/memory/jemalloc_hook.cpp` uses glibc
aliases that macOS cannot build (#69819), and
`format_v2/table_reader.cpp` alone fails the same way on master alone
while its unity batch compiles. The full `doris_be_test` builds and
links on the rebased head; `ArrowParentNulls*` and `Lance*` (121 cases)
pass before the mask fix, and the 328 cases above with it.
- `build-support/check-build-hygiene.sh` (on this branch rebased onto
master `315c2e00331`), clang-format 16 and
`build-support/run-clang-tidy.sh` on the changed files: all pass; on the
changed lines clang-tidy (llvm 22) reports only
`readability-inconsistent-ifelse-braces` on the `DORIS_CHECK` lines of
the masking functions, the macro's expansion that master's existing
`DORIS_CHECK`s report too.
    - [ ] Manual test (add detailed scripts or steps below)
    - [ ] No need to test or manual test. Explain why:
- Behavior changed:
    - [ ] No.
- [x] Yes. `PRequestBlockDesc.row_id` is `uint64`; phase two of TopN
lazy materialization rejects row locations of an unknown version or
size; `FORMAT_LANCE` scans run on FileScannerV2; an Arrow DATE32 day
outside the Doris DATE range fails the read instead of becoming
`0000-00-00`.
- Does this need documentation?
    - [x] No. Lance is documented with the FE connector.
- [ ] Yes. <!-- Add document PR link here. eg:
apache/doris-website#1214 -->

### Check List (For Reviewer who merge this PR)

- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label <!-- Add branch pick label that this PR
should merge into -->

---------

Co-authored-by: zhangstar333 <zhangsida@selectdb.com>
Co-authored-by: Gabriel <liwenqiang@selectdb.com>
Co-authored-by: zhaobo wang <wangzhaobo957@gmail.com>
Co-authored-by: jay <qingfengyouchen@163.com>
Co-authored-by: FANNG <fanng@apache.org>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: zy-kkk <zhongyk10@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants