Skip to content

branch-3.1: [bug](group commit) Fix group commit blocked after schema change throw exception #54113#54309

Merged
morrySnow merged 1 commit intoapache:branch-3.1from
xy720:fix-group-commit-3.1
Aug 5, 2025
Merged

branch-3.1: [bug](group commit) Fix group commit blocked after schema change throw exception #54113#54309
morrySnow merged 1 commit intoapache:branch-3.1from
xy720:fix-group-commit-3.1

Conversation

@xy720
Copy link
Member

@xy720 xy720 commented Aug 5, 2025

pick #54113

…w exception (apache#54113)

Fix group commit blocked after schema change throw exception

Problem Summary:

Reproduce step:

1、create table

```
CREATE TABLE `test_table_uniq` (
  `company_id` varchar(32) NOT NULL,
  `date` datetime NOT NULL,
  `discount` decimal(19,10) NULL,
) ENGINE=OLAP
UNIQUE KEY(`company_id`, `date`)
DISTRIBUTED BY HASH(`company_id`) BUCKETS 8
```

2、group commit insert  SUCCESS

```
SET group_commit = async_mode;
INSERT INTO test_table_uniq (company_id, date, discount) VALUES(1, '2025-07-25', 10);
```

3、create rollup and wait job SUCCESS

```
CREATE MATERIALIZED VIEW mv_company_day
AS
SELECT   company_id,   date
FROM test_table_uniq;
```

4、group commit insert  SUCCESS

```
SET group_commit = async_mode;
INSERT INTO test_table_uniq (company_id, date, discount) VALUES(2, '2025-07-25', 11);
```

5、create rollup with same name and throw exception

```
CREATE MATERIALIZED VIEW mv_company_day
AS
SELECT   company_id,   date
FROM test_table_uniq;
ERROR 1105 (HY000): errCode = 2, detailMessage = Materialized view[mv_company_day] already exists
```

6、group commit insert  FAIL

```
SET group_commit = async_mode;
INSERT INTO test_table_uniq (company_id, date, discount) VALUES(3, '2025-07-25', 12);
```

JDBC ERROR LOG:
```
java.sql.BatchUpdateException: errCode = 2, detailMessage = insert table 1753872336812 is blocked on schema change
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at com.mysql.cj.util.Util.handleNewInstance(Util.java:192)
        at com.mysql.cj.util.Util.getInstance(Util.java:167)
        at com.mysql.cj.util.Util.getInstance(Util.java:174)
        at com.mysql.cj.jdbc.exceptions.SQLError.createBatchUpdateException(SQLError.java:224)
        at com.mysql.cj.jdbc.ClientPreparedStatement.executeBatchedInserts(ClientPreparedStatement.java:755)
        at com.mysql.cj.jdbc.ClientPreparedStatement.executeBatchInternal(ClientPreparedStatement.java:426)
        at com.mysql.cj.jdbc.StatementImpl.executeBatch(StatementImpl.java:795)
        at DorisStressTest.main(DorisStressTest.java:78)
Caused by: java.sql.SQLException: errCode = 2, detailMessage = insert table 1753872336812 is blocked on schema change
        at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129)
        at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
        at com.mysql.cj.jdbc.ServerPreparedStatement.serverExecute(ServerPreparedStatement.java:633)
        at com.mysql.cj.jdbc.ServerPreparedStatement.executeInternal(ServerPreparedStatement.java:417)
        at com.mysql.cj.jdbc.ClientPreparedStatement.executeUpdateInternal(ClientPreparedStatement.java:1098)
        at com.mysql.cj.jdbc.ClientPreparedStatement.executeUpdateInternal(ClientPreparedStatement.java:1046)
        at com.mysql.cj.jdbc.ClientPreparedStatement.executeLargeUpdate(ClientPreparedStatement.java:1371)
        at com.mysql.cj.jdbc.ClientPreparedStatement.executeBatchedInserts(ClientPreparedStatement.java:716)
```

master/3.0/2.1

- Test <!-- At least one of them must be included. -->
    - [x] 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 <!-- Add your reason?  -->

- Behavior changed:
    - [x] No.
    - [ ] Yes. <!-- Explain the behavior change -->

- Does this need documentation?
    - [x] No.
- [ ] Yes. <!-- Add document PR link here. eg:
apache/doris-website#1214 -->

- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label <!-- Add branch pick label that this PR
should merge into -->
@xy720 xy720 requested a review from morrySnow as a code owner August 5, 2025 01:54
@hello-stephen
Copy link
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?

@xy720
Copy link
Member Author

xy720 commented Aug 5, 2025

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17588	5494	5476	5476
q2	2059	287	183	183
q3	10892	1248	796	796
q4	10544	878	457	457
q5	9742	2360	2166	2166
q6	193	166	135	135
q7	920	736	630	630
q8	9352	1430	1345	1345
q9	5256	4969	4891	4891
q10	6777	2250	1824	1824
q11	464	283	250	250
q12	345	379	217	217
q13	17768	3586	3004	3004
q14	243	227	201	201
q15	512	462	462	462
q16	419	426	367	367
q17	592	853	355	355
q18	6955	6377	6260	6260
q19	1554	941	555	555
q20	332	337	204	204
q21	2770	2194	2004	2004
q22	1028	1033	996	996
Total cold run time: 106305 ms
Total hot run time: 32778 ms

----- Round 2, with runtime_filter_mode=off -----
q1	5592	5528	5570	5528
q2	235	322	230	230
q3	2222	2611	2308	2308
q4	1356	1811	1344	1344
q5	4431	5033	4954	4954
q6	177	163	132	132
q7	2109	1934	1825	1825
q8	2566	2845	2651	2651
q9	7289	7205	7207	7205
q10	3049	3288	2675	2675
q11	565	533	478	478
q12	681	798	628	628
q13	3419	3813	3219	3219
q14	280	294	273	273
q15	531	466	481	466
q16	443	485	443	443
q17	1203	1718	1250	1250
q18	7655	7521	7542	7521
q19	806	1114	1113	1113
q20	2006	2057	1908	1908
q21	5470	4991	4669	4669
q22	1111	1130	1043	1043
Total cold run time: 53196 ms
Total hot run time: 51863 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 196896 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 1a0438d6352a4fc27a707b16f72f34faabc59bc1, data reload: false

query1	1266	944	890	890
query2	6143	1963	1920	1920
query3	10959	4339	4560	4339
query4	32786	24206	23411	23411
query5	4288	624	457	457
query6	286	193	175	175
query7	3982	502	334	334
query8	298	242	233	233
query9	9441	2590	2573	2573
query10	479	322	260	260
query11	17858	15373	15172	15172
query12	153	107	104	104
query13	1565	544	429	429
query14	10096	6609	7360	6609
query15	254	213	185	185
query16	8038	654	516	516
query17	1613	802	593	593
query18	2136	411	322	322
query19	209	199	165	165
query20	126	121	121	121
query21	210	131	107	107
query22	4610	4495	4532	4495
query23	34932	34313	33921	33921
query24	7413	2721	2669	2669
query25	524	473	436	436
query26	1171	293	172	172
query27	2053	481	352	352
query28	5516	2218	2236	2218
query29	751	608	504	504
query30	237	189	162	162
query31	1098	906	863	863
query32	76	58	57	57
query33	487	371	322	322
query34	798	852	515	515
query35	780	806	718	718
query36	1021	1041	970	970
query37	113	95	68	68
query38	4001	4087	3969	3969
query39	1533	1506	1460	1460
query40	217	122	110	110
query41	54	51	48	48
query42	122	102	103	102
query43	503	514	520	514
query44	1325	825	820	820
query45	185	173	167	167
query46	870	1041	678	678
query47	1970	2006	1902	1902
query48	407	439	354	354
query49	797	498	434	434
query50	660	707	432	432
query51	7444	7438	7368	7368
query52	103	99	97	97
query53	236	263	192	192
query54	556	536	469	469
query55	78	80	81	80
query56	274	279	249	249
query57	1265	1266	1224	1224
query58	256	227	219	219
query59	3131	3100	3225	3100
query60	287	281	282	281
query61	113	124	124	124
query62	838	736	681	681
query63	230	205	194	194
query64	4312	999	631	631
query65	3355	3283	3285	3283
query66	983	401	303	303
query67	15985	15811	15672	15672
query68	8114	841	543	543
query69	497	319	269	269
query70	1157	1135	1111	1111
query71	395	303	261	261
query72	5803	3731	3794	3731
query73	632	739	357	357
query74	10567	9342	9227	9227
query75	3191	3152	2663	2663
query76	3089	1163	779	779
query77	513	366	273	273
query78	10466	10320	9622	9622
query79	3922	838	593	593
query80	773	526	434	434
query81	506	258	220	220
query82	1036	119	90	90
query83	185	163	143	143
query84	289	97	87	87
query85	776	383	301	301
query86	401	299	305	299
query87	4311	4356	4214	4214
query88	5299	2432	2404	2404
query89	419	338	295	295
query90	1741	198	201	198
query91	142	140	112	112
query92	64	57	51	51
query93	2969	908	552	552
query94	701	390	316	316
query95	348	281	264	264
query96	497	612	283	283
query97	3181	3275	3182	3182
query98	226	212	208	208
query99	1561	1421	1300	1300
Total cold run time: 299627 ms
Total hot run time: 196896 ms

@doris-robot
Copy link

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

query1	0.04	0.04	0.02
query2	0.07	0.03	0.03
query3	0.23	0.07	0.06
query4	1.61	0.11	0.10
query5	0.51	0.50	0.52
query6	1.13	0.75	0.73
query7	0.02	0.01	0.02
query8	0.04	0.03	0.03
query9	0.58	0.51	0.50
query10	0.55	0.56	0.55
query11	0.15	0.10	0.11
query12	0.16	0.11	0.11
query13	0.61	0.59	0.59
query14	0.76	0.79	0.79
query15	0.84	0.83	0.84
query16	0.37	0.41	0.38
query17	1.07	1.00	1.05
query18	0.25	0.21	0.22
query19	1.89	1.86	1.86
query20	0.02	0.02	0.01
query21	15.39	0.92	0.60
query22	0.74	0.91	0.67
query23	15.01	1.42	0.58
query24	2.85	1.40	1.97
query25	0.17	0.14	0.07
query26	0.24	0.15	0.13
query27	0.06	0.05	0.03
query28	14.41	1.00	0.44
query29	12.56	3.96	3.30
query30	0.25	0.09	0.07
query31	2.83	0.61	0.39
query32	3.23	0.55	0.46
query33	3.00	3.03	2.96
query34	16.69	5.19	4.55
query35	4.54	4.49	4.53
query36	0.66	0.49	0.48
query37	0.08	0.06	0.07
query38	0.05	0.04	0.03
query39	0.03	0.02	0.02
query40	0.16	0.13	0.13
query41	0.08	0.03	0.02
query42	0.05	0.02	0.02
query43	0.04	0.03	0.03
Total cold run time: 104.02 s
Total hot run time: 29.34 s

@hello-stephen
Copy link
Contributor

FE UT Coverage Report

Increment line coverage 100.00% (7/7) 🎉
Increment coverage report
Complete coverage report

@morrySnow morrySnow changed the title branch-3.1: [bug](group commit) Fix group commit blocked after schema change throw exception branch-3.1: [bug](group commit) Fix group commit blocked after schema change throw exception #54113 Aug 5, 2025
@morrySnow morrySnow merged commit ba414fd into apache:branch-3.1 Aug 5, 2025
26 checks passed
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

Comments