Skip to content

[feature](catalog) support medium allocation mode#63011

Open
Ryan19929 wants to merge 2 commits into
apache:masterfrom
Ryan19929:medium-pr1-table-property
Open

[feature](catalog) support medium allocation mode#63011
Ryan19929 wants to merge 2 commits into
apache:masterfrom
Ryan19929:medium-pr1-table-property

Conversation

@Ryan19929
Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: close #xxx

Related PR: #58897

Problem Summary:

This is the first PR of a series that enables RESTORE to choose the target
storage medium in a clear and consistent way.

To support that RESTORE feature, Doris first needs a stable table/partition
metadata model for storage medium allocation. This series also makes storage
medium selection consistent between CREATE TABLE and RESTORE.

The complete series will introduce:

  • STRICT / ADAPTIVE medium allocation semantics.
  • CREATE TABLE hard binding: specifying storage_medium means STRICT; omitting it means ADAPTIVE.
  • RESTORE medium properties, including same_with_upstream, in follow-up PRs.
  • A unified MediumDecisionMaker for restore scenarios in follow-up PRs.
  • FE-BE per-task fallback control (allow_medium_fallback) in follow-up PRs.

This PR only builds the table-level metadata foundation. It does not change RESTORE behavior yet.

Main changes in this PR:

  • Add MediumAllocationMode (STRICT / ADAPTIVE).
  • Persist mediumAllocationMode in DataProperty.
  • Keep TableProperty.mediumAllocationMode as a rebuilt cache from table properties.
  • Map CREATE TABLE storage_medium to STRICT; unspecified medium remains ADAPTIVE.
  • Change SystemInfoService.selectBackendIdsForReplicaCreation and cloud override to accept MediumAllocationMode instead of a boolean.
  • Keep old image compatibility by defaulting missing mediumAllocationMode to ADAPTIVE.

This also fixes the previous storageMediumSpecified problem: the old boolean was not persisted because it had no @SerializedName.

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

Introduce MediumAllocationMode as the table and partition metadata
foundation for storage medium allocation semantics. CREATE TABLE keeps
the existing user syntax: explicitly specifying storage_medium maps to
STRICT, while omitting it maps to ADAPTIVE.

Persist the mode in DataProperty, rebuild the table-level cache in
TableProperty, and migrate SystemInfoService and its callers from the
old boolean flag to the enum so STRICT placement cannot silently fall
back. Old images that do not contain the new field default to ADAPTIVE,
which matches the previous behavior because storageMediumSpecified was
not persisted.

Add FE unit coverage for enum parsing, DataProperty compatibility,
TableProperty cache behavior, and STRICT/ADAPTIVE backend selection, plus
a regression test covering persistence across FE restart.

Co-authored-by: Cursor <cursoragent@cursor.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?

@Ryan19929
Copy link
Copy Markdown
Contributor Author

run buildall

1 similar comment
@Ryan19929
Copy link
Copy Markdown
Contributor Author

run buildall

@hello-stephen
Copy link
Copy Markdown
Contributor

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

------ Round 1 ----------------------------------
orders	Doris	NULL	NULL	0	0	0	NULL	0	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	17728	3818	3799	3799
q2	q3	10700	861	605	605
q4	4684	461	351	351
q5	7432	1319	1147	1147
q6	195	173	140	140
q7	913	936	735	735
q8	9641	1379	1282	1282
q9	5942	5363	5317	5317
q10	6313	2108	1814	1814
q11	488	261	261	261
q12	692	412	293	293
q13	18178	3299	2765	2765
q14	295	285	264	264
q15	q16	903	881	789	789
q17	924	998	759	759
q18	6384	5661	5618	5618
q19	1248	1291	1066	1066
q20	518	404	268	268
q21	4505	2283	1863	1863
q22	426	361	306	306
Total cold run time: 98109 ms
Total hot run time: 29442 ms

----- Round 2, with runtime_filter_mode=off -----
orders	Doris	NULL	NULL	150000000	42	6422171781	NULL	22778155	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	4182	4066	4119	4066
q2	q3	4640	4766	4164	4164
q4	2096	2161	1369	1369
q5	4951	4933	5194	4933
q6	193	167	133	133
q7	2016	1784	1816	1784
q8	3476	3248	3193	3193
q9	8522	8520	8434	8434
q10	4493	4501	4317	4317
q11	630	437	412	412
q12	705	737	536	536
q13	3266	3536	2901	2901
q14	309	306	286	286
q15	q16	758	786	676	676
q17	1341	1397	1313	1313
q18	8367	7098	7193	7098
q19	1169	1167	1164	1164
q20	2239	2229	1956	1956
q21	6172	5416	4905	4905
q22	548	539	409	409
Total cold run time: 60073 ms
Total hot run time: 54049 ms

@hello-stephen
Copy link
Copy Markdown
Contributor

