Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature](Schema Change)light schema change support add key column #42911

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mongo360
Copy link
Contributor

@mongo360 mongo360 commented Oct 30, 2024

Proposed changes

  • Background
    Currently, the LightSchemaChange feature in Doris only supports adding value columns, not supports the regular key column adding. If we add a regular key column to a simple table that not in the short key columns, it will do with HardLinkedSchemaChange; But for the cooldown tablets that save on remote system like S3, it will degrade to DirectSchemaChange, The schema change time is very slow. This modification is intended to replace HardLinkedSchemaChange with LightSchemaChange for normal key column adding.

  • Modification
    Modify LightSchemaChange check logic in FE, adding key column adding scene.

  1. Table property light_schema_change is True
  2. new key column pos not in short key columns
  3. new key column is not add to materialize view
  4. Table property enable_unique_key_merge_on_write is False

@doris-robot
Copy link

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR

Since 2024-03-18, the Document has been moved to doris-website.
See Doris Document.

Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@mongo360 mongo360 force-pushed the light_schema_change_support_add_key_column branch 2 times, most recently from 0fe8150 to 9a99b34 Compare November 5, 2024 09:59
Copy link
Contributor

github-actions bot commented Nov 5, 2024

clang-tidy review says "All clean, LGTM! 👍"

1 similar comment
Copy link
Contributor

github-actions bot commented Nov 5, 2024

clang-tidy review says "All clean, LGTM! 👍"

@mongo360 mongo360 force-pushed the light_schema_change_support_add_key_column branch from 9a99b34 to 72f1191 Compare November 5, 2024 11:52
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

@@ -15,8 +15,6 @@
// specific language governing permissions and limitations
// under the License.

#include "vec/olap/block_reader.h"

#include <gen_cpp/olap_file.pb.h>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: 'gen_cpp/olap_file.pb.h' file not found [clang-diagnostic-error]

#include <gen_cpp/olap_file.pb.h>
         ^

@mongo360 mongo360 force-pushed the light_schema_change_support_add_key_column branch from 72f1191 to 98197ee Compare November 5, 2024 14:33
Copy link
Contributor

github-actions bot commented Nov 5, 2024

clang-tidy review says "All clean, LGTM! 👍"

@mongo360
Copy link
Contributor Author

mongo360 commented Nov 6, 2024

run buildall

@doris-robot
Copy link

TeamCity be ut coverage result:
Function Coverage: 37.88% (9849/26000)
Line Coverage: 29.04% (81894/282025)
Region Coverage: 28.28% (42198/149236)
Branch Coverage: 24.85% (21407/86132)
Coverage Report: http://coverage.selectdb-in.cc/coverage/98197ee29367b18764c14451424246d762cf46c8_98197ee29367b18764c14451424246d762cf46c8/report/index.html

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17564	7442	7327	7327
q2	2063	184	176	176
q3	10511	1080	1215	1080
q4	10538	849	844	844
q5	7760	3055	3028	3028
q6	243	149	155	149
q7	1000	606	599	599
q8	9371	1944	2011	1944
q9	6594	6457	6519	6457
q10	7116	2473	2438	2438
q11	463	263	263	263
q12	408	212	207	207
q13	17761	2989	2994	2989
q14	243	202	203	202
q15	581	525	521	521
q16	690	600	570	570
q17	950	612	532	532
q18	7260	6687	6790	6687
q19	1332	1026	1005	1005
q20	469	183	176	176
q21	3920	3179	3181	3179
q22	1077	1005	990	990
Total cold run time: 107914 ms
Total hot run time: 41363 ms

----- Round 2, with runtime_filter_mode=off -----
q1	7327	7316	7265	7265
q2	351	253	249	249
q3	2900	2920	2962	2920
q4	2038	1815	1798	1798
q5	5744	5709	5739	5709
q6	228	144	145	144
q7	2240	1854	1812	1812
q8	3387	3621	3527	3527
q9	8936	8886	8841	8841
q10	3570	3539	3539	3539
q11	598	497	527	497
q12	795	611	645	611
q13	10217	3193	3172	3172
q14	291	263	270	263
q15	601	562	557	557
q16	684	675	666	666
q17	1861	1659	1619	1619
q18	8313	7936	7680	7680
q19	1705	1669	1524	1524
q20	2111	1893	1873	1873
q21	5578	5468	5508	5468
q22	1139	1037	1011	1011
Total cold run time: 70614 ms
Total hot run time: 60745 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 194832 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 98197ee29367b18764c14451424246d762cf46c8, data reload: false

query1	2237	2137	2073	2073
query2	6240	2108	2037	2037
query3	14997	11357	239	239
query4	32740	23721	23596	23596
query5	3517	452	436	436
query6	266	186	184	184
query7	3993	308	294	294
query8	291	230	228	228
query9	9410	2694	2690	2690
query10	493	253	246	246
query11	17967	15304	15274	15274
query12	160	103	104	103
query13	1584	418	417	417
query14	9447	7115	6681	6681
query15	261	182	189	182
query16	8138	503	463	463
query17	1546	585	575	575
query18	2437	629	624	624
query19	372	195	189	189
query20	126	119	118	118
query21	215	105	103	103
query22	4919	4360	4159	4159
query23	34645	34009	34121	34009
query24	11650	3339	3428	3339
query25	623	403	400	400
query26	1158	182	180	180
query27	2063	279	287	279
query28	7212	2428	2388	2388
query29	824	435	435	435
query30	398	313	298	298
query31	998	819	823	819
query32	95	57	56	56
query33	782	289	299	289
query34	905	518	510	510
query35	899	736	720	720
query36	1113	915	967	915
query37	143	76	74	74
query38	4415	4420	4386	4386
query39	1485	1408	1410	1408
query40	198	101	101	101
query41	48	45	46	45
query42	108	96	101	96
query43	521	496	491	491
query44	1310	814	818	814
query45	186	167	169	167
query46	1151	707	727	707
query47	1937	1859	1880	1859
query48	412	315	330	315
query49	953	402	390	390
query50	812	394	392	392
query51	7245	7233	7052	7052
query52	97	89	88	88
query53	251	177	175	175
query54	1192	416	396	396
query55	76	81	74	74
query56	254	237	238	237
query57	1317	1215	1176	1176
query58	233	209	205	205
query59	3089	3145	3147	3145
query60	267	250	241	241
query61	106	110	112	110
query62	850	752	693	693
query63	213	186	186	186
query64	4066	685	644	644
query65	3290	3207	3233	3207
query66	847	316	305	305
query67	16120	15845	15961	15845
query68	4567	584	590	584
query69	435	247	254	247
query70	1206	1156	1151	1151
query71	344	252	247	247
query72	6287	4005	4002	4002
query73	749	348	352	348
query74	10369	9036	9064	9036
query75	3429	2686	2717	2686
query76	2717	1196	1083	1083
query77	385	284	274	274
query78	10411	9378	9415	9378
query79	1094	595	590	590
query80	875	431	427	427
query81	560	237	236	236
query82	380	115	117	115
query83	242	157	167	157
query84	241	77	75	75
query85	1118	305	295	295
query86	375	307	307	307
query87	4837	4690	4814	4690
query88	3550	2198	2159	2159
query89	406	283	291	283
query90	2017	191	188	188
query91	139	112	108	108
query92	58	48	50	48
query93	1350	542	535	535
query94	833	302	308	302
query95	345	244	238	238
query96	618	278	283	278
query97	2929	2683	2746	2683
query98	212	199	201	199
query99	1580	1311	1315	1311
Total cold run time: 302571 ms
Total hot run time: 194832 ms

@doris-robot
Copy link

ClickBench: Total hot run time: 32.08 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 98197ee29367b18764c14451424246d762cf46c8, data reload: false

query1	0.04	0.04	0.03
query2	0.06	0.03	0.03
query3	0.23	0.06	0.07
query4	1.63	0.10	0.10
query5	0.41	0.38	0.40
query6	1.15	0.66	0.66
query7	0.02	0.01	0.03
query8	0.04	0.02	0.03
query9	0.56	0.49	0.50
query10	0.55	0.55	0.55
query11	0.14	0.10	0.10
query12	0.13	0.11	0.10
query13	0.60	0.59	0.59
query14	2.70	2.84	2.75
query15	0.90	0.85	0.83
query16	0.39	0.38	0.39
query17	1.05	1.07	1.07
query18	0.20	0.19	0.19
query19	1.94	1.87	1.97
query20	0.01	0.00	0.01
query21	15.38	0.61	0.57
query22	2.91	2.75	1.46
query23	16.89	0.83	0.87
query24	3.33	1.60	0.92
query25	0.19	0.17	0.23
query26	0.40	0.14	0.14
query27	0.04	0.04	0.04
query28	10.23	1.11	1.07
query29	12.54	3.21	3.17
query30	0.24	0.06	0.06
query31	2.88	0.37	0.37
query32	3.30	0.47	0.45
query33	3.05	3.05	3.03
query34	17.01	4.40	4.47
query35	4.52	4.43	4.46
query36	0.67	0.49	0.47
query37	0.09	0.06	0.06
query38	0.04	0.04	0.03
query39	0.03	0.02	0.02
query40	0.16	0.12	0.12
query41	0.07	0.02	0.03
query42	0.04	0.03	0.02
query43	0.04	0.02	0.03
Total cold run time: 106.8 s
Total hot run time: 32.08 s

@GoGoWen GoGoWen self-assigned this Nov 7, 2024
@mongo360 mongo360 force-pushed the light_schema_change_support_add_key_column branch from ec7d59a to 79d0dc6 Compare November 8, 2024 10:05
Copy link
Contributor

github-actions bot commented Nov 8, 2024

clang-tidy review says "All clean, LGTM! 👍"

1 similar comment
Copy link
Contributor

github-actions bot commented Nov 8, 2024

clang-tidy review says "All clean, LGTM! 👍"

@mongo360 mongo360 force-pushed the light_schema_change_support_add_key_column branch from 79d0dc6 to 4c5aefd Compare November 22, 2024 08:01
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@mongo360 mongo360 force-pushed the light_schema_change_support_add_key_column branch from 4c5aefd to fbdeccd Compare December 27, 2024 07:52
@mongo360
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17563	6135	6014	6014
q2	2038	312	183	183
q3	10395	1238	754	754
q4	10227	865	442	442
q5	8216	2288	2045	2045
q6	212	183	154	154
q7	923	779	635	635
q8	9243	1358	1126	1126
q9	5242	4856	4863	4856
q10	6812	2313	1847	1847
q11	487	298	261	261
q12	364	354	226	226
q13	17790	3629	3013	3013
q14	239	232	216	216
q15	569	501	493	493
q16	638	618	596	596
q17	575	846	324	324
q18	6932	6448	6380	6380
q19	3309	968	554	554
q20	299	311	189	189
q21	2871	2206	1998	1998
q22	355	347	311	311
Total cold run time: 105299 ms
Total hot run time: 32617 ms

----- Round 2, with runtime_filter_mode=off -----
q1	6350	6241	6231	6231
q2	236	323	228	228
q3	2305	2655	2346	2346
q4	1497	1939	1379	1379
q5	4391	4882	4962	4882
q6	181	173	146	146
q7	2028	1949	1843	1843
q8	2717	2827	2671	2671
q9	7283	7274	7273	7273
q10	3089	3378	2766	2766
q11	572	516	489	489
q12	647	771	665	665
q13	3415	3816	3194	3194
q14	290	313	278	278
q15	579	509	510	509
q16	660	660	673	660
q17	1265	1751	1244	1244
q18	7684	7420	7319	7319
q19	831	1174	1065	1065
q20	2006	2041	1920	1920
q21	5785	5383	4969	4969
q22	617	639	583	583
Total cold run time: 54428 ms
Total hot run time: 52660 ms

@doris-robot
Copy link

TeamCity be ut coverage result:
Function Coverage: 38.88% (10118/26022)
Line Coverage: 29.87% (85460/286103)
Region Coverage: 29.02% (43692/150560)
Branch Coverage: 25.56% (22289/87212)
Coverage Report: http://coverage.selectdb-in.cc/coverage/fbdeccdedb4ccb0f530ab4819739d4950a8a72ea_fbdeccdedb4ccb0f530ab4819739d4950a8a72ea/report/index.html

@doris-robot
Copy link

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

query1	1285	935	925	925
query2	6517	2380	2396	2380
query3	10938	4556	4900	4556
query4	32954	24021	23186	23186
query5	3925	617	471	471
query6	270	197	190	190
query7	3989	501	309	309
query8	285	242	234	234
query9	9416	2767	2734	2734
query10	460	338	267	267
query11	17824	15289	15199	15199
query12	156	105	102	102
query13	1572	533	396	396
query14	10277	7291	7919	7291
query15	245	205	182	182
query16	8376	635	464	464
query17	1582	763	574	574
query18	2073	413	309	309
query19	200	188	162	162
query20	122	126	112	112
query21	206	122	102	102
query22	4664	4588	4510	4510
query23	34730	33496	33829	33496
query24	6571	2323	2324	2323
query25	498	472	413	413
query26	806	298	158	158
query27	1951	485	349	349
query28	5784	2492	2522	2492
query29	651	575	416	416
query30	209	179	156	156
query31	974	926	838	838
query32	69	59	61	59
query33	473	352	306	306
query34	795	903	544	544
query35	807	849	771	771
query36	1034	1045	953	953
query37	128	101	73	73
query38	4135	4282	4147	4147
query39	1520	1458	1477	1458
query40	214	121	103	103
query41	45	45	43	43
query42	127	104	99	99
query43	535	552	523	523
query44	1382	821	825	821
query45	186	174	168	168
query46	882	1076	690	690
query47	2033	2026	1954	1954
query48	412	437	319	319
query49	711	505	409	409
query50	656	699	400	400
query51	7195	7233	7302	7233
query52	102	104	91	91
query53	240	255	182	182
query54	481	506	416	416
query55	85	82	79	79
query56	263	263	236	236
query57	1256	1233	1156	1156
query58	243	230	231	230
query59	3318	3300	3287	3287
query60	274	273	254	254
query61	137	104	107	104
query62	856	819	742	742
query63	231	196	192	192
query64	2677	1028	660	660
query65	3407	3274	3337	3274
query66	769	436	317	317
query67	16461	15817	15503	15503
query68	9322	774	502	502
query69	495	298	249	249
query70	1174	1143	1140	1140
query71	431	292	265	265
query72	6003	3853	3912	3853
query73	694	785	361	361
query74	10424	8919	8886	8886
query75	4575	3163	2649	2649
query76	5451	1217	797	797
query77	980	368	283	283
query78	11295	10312	9465	9465
query79	2531	850	602	602
query80	670	610	420	420
query81	503	279	231	231
query82	336	154	117	117
query83	194	161	147	147
query84	283	89	81	81
query85	751	373	301	301
query86	338	325	275	275
query87	4558	4587	4377	4377
query88	3231	2265	2231	2231
query89	410	319	290	290
query90	2025	252	188	188
query91	134	132	109	109
query92	71	54	53	53
query93	1004	698	524	524
query94	645	399	297	297
query95	343	271	252	252
query96	491	616	282	282
query97	2738	2884	2700	2700
query98	218	204	200	200
query99	1923	1582	1425	1425
Total cold run time: 297890 ms
Total hot run time: 196644 ms

@doris-robot
Copy link

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

query1	0.03	0.03	0.05
query2	0.08	0.03	0.04
query3	0.25	0.07	0.07
query4	1.60	0.10	0.11
query5	0.43	0.42	0.41
query6	1.15	0.65	0.65
query7	0.02	0.01	0.01
query8	0.04	0.03	0.04
query9	0.57	0.50	0.50
query10	0.57	0.57	0.55
query11	0.15	0.10	0.11
query12	0.14	0.11	0.11
query13	0.61	0.60	0.60
query14	2.73	2.83	2.83
query15	0.90	0.83	0.83
query16	0.38	0.38	0.40
query17	1.08	0.97	1.01
query18	0.22	0.21	0.21
query19	1.87	1.74	2.00
query20	0.01	0.01	0.01
query21	15.36	0.96	0.59
query22	0.76	0.78	0.60
query23	15.34	1.47	0.54
query24	2.94	1.80	1.60
query25	0.24	0.10	0.10
query26	0.26	0.14	0.14
query27	0.06	0.05	0.04
query28	14.21	1.47	1.04
query29	12.60	3.85	3.26
query30	0.26	0.09	0.08
query31	2.82	0.58	0.39
query32	3.23	0.56	0.46
query33	3.08	3.08	3.18
query34	16.72	5.07	4.51
query35	4.49	4.52	4.43
query36	0.64	0.53	0.47
query37	0.10	0.06	0.06
query38	0.05	0.04	0.04
query39	0.03	0.02	0.03
query40	0.18	0.12	0.12
query41	0.07	0.03	0.02
query42	0.04	0.02	0.03
query43	0.04	0.04	0.03
Total cold run time: 106.35 s
Total hot run time: 31.8 s

@mongo360 mongo360 force-pushed the light_schema_change_support_add_key_column branch from fbdeccd to 324eed6 Compare December 27, 2024 13:18
@mongo360
Copy link
Contributor Author

run buildall

@mongo360 mongo360 force-pushed the light_schema_change_support_add_key_column branch 2 times, most recently from 0ab8b9a to a7be770 Compare December 31, 2024 05:54
@mongo360
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17594	6107	6027	6027
q2	2046	310	176	176
q3	10406	1234	751	751
q4	10441	848	425	425
q5	8045	2191	1923	1923
q6	206	180	146	146
q7	891	756	595	595
q8	9250	1374	1160	1160
q9	5301	5035	5000	5000
q10	6788	2342	1862	1862
q11	485	288	254	254
q12	344	353	226	226
q13	17996	3579	3003	3003
q14	233	233	219	219
q15	559	512	490	490
q16	631	633	586	586
q17	564	850	323	323
q18	7000	6450	6340	6340
q19	2688	978	555	555
q20	293	311	185	185
q21	2845	2152	1954	1954
q22	362	334	312	312
Total cold run time: 104968 ms
Total hot run time: 32512 ms

----- Round 2, with runtime_filter_mode=off -----
q1	6300	6217	6232	6217
q2	235	343	240	240
q3	2464	2804	2498	2498
q4	1449	1884	1382	1382
q5	4540	4960	5014	4960
q6	187	178	140	140
q7	2140	2030	1825	1825
q8	2674	2857	2707	2707
q9	7442	7342	7303	7303
q10	3108	3334	2792	2792
q11	569	528	503	503
q12	637	776	613	613
q13	3300	3726	3146	3146
q14	299	314	289	289
q15	567	512	508	508
q16	678	692	659	659
q17	1225	1747	1258	1258
q18	7704	7493	7265	7265
q19	869	1071	1113	1071
q20	1981	2057	1920	1920
q21	5600	5280	4780	4780
q22	593	623	589	589
Total cold run time: 54561 ms
Total hot run time: 52665 ms

@doris-robot
Copy link

TeamCity be ut coverage result:
Function Coverage: 38.89% (10121/26024)
Line Coverage: 29.89% (85529/286155)
Region Coverage: 29.01% (43708/150670)
Branch Coverage: 25.54% (22295/87296)
Coverage Report: http://coverage.selectdb-in.cc/coverage/a7be7703bc562a41602a7af33971d84c0ccd2fd2_a7be7703bc562a41602a7af33971d84c0ccd2fd2/report/index.html

@doris-robot
Copy link

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

query1	1293	1010	932	932
query2	6506	2435	2323	2323
query3	10993	4664	4787	4664
query4	39112	23527	23530	23527
query5	4731	618	460	460
query6	251	192	201	192
query7	3649	480	304	304
query8	319	230	250	230
query9	6519	2722	2712	2712
query10	436	292	248	248
query11	15650	15496	15080	15080
query12	156	107	101	101
query13	894	533	417	417
query14	10740	7811	7149	7149
query15	259	219	186	186
query16	7527	611	475	475
query17	1548	771	601	601
query18	2010	406	343	343
query19	203	207	177	177
query20	118	118	111	111
query21	213	131	108	108
query22	4568	4687	4448	4448
query23	34295	33858	33704	33704
query24	6546	2312	2373	2312
query25	499	459	400	400
query26	810	276	164	164
query27	2124	484	342	342
query28	5845	2483	2485	2483
query29	657	553	433	433
query30	209	195	157	157
query31	1041	916	842	842
query32	95	63	57	57
query33	478	384	306	306
query34	798	866	530	530
query35	853	846	782	782
query36	1055	1031	973	973
query37	116	103	74	74
query38	4397	4306	4326	4306
query39	1533	1465	1460	1460
query40	201	114	105	105
query41	46	49	46	46
query42	117	103	109	103
query43	526	524	497	497
query44	1353	822	837	822
query45	181	177	173	173
query46	913	1071	667	667
query47	2009	2042	1944	1944
query48	397	415	337	337
query49	737	476	393	393
query50	632	675	401	401
query51	7406	7435	7253	7253
query52	103	101	102	101
query53	226	249	192	192
query54	490	513	428	428
query55	94	84	82	82
query56	257	271	236	236
query57	1218	1252	1183	1183
query58	236	230	226	226
query59	3265	3255	3188	3188
query60	295	257	251	251
query61	118	109	112	109
query62	892	816	744	744
query63	240	201	205	201
query64	3773	1042	689	689
query65	3431	3237	3261	3237
query66	868	437	307	307
query67	16562	15941	15534	15534
query68	10287	758	518	518
query69	483	334	252	252
query70	1203	1148	1139	1139
query71	446	287	253	253
query72	5933	3759	3895	3759
query73	950	746	368	368
query74	10597	9152	8906	8906
query75	4561	3161	2677	2677
query76	5600	1192	792	792
query77	1064	353	269	269
query78	10163	10200	9740	9740
query79	2727	894	609	609
query80	699	527	420	420
query81	492	270	228	228
query82	532	149	123	123
query83	190	165	143	143
query84	279	93	140	93
query85	808	375	315	315
query86	345	304	289	289
query87	4583	4558	4532	4532
query88	3120	2259	2234	2234
query89	413	343	298	298
query90	1884	186	184	184
query91	135	139	107	107
query92	65	56	58	56
query93	953	899	529	529
query94	655	394	293	293
query95	343	266	255	255
query96	479	619	275	275
query97	2752	2840	2660	2660
query98	230	210	192	192
query99	1648	1549	1428	1428
Total cold run time: 300251 ms
Total hot run time: 197498 ms

@doris-robot
Copy link

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

query1	0.03	0.04	0.03
query2	0.07	0.04	0.03
query3	0.24	0.07	0.06
query4	1.63	0.10	0.10
query5	0.42	0.43	0.41
query6	1.17	0.64	0.64
query7	0.02	0.01	0.01
query8	0.03	0.03	0.03
query9	0.59	0.50	0.51
query10	0.57	0.57	0.55
query11	0.15	0.10	0.11
query12	0.14	0.10	0.10
query13	0.61	0.60	0.60
query14	2.71	2.82	2.72
query15	0.90	0.84	0.81
query16	0.37	0.37	0.38
query17	1.07	1.06	1.05
query18	0.22	0.20	0.19
query19	1.89	1.87	1.98
query20	0.02	0.01	0.01
query21	15.39	0.91	0.58
query22	0.76	0.68	0.76
query23	15.30	1.42	0.55
query24	2.94	0.77	1.44
query25	0.17	0.10	0.08
query26	0.37	0.17	0.13
query27	0.06	0.04	0.04
query28	13.34	1.52	1.05
query29	12.66	3.83	3.25
query30	0.25	0.09	0.06
query31	2.83	0.60	0.38
query32	3.23	0.54	0.46
query33	3.03	3.02	3.08
query34	16.54	5.10	4.46
query35	4.58	4.46	4.44
query36	0.64	0.48	0.50
query37	0.09	0.06	0.06
query38	0.05	0.04	0.03
query39	0.03	0.02	0.02
query40	0.17	0.14	0.14
query41	0.08	0.03	0.02
query42	0.03	0.02	0.02
query43	0.04	0.03	0.03
Total cold run time: 105.43 s
Total hot run time: 30.93 s

ALTER TABLE add_keys_light_schema_change ADD COLUMN new_key_column INT default "2" AFTER user_id PROPERTIES ("timeout"="604800")
"""

def jobStateResult = waitJobFinish(""" SHOW ALTER TABLE COLUMN WHERE IndexName='add_keys_light_schema_change' ORDER BY createtime DESC LIMIT 1 """, 9)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not need wait, because light weight schema change is sync process. Not need background process.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jobStateResult is used to check schema change is use light schema change or not.

`sex` TINYINT COMMENT "用户性别",

`cost` BIGINT DEFAULT "0" COMMENT "用户总消费")
UNIQUE KEY(`user_id`, `date`, `city`, `age`, `sex`) DISTRIBUTED BY HASH(`user_id`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also need test unique key merge on read

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌🏻,i will add case 4.1 for this scene

BUCKETS 4
PROPERTIES (
"replication_num" = "1",
"light_schema_change" = "true",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all test cases should disable compaction

INSERT INTO add_keys_light_schema_change VALUES
(1, '2017-10-01', 'Beijing', 10, 1, 20)
"""
qt_sc_12 """ select * from add_keys_light_schema_change order by user_id """
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test case should follow this process:

  1. insert values
  2. add key column with default value
  3. insert values
  4. check select value

qt_sc_12 """ select * from add_keys_light_schema_change order by user_id """

sql """
ALTER TABLE add_keys_light_schema_change ADD COLUMN new_mv_key1 INT KEY default "2"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should also test delete condition:

  1. insert values
  2. add key column with default value
  3. delete where new keycolumn = xxx
  4. insert values
  5. check select value

qt_sc_12 """ select * from add_keys_light_schema_change order by user_id """

sql """
ALTER TABLE add_keys_light_schema_change ADD COLUMN new_mv_key1 INT KEY default "2"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the org table is key(col1,col2)
you add col3, the new key is (col1,col2,col3) or (col3,col1,col2) or (col1,col3,col2) ?
I think you should test all these cases.

sql """ DROP TABLE IF EXISTS add_keys_light_schema_change """
sql """
CREATE TABLE IF NOT EXISTS add_keys_light_schema_change (
`user_id` LARGEINT NOT NULL COMMENT "用户id",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should test all typed key columns such as string,date,int.
For example, the original key column could be one of string,date,int
and you add a new key column, it could also be one of string,date,int

jobStateResult = waitJobFinish(""" SHOW ALTER TABLE COLUMN WHERE IndexName='add_keys_light_schema_change' ORDER BY createtime DESC LIMIT 1 """, 9)
assertNotEquals(jobStateResult[0][8], "-1")

// case 2.1: light schema change aggreage : with multi version rowset and compaction
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should check these query values:

  1. select * from new table
  2. select * from newtable where key=xxx

"""
table_tablets = sql """ SHOW TABLETS FROM add_keys_light_schema_change ORDER BY RowCount DESC LIMIT 1 """

qt_41_unique_multi_rowset """ SELECT * FROM add_keys_light_schema_change; """
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For all test cases, you should check the compaction logic:

  1. first disable compaction and run all cases.
  2. call compaction API to do compaction for the table, and then run all test cases.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@mongo360 mongo360 force-pushed the light_schema_change_support_add_key_column branch from a7be770 to 23f7672 Compare January 2, 2025 02:40
@mongo360
Copy link
Contributor Author

mongo360 commented Jan 2, 2025

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17605	6093	6020	6020
q2	2045	312	176	176
q3	10400	1267	727	727
q4	10240	865	436	436
q5	8263	2192	1981	1981
q6	205	184	144	144
q7	892	746	601	601
q8	9235	1355	1127	1127
q9	5165	4867	4900	4867
q10	6758	2291	1841	1841
q11	468	283	255	255
q12	343	367	215	215
q13	17781	3605	2910	2910
q14	236	219	225	219
q15	550	504	498	498
q16	642	623	587	587
q17	578	838	338	338
q18	6941	6446	6398	6398
q19	1722	959	526	526
q20	309	320	190	190
q21	2774	2141	2000	2000
q22	351	326	298	298
Total cold run time: 103503 ms
Total hot run time: 32354 ms

----- Round 2, with runtime_filter_mode=off -----
q1	6204	6196	6217	6196
q2	229	332	231	231
q3	2225	2656	2321	2321
q4	1432	1859	1400	1400
q5	4330	4741	4756	4741
q6	182	182	144	144
q7	2085	1977	1775	1775
q8	2623	2812	2676	2676
q9	7291	7229	7262	7229
q10	3091	3372	2891	2891
q11	565	509	491	491
q12	633	758	592	592
q13	3443	3775	3173	3173
q14	295	295	288	288
q15	579	527	523	523
q16	647	671	636	636
q17	1218	1736	1265	1265
q18	7638	7444	7237	7237
q19	824	1144	1097	1097
q20	1984	2018	1933	1933
q21	5571	5301	4901	4901
q22	610	617	578	578
Total cold run time: 53699 ms
Total hot run time: 52318 ms

@doris-robot
Copy link

TeamCity be ut coverage result:
Function Coverage: 38.90% (10122/26021)
Line Coverage: 29.90% (85553/286135)
Region Coverage: 29.01% (43702/150632)
Branch Coverage: 25.55% (22306/87308)
Coverage Report: http://coverage.selectdb-in.cc/coverage/23f7672e685e1b9007b132938339d5c5ffcc8df0_23f7672e685e1b9007b132938339d5c5ffcc8df0/report/index.html

@doris-robot
Copy link

TPC-DS: Total hot run time: 196160 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 23f7672e685e1b9007b132938339d5c5ffcc8df0, data reload: false

query1	1304	968	924	924
query2	6513	2415	2343	2343
query3	11091	4859	4748	4748
query4	32971	23579	23888	23579
query5	4341	607	479	479
query6	290	210	187	187
query7	3996	485	323	323
query8	308	251	242	242
query9	9493	2656	2632	2632
query10	443	324	250	250
query11	17782	15278	15309	15278
query12	171	111	104	104
query13	1763	544	407	407
query14	11369	6987	7073	6987
query15	243	208	199	199
query16	8053	600	473	473
query17	1557	768	572	572
query18	2137	407	298	298
query19	206	186	177	177
query20	125	116	116	116
query21	206	126	112	112
query22	4475	4520	4488	4488
query23	34348	33666	33266	33266
query24	7107	2287	2320	2287
query25	458	471	384	384
query26	875	273	153	153
query27	3106	481	343	343
query28	5792	2488	2453	2453
query29	637	595	421	421
query30	211	196	156	156
query31	975	928	846	846
query32	73	64	55	55
query33	489	344	302	302
query34	755	878	512	512
query35	829	858	747	747
query36	1022	1052	973	973
query37	117	100	83	83
query38	4410	4180	4144	4144
query39	1578	1470	1447	1447
query40	209	112	98	98
query41	46	43	46	43
query42	124	107	110	107
query43	521	524	503	503
query44	1357	830	842	830
query45	187	180	169	169
query46	916	1067	655	655
query47	1986	1961	1949	1949
query48	386	430	315	315
query49	712	479	400	400
query50	642	675	392	392
query51	7120	7287	7056	7056
query52	111	107	94	94
query53	236	265	196	196
query54	467	499	430	430
query55	82	77	80	77
query56	262	257	236	236
query57	1242	1204	1147	1147
query58	237	232	219	219
query59	3085	3396	3160	3160
query60	279	267	249	249
query61	112	107	107	107
query62	869	839	776	776
query63	233	196	186	186
query64	3383	1023	663	663
query65	3349	3278	3285	3278
query66	834	416	309	309
query67	16000	15963	15536	15536
query68	9610	751	522	522
query69	496	301	250	250
query70	1341	1153	1133	1133
query71	440	282	253	253
query72	5991	3945	3836	3836
query73	1499	748	364	364
query74	9848	9096	8968	8968
query75	4741	3148	2646	2646
query76	5668	1167	757	757
query77	1025	368	273	273
query78	9919	10185	9394	9394
query79	4023	883	577	577
query80	784	517	415	415
query81	468	265	227	227
query82	279	146	125	125
query83	196	172	144	144
query84	278	89	64	64
query85	756	370	298	298
query86	344	320	289	289
query87	4369	4459	4570	4459
query88	3312	2232	2201	2201
query89	432	334	288	288
query90	2164	185	189	185
query91	134	137	106	106
query92	63	55	52	52
query93	2751	868	523	523
query94	663	370	287	287
query95	326	312	248	248
query96	487	605	280	280
query97	2703	2771	2693	2693
query98	219	201	207	201
query99	1604	1541	1432	1432
Total cold run time: 303539 ms
Total hot run time: 196160 ms

@doris-robot
Copy link

ClickBench: Total hot run time: 30.82 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 23f7672e685e1b9007b132938339d5c5ffcc8df0, data reload: false

query1	0.03	0.03	0.04
query2	0.07	0.04	0.03
query3	0.24	0.07	0.07
query4	1.62	0.11	0.11
query5	0.42	0.42	0.40
query6	1.14	0.65	0.65
query7	0.02	0.02	0.02
query8	0.04	0.03	0.03
query9	0.59	0.49	0.51
query10	0.56	0.56	0.55
query11	0.15	0.11	0.11
query12	0.13	0.11	0.11
query13	0.62	0.60	0.61
query14	2.71	2.74	2.86
query15	0.90	0.83	0.84
query16	0.38	0.38	0.38
query17	1.01	1.02	1.01
query18	0.24	0.21	0.21
query19	1.92	1.88	2.00
query20	0.01	0.01	0.01
query21	15.38	0.95	0.59
query22	0.75	0.80	0.74
query23	15.22	1.42	0.56
query24	3.02	0.35	0.72
query25	0.25	0.15	0.08
query26	0.38	0.15	0.14
query27	0.05	0.05	0.04
query28	13.19	1.59	1.08
query29	12.61	4.00	3.26
query30	0.25	0.09	0.07
query31	2.82	0.59	0.38
query32	3.23	0.53	0.46
query33	3.11	3.06	3.07
query34	16.89	5.10	4.50
query35	4.54	4.45	4.48
query36	0.66	0.50	0.49
query37	0.10	0.06	0.06
query38	0.04	0.04	0.04
query39	0.03	0.02	0.02
query40	0.16	0.14	0.12
query41	0.08	0.03	0.02
query42	0.03	0.02	0.02
query43	0.03	0.04	0.03
Total cold run time: 105.62 s
Total hot run time: 30.82 s

@mongo360 mongo360 force-pushed the light_schema_change_support_add_key_column branch from 23f7672 to 2c7af74 Compare January 3, 2025 14:48
@mongo360
Copy link
Contributor Author

mongo360 commented Jan 3, 2025

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17591	6430	6027	6027
q2	2054	301	177	177
q3	10417	1223	758	758
q4	10231	873	434	434
q5	8358	2191	1978	1978
q6	206	180	143	143
q7	888	767	596	596
q8	9246	1382	1132	1132
q9	5250	4972	5022	4972
q10	6801	2337	1873	1873
q11	477	278	261	261
q12	344	362	225	225
q13	17789	3658	3089	3089
q14	238	231	211	211
q15	578	504	485	485
q16	625	619	594	594
q17	576	839	322	322
q18	6938	6496	6526	6496
q19	2149	963	573	573
q20	306	312	183	183
q21	3117	2211	1987	1987
q22	364	328	310	310
Total cold run time: 104543 ms
Total hot run time: 32826 ms

----- Round 2, with runtime_filter_mode=off -----
q1	6255	6153	6169	6153
q2	229	326	226	226
q3	2258	2657	2291	2291
q4	1368	1837	1356	1356
q5	4351	4785	4887	4785
q6	188	177	143	143
q7	2053	2032	1852	1852
q8	2683	2783	2701	2701
q9	7355	7239	7299	7239
q10	3055	3361	2823	2823
q11	567	503	484	484
q12	629	765	621	621
q13	3504	3898	3223	3223
q14	283	302	290	290
q15	569	522	492	492
q16	660	694	641	641
q17	1195	1702	1249	1249
q18	7734	7588	7445	7445
q19	860	1132	1126	1126
q20	2014	2035	1884	1884
q21	5689	5215	4975	4975
q22	619	581	632	581
Total cold run time: 54118 ms
Total hot run time: 52580 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 197143 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 2c7af743d7f34f61144f518f0f4e9eb6c018a2cb, data reload: false

query1	1290	968	931	931
query2	6334	2462	2414	2414
query3	11084	5020	4811	4811
query4	32998	23748	23327	23327
query5	3709	608	451	451
query6	274	192	190	190
query7	3991	491	303	303
query8	298	246	222	222
query9	9536	2632	2613	2613
query10	460	317	249	249
query11	18484	15830	15373	15373
query12	174	103	99	99
query13	1595	538	393	393
query14	10358	6798	7644	6798
query15	239	203	209	203
query16	7935	654	462	462
query17	1531	779	598	598
query18	2115	414	323	323
query19	212	195	169	169
query20	141	126	110	110
query21	206	126	112	112
query22	4504	4714	4419	4419
query23	34348	33722	33973	33722
query24	6192	2511	2313	2313
query25	476	474	387	387
query26	713	280	159	159
query27	2034	453	340	340
query28	5579	2468	2411	2411
query29	628	561	436	436
query30	206	179	150	150
query31	957	938	831	831
query32	75	63	59	59
query33	469	368	353	353
query34	782	867	519	519
query35	837	859	789	789
query36	1041	1064	988	988
query37	121	110	81	81
query38	4354	4186	4411	4186
query39	1517	1517	1456	1456
query40	213	117	105	105
query41	44	43	43	43
query42	122	105	109	105
query43	548	540	503	503
query44	1358	835	856	835
query45	183	181	169	169
query46	912	1080	673	673
query47	1983	2021	1932	1932
query48	400	424	328	328
query49	721	490	409	409
query50	698	681	437	437
query51	7345	7342	7320	7320
query52	105	105	97	97
query53	228	262	184	184
query54	500	511	428	428
query55	83	86	88	86
query56	264	264	250	250
query57	1248	1219	1169	1169
query58	239	221	253	221
query59	3136	3374	3099	3099
query60	270	266	264	264
query61	108	106	109	106
query62	873	796	748	748
query63	233	199	198	198
query64	2840	1025	639	639
query65	3311	3326	3325	3325
query66	782	406	316	316
query67	16704	15934	15584	15584
query68	8688	704	519	519
query69	484	303	248	248
query70	1179	1162	1113	1113
query71	428	298	251	251
query72	6495	3892	3874	3874
query73	664	759	361	361
query74	10013	9139	8931	8931
query75	4357	3171	2661	2661
query76	3757	1195	775	775
query77	765	475	308	308
query78	10089	10313	9659	9659
query79	4342	811	579	579
query80	705	525	419	419
query81	468	275	227	227
query82	573	163	122	122
query83	182	169	156	156
query84	278	86	74	74
query85	774	409	312	312
query86	355	312	287	287
query87	4599	4646	4258	4258
query88	3560	2196	2169	2169
query89	468	343	304	304
query90	1976	189	190	189
query91	130	136	102	102
query92	60	54	53	53
query93	2180	910	529	529
query94	662	408	295	295
query95	328	268	248	248
query96	488	604	294	294
query97	2949	3006	2876	2876
query98	220	202	203	202
query99	1701	1578	1425	1425
Total cold run time: 297165 ms
Total hot run time: 197143 ms

@doris-robot
Copy link

ClickBench: Total hot run time: 31.48 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 2c7af743d7f34f61144f518f0f4e9eb6c018a2cb, data reload: false

query1	0.04	0.04	0.03
query2	0.08	0.03	0.04
query3	0.24	0.08	0.06
query4	1.61	0.10	0.11
query5	0.42	0.43	0.41
query6	1.16	0.64	0.65
query7	0.02	0.02	0.02
query8	0.04	0.03	0.03
query9	0.59	0.51	0.49
query10	0.57	0.58	0.55
query11	0.15	0.10	0.10
query12	0.14	0.10	0.11
query13	0.61	0.60	0.59
query14	2.73	2.75	2.75
query15	0.89	0.82	0.83
query16	0.37	0.41	0.38
query17	1.06	1.06	1.07
query18	0.23	0.21	0.21
query19	1.99	1.88	2.02
query20	0.01	0.01	0.01
query21	15.37	0.89	0.57
query22	0.75	0.80	0.64
query23	15.30	1.44	0.59
query24	3.24	0.99	1.45
query25	0.17	0.16	0.11
query26	0.21	0.14	0.13
query27	0.07	0.06	0.03
query28	14.17	1.54	1.05
query29	12.56	3.88	3.23
query30	0.24	0.08	0.06
query31	2.81	0.58	0.39
query32	3.22	0.54	0.46
query33	3.06	3.16	3.18
query34	16.56	5.20	4.52
query35	4.50	4.51	4.52
query36	0.81	0.49	0.51
query37	0.09	0.06	0.06
query38	0.04	0.03	0.04
query39	0.04	0.02	0.03
query40	0.17	0.13	0.12
query41	0.07	0.02	0.03
query42	0.04	0.02	0.02
query43	0.04	0.02	0.02
Total cold run time: 106.48 s
Total hot run time: 31.48 s

@doris-robot
Copy link

TeamCity be ut coverage result:
Function Coverage: 38.88% (10128/26048)
Line Coverage: 29.92% (85683/286399)
Region Coverage: 29.02% (43729/150668)
Branch Coverage: 25.56% (22320/87310)
Coverage Report: http://coverage.selectdb-in.cc/coverage/2c7af743d7f34f61144f518f0f4e9eb6c018a2cb_2c7af743d7f34f61144f518f0f4e9eb6c018a2cb/report/index.html

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.

4 participants