Skip to content

[improvement](fe) Reuse boxed IDs in cloud tablet indexes - #66389

Merged
deardeng merged 2 commits into
apache:masterfrom
deardeng:improve-cloud-rebalance-id-boxing-standalone
Aug 4, 2026
Merged

[improvement](fe) Reuse boxed IDs in cloud tablet indexes#66389
deardeng merged 2 commits into
apache:masterfrom
deardeng:improve-cloud-rebalance-id-boxing-standalone

Conversation

@deardeng

@deardeng deardeng commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Problem Summary: Cloud tablet route rebuilding repeatedly boxes primitive backend, table, partition, index, and tablet IDs while inserting the same logical IDs into current and future global, table, and partition indexes.

This PR contains two related improvements:

  1. Reuse boxed IDs across route indexes

    Hoist boxing to the traversal and incremental update callers, then pass the same immutable Long references through a boxed helper overload. Preserve the public primitive method descriptor and the existing putIfAbsent container implementation so the optimization
    applies directly to master without depending on lazy container creation.

  2. Preserve in-flight tablet IDs across route rebuilds

    An asynchronous warmup task may remain in flight when the next rebalance round rebuilds route information. Previously, the rebuild stored a newly boxed tablet ID in the current and future indexes. If the warmup subsequently failed, rollback restored the original boxed
    ID held by the task only to the future indexes, while the current indexes retained the newly boxed instance.

    The fix reuses InfightTask.pickedTabletId when rebuilding both current and future route indexes. This preserves boxed-ID identity across the global, table-level, and partition-level indexes without changing routing decisions, destination backends, or scheduling
    semantics. It also prevents one additional Long wrapper from being retained for each affected failed in-flight tablet until the next route rebuild.

A single-threaded JDK 17 allocation model that keeps eager container candidates in both variants estimates that 4 million tablets across 4 clusters reduce cumulative allocation from 25.47 GiB to 19.76 GiB (22.42%) and approximate post-full-GC retained heap from 6.80 GiB
to 4.94 GiB (27.37%). These are path-level model estimates rather than production RSS measurements.

The allocation estimates cover the boxed-ID reuse optimization. The cross-generation warmup rollback fix provides an additional lifecycle correctness guarantee and is not included in those estimates.

related PR #66378

Release note

None

Check List (For Author)

  • Test: Unit Test and Manual test

    • ./run-fe-ut.sh --run org.apache.doris.cloud.catalog.CloudTabletRebalancerTest (10 tests passed)

    • ./run-fe-ut.sh --run org.apache.doris.cloud.catalog.CloudTabletRebalancerTest#testFillBeToTabletsReusesBoxedIdsAcrossIndexes (RED before fix, passed after fix)

    • mvn checkstyle:check -pl fe-core (0 violations)

    • Multi-scale JDK 17 eager-container allocation model at 0.2M, 0.4M, 0.8M, and 3.2M tablet-cluster pairs, three runs per scale

  • Behavior changed: No

  • Does this need documentation: No

What problem does this PR solve?

Issue Number: close #xxx

Related PR: #xxx

Problem Summary:

Release note

None

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
  • Behavior changed:

    • No.
    • Yes.
  • 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

@deardeng
deardeng requested a review from gavinchou as a code owner August 3, 2026 12:02
@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?

@deardeng

deardeng commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

/review

@deardeng

deardeng commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

run buildall

@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.

The rebuild-side change is focused and preserves route equality, the public primitive method descriptor, and existing concurrency/lifecycle behavior. The boxed helper plus statRouteInfo callers do reuse identifier objects across the current/future global, table, and partition indexes, and the added test proves that helper behavior on empty maps.

One material performance gap remains: incremental direct moves, warmup, and rollback unbox the selected canonical tablet ID and re-box it inside updateBeToTablets; direct moves then retain distinct objects in the current and future families. Because the test calls the boxed helper directly, it does not cover this production path. I am requesting changes for the inline issue.

