Skip to content

Conversation

@morningman
Copy link
Contributor

@morningman morningman commented Jun 24, 2025

yx-keith and others added 2 commits June 24, 2025 15:14
…pache#50791)

Related PR: apache#50776, apache#46882

Problem Summary:

1. Fix bug that `KILL connection_id` is not supported in Nereids

This PR apache#46882 implements `KILL` in Nereids, but it miss the grammar
`KILL connection_id` and treat it as `KILL query_id`. This PR fix it.

2. Unify the core code of `KILL` operation in both old and new planner

All core logic about `kill` are moved to `KillUtils` class. So that both
old and new planner and can have same logic.

3. Support Kill query by query id from all FE

Previously, when executing `kill query query_id;`, Doris will only find
query id in current FE. If not found, Doris will send the cancel request
to all Backends to try cancelling this query.

In this PR, I changed the logic. Doris will first find query id in
current FE, if not found, this `kill` command will be forwarded to all
other Frontends to then find it in other FEs. And Doris will no longer
send the cancel request to Backend.

4. Support Kill query by trace id from all FE

User can set a custom `trace id` by `set
session_context="trace_id:your_trace_id"`. And this trace id will be
bind to the subsequent queries in this connection. Then user can cancel
the query by trace id:

    `KILL QUERY "trace_id"`

More details can be found in user doc:
apache/doris-website#2371
@morningman morningman requested a review from morrySnow as a code owner June 24, 2025 07:17
@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?

@morningman morningman changed the title branch-3.1: [fix/feature](kill) fix kill operation and support kill by trace id #50791 branch-3.1: [fix/feature](kill) fix kill operation and support kill by trace id #46882 #48942 #50791 #43231 Jun 24, 2025
@morningman
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17593	7191	6640	6640
q2	2074	178	161	161
q3	10703	1076	1140	1076
q4	10481	736	823	736
q5	7770	2883	2828	2828
q6	215	136	141	136
q7	984	626	611	611
q8	9363	1942	2032	1942
q9	6636	6396	6461	6396
q10	7005	2316	2327	2316
q11	481	267	268	267
q12	395	207	209	207
q13	17787	2984	3003	2984
q14	249	204	204	204
q15	514	461	461	461
q16	477	386	376	376
q17	987	577	610	577
q18	7455	6654	6759	6654
q19	1334	1025	892	892
q20	491	215	200	200
q21	4015	3289	3198	3198
q22	1126	995	995	995
Total cold run time: 108135 ms
Total hot run time: 39857 ms

----- Round 2, with runtime_filter_mode=off -----
q1	6626	6595	6600	6595
q2	335	232	230	230
q3	2923	2780	2903	2780
q4	2017	1782	1779	1779
q5	5781	5785	5753	5753
q6	207	131	127	127
q7	2188	1799	1842	1799
q8	3404	3615	3582	3582
q9	8996	8864	8972	8864
q10	3587	3522	3548	3522
q11	626	501	502	501
q12	826	575	606	575
q13	9336	3155	3196	3155
q14	297	272	272	272
q15	511	477	457	457
q16	484	454	440	440
q17	1859	1612	1619	1612
q18	8438	7811	7908	7811
q19	1698	1529	1475	1475
q20	2092	1791	1845	1791
q21	5105	4923	5106	4923
q22	1133	1036	1097	1036
Total cold run time: 68469 ms
Total hot run time: 59079 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 196587 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 163869e06c10bd90670ef08c0e6ec390b7310229, data reload: false

query1	1299	919	910	910
query2	6240	1962	1893	1893
query3	10858	4383	4383	4383
query4	60840	29026	23628	23628
query5	5251	470	484	470
query6	444	190	198	190
query7	5508	307	307	307
query8	316	232	238	232
query9	8662	2589	2591	2589
query10	470	278	262	262
query11	17710	15250	15812	15250
query12	157	105	109	105
query13	1489	447	453	447
query14	10041	7951	6851	6851
query15	200	179	186	179
query16	7121	484	480	480
query17	1179	610	570	570
query18	1881	337	322	322
query19	237	163	155	155
query20	122	114	114	114
query21	205	106	104	104
query22	4526	4411	4629	4411
query23	34504	34417	33713	33713
query24	6171	2909	2962	2909
query25	528	388	411	388
query26	670	170	164	164
query27	1899	349	352	349
query28	4150	2163	2151	2151
query29	690	444	434	434
query30	232	162	161	161
query31	1019	805	840	805
query32	70	54	56	54
query33	444	300	302	300
query34	915	512	545	512
query35	843	733	718	718
query36	1061	959	963	959
query37	117	67	70	67
query38	4055	3991	4011	3991
query39	1498	1469	1491	1469
query40	206	99	96	96
query41	46	45	51	45
query42	112	107	99	99
query43	527	509	497	497
query44	1194	852	834	834
query45	195	169	170	169
query46	1135	726	739	726
query47	2010	1909	1910	1909
query48	442	347	365	347
query49	742	394	400	394
query50	857	434	429	429
query51	7326	7270	7238	7238
query52	102	94	88	88
query53	267	182	190	182
query54	581	467	486	467
query55	82	82	82	82
query56	266	274	248	248
query57	1333	1213	1195	1195
query58	233	218	221	218
query59	3278	3069	2979	2979
query60	299	264	266	264
query61	158	149	125	125
query62	797	663	689	663
query63	214	185	191	185
query64	1374	661	635	635
query65	3274	3195	3194	3194
query66	701	296	292	292
query67	15711	15481	15518	15481
query68	4316	583	581	581
query69	437	265	262	262
query70	1112	1129	1129	1129
query71	347	268	255	255
query72	6423	4103	4257	4103
query73	755	366	360	360
query74	9790	9346	8962	8962
query75	3367	2657	2711	2657
query76	1993	1073	1042	1042
query77	498	283	291	283
query78	10593	9587	9576	9576
query79	2987	614	619	614
query80	1381	424	435	424
query81	521	228	223	223
query82	973	94	88	88
query83	262	149	143	143
query84	285	77	84	77
query85	1167	326	304	304
query86	414	272	304	272
query87	4442	4278	4242	4242
query88	4422	2385	2351	2351
query89	421	294	283	283
query90	1986	183	183	183
query91	134	108	110	108
query92	66	51	51	51
query93	3044	556	552	552
query94	840	298	294	294
query95	356	258	261	258
query96	632	282	275	275
query97	3315	3091	3139	3091
query98	214	199	200	199
query99	1576	1268	1299	1268
Total cold run time: 316153 ms
Total hot run time: 196587 ms

@doris-robot
Copy link

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

query1	0.04	0.04	0.03
query2	0.07	0.03	0.03
query3	0.23	0.07	0.06
query4	1.63	0.10	0.10
query5	0.51	0.50	0.52
query6	1.13	0.73	0.73
query7	0.02	0.03	0.01
query8	0.04	0.03	0.03
query9	0.57	0.50	0.49
query10	0.55	0.55	0.55
query11	0.15	0.11	0.11
query12	0.13	0.11	0.11
query13	0.61	0.60	0.59
query14	0.75	0.83	0.81
query15	0.85	0.83	0.82
query16	0.39	0.38	0.37
query17	0.98	1.10	1.02
query18	0.24	0.22	0.23
query19	1.83	1.72	1.76
query20	0.02	0.01	0.01
query21	15.40	0.61	0.56
query22	2.72	1.91	1.45
query23	16.91	0.97	0.83
query24	3.80	0.50	1.37
query25	0.18	0.11	0.10
query26	0.57	0.13	0.14
query27	0.04	0.05	0.05
query28	10.06	0.49	0.49
query29	12.55	3.20	3.22
query30	0.25	0.06	0.06
query31	2.83	0.38	0.39
query32	3.24	0.47	0.45
query33	3.01	3.04	3.01
query34	17.33	4.44	4.47
query35	4.55	4.53	4.53
query36	0.68	0.48	0.47
query37	0.09	0.06	0.06
query38	0.05	0.03	0.03
query39	0.03	0.02	0.02
query40	0.16	0.13	0.14
query41	0.08	0.03	0.02
query42	0.03	0.02	0.02
query43	0.03	0.03	0.03
Total cold run time: 105.33 s
Total hot run time: 29.27 s

@morningman
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17820	7014	6651	6651
q2	2041	165	163	163
q3	10677	1076	1150	1076
q4	10578	747	798	747
q5	7724	2916	2870	2870
q6	211	128	133	128
q7	969	628	608	608
q8	9370	1945	2017	1945
q9	6628	6369	6386	6369
q10	6985	2325	2299	2299
q11	462	254	269	254
q12	397	219	214	214
q13	17793	2977	3011	2977
q14	230	219	225	219
q15	493	466	464	464
q16	455	378	376	376
q17	1001	651	592	592
q18	7159	6660	6503	6503
q19	1338	1002	948	948
q20	503	202	200	200
q21	3985	3367	3220	3220
q22	1071	983	960	960
Total cold run time: 107890 ms
Total hot run time: 39783 ms

----- Round 2, with runtime_filter_mode=off -----
q1	6663	6592	6549	6549
q2	327	238	235	235
q3	2895	2723	2886	2723
q4	2078	1817	1807	1807
q5	5721	5760	5754	5754
q6	222	136	130	130
q7	2216	1826	1852	1826
q8	3403	3576	3538	3538
q9	8874	8829	8971	8829
q10	3559	3518	3508	3508
q11	601	497	495	495
q12	817	630	596	596
q13	9612	3156	3219	3156
q14	322	265	270	265
q15	535	468	487	468
q16	508	448	464	448
q17	1871	1642	1635	1635
q18	8247	7773	7628	7628
q19	1702	1657	1557	1557
q20	2055	1819	1810	1810
q21	5321	5042	4998	4998
q22	1109	998	1062	998
Total cold run time: 68658 ms
Total hot run time: 58953 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 196463 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 79f5d2f40dafee1e6085a7a92cb7161b0b031456, data reload: false

