StarRocks / starrocks

StarRocks, a Linux Foundation project, is a next-generation sub-second MPP OLAP database for full analytics scenarios, including multi-dimensional analytics, real-time analytics, and ad-hoc queries.
https://starrocks.io
Apache License 2.0
8.26k stars 1.67k forks source link

[Feature] Support kill query by custom_query_id #47632

Open kaijianding opened 3 days ago

kaijianding commented 3 days ago

Why I'm doing:

User want to set a user generated query id and kill query by the user specified query id

What I'm doing:

Allow set custom query id in session and kill query by this id in all running fe(leader, follower, observer).

Usage:


set custom_query_id=xx;
select ...;

show proc '/current_queries';
kill running query 'xx';

this custom_query_id is temporary, it will be removed from session after select sql is done

Fixes #47699

What type of PR is this:

Does this PR entail a change in behavior?

Checklist:

Bugfix cherry-pick branch check:

github-actions[bot] commented 3 days ago

[FE Incremental Coverage Report]

:x: fail : 30 / 64 (46.88%)

file detail

path covered_line new_line coverage not_covered_line_detail
:large_blue_circle: com/starrocks/qe/LeaderOpExecutor.java 0 5 00.00% [92, 93, 94, 122, 123]
:large_blue_circle: com/starrocks/qe/ConnectScheduler.java 0 1 00.00% [182]
:large_blue_circle: com/starrocks/qe/QueryStatisticsItem.java 0 8 00.00% [43, 82, 106, 124, 125, 183, 184, 186]
:large_blue_circle: com/starrocks/qe/ConnectContext.java 2 5 40.00% [613, 614, 616]
:large_blue_circle: com/starrocks/qe/StmtExecutor.java 12 24 50.00% [1005, 1007, 1037, 1040, 1041, 1042, 1044, 1046, 1049, 1051, 1052, 1054]
:large_blue_circle: com/starrocks/common/proc/CurrentQueryStatisticsProcDir.java 1 2 50.00% [114]
:large_blue_circle: com/starrocks/qe/ConnectProcessor.java 5 9 55.56% [380, 381, 382, 384]
:large_blue_circle: com/starrocks/sql/parser/AstBuilder.java 6 6 100.00% []
:large_blue_circle: com/starrocks/qe/SessionVariable.java 2 2 100.00% []
:large_blue_circle: com/starrocks/qe/QeProcessorImpl.java 1 1 100.00% []
:large_blue_circle: com/starrocks/sql/ast/AstVisitor.java 1 1 100.00% []
imay commented 2 days ago

@kaijianding Do you think the name custom_query_id is more suitable? And I suggest you can split this PR into multi PRs. One is to add new query id. the other is to support kill by this new id.

kaijianding commented 1 hour ago

@kaijianding Do you think the name custom_query_id is more suitable? And I suggest you can split this PR into multi PRs. One is to add new query id. the other is to support kill by this new id.

Done renaming to custom_query_id.

Most codes are about killing query by custom_query_id, i think these code should stay in 1 pr.

sonarcloud[bot] commented 1 hour ago

Quality Gate Passed Quality Gate passed

Issues
11 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud

github-actions[bot] commented 54 minutes ago

[BE Incremental Coverage Report]

:white_check_mark: pass : 0 / 0 (0%)