Critical checkpoints: the scope is otherwise small and clear; no new locking, static lifecycle, configuration, persistence, transaction, FE-BE, storage-format, or rolling-upgrade concern was found; all parallel rebuild and incremental paths were traced; no extra observability is needed for this allocation-only change. The review was static-only as required, so no builds or tests were run. There was no additional user-provided focus; the whole PR was reviewed.

@hello-stephen

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

------ Round 1 ----------------------------------
============================================
q1	17881	3951	3939	3939
q2	2025	314	196	196
q3	10359	1331	800	800
q4	4681	460	336	336
q5	7488	830	547	547
q6	177	183	142	142
q7	723	793	597	597
q8	9364	1551	1431	1431
q9	5745	4061	4037	4037
q10	6750	1621	1329	1329
q11	519	370	325	325
q12	754	577	453	453
q13	18117	3195	2726	2726
q14	262	254	242	242
q15	q16	735	724	656	656
q17	994	987	1092	987
q18	6867	5738	5387	5387
q19	1145	1199	1056	1056
q20	816	690	602	602
q21	5628	2629	2369	2369
q22	423	358	294	294
Total cold run time: 101453 ms
Total hot run time: 28451 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	4254	4147	4165	4147
q2	283	313	207	207
q3	4540	4861	4343	4343
q4	2168	2263	1401	1401
q5	4219	4126	4112	4112
q6	231	175	124	124
q7	1678	1594	1409	1409
q8	2524	2164	2128	2128
q9	7336	7185	7168	7168
q10	4359	4268	3883	3883
q11	559	412	365	365
q12	706	728	495	495
q13	3116	3477	2996	2996
q14	296	302	286	286
q15	q16	726	701	635	635
q17	1269	1271	1299	1271
q18	7935	7158	7252	7158
q19	1156	1059	1089	1059
q20	2186	2189	1908	1908
q21	5256	4608	4363	4363
q22	522	455	398	398
Total cold run time: 55319 ms
Total hot run time: 49856 ms

@hello-stephen

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

query5	4332	610	467	467
query6	473	213	202	202
query7	4909	607	350	350
query8	326	185	171	171
query9	8785	4057	4027	4027
query10	449	343	284	284
query11	5816	2223	2015	2015
query12	149	98	99	98
query13	1245	577	425	425
query14	6079	4668	4379	4379
query14_1	3806	3767	3819	3767
query15	211	205	176	176
query16	1015	466	436	436
query17	1102	673	560	560
query18	2433	472	347	347
query19	208	190	153	153
query20	107	103	102	102
query21	239	157	143	143
query22	13004	13022	12832	12832
query23	17220	16317	16000	16000
query23_1	16083	16088	16167	16088
query24	7666	1725	1265	1265
query24_1	1268	1263	1264	1263
query25	573	444	385	385
query26	1329	352	212	212
query27	2628	611	393	393
query28	4437	2069	2051	2051
query29	1130	624	490	490
query30	348	267	224	224
query31	1122	1081	964	964
query32	98	64	63	63
query33	549	324	258	258
query34	1194	1133	645	645
query35	744	751	644	644
query36	782	772	692	692
query37	158	110	89	89
query38	1839	1666	1589	1589
query39	814	839	808	808
query39_1	805	776	803	776
query40	248	166	151	151
query41	73	71	69	69
query42	100	91	91	91
query43	322	326	282	282
query44	1420	815	795	795
query45	189	185	165	165
query46	1053	1146	745	745
query47	1554	1504	1447	1447
query48	411	416	322	322
query49	609	417	304	304
query50	1041	428	350	350
query51	10754	10780	10304	10304
query52	87	86	73	73
query53	246	272	206	206
query54	286	225	228	225
query55	75	70	67	67
query56	301	309	315	309
query57	1025	1008	903	903
query58	282	256	247	247
query59	1524	1583	1354	1354
query60	299	284	251	251
query61	156	147	148	147
query62	412	319	268	268
query63	241	199	200	199
query64	2797	1025	844	844
query65	3896	3843	3793	3793
query66	1816	470	367	367
query67	28169	28160	27951	27951
query68	3320	1570	1056	1056
query69	421	311	253	253
query70	912	764	793	764
query71	378	324	309	309
query72	3026	2634	2285	2285
query73	820	748	450	450
query74	4608	4480	4312	4312
query75	2396	2339	1994	1994
query76	2338	1130	741	741
query77	348	372	336	336
query78	11170	11063	10532	10532
query79	2310	1163	757	757
query80	1541	545	451	451
query81	622	322	283	283
query82	618	157	118	118
query83	375	324	305	305
query84	283	159	134	134
query85	986	618	551	551
query86	414	231	230	230
query87	1804	1829	1748	1748
query88	3773	2839	2821	2821
query89	406	318	287	287
query90	1881	215	197	197
query91	206	191	163	163
query92	62	63	59	59
query93	1754	1463	943	943
query94	719	329	321	321
query95	807	537	483	483
query96	1028	787	357	357
query97	2451	2434	2345	2345
query98	207	195	187	187
query99	721	734	608	608
Total cold run time: 257768 ms
Total hot run time: 169106 ms