query1	1299	908	931	908
query2	6337	1911	1884	1884
query3	10849	4358	4414	4358
query4	60992	29613	23182	23182
query5	5227	470	454	454
query6	405	181	186	181
query7	5504	320	305	305
query8	314	240	239	239
query9	8426	2612	2611	2611
query10	477	266	260	260
query11	17694	15228	16242	15228
query12	160	106	106	106
query13	1455	478	419	419
query14	11034	7426	7058	7058
query15	204	188	180	180
query16	7110	497	478	478
query17	1164	594	585	585
query18	1903	325	323	323
query19	228	183	155	155
query20	116	112	124	112
query21	206	107	103	103
query22	4656	4467	4638	4467
query23	34717	33953	33999	33953
query24	6188	2940	2960	2940
query25	535	414	399	399
query26	650	164	181	164
query27	1831	361	362	361
query28	3964	2176	2169	2169
query29	704	440	421	421
query30	235	162	159	159
query31	995	826	883	826
query32	62	57	57	57
query33	416	297	301	297
query34	910	502	509	502
query35	849	723	710	710
query36	1117	979	943	943
query37	113	64	67	64
query38	4083	3949	3974	3949
query39	1519	1458	1448	1448
query40	195	98	99	98
query41	47	45	45	45
query42	114	105	102	102
query43	537	497	503	497
query44	1167	835	846	835
query45	185	171	169	169
query46	1164	710	730	710
query47	2005	1896	1944	1896
query48	426	356	355	355
query49	758	393	420	393
query50	854	430	425	425
query51	7363	7251	7179	7179
query52	97	89	92	89
query53	258	183	203	183
query54	579	464	473	464
query55	78	77	80	77
query56	277	261	248	248
query57	1289	1201	1225	1201
query58	228	217	217	217
query59	3257	3019	3106	3019
query60	292	280	268	268
query61	112	108	101	101
query62	771	688	668	668
query63	217	181	183	181
query64	1359	646	621	621
query65	3263	3191	3193	3191
query66	704	298	294	294
query67	15703	15450	15411	15411
query68	4147	586	579	579
query69	425	262	261	261
query70	1150	1061	1098	1061
query71	363	267	257	257
query72	6418	4167	4160	4160
query73	749	349	359	349
query74	10103	9048	9325	9048
query75	3310	2655	2672	2655
query76	2050	990	1092	990
query77	534	287	285	285
query78	10497	9691	9524	9524
query79	1808	604	603	603
query80	1430	454	467	454
query81	523	233	223	223
query82	1236	91	92	91
query83	285	154	148	148
query84	287	92	88	88
query85	1095	306	289	289
query86	373	303	308	303
query87	4453	4216	4227	4216
query88	3603	2403	2371	2371
query89	409	287	289	287
query90	2008	186	185	185
query91	143	106	110	106
query92	63	50	50	50
query93	2026	555	559	555
query94	776	293	290	290
query95	352	253	252	252
query96	617	286	278	278
query97	3302	3127	3130	3127
query98	210	210	200	200
query99	1589	1283	1286	1283
Total cold run time: 314281 ms
Total hot run time: 196463 ms

@doris-robot
Copy link

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

query1	0.03	0.03	0.03
query2	0.07	0.03	0.02
query3	0.23	0.06	0.06
query4	1.62	0.10	0.10
query5	0.52	0.51	0.53
query6	1.14	0.73	0.72
query7	0.03	0.02	0.02
query8	0.05	0.04	0.03
query9	0.56	0.49	0.47
query10	0.56	0.56	0.54
query11	0.14	0.10	0.10
query12	0.13	0.12	0.11
query13	0.60	0.60	0.60
query14	0.78	0.79	0.81
query15	0.84	0.84	0.82
query16	0.38	0.38	0.39
query17	1.10	1.06	1.07
query18	0.23	0.22	0.21
query19	1.88	1.84	1.82
query20	0.02	0.01	0.01
query21	15.39	0.61	0.60
query22	2.86	2.39	1.71
query23	16.85	1.04	0.74
query24	2.93	1.06	1.49
query25	0.33	0.15	0.10
query26	0.34	0.14	0.14
query27	0.04	0.04	0.04
query28	10.13	0.48	0.44
query29	12.56	3.20	3.23
query30	0.24	0.05	0.06
query31	2.85	0.39	0.41
query32	3.24	0.46	0.47
query33	2.98	3.06	3.04
query34	16.79	4.47	4.47
query35	4.53	4.51	4.54
query36	0.65	0.49	0.49
query37	0.08	0.06	0.06
query38	0.04	0.04	0.03
query39	0.03	0.03	0.02
query40	0.16	0.12	0.13
query41	0.07	0.03	0.02
query42	0.03	0.03	0.02
query43	0.03	0.02	0.02
Total cold run time: 104.06 s
Total hot run time: 30.13 s

@morrySnow morrySnow merged commit 7199808 into apache:branch-3.1 Jun 24, 2025
20 of 21 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.

6 participants