TPC-DS: Total hot run time: 171204 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 afdbac882fcf0ff9f7002544d2b9bc91ddbd7891, data reload: false

query5	4314	665	538	538
query6	330	220	201	201
query7	4278	585	316	316
query8	345	245	227	227
query9	8837	4087	4078	4078
query10	466	362	304	304
query11	5757	2379	2216	2216
query12	187	135	129	129
query13	1299	608	425	425
query14	6607	5397	5101	5101
query14_1	4459	4426	4334	4334
query15	209	209	185	185
query16	994	485	440	440
query17	1158	788	648	648
query18	2759	479	371	371
query19	227	211	175	175
query20	139	136	133	133
query21	216	143	120	120
query22	13985	14054	14407	14054
query23	17323	16453	16155	16155
query23_1	16365	16315	16344	16315
query24	7905	1875	1379	1379
query24_1	1443	1426	1437	1426
query25	555	491	472	472
query26	1279	304	164	164
query27	2694	581	326	326
query28	4441	1984	1960	1960
query29	978	624	522	522
query30	306	240	197	197
query31	1101	1077	945	945
query32	81	73	74	73
query33	525	346	284	284
query34	1158	1118	615	615
query35	756	782	664	664
query36	1365	1315	1169	1169
query37	149	100	89	89
query38	3149	3130	3056	3056
query39	924	924	902	902
query39_1	877	893	863	863
query40	242	155	133	133
query41	68	62	60	60
query42	109	113	110	110
query43	322	332	280	280
query44	
query45	209	201	188	188
query46	1038	1182	716	716
query47	2397	2325	2248	2248
query48	399	428	293	293
query49	634	539	447	447
query50	723	282	229	229
query51	4263	4240	4218	4218
query52	107	106	96	96
query53	251	283	209	209
query54	313	294	265	265
query55	93	88	85	85
query56	301	305	309	305
query57	1436	1405	1304	1304
query58	286	282	273	273
query59	1570	1657	1430	1430
query60	341	332	325	325
query61	162	151	155	151
query62	670	607	578	578
query63	237	195	206	195
query64	2360	861	673	673
query65	
query66	1709	510	397	397
query67	30322	29910	29880	29880
query68	
query69	462	333	317	317
query70	1057	998	1000	998
query71	314	283	272	272
query72	2941	2725	2443	2443
query73	851	754	422	422
query74	5087	4904	4734	4734
query75	2782	2633	2342	2342
query76	2257	1121	759	759
query77	425	475	353	353
query78	12794	12905	12268	12268
query79	1557	934	762	762
query80	1377	598	498	498
query81	522	282	251	251
query82	1025	159	126	126
query83	358	277	246	246
query84	265	146	113	113
query85	911	512	447	447
query86	465	344	337	337
query87	3417	3364	3216	3216
query88	3539	2677	2630	2630
query89	442	379	339	339
query90	1933	178	183	178
query91	176	167	141	141
query92	82	75	75	75
query93	1269	957	553	553
query94	717	342	297	297
query95	672	368	340	340
query96	986	818	348	348
query97	2673	2705	2538	2538
query98	239	236	228	228
query99	1103	1143	976	976
Total cold run time: 256361 ms
Total hot run time: 171204 ms

@hello-stephen
Copy link
Copy Markdown
Contributor

FE UT Coverage Report

Increment line coverage 77.08% (37/48) 🎉
Increment coverage report
Complete coverage report

@hello-stephen
Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 47.92% (23/48) 🎉
Increment coverage report
Complete coverage report

### What problem does this PR solve?

Issue Number: close #xxx

Related PR: None

Problem Summary: Improve coverage for the medium allocation mode metadata change by testing DataProperty's persisted mode behavior, keeping the enum API scoped to PR-1, and adding a regression case for ADAPTIVE fallback versus STRICT failure.

### Release note

None

### Check List (For Author)

- Test: Unit Test attempted, but local Maven dependency resolution failed for missing FE 1.2-SNAPSHOT modules; `ReadLints` and `git diff --check` passed for changed files.
- Behavior changed: No
- Does this need documentation: No

Co-authored-by: Cursor <cursoragent@cursor.com>
@Ryan19929
Copy link
Copy Markdown
Contributor Author

run buildall

@hello-stephen
Copy link
Copy Markdown
Contributor

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

------ Round 1 ----------------------------------
orders	Doris	NULL	NULL	0	0	0	NULL	0	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	17686	3832	3794	3794
q2	q3	10733	865	616	616
q4	4664	461	340	340
q5	7452	1345	1138	1138
q6	178	167	137	137
q7	904	955	733	733
q8	9315	1379	1254	1254
q9	5558	5329	5325	5325
q10	6246	2067	1813	1813
q11	467	260	252	252
q12	642	420	289	289
q13	18093	3231	2760	2760
q14	279	278	262	262
q15	q16	847	868	784	784
q17	978	1106	727	727
q18	6480	5653	5549	5549
q19	1191	1184	997	997
q20	531	408	268	268
q21	5222	2389	1998	1998
q22	469	440	347	347
Total cold run time: 97935 ms
Total hot run time: 29383 ms

----- Round 2, with runtime_filter_mode=off -----
orders	Doris	NULL	NULL	150000000	42	6422171781	NULL	22778155	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	4688	4740	4785	4740
q2	q3	4647	4750	4170	4170
q4	2182	2140	1410	1410
q5	4946	5038	5241	5038
q6	192	166	131	131
q7	2072	1811	1616	1616
q8	3389	3043	3102	3043
q9	8440	8373	8411	8373
q10	4524	4480	4245	4245
q11	579	430	394	394
q12	717	739	520	520
q13	3156	3579	2918	2918
q14	302	308	278	278
q15	q16	759	783	861	783
q17	1353	1294	1225	1225
q18	7864	6972	7120	6972
q19	1159	1129	1168	1129
q20	2224	2234	2028	2028
q21	6353	5381	4817	4817
q22	561	503	428	428
Total cold run time: 60107 ms
Total hot run time: 54258 ms

@hello-stephen
Copy link
Copy Markdown
Contributor

TPC-DS: Total hot run time: 170028 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 99aa83f4c4480126ed1003ad9b03f5c7d7d55d09, data reload: false

query5	4333	663	536	536
query6	331	225	199	199
query7	4229	544	315	315
query8	334	233	232	232
query9	8825	3998	4024	3998
query10	455	373	326	326
query11	5779	2362	2175	2175
query12	186	128	127	127
query13	1299	622	410	410
query14	6008	5360	5063	5063
query14_1	4370	4362	4370	4362
query15	217	204	187	187
query16	1018	470	431	431
query17	1151	764	645	645
query18	2527	500	372	372
query19	220	215	184	184
query20	142	134	129	129
query21	224	140	122	122
query22	13585	13949	14685	13949
query23	17379	16438	16230	16230
query23_1	16164	16231	16143	16143
query24	7383	1717	1308	1308
query24_1	1343	1334	1337	1334
query25	557	480	409	409
query26	1295	313	166	166
query27	2740	581	332	332
query28	4363	1966	1956	1956
query29	978	627	510	510
query30	297	234	196	196
query31	1106	1066	924	924
query32	81	69	73	69
query33	532	337	282	282
query34	1186	1100	648	648
query35	754	785	656	656
query36	1326	1377	1193	1193
query37	150	101	83	83
query38	3168	3109	3059	3059
query39	915	924	889	889
query39_1	862	868	865	865
query40	229	153	133	133
query41	64	61	59	59
query42	107	104	105	104
query43	321	322	285	285
query44	
query45	204	199	195	195
query46	1090	1216	709	709
query47	2279	2320	2154	2154
query48	395	415	288	288
query49	627	524	421	421
query50	712	282	212	212
query51	4294	4236	4148	4148
query52	101	135	91	91
query53	252	276	208	208
query54	318	271	254	254
query55	91	86	83	83
query56	305	336	305	305
query57	1395	1385	1311	1311
query58	294	263	265	263
query59	1529	1603	1395	1395
query60	333	324	328	324
query61	158	155	148	148
query62	680	601	572	572
query63	231	196	202	196
query64	2420	809	659	659
query65	
query66	1737	514	394	394
query67	29953	29852	29707	29707
query68	
query69	443	335	309	309
query70	987	1014	948	948
query71	311	280	270	270
query72	2967	2702	2416	2416
query73	852	747	452	452
query74	5059	4939	4695	4695
query75	2794	2674	2309	2309
query76	2276	1128	754	754
query77	405	420	342	342
query78	12998	12992	12489	12489
query79	1521	930	761	761
query80	1371	587	482	482
query81	526	279	239	239
query82	1031	154	120	120
query83	349	271	242	242
query84	267	143	113	113
query85	904	491	429	429
query86	449	333	327	327
query87	3433	3340	3203	3203
query88	3537	2663	2657	2657
query89	437	374	329	329
query90	1924	185	179	179
query91	174	167	134	134
query92	76	71	71	71
query93	1086	954	565	565
query94	705	327	265	265
query95	658	377	344	344
query96	1044	766	320	320
query97	2675	2687	2538	2538
query98	232	229	227	227
query99	1118	1138	970	970
Total cold run time: 253549 ms
Total hot run time: 170028 ms

@hello-stephen
Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 54.05% (20/37) 🎉
Increment coverage report
Complete coverage report

@Ryan19929
Copy link
Copy Markdown
Contributor Author

run feut

@Ryan19929
Copy link
Copy Markdown
Contributor Author

/review

1 similar comment
@Ryan19929
Copy link
Copy Markdown
Contributor Author

/review

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