@hello-stephen

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

query1	0.00	0.01	0.01
query2	0.10	0.05	0.05
query3	0.25	0.14	0.13
query4	1.61	0.14	0.15
query5	0.25	0.22	0.22
query6	1.16	0.83	0.83
query7	0.04	0.01	0.00
query8	0.06	0.03	0.03
query9	0.37	0.36	0.31
query10	0.57	0.56	0.53
query11	0.19	0.13	0.13
query12	0.18	0.14	0.14
query13	0.47	0.46	0.47
query14	1.03	0.99	0.97
query15	0.60	0.58	0.59
query16	0.30	0.34	0.31
query17	1.11	1.10	1.08
query18	0.21	0.20	0.19
query19	2.04	1.99	1.95
query20	0.02	0.01	0.02
query21	15.45	0.22	0.14
query22	4.76	0.05	0.05
query23	16.14	0.31	0.12
query24	2.99	0.42	0.31
query25	0.11	0.06	0.04
query26	0.75	0.20	0.17
query27	0.04	0.05	0.05
query28	3.48	0.72	0.37
query29	12.51	4.00	3.19
query30	0.27	0.15	0.16
query31	2.78	0.56	0.32
query32	3.22	0.60	0.49
query33	3.14	3.22	3.17
query34	15.66	3.95	3.27
query35	3.21	3.21	3.23
query36	0.56	0.43	0.42
query37	0.10	0.06	0.06
query38	0.05	0.04	0.03
query39	0.04	0.03	0.03
query40	0.18	0.16	0.15
query41	0.09	0.03	0.03
query42	0.04	0.02	0.02
query43	0.04	0.03	0.04
Total cold run time: 96.17 s
Total hot run time: 23.89 s

### What problem does this PR solve?

Issue Number: None

Related PR: apache#61318

Problem Summary: Cloud tablet route rebuilding repeatedly boxes primitive backend, table, partition, index, and tablet IDs while inserting the same logical IDs into current and future global, table, and partition indexes. Hoist boxing to traversal callers and preserve selected boxed tablet IDs through direct transfers, warmup moves, and warmup rollbacks so all route index families reuse immutable Long references without changing routing or scheduling semantics. A single-threaded JDK 17 allocation model that keeps eager container candidates in both variants estimates that 4 million tablets across 4 clusters reduce cumulative allocation from 25.47 GiB to 19.76 GiB (22.42%) and approximate post-full-GC retained heap from 6.80 GiB to 4.94 GiB (27.37%). For IDs outside the Long cache, each direct incremental move additionally avoids two tablet wrapper allocations and one duplicate retained tablet wrapper; warmup and rollback each avoid one tablet wrapper allocation. These are path-level model and identity-test results, not production RSS measurements.

### Release note

None

### Check List (For Author)

- Test: Unit Test and Manual test\n    - ./run-fe-ut.sh --run org.apache.doris.cloud.catalog.CloudTabletRebalancerTest (13 tests passed)\n    - mvn checkstyle:check -pl fe-core (0 violations)\n    - Multi-scale JDK 17 eager-container allocation model at 0.2M, 0.4M, 0.8M, and 3.2M tablet-cluster pairs, three runs per scale\n- Behavior changed: No\n- Does this need documentation: No
@hello-stephen

