Skip to content

[Fix](test) Isolate profile manager in cloud insert retry tests - #69015

Merged
924060929 merged 1 commit into
apache:masterfrom
linrrzqqq:fix-profile-feut
Oct 14, 2026
Merged

924060929 merged 1 commit into
apache:masterfrom
linrrzqqq:fix-profile-feut

Conversation

@linrrzqqq

@linrrzqqq linrrzqqq commented Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator

What problem does this PR solve?

Issue Number: close #xxx

Related PR: #68658

Problem Summary:

CloudInsertProfileRetryTest uses the ProfileManager singleton, which starts a periodic storage thread. After an INSERT retry succeeds, this thread can persist the finished profile and clear its execution profiles before the test assertions run, causing intermittent failures.

Use a dedicated ProfileManager without starting its periodic thread and redirect singleton access through a scoped static mock. Preserve the explicit background storage probe to verify that profiles remain ineligible for storage while the outer retry decision is pending.

Release note

None

Check List (For Author)

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

@linrrzqqq

Copy link
Copy Markdown
Collaborator Author

/review

@linrrzqqq

Copy link
Copy Markdown
Collaborator 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.

Reviewed PR #69015 at f5983f2 using the supplied authoritative diff. No new actionable findings were identified across the single changed file, all three hunks, and all 14 INSERT/MERGE cases. Both independent reviewers returned NO_NEW_VALUABLE_FINDINGS in round 1; the main review verified their evidence and completed the final sweep.

The isolation matches the reported failure mechanism: constructing TestProfileManager does not start its periodic storage daemon, and the scoped getter mock routes registration, retry reset, finalization and cleanup to that instance. The explicit spill worker accesses the Profile directly and finishes before retry continues, so it still checks storage eligibility while the outer decision is pending. Internal manager executors receive no tasks on these paths; repeated constructor registrations replace the same two pool keys and do not retain all case managers.

Critical checkpoint conclusions:

  • Goal and proof: the source removes the uncontrolled periodic spill/release race while retaining the retry-window probe and final persistence assertions. Runtime success is unverified.
  • Scope and clarity: the change is confined to one test; helper extraction preserves case selection, execution and assertions, with a minimal subclass for the protected constructor.
  • Concurrency and locking: registration, finalization and callbacks are synchronous on the test thread; the worker probe is ordered by Future.get. Existing manager locks remain in place, with no new nested lock, lock-order change, or IO under a new lock.
  • Lifecycle and initialization: try-with-resources closes both static mocks; existing cleanup runs while the manager mock remains active and restores configuration/session/thread-local state. The test manager and its internal pools start no threads on this path; no new ownership cycle is introduced.
  • Configuration: no item is added; temporary cloud/retry settings retain their existing restoration.
  • Compatibility: no production API, symbol, storage format or rolling-upgrade behavior changes.
  • Thrift/protobuf: no definition, field ID or enum value changes.
  • Parallel paths: the shared wrapper covers all ten INSERT and four MERGE variants, including the real outer execution and empty-return MERGE case.
  • Conditional checks: no new condition is introduced; existing outcome and retry branches are preserved.
  • Test coverage: the JUnit 5 cases retain success, session restoration, empty input, planning failure, exhaustion, cancellation, direct execution, RPC and non-replan failure checks. Required Mockito core/inline dependencies already exist; no added style issue was identified by inspection.
  • Test results: no golden/output file changes. ZIP readback assertions still compare retry details, effective session settings and exclusion of abandoned execution state; none was executed in this review.
  • Observability: existing assertions and profile state/retry details cover the test behavior; no additional production logging or metric is needed.
  • Transactions and persistence: EditLog, transaction ownership and failover behavior are unchanged. Real profile write/read assertions remain within the isolated test scope.
  • Data writes and atomicity: production data writes and crash semantics are unchanged; test writes remain limited to temporary profile ZIP files.
  • FE-BE variables: no transmitted variable or send path changes; mock backend reports and query options are preserved.
  • Performance: no production hot-path work is added; manager pools are lazy and unused by these cases, with bounded registry retention.
  • Other issues and core invariants: the final recheck found no introduced setup/cleanup, static-mock nesting, accessibility or callback defect. Production data visibility, visible versions, delete bitmaps and BE memory accounting are unaffected; failure assertions remain intact.

No existing inline comments or additional user focus were present. Both initial risk concerns were dismissed with concrete call-path and resource-lifecycle evidence; no unresolved source-review candidate or coverage gap remains. This was a static review only: no builds, tests or checkstyle checks ran, and CI results and empirical flake elimination were not verified.

Review converged after 1 round(s).

@linrrzqqq

Copy link
Copy Markdown
Collaborator Author

run buildall

@hello-stephen

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

------ Round 1 ----------------------------------
============================================
q1	17595	5617	5505	5505
q2	2093	309	259	259
q3	10238	1385	827	827
q4	4679	472	347	347
q5	7430	788	536	536
q6	189	192	156	156
q7	766	800	595	595
q8	9243	1318	1074	1074
q9	5663	4433	4403	4403
q10	6812	1288	1004	1004
q11	437	266	232	232
q12	621	404	279	279
q13	18069	3075	2389	2389
q14	263	271	242	242
q15	q16	727	720	675	675
q17	1154	752	570	570
q18	7088	6191	6161	6161
q19	1104	956	592	592
q20	379	339	226	226
q21	5085	2275	2371	2275
q22	364	314	259	259
Total cold run time: 99999 ms
Total hot run time: 28606 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	6152	6143	6137	6137
q2	675	560	543	543
q3	5191	5382	4953	4953
q4	2001	2155	1543	1543
q5	5265	5154	5740	5154
q6	251	203	155	155
q7	2264	2102	1916	1916
q8	3185	2858	2796	2796
q9	8236	8155	8221	8155
q10	3820	3751	3354	3354
q11	644	428	439	428
q12	699	746	549	549
q13	2875	3185	2578	2578
q14	336	324	301	301
q15	q16	743	700	679	679
q17	8376	7597	7477	7477
q18	13243	12318	12997	12318
q19	920	801	793	793
q20	2183	2161	1927	1927
q21	5769	4678	4765	4678
q22	494	442	420	420
Total cold run time: 73322 ms
Total hot run time: 66854 ms

@hello-stephen

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

query5	4302	576	449	449
query6	420	208	208	208
query7	4798	437	229	229
query8	319	182	165	165
query9	8788	3978	4000	3978
query10	499	318	255	255
query11	5919	3410	3189	3189
query12	144	89	85	85
query13	1248	426	316	316
query14	6514	4749	4489	4489
query14_1	4213	4204	4191	4191
query15	209	204	193	193
query16	960	447	422	422
query17	886	638	518	518
query18	2407	401	299	299
query19	191	162	138	138
query20	80	80	76	76
query21	220	132	109	109
query22	12930	13061	12812	12812
query23	13200	12785	12477	12477
query23_1	12377	12286	12153	12153
query24	7075	816	454	454
query24_1	468	468	473	468
query25	513	390	342	342
query26	1281	260	138	138
query27	2739	439	265	265
query28	4601	1934	1943	1934
query29	1543	570	424	424
query30	306	210	183	183
query31	883	761	660	660
query32	146	96	85	85
query33	512	291	266	266
query34	893	847	485	485
query35	737	747	658	658
query36	825	808	739	739
query37	123	94	91	91
query38	1796	1746	1692	1692
query39	711	719	687	687
query39_1	651	646	692	646
query40	212	112	93	93
query41	64	61	61	61
query42	90	85	86	85
query43	359	375	326	326
query44	1305	695	708	695
query45	181	171	162	162
query46	849	965	557	557
query47	3009	2943	2849	2849
query48	304	308	222	222
query49	593	403	290	290
query50	681	271	207	207
query51	10669	10650	10339	10339
query52	80	82	68	68
query53	192	211	152	152
query54	233	184	175	175
query55	75	72	59	59
query56	212	203	207	203
query57	1593	1587	1546	1546
query58	284	248	247	247
query59	2339	2375	2120	2120
query60	314	264	235	235
query61	147	138	145	138
query62	399	342	281	281
query63	193	163	163	163
query64	2814	1042	902	902
query65	3422	3358	3381	3358
query66	1799	422	312	312
query67	20098	20531	20420	20420
query68	2881	1063	654	654
query69	398	307	269	269
query70	943	822	831	822
query71	293	234	217	217
query72	2780	2660	2338	2338
query73	520	539	289	289
query74	4564	4474	4300	4300
query75	2310	2310	1926	1926
query76	2299	1007	618	618
query77	373	402	303	303
query78	9020	9099	8428	8428
query79	989	894	521	521
query80	524	414	333	333
query81	521	320	275	275
query82	573	137	117	117
query83	293	197	176	176
query84	305	116	106	106
query85	800	421	359	359
query86	318	234	227	227
query87	1997	1995	1833	1833
query88	3594	2687	2676	2676
query89	343	301	261	261
query90	1883	185	176	176
query91	153	197	128	128
query92	102	87	86	86
query93	1003	1015	572	572
query94	459	300	286	286
query95	596	343	321	321
query96	679	510	233	233
query97	2463	2409	2333	2333
query98	156	154	141	141
query99	768	761	645	645
Total cold run time: 233508 ms
Total hot run time: 152527 ms

@hello-stephen

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

query1	0.01	0.00	0.01
query2	0.10	0.05	0.05
query3	0.27	0.12	0.12
query4	1.63	0.12	0.12
query5	0.27	0.25	0.26
query6	1.16	0.68	0.69
query7	0.04	0.00	0.00
query8	0.06	0.04	0.04
query9	0.43	0.37	0.35
query10	0.62	0.61	0.59
query11	0.21	0.14	0.14
query12	0.18	0.14	0.14
query13	0.50	0.50	0.50
query14	0.98	0.97	0.96
query15	0.64	0.60	0.61
query16	0.33	0.31	0.32
query17	1.16	1.11	1.15
query18	0.24	0.22	0.24
query19	2.08	1.99	2.01
query20	0.02	0.01	0.02
query21	15.51	0.26	0.14
query22	4.37	0.06	0.05
query23	16.25	0.32	0.12
query24	2.88	0.61	0.39
query25	0.11	0.06	0.05
query26	1.23	0.23	0.16
query27	0.05	0.04	0.04
query28	2.02	0.62	0.42
query29	12.53	4.18	3.29
query30	0.28	0.13	0.14
query31	2.81	0.58	0.34
query32	3.22	0.62	0.52
query33	3.12	3.24	3.14
query34	15.56	4.05	3.41
query35	3.32	3.36	3.36
query36	0.54	0.43	0.43
query37	0.10	0.07	0.06
query38	0.04	0.04	0.03
query39	0.04	0.03	0.03
query40	0.17	0.14	0.14
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: 95.24 s
Total hot run time: 24.52 s

@hello-stephen

Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 100% (0/0) 🎉
Increment coverage report
Complete coverage report

@hello-stephen

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

------ Round 1 ----------------------------------
============================================
q1	17608	5629	5537	5537
q2	2089	307	254	254
q3	10274	1409	841	841
q4	4679	480	354	354
q5	7437	814	538	538
q6	182	190	150	150
q7	762	797	613	613
q8	9246	1332	1063	1063
q9	5648	4433	4461	4433
q10	6824	1295	1024	1024
q11	443	252	233	233
q12	637	403	288	288
q13	18033	3041	2394	2394
q14	282	280	251	251
q15	q16	725	732	672	672
q17	1169	743	570	570
q18	7046	6217	6176	6176
q19	1100	961	605	605
q20	367	336	222	222
q21	4864	2213	2389	2213
q22	357	307	265	265
Total cold run time: 99772 ms
Total hot run time: 28696 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	6110	6097	6095	6095
q2	666	590	550	550
q3	5264	5394	4907	4907
q4	1986	2109	1551	1551
q5	5247	5151	5928	5151
q6	252	194	154	154
q7	2323	2045	1842	1842
q8	3099	2733	2746	2733
q9	8289	8166	8291	8166
q10	3973	3706	3371	3371
q11	631	467	404	404
q12	700	735	524	524
q13	2891	3266	2493	2493
q14	308	330	298	298
q15	q16	738	718	628	628
q17	8533	7558	7423	7423
q18	13204	12294	13083	12294
q19	900	777	770	770
q20	2177	2210	1953	1953
q21	5856	4748	4839	4748
q22	497	443	409	409
Total cold run time: 73644 ms
Total hot run time: 66464 ms

@hello-stephen

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

query5	4298	598	427	427
query6	451	218	189	189
query7	4811	434	231	231
query8	321	186	167	167
query9	8779	4030	3990	3990
query10	460	323	260	260
query11	6010	3426	3215	3215
query12	144	92	84	84
query13	1269	432	321	321
query14	6520	4781	4412	4412
query14_1	4255	4186	4261	4186
query15	203	211	181	181
query16	950	441	439	439
query17	848	652	541	541
query18	2410	419	325	325
query19	195	169	134	134
query20	82	80	79	79
query21	216	134	111	111
query22	13002	13019	12789	12789
query23	13179	12564	12171	12171
query23_1	12195	12324	12203	12203
query24	7083	827	463	463
query24_1	466	467	475	467
query25	531	415	363	363
query26	1248	258	137	137
query27	2764	437	276	276
query28	4626	1967	1944	1944
query29	1556	593	463	463
query30	300	225	184	184
query31	893	761	639	639
query32	144	94	97	94
query33	514	310	245	245
query34	918	849	500	500
query35	752	763	662	662
query36	802	829	734	734
query37	130	110	93	93
query38	1801	1756	1695	1695
query39	720	713	677	677
query39_1	680	644	676	644
query40	240	116	98	98
query41	70	67	71	67
query42	85	87	88	87
query43	364	379	327	327
query44	1285	707	702	702
query45	180	179	171	171
query46	851	960	569	569
query47	2953	2970	2879	2879
query48	337	296	210	210
query49	560	396	299	299
query50	668	279	204	204
query51	10457	10589	10416	10416
query52	83	76	69	69
query53	185	211	149	149
query54	233	216	180	180
query55	73	64	61	61
query56	229	199	198	198
query57	1587	1584	1545	1545
query58	286	259	247	247
query59	2332	2357	2136	2136
query60	280	231	218	218
query61	149	140	137	137
query62	393	339	286	286
query63	198	160	165	160
query64	2701	915	760	760
query65	3417	3358	3372	3358
query66	1775	425	297	297
query67	20035	20298	19807	19807
query68	2919	983	625	625
query69	386	294	301	294
query70	910	822	807	807
query71	295	226	207	207
query72	2694	2556	2309	2309
query73	511	518	300	300
query74	4582	4463	4312	4312
query75	2326	2311	1931	1931
query76	2304	1010	580	580
query77	349	394	291	291
query78	9162	8973	8458	8458
query79	961	836	518	518
query80	1233	426	351	351
query81	579	321	276	276
query82	573	134	108	108
query83	281	194	171	171
query84	307	119	101	101
query85	856	407	362	362
query86	395	238	237	237
query87	2018	1951	1831	1831
query88	3586	2698	2673	2673
query89	344	304	258	258
query90	1949	180	180	180
query91	158	143	120	120
query92	97	80	87	80
query93	986	982	578	578
query94	639	306	262	262
query95	584	340	388	340
query96	659	523	234	234
query97	2449	2426	2347	2347
query98	155	156	143	143
query99	775	761	659	659
Total cold run time: 234306 ms
Total hot run time: 151634 ms

@hello-stephen

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

query1	0.01	0.00	0.00
query2	0.11	0.05	0.05
query3	0.26	0.13	0.12
query4	1.61	0.13	0.12
query5	0.28	0.24	0.25
query6	1.18	0.69	0.69
query7	0.04	0.00	0.00
query8	0.05	0.03	0.03
query9	0.42	0.35	0.35
query10	0.60	0.57	0.57
query11	0.20	0.15	0.13
query12	0.17	0.15	0.14
query13	0.48	0.48	0.49
query14	0.98	0.97	0.98
query15	0.63	0.61	0.61
query16	0.34	0.35	0.35
query17	1.19	1.10	1.15
query18	0.22	0.20	0.22
query19	2.10	1.96	1.98
query20	0.02	0.02	0.01
query21	15.49	0.26	0.15
query22	4.59	0.05	0.05
query23	16.29	0.31	0.12
query24	3.18	0.70	0.36
query25	0.11	0.06	0.06
query26	1.16	0.25	0.16
query27	0.04	0.04	0.03
query28	1.76	0.60	0.41
query29	12.55	4.15	3.29
query30	0.28	0.14	0.13
query31	2.77	0.58	0.34
query32	3.25	0.62	0.52
query33	3.13	3.14	3.19
query34	15.48	3.99	3.40
query35	3.33	3.34	3.35
query36	0.55	0.44	0.42
query37	0.10	0.06	0.06
query38	0.05	0.04	0.03
query39	0.04	0.04	0.03
query40	0.17	0.15	0.14
query41	0.09	0.03	0.03
query42	0.04	0.02	0.02
query43	0.04	0.03	0.03
Total cold run time: 95.38 s
Total hot run time: 24.38 s

@hello-stephen

Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 100% (0/0) 🎉
Increment coverage report
Complete coverage report

3 similar comments
@hello-stephen

Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 100% (0/0) 🎉
Increment coverage report
Complete coverage report

@hello-stephen

Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 100% (0/0) 🎉
Increment coverage report
Complete coverage report

@hello-stephen

Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 100% (0/0) 🎉
Increment coverage report
Complete coverage report

@hello-stephen

Copy link
Copy Markdown
Contributor

FE UT Coverage Report

Increment line coverage `` 🎉
Increment coverage report
Complete coverage report

@924060929
924060929 merged commit 25a15f9 into apache:master Oct 14, 2026
44 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

PR approved by anyone and no changes requested.

@github-actions github-actions Bot added the approved Indicates a PR has been approved by one committer. label Oct 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

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

@linrrzqqq
linrrzqqq deleted the fix-profile-feut branch October 15, 2026 02:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by one committer. reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants