Skip to content

[fix](cloud) Release warm-up destination on initialization failure - #67924

Merged
gavinchou merged 1 commit into
apache:masterfrom
bobhan1:fix/cloud-warmup-pending-initialization
Sep 17, 2026
Merged

gavinchou merged 1 commit into
apache:masterfrom
bobhan1:fix/cloud-warmup-pending-initialization

Conversation

@bobhan1

@bobhan1 bobhan1 commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Problem Summary:

A cloud warm-up job registers its destination compute group before initializing tablet batches. If initialization throws, the outer run() handler only logs the exception: the job stays PENDING and keeps the destination registration. Other ONCE/PERIODIC jobs targeting that group cannot start. A later successful retry can recover the original job, but repeated initialization failures can block the group indefinitely because the warm-up timeout only applies to RUNNING jobs.

Catch initialization failures before transitioning to RUNNING and reuse cancel(..., false) to persist the error and release the destination registration. ONCE jobs become CANCELLED; PERIODIC jobs remain PENDING and retry at their existing interval. Initialization has not submitted work to BEs, so this path does not send cleanup RPCs. Successful initialization retains the destination registration as before.

Release note

Release the destination compute group when cloud warm-up initialization fails, allowing subsequent warm-up jobs to proceed. Report the initialization error and preserve periodic retry scheduling.

Check List (For Author)

  • Test: Unit Test. All 30 tests passed across CloudWarmUpJobTest (11), CacheHotspotManagerSchedulerTest (4), and cloud.cache.CacheHotspotManagerTest (15). New tests cover ONCE/PERIODIC initialization failure using the real destination registration map, persisted failure state, periodic retry, and continued mutual exclusion after successful initialization. Before the fix, both failure-injection cases failed at the subsequent-job registration assertion; both successful-initialization cases passed.
  • Validation commands: ./build.sh --fe -j100 passed, including Checkstyle; ./run-fe-ut.sh --run 'org.apache.doris.cloud.CloudWarmUpJobTest,org.apache.doris.cloud.CacheHotspotManagerSchedulerTest,org.apache.doris.cloud.cache.CacheHotspotManagerTest' passed; git diff --check passed. No live cloud-cluster SQL regression was run.
  • Behavior changed: Yes. Failed ONCE initialization cancels the job; failed PERIODIC initialization releases the destination registration and waits for its next interval.
  • Does this need documentation: No.

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?

Problem Summary:

A cloud warm-up job registers its destination compute group before initializing tablet batches. If initialization throws, the outer `run()` handler only logs the exception: the job stays `PENDING` and keeps the destination registration. Other ONCE/PERIODIC jobs targeting that group cannot start. A later successful retry can recover the original job, but repeated initialization failures can block the group indefinitely because the warm-up timeout only applies to `RUNNING` jobs.

Catch initialization failures before transitioning to `RUNNING` and reuse `cancel(..., false)` to persist the error and release the destination registration. ONCE jobs become `CANCELLED`; PERIODIC jobs remain `PENDING` and retry at their existing interval. Initialization has not submitted work to BEs, so this path does not send cleanup RPCs. Successful initialization retains the destination registration as before.

### Release note

Release the destination compute group when cloud warm-up initialization fails, allowing subsequent warm-up jobs to proceed. Report the initialization error and preserve periodic retry scheduling.

### Check List (For Author)

- Test: Unit Test. All 30 tests passed across `CloudWarmUpJobTest` (11), `CacheHotspotManagerSchedulerTest` (4), and `cloud.cache.CacheHotspotManagerTest` (15). New tests cover ONCE/PERIODIC initialization failure using the real destination registration map, persisted failure state, periodic retry, and continued mutual exclusion after successful initialization. Before the fix, both failure-injection cases failed at the subsequent-job registration assertion; both successful-initialization cases passed.
- Validation commands: `./build.sh --fe -j100` passed, including Checkstyle; `./run-fe-ut.sh --run 'org.apache.doris.cloud.CloudWarmUpJobTest,org.apache.doris.cloud.CacheHotspotManagerSchedulerTest,org.apache.doris.cloud.cache.CacheHotspotManagerTest'` passed; `git diff --check` passed. No live cloud-cluster SQL regression was run.
- Behavior changed: Yes. Failed ONCE initialization cancels the job; failed PERIODIC initialization releases the destination registration and waits for its next interval.
- Does this need documentation: No.

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

- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label
@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?

@bobhan1
bobhan1 marked this pull request as ready for review September 14, 2026 03:56
@bobhan1
bobhan1 requested a review from gavinchou as a code owner September 14, 2026 03:56
@bobhan1

bobhan1 commented Sep 14, 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.

Automated review result: no blocking issues or distinct inline findings at 0b7a7a4df86714031b866b882841c11655abe436. The review completed its main risk scan, full production/test passes, and dedicated initialization-lifecycle scan; all Round 1 reviewers converged with no new valuable findings.

Critical checkpoint conclusions:

  • Goal and proof: The change closes the PENDING-state destination-registration leak. The new failure test uses the real registration map to prove ownership exists before the injected exception and is released afterward; the success control proves normal initialization retains ownership. Against the pre-fix path, the post-failure registration assertion would fail.
  • Scope and clarity: The production change is localized to pre-RUNNING initialization and reuses the existing cancellation/persistence path. The test additions are focused on failure, success, serialization, and periodic retry behavior.
  • Concurrency: Scheduler workers call synchronized run(), while SQL/cluster-change cancellation calls synchronized cancel() on the same reentrant job monitor. Destination ownership uses atomic putIfAbsent and conditional (cluster, jobId) removal, so this job cannot release another job's registration. The scheduler's active-job entry is removed in finally; no lock-order or deadlock issue was found.
  • Lifecycle and parallel paths: ONCE and legacy-null jobs become CANCELLED; PERIODIC jobs return to PENDING and retain the existing start-to-start retry interval; EVENT_DRIVEN jobs never own the destination registration. Initialization may issue read-only BE capacity/hotspot discovery RPCs, but no BE warm-up SET_JOB is sent until the later RUNNING pass, so skipping CLEAR_JOB on this failure path is correct. TABLE/TABLES behavior is unchanged.
  • Configuration and compatibility: No configuration, function symbol, storage format, protocol field, or serialized-field format changes are introduced.
  • Persistence and failover: The failure state, error, and timestamps are journaled before local deregistration. Replay restores PENDING/CANCELLED state and periodic repeat detection while the transient destination map starts empty, so failover does not preserve the leaked registration. EditLog failure remains FE-fatal by subsystem contract.
  • Error handling and observability: The warning includes the job ID and stack, the error is persisted for SHOW output, and existing start/finish metrics are updated. No recoverable cleanup-side exception or silent failure path was substantiated.
  • Tests and results: Static inspection confirms deterministic ONCE/PERIODIC failure and success coverage, no warm-up cleanup RPC, persisted fields, interval eligibility, and retry mutual exclusion. Per the review contract, I did not run builds or tests; the author's reported 30 targeted tests and FE build were not independently rerun. Current GitHub evidence independently shows CheckStyle passing. No live cloud-cluster end-to-end test was reported.
  • Data, transactions, and FE-BE propagation: No data-write, transaction, visibility, or new FE-BE variable path is involved.
  • Performance: The added cancellation/journal/deregistration work is exceptional-path only; no normal-path performance regression was identified.
  • Additional user focus: None was provided; the full PR scope was reviewed.

Overall opinion: the patch is small, coherent, and adequately unit-tested for the reported defect. Static review approves the change; no inline comments are needed.

@bobhan1

bobhan1 commented Sep 14, 2026

Copy link
Copy Markdown
Contributor Author

run buildall

@hello-stephen

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

------ Round 1 ----------------------------------
============================================
q1	17561	3035	3030	3030
q2	2063	262	214	214
q3	10264	884	516	516
q4	4675	250	212	212
q5	7673	561	390	390
q6	135	114	96	96
q7	530	514	393	393
q8	9239	847	874	847
q9	3483	2410	2414	2410
q10	6501	844	723	723
q11	387	198	177	177
q12	610	262	204	204
q13	18133	1537	1173	1173
q14	157	151	141	141
q15	q16	445	405	383	383
q17	1271	897	839	839
q18	3160	2321	2299	2299
q19	1263	876	746	746
q20	372	293	200	200
q21	5565	1763	1899	1763
q22	329	277	234	234
Total cold run time: 93816 ms
Total hot run time: 16990 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	3386	3335	3302	3302
q2	504	407	387	387
q3	2263	2308	2186	2186
q4	1220	1185	916	916
q5	2227	2201	2142	2142
q6	166	124	88	88
q7	1035	933	890	890
q8	1593	1412	1418	1412
q9	3218	3178	3169	3169
q10	1887	1847	1659	1659
q11	359	271	253	253
q12	455	430	338	338
q13	1487	1529	1146	1146
q14	168	173	170	170
q15	q16	398	397	355	355
q17	3676	3325	3382	3325
q18	4902	4546	4862	4546
q19	1027	851	862	851
q20	1042	957	824	824
q21	3876	3231	3211	3211
q22	392	338	326	326
Total cold run time: 35281 ms
Total hot run time: 31496 ms

@hello-stephen

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

query5	4247	410	341	341
query6	385	138	125	125
query7	4946	408	237	237
query8	297	124	119	119
query9	8699	2858	2824	2824
query10	386	214	185	185
query11	5404	1043	916	916
query12	127	70	70	70
query13	1186	419	317	317
query14	6073	2277	2148	2148
query14_1	2041	2023	2012	2012
query15	178	127	121	121
query16	927	362	361	361
query17	818	449	372	372
query18	2323	326	239	239
query19	168	135	114	114
query20	75	71	71	71
query21	199	101	92	92
query22	5574	5384	5434	5384
query23	6885	6309	6266	6266
query23_1	6262	6267	6365	6267
query24	7303	1054	760	760
query24_1	771	770	768	768
query25	431	302	255	255
query26	1230	234	138	138
query27	2776	408	257	257
query28	4698	1508	1492	1492
query29	933	428	349	349
query30	258	153	133	133
query31	832	407	342	342
query32	125	78	75	75
query33	471	224	191	191
query34	982	820	477	477
query35	405	417	346	346
query36	561	554	503	503
query37	126	80	70	70
query38	1010	872	808	808
query39	513	505	473	473
query39_1	484	482	474	474
query40	202	91	79	79
query41	58	55	55	55
query42	77	72	71	71
query43	241	245	216	216
query44	980	537	544	537
query45	111	112	104	104
query46	749	851	518	518
query47	770	768	721	721
query48	300	308	236	236
query49	587	231	200	200
query50	782	256	199	199
query51	7951	7949	7930	7930
query52	65	67	61	61
query53	191	201	147	147
query54	205	156	154	154
query55	76	65	74	65
query56	226	168	189	168
query57	687	671	667	667
query58	198	172	167	167
query59	1251	1266	1117	1117
query60	238	178	170	170
query61	129	108	117	108
query62	381	207	190	190
query63	170	138	138	138
query64	2745	701	587	587
query65	1704	1671	1630	1630
query66	1877	253	202	202
query67	9941	10072	9950	9950
query68	2979	1217	753	753
query69	347	227	183	183
query70	680	635	621	621
query71	264	173	164	164
query72	2253	1662	1534	1534
query73	623	550	346	346
query74	2006	1236	1152	1152
query75	1180	1102	960	960
query76	2370	704	502	502
query77	249	248	220	220
query78	4165	3741	3397	3397
query79	2734	884	590	590
query80	1625	333	270	270
query81	510	156	133	133
query82	628	124	96	96
query83	278	207	194	194
query84	304	114	84	84
query85	801	331	286	286
query86	392	181	174	174
query87	1023	1004	921	921
query88	2860	2100	2095	2095
query89	294	189	170	170
query90	1947	131	129	129
query91	130	124	97	97
query92	78	69	62	62
query93	1699	1058	752	752
query94	668	252	229	229
query95	513	260	291	260
query96	840	590	262	262
query97	1177	1096	1022	1022
query98	166	134	133	133
query99	426	354	308	308
Total cold run time: 179641 ms
Total hot run time: 83150 ms

@hello-stephen

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

query1	0.00	0.00	0.00
query2	0.07	0.04	0.04
query3	0.25	0.11	0.09
query4	1.60	0.10	0.10
query5	0.17	0.17	0.16
query6	1.25	0.69	0.72
query7	0.03	0.00	0.01
query8	0.04	0.02	0.03
query9	0.30	0.22	0.21
query10	0.35	0.36	0.35
query11	0.16	0.12	0.11
query12	0.15	0.12	0.12
query13	0.31	0.31	0.32
query14	0.47	0.46	0.46
query15	0.38	0.35	0.36
query16	0.23	0.23	0.21
query17	0.73	0.75	0.71
query18	0.17	0.17	0.16
query19	1.28	1.23	1.19
query20	0.01	0.01	0.01
query21	15.45	0.16	0.12
query22	5.07	0.04	0.04
query23	16.21	0.25	0.10
query24	3.00	0.32	0.25
query25	0.12	0.03	0.03
query26	0.78	0.18	0.13
query27	0.04	0.03	0.03
query28	3.61	0.56	0.28
query29	12.46	3.15	2.57
query30	0.25	0.12	0.13
query31	2.76	0.37	0.18
query32	3.53	0.32	0.24
query33	1.39	1.43	1.55
query34	15.36	2.26	1.83
query35	1.76	1.74	1.74
query36	0.47	0.30	0.30
query37	0.06	0.04	0.04
query38	0.04	0.03	0.03
query39	0.03	0.02	0.02
query40	0.11	0.08	0.07
query41	0.08	0.03	0.02
query42	0.04	0.02	0.02
query43	0.03	0.03	0.02
Total cold run time: 90.6 s
Total hot run time: 14.9 s

@hello-stephen

Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

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

@bobhan1

bobhan1 commented Sep 15, 2026

Copy link
Copy Markdown
Contributor Author

run feut

@gavinchou
gavinchou merged commit f0affa9 into apache:master Sep 17, 2026
44 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