Copy link
Copy Markdown
Contributor

FE UT Coverage Report

Increment line coverage 0.00% (0/34) 🎉
Increment coverage report
Complete coverage report

@deardeng
deardeng force-pushed the improve-cloud-rebalance-id-boxing-standalone branch from 96c3a48 to a326d1c Compare August 3, 2026 14:56
@deardeng

deardeng commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

/review

@deardeng

deardeng commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

run buildall

gavinchou
gavinchou previously approved these changes Aug 3, 2026
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

PR approved by at least one committer and no changes requested.

@github-actions github-actions Bot added approved Indicates a PR has been approved by one committer. reviewed labels Aug 3, 2026
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

PR approved by anyone and no changes requested.

@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.

Request changes: the boxed-ID reuse is correct within a single route-map generation, but one asynchronous warmup lifecycle still defeats the current/future sharing invariant.

Critical checkpoint conclusions:

  • Goal and scope: The patch is focused and preserves equality-based routing behavior. Within one map generation, rebuild fills share one freshly boxed tablet across current/future indexes; selection, direct transfer, preheat, and same-generation rollback preserve the selected object, while completion carries the task object without reinserting route-map IDs. The inline issue identifies the remaining preheat -> later rebuild -> queued failure/rollback gap.
  • Concurrency and lifecycle: The daemon rebuilds route maps before balancing, while warmup RPC failures are produced asynchronously and consumed later from balanceImpl; that ordering is the source of the retained-identity split. The refactor introduces no additional lock-order, deadlock, or publication problem.
  • Compatibility and parallel paths: The public primitive fillBeToTablets descriptor remains available, the boxed overload is package-private, and all repository callers resolve unambiguously. Full rebuild, direct transfer, async/sync warmup, completion, failure rollback, and smooth-upgrade-triggered rebuild paths were reviewed. No additional parallel-path issue was found.
  • Correctness, error handling, persistence, configuration, and observability: Numeric routing semantics, metadata/edit-log behavior, and existing failure reporting are unchanged. No configuration, FE/BE protocol, storage format, or observability change is introduced, and no separate issue was found in these areas.
  • Performance: Sharing across the global/table/partition and current/future indexes works at the intended tablet-cluster insertion granularity except for the accepted cross-generation rollback issue.
  • Tests and results: The above-cache unit tests cover the helper, direct transfer, preheat, and immediate rollback, but not preheat -> full rebuild -> asynchronous failure/revert. The PR body's reported 10-test class run predates the three newly added lifecycle tests at the authoritative head, so this static review does not treat that result as current-head execution evidence. At payload freeze, live CheckStyle is successful, FE UT is pending, and check_coverage_fe is failing. Per the review constraints, no builds or tests were run here.
  • User focus: No additional review focus was provided; the complete PR was reviewed.
  • Review completion: Complete after three bounded normal/risk-focused review rounds against the frozen head, diff, existing-thread set, ledger, summary, and final inline wording. One distinct issue is submitted; the earlier same-generation thread was deduplicated.

@hello-stephen

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

------ Round 1 ----------------------------------
============================================
q1	17706	3931	3893	3893
q2	2005	315	198	198
q3	10280	1344	771	771
q4	4674	460	332	332
q5	7569	821	566	566
q6	178	165	132	132
q7	725	792	584	584
q8	9568	1524	1540	1524
q9	5675	4003	4009	4003
q10	6782	1646	1360	1360
q11	495	361	313	313
q12	790	564	445	445
q13	18093	3198	2716	2716
q14	265	252	236	236
q15	q16	728	725	664	664
q17	978	969	944	944
q18	6914	5676	5464	5464
q19	1182	1278	1078	1078
q20	767	712	602	602
q21	5651	2575	2284	2284
q22	425	354	304	304
Total cold run time: 101450 ms
Total hot run time: 28413 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	4227	4164	4138	4138
q2	268	303	198	198
q3	4506	4876	4340	4340
q4	2105	2218	1396	1396
q5	4226	4135	4253	4135
q6	226	183	127	127
q7	1723	1655	1482	1482
q8	2605	2263	2057	2057
q9	7227	7112	7228	7112
q10	4291	4262	3838	3838
q11	536	409	389	389
q12	703	723	506	506
q13	3163	3440	3058	3058
q14	287	310	278	278
q15	q16	680	719	666	666
q17	1283	1270	1275	1270
q18	8040	7083	7220	7083
q19	1120	1069	1033	1033
q20	2202	2181	1907	1907
q21	5138	4552	4436	4436
q22	520	446	431	431
Total cold run time: 55076 ms
Total hot run time: 49880 ms

@hello-stephen

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

query5	4321	631	469	469
query6	457	229	203	203
query7	4879	597	339	339
query8	327	185	177	177
query9	8765	3990	3976	3976
query10	489	359	290	290
query11	5895	2172	2043	2043
query12	149	97	96	96
query13	1225	592	435	435
query14	6117	4655	4386	4386
query14_1	3795	3784	3767	3767
query15	206	199	174	174
query16	1052	538	436	436
query17	1098	681	525	525
query18	2455	434	330	330
query19	196	178	139	139
query20	101	96	100	96
query21	227	156	138	138
query22	13032	12952	12794	12794
query23	17236	16320	15988	15988
query23_1	16077	16043	16066	16043
query24	7561	1670	1243	1243
query24_1	1248	1257	1229	1229
query25	527	415	345	345
query26	1329	359	213	213
query27	2612	616	387	387
query28	4463	2039	2041	2039
query29	1049	597	467	467
query30	340	262	229	229
query31	1128	1072	955	955
query32	107	62	63	62
query33	517	318	259	259
query34	1195	1128	643	643
query35	742	751	632	632
query36	786	779	694	694
query37	149	111	88	88
query38	1830	1644	1594	1594
query39	831	813	778	778
query39_1	788	789	776	776
query40	249	164	151	151
query41	73	70	74	70
query42	93	95	93	93
query43	309	323	272	272
query44	1461	791	759	759
query45	196	183	165	165
query46	1059	1167	773	773
query47	1540	1529	1459	1459
query48	421	426	286	286
query49	581	401	298	298
query50	1019	425	334	334
query51	10864	10427	10566	10427
query52	84	86	74	74
query53	264	279	198	198
query54	278	230	218	218
query55	82	71	67	67
query56	282	296	289	289
query57	1075	1060	963	963
query58	285	270	246	246
query59	1559	1596	1387	1387
query60	307	268	257	257
query61	153	153	147	147
query62	402	323	271	271
query63	237	198	199	198
query64	2819	1055	857	857
query65	3866	3808	3766	3766
query66	1822	451	362	362
query67	28222	28256	28057	28057
query68	3123	1556	957	957
query69	411	290	252	252
query70	899	767	794	767
query71	368	337	295	295
query72	3020	2662	2288	2288
query73	842	778	440	440
query74	4615	4475	4315	4315
query75	2381	2334	1970	1970
query76	2333	1114	708	708
query77	316	366	273	273
query78	11014	11008	10578	10578
query79	1285	1091	714	714
query80	600	545	455	455
query81	455	320	281	281
query82	236	146	116	116
query83	319	323	298	298
query84	274	157	131	131
query85	886	596	528	528
query86	276	240	232	232
query87	1790	1792	1677	1677
query88	3778	2836	2805	2805
query89	369	317	285	285
query90	2151	205	185	185
query91	201	185	167	167
query92	67	59	54	54
query93	1463	1639	976	976
query94	553	364	324	324
query95	795	611	477	477
query96	1129	784	354	354
query97	2450	2462	2353	2353
query98	205	203	194	194
query99	720	723	621	621
Total cold run time: 254466 ms
Total hot run time: 168974 ms

@hello-stephen

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

query1	0.00	0.00	0.00
query2	0.09	0.05	0.05
query3	0.26	0.13	0.14
query4	1.60	0.14	0.13
query5	0.24	0.21	0.22
query6	1.16	0.79	0.82
query7	0.03	0.00	0.00
query8	0.05	0.03	0.03
query9	0.37	0.32	0.31
query10	0.53	0.52	0.57
query11	0.18	0.14	0.13
query12	0.17	0.14	0.14
query13	0.45	0.46	0.46
query14	1.01	0.99	1.00
query15	0.59	0.57	0.59
query16	0.31	0.33	0.33
query17	1.11	1.09	1.07
query18	0.20	0.20	0.20
query19	2.06	1.89	1.97
query20	0.02	0.01	0.01
query21	15.41	0.21	0.13
query22	4.85	0.06	0.05
query23	16.14	0.30	0.12
query24	2.98	0.44	0.32
query25	0.11	0.05	0.05
query26	0.72	0.20	0.16
query27	0.04	0.04	0.04
query28	3.55	0.77	0.32
query29	12.49	4.08	3.21
query30	0.29	0.14	0.15
query31	2.77	0.55	0.32
query32	3.22	0.58	0.48
query33	3.08	3.19	3.17
query34	15.68	3.94	3.31
query35	3.21	3.23	3.25
query36	0.54	0.42	0.43
query37	0.09	0.06	0.06
query38	0.05	0.04	0.04
query39	0.04	0.03	0.03
query40	0.17	0.15	0.15
query41	0.08	0.03	0.03
query42	0.04	0.03	0.03
query43	0.04	0.04	0.03
Total cold run time: 96.02 s
Total hot run time: 23.8 s

@hello-stephen

Copy link
Copy Markdown
Contributor

FE UT Coverage Report

Increment line coverage 17.86% (5/28) 🎉
Increment coverage report
Complete coverage report

### What problem does this PR solve?

Issue Number: None

Related PR: apache#66389

Problem Summary: When an asynchronous warmup task survives into a later rebalance round, statRouteInfo rebuilds current and future route maps with a newly boxed tablet ID. If the queued warmup failure is then rolled back, future maps reinsert the task's older boxed ID while current maps retain the rebuilt object. Numeric routing stays correct, but current and future indexes retain duplicate Long wrappers until the next rebuild, defeating boxed-ID sharing. Reuse the inflight task's canonical tablet ID for both map families during rebuild, avoiding one duplicate retained wrapper per affected failed inflight tablet without changing route or scheduling semantics.

### Release note

None

### Check List (For Author)

- Test: Unit Test
    - ./run-fe-ut.sh --run org.apache.doris.cloud.catalog.CloudTabletRebalancerTest (14 tests passed)
    - cd fe && mvn checkstyle:check -pl fe-core (0 violations)
- Behavior changed: No
- Does this need documentation: No
@deardeng

deardeng commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

run buildall

@deardeng

deardeng commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

/review

@github-actions github-actions Bot removed the approved Indicates a PR has been approved by one committer. label Aug 4, 2026

@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 opinion: no blocking issue remains at head dd6909afab54253408756d1408964855e8612b76; this is a comment-only review with zero new inline comments.

Critical checkpoint conclusions:

  • Goal and proof: The patch hoists ID boxing to traversal/update callers and preserves the selected Long through full route rebuilds, direct transfer, preheat, rollback, and the task-survives-rebuild failure path. The above-cache unit cases cover helper insertion, direct and warmup moves, same-generation rollback, and preheat -> rebuild -> queued failure -> rollback.
  • Scope and compatibility: The production change is focused on boxed-ID plumbing. The public primitive fillBeToTablets(long, ...) descriptor remains intact; other changed descriptors are non-public and have no outside repository callers. No configuration, FE-BE protocol, storage format, persistence schema, rolling-upgrade, or documentation change is introduced.
  • Concurrency and lifecycle: The main daemon, warmup batch/RPC workers, and checker paths were traced end to end. Task fields are assigned before concurrent-map publication, warmup-task fields are final, and Long is immutable. The diff adds no lock, lock-order, deadlock, static-initialization, or ownership-cycle risk. The current head addresses both existing tablet-identity threads, including the later-generation rollback ordering.
  • Correctness and parallel paths: Routing remains equality-based; no reference comparison affects scheduling or metadata. Global/table/partition rebuilds, direct transfer, async/sync warmup, completion/timeout, failure rollback, balance-type/backend-loss removal, colocate/secondary statistics, and smooth-upgrade rebuild were reviewed. Existing error, EditLog, and observability behavior is unchanged and sufficient for this allocation-only change.
  • Performance: Each logical fill now reuses one boxed object across global, table, and partition operations, and incremental paths keep the selected tablet object across current/future families. No material regression or unsupported performance claim was substantiated.
  • Tests and results: The identity assertions use IDs outside the mandated Long cache and are meaningful against the primitive base paths. This review was static-only as required, so no build or test was run here; live CheckStyle was passing at payload freeze.
  • User focus: No additional user-provided focus was present, so the complete PR was reviewed.
  • Review completion: Three bounded normal and risk-focused convergence rounds were completed against the same head, existing-thread set, adjudicated ledger, and frozen zero-inline payload; every final-round reviewer returned NO_NEW_VALUABLE_FINDINGS.

@hello-stephen

Copy link
Copy Markdown
Contributor

FE UT Coverage Report

Increment line coverage 65.52% (19/29) 🎉
Increment coverage report
Complete coverage report

@hello-stephen

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

------ Round 1 ----------------------------------
============================================
q1	17656	4028	4073	4028
q2	2007	331	202	202
q3	10267	1411	825	825
q4	4681	467	341	341
q5	7493	826	548	548
q6	183	180	144	144
q7	739	814	586	586
q8	9358	1408	1448	1408
q9	5264	4007	4041	4007
q10	6766	1649	1360	1360
q11	509	358	316	316
q12	747	570	451	451
q13	18087	3340	2733	2733
q14	258	258	243	243
q15	q16	737	730	657	657
q17	975	900	1035	900
q18	6631	5602	5604	5602
q19	1336	1195	1020	1020
q20	789	667	565	565
q21	6004	2627	2438	2438
q22	436	358	292	292
Total cold run time: 100923 ms
Total hot run time: 28666 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	4325	4272	4311	4272
q2	277	316	204	204
q3	4528	4954	4387	4387
q4	2190	2271	1410	1410
q5	4238	4107	4094	4094
q6	230	176	132	132
q7	1681	1582	1391	1391
q8	2800	2342	2168	2168
q9	7480	7511	7689	7511
q10	4327	4353	3898	3898
q11	582	393	361	361
q12	704	734	494	494
q13	3253	3597	2993	2993
q14	290	315	289	289
q15	q16	693	715	637	637
q17	1310	1278	1271	1271
q18	12155	11172	11792	11172
q19	1128	1200	1134	1134
q20	2205	2213	1955	1955
q21	5595	4869	4939	4869
q22	550	474	432	432
Total cold run time: 60541 ms
Total hot run time: 55074 ms

@hello-stephen

Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 58.62% (17/29) 🎉
Increment coverage report
Complete coverage report

@hello-stephen

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

query5	4313	575	457	457
query6	462	214	213	213
query7	4846	569	332	332
query8	324	156	157	156
query9	8775	4000	3997	3997
query10	488	363	325	325
query11	5837	2172	1996	1996
query12	153	102	94	94
query13	1268	626	435	435
query14	6063	4233	3946	3946
query14_1	3773	3774	3770	3770
query15	200	192	180	180
query16	967	461	442	442
query17	938	741	551	551
query18	2430	467	348	348
query19	214	202	153	153
query20	104	100	102	100
query21	232	159	134	134
query22	12885	12906	13436	12906
query23	16311	15514	14977	14977
query23_1	15025	14784	14683	14683
query24	7495	1700	1245	1245
query24_1	1220	1241	1234	1234
query25	530	442	346	346
query26	1319	353	218	218
query27	2606	581	377	377
query28	4530	2042	2032	2032
query29	1034	586	460	460
query30	332	256	216	216
query31	1148	1106	1029	1029
query32	100	57	54	54
query33	514	297	243	243
query34	1182	1118	636	636
query35	721	728	611	611
query36	780	785	707	707
query37	152	103	91	91
query38	1808	1765	1686	1686
query39	802	833	785	785
query39_1	771	793	781	781
query40	253	162	141	141
query41	63	64	60	60
query42	95	88	88	88
query43	312	314	274	274
query44	1403	776	744	744
query45	179	175	163	163
query46	1011	1163	724	724
query47	1596	1588	1517	1517
query48	416	416	296	296
query49	596	405	290	290
query50	1036	440	361	361
query51	10678	10457	10571	10457
query52	84	84	73	73
query53	266	270	195	195
query54	277	233	216	216
query55	75	71	73	71
query56	320	280	269	269
query57	1022	1014	921	921
query58	280	258	259	258
query59	1516	1613	1374	1374
query60	317	290	271	271
query61	177	174	168	168
query62	391	329	272	272
query63	235	198	198	198
query64	2993	1170	995	995
query65	3891	3800	3792	3792
query66	1839	476	350	350
query67	28153	28090	28063	28063
query68	3258	1550	1057	1057
query69	402	298	264	264
query70	888	762	791	762
query71	371	336	316	316
query72	2998	2616	2319	2319
query73	855	780	428	428
query74	4585	4443	4290	4290
query75	2376	2350	1989	1989
query76	2291	1193	735	735
query77	330	350	272	272
query78	11180	11045	10591	10591
query79	1405	1231	799	799
query80	1225	529	459	459
query81	529	325	287	287
query82	675	171	134	134
query83	377	330	300	300
query84	324	162	132	132
query85	966	650	516	516
query86	407	229	226	226
query87	1978	1967	1833	1833
query88	3686	2823	2773	2773
query89	395	318	281	281
query90	1995	207	199	199
query91	227	192	167	167
query92	60	58	51	51
query93	1586	1517	1068	1068
query94	717	348	309	309
query95	776	498	448	448
query96	1101	796	334	334
query97	2453	2462	2317	2317
query98	190	188	180	180
query99	747	727	622	622
Total cold run time: 253583 ms
Total hot run time: 166911 ms

@hello-stephen

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

query1	0.01	0.01	0.01
query2	0.10	0.04	0.04
query3	0.26	0.14	0.14
query4	1.60	0.14	0.14
query5	0.24	0.23	0.21
query6	1.16	0.82	0.79
query7	0.03	0.01	0.00
query8	0.06	0.05	0.04
query9	0.36	0.30	0.30
query10	0.54	0.57	0.56
query11	0.18	0.13	0.14
query12	0.18	0.15	0.14
query13	0.46	0.45	0.47
query14	0.99	1.00	0.98
query15	0.59	0.58	0.59
query16	0.32	0.32	0.32
query17	1.11	1.14	1.14
query18	0.19	0.18	0.19
query19	2.01	1.93	1.96
query20	0.02	0.01	0.02
query21	15.50	0.21	0.14
query22	4.87	0.05	0.05
query23	16.15	0.31	0.12
query24	2.89	0.40	0.33
query25	0.12	0.06	0.04
query26	0.72	0.20	0.14
query27	0.04	0.03	0.03
query28	3.56	0.77	0.36
query29	12.54	4.11	3.23
query30	0.28	0.15	0.15
query31	2.77	0.55	0.32
query32	3.22	0.59	0.48
query33	3.19	3.15	3.14
query34	15.75	3.92	3.28
query35	3.23	3.20	3.28
query36	0.54	0.43	0.44
query37	0.08	0.07	0.06
query38	0.04	0.04	0.04
query39	0.04	0.03	0.03
query40	0.17	0.15	0.15
query41	0.08	0.03	0.03
query42	0.04	0.03	0.02
query43	0.05	0.04	0.03
Total cold run time: 96.28 s
Total hot run time: 23.89 s

@deardeng
deardeng merged commit 53d6fa3 into apache:master Aug 4, 2026
35 checks passed
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