Skip to content

[fix](fe) Reserve watershed before exposing shadow indexes - #67247

Draft
Yukang-Lian wants to merge 2 commits into
apache:masterfrom
Yukang-Lian:codex/fix-shadow-index-watershed-order
Draft

Yukang-Lian wants to merge 2 commits into
apache:masterfrom
Yukang-Lian:codex/fix-shadow-index-watershed-order

Conversation

@Yukang-Lian

Copy link
Copy Markdown
Collaborator

What problem does this PR solve?

Issue Number: None

Related PR: #62946

Problem Summary: Schema change and rollup jobs exposed shadow indexes to load planning before reserving their watershed transaction boundary. A transaction could therefore miss the shadow index while being ordered after the watershed, leaving a rowset version gap that the alter job would not wait for. Reserve the boundary under the same table write lock used to publish the shadow metadata in local and cloud jobs, and keep schema-change jobs pending when the second stability check aborts publication.

Release note

None

Check List (For Author)

  • Test: Unit Test
    • SchemaChangeJobV2Test
    • RollupJobV2Test
    • CloudIndexTest
  • Behavior changed: Yes (shadow indexes are published only after their transaction watershed is reserved)
  • Does this need documentation: No

Co-authored-by: Siyang Tang tangsiyang@selectdb.com

### What problem does this PR solve?

Issue Number: None

Related PR: apache#62946

Problem Summary: Schema change and rollup jobs exposed shadow indexes to load planning before reserving their watershed transaction boundary. A transaction could therefore miss the shadow index while being ordered after the watershed, leaving a rowset version gap that the alter job would not wait for. Reserve the boundary under the same table write lock used to publish the shadow metadata in local and cloud jobs, and keep schema-change jobs pending when the second stability check aborts publication.

### Release note

None

### Check List (For Author)

- Test: Unit Test
    - SchemaChangeJobV2Test
    - RollupJobV2Test
    - CloudIndexTest
- Behavior changed: Yes (shadow indexes are published only after their transaction watershed is reserved)
- Does this need documentation: No

Co-authored-by: Siyang Tang <tangsiyang@selectdb.com>
@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?

### What problem does this PR solve?

Issue Number: None

Related PR: apache#62946

Problem Summary: CheckStyle requires imports to be sorted lexicographically. Place AddRollupOp before AlterOp in CloudIndexTest.

### Release note

None

### Check List (For Author)

- Test: FE CheckStyle
    - `cd fe && mvn clean checkstyle:check` (all 74 modules passed)
- Behavior changed: No
- Does this need documentation: No
@Yukang-Lian

Copy link
Copy Markdown
Collaborator Author

run buildall

@hello-stephen

Copy link
Copy Markdown
Contributor

FE UT Coverage Report

Increment line coverage 58.33% (7/12) 🎉
Increment coverage report
Complete coverage report

@hello-stephen

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

------ Round 1 ----------------------------------
============================================
q1	17588	2995	2978	2978
q2	2096	258	213	213
q3	10240	826	507	507
q4	4674	251	207	207
q5	7664	562	387	387
q6	135	116	93	93
q7	545	510	384	384
q8	9240	937	919	919
q9	3484	2388	2399	2388
q10	6523	886	704	704
q11	399	198	176	176
q12	613	266	203	203
q13	18114	1528	1157	1157
q14	155	152	139	139
q15	q16	432	396	365	365
q17	1322	919	799	799
q18	3123	2281	2232	2232
q19	1123	902	688	688
q20	354	282	195	195
q21	4843	1703	1797	1703
q22	319	266	232	232
Total cold run time: 92986 ms
Total hot run time: 16669 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	3327	3273	3258	3258
q2	507	397	381	381
q3	2209	2367	2142	2142
q4	1174	1160	889	889
q5	2178	2138	2107	2107
q6	168	116	86	86
q7	1010	926	833	833
q8	1589	1397	1397	1397
q9	3133	3084	3079	3079
q10	1836	1772	1629	1629
q11	348	271	246	246
q12	443	427	342	342
q13	1476	1520	1139	1139
q14	166	174	154	154
q15	q16	389	394	350	350
q17	3631	3341	3281	3281
q18	4805	4414	4699	4414
q19	879	797	846	797
q20	1119	972	831	831
q21	3777	3138	3260	3138
q22	405	329	316	316
Total cold run time: 34569 ms
Total hot run time: 30809 ms

@hello-stephen

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

query5	4276	413	333	333
query6	378	134	122	122
query7	4962	432	232	232
query8	295	122	114	114
query9	8672	2860	2862	2860
query10	377	224	179	179
query11	5366	1031	930	930
query12	112	68	69	68
query13	1188	444	342	342
query14	6068	2177	2064	2064
query14_1	1966	1946	1937	1937
query15	176	121	109	109
query16	918	381	346	346
query17	809	460	377	377
query18	2335	339	242	242
query19	171	137	108	108
query20	72	68	69	68
query21	201	101	85	85
query22	5368	5335	5284	5284
query23	6622	6149	6116	6116
query23_1	6088	6194	5985	5985
query24	7239	1102	778	778
query24_1	762	766	774	766
query25	435	300	258	258
query26	1229	236	130	130
query27	2771	439	267	267
query28	4679	1490	1494	1490
query29	914	409	336	336
query30	251	154	129	129
query31	806	396	323	323
query32	132	70	70	70
query33	456	205	183	183
query34	979	802	473	473
query35	405	404	338	338
query36	549	548	521	521
query37	114	78	67	67
query38	983	840	819	819
query39	532	481	459	459
query39_1	481	480	452	452
query40	202	85	72	72
query41	52	49	50	49
query42	72	75	73	73
query43	236	238	206	206
query44	997	539	545	539
query45	106	107	99	99
query46	814	831	502	502
query47	763	752	704	704
query48	309	307	229	229
query49	539	236	174	174
query50	749	259	193	193
query51	7977	7975	7877	7877
query52	70	73	61	61
query53	195	197	160	160
query54	226	196	156	156
query55	70	63	58	58
query56	183	161	192	161
query57	708	673	653	653
query58	193	171	154	154
query59	1292	1214	1098	1098
query60	226	179	191	179
query61	107	120	120	120
query62	374	205	180	180
query63	168	140	145	140
query64	2676	674	607	607
query65	1603	1649	1591	1591
query66	1870	291	227	227
query67	9855	9736	9564	9564
query68	3007	1213	700	700
query69	340	218	192	192
query70	659	626	609	609
query71	246	176	161	161
query72	2301	1711	1540	1540
query73	675	600	349	349
query74	2011	1202	1134	1134
query75	1160	1099	953	953
query76	2383	738	535	535
query77	251	261	212	212
query78	4060	3724	3287	3287
query79	1274	827	579	579
query80	1169	332	298	298
query81	485	151	133	133
query82	609	132	97	97
query83	287	205	193	193
query84	293	113	90	90
query85	790	338	297	297
query86	382	167	177	167
query87	1007	950	881	881
query88	2750	2086	2100	2086
query89	277	193	172	172
query90	1966	125	128	125
query91	129	118	97	97
query92	80	63	70	63
query93	1363	1037	685	685
query94	638	240	227	227
query95	521	265	235	235
query96	794	598	269	269
query97	1087	1029	999	999
query98	139	132	132	132
query99	415	338	305	305
Total cold run time: 175758 ms
Total hot run time: 81554 ms

@hello-stephen

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

query1	0.00	0.00	0.00
query2	0.08	0.04	0.03
query3	0.25	0.11	0.11
query4	1.62	0.10	0.09
query5	0.17	0.16	0.15
query6	1.28	0.70	0.67
query7	0.04	0.01	0.01
query8	0.05	0.03	0.03
query9	0.29	0.22	0.21
query10	0.35	0.34	0.38
query11	0.16	0.12	0.11
query12	0.15	0.12	0.12
query13	0.31	0.30	0.29
query14	0.45	0.46	0.45
query15	0.36	0.35	0.34
query16	0.23	0.22	0.23
query17	0.74	0.73	0.66
query18	0.17	0.17	0.17
query19	1.09	1.13	1.06
query20	0.02	0.01	0.01
query21	15.44	0.16	0.13
query22	5.07	0.05	0.04
query23	16.21	0.25	0.10
query24	2.97	0.29	0.25
query25	0.11	0.04	0.03
query26	0.76	0.16	0.11
query27	0.04	0.02	0.03
query28	3.66	0.57	0.28
query29	12.42	3.20	2.56
query30	0.26	0.12	0.13
query31	2.75	0.39	0.18
query32	3.50	0.31	0.24
query33	1.51	1.58	1.44
query34	15.41	2.23	1.78
query35	1.76	1.75	1.70
query36	0.48	0.29	0.28
query37	0.07	0.03	0.03
query38	0.05	0.03	0.03
query39	0.03	0.03	0.02
query40	0.11	0.07	0.08
query41	0.08	0.02	0.02
query42	0.03	0.02	0.02
query43	0.03	0.03	0.02
Total cold run time: 90.56 s
Total hot run time: 14.54 s

@hello-stephen

Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 1.88% (7/373) 🎉
Increment coverage report
Complete coverage report

@Yukang-Lian
Yukang-Lian marked this pull request as draft September 10, 2026 03:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants