-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[fix/feature](kill) fix kill operation and support kill by trace id #50791
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
Conversation
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
0c4ffa8 to
cb392aa
Compare
|
run buildall |
TPC-H: Total hot run time: 33848 ms |
TPC-DS: Total hot run time: 194326 ms |
ClickBench: Total hot run time: 29.34 s |
| } | ||
|
|
||
| @Override | ||
| public LogicalPlan visitKillQuery(KillQueryContext ctx) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
based on old planner, if specify QUERY KEYWORD, it always means to kill query, and the query id is whatever INTEGER_VALUE or STRING_LITERAL. Looks like the behavior is changed in this pr?
kill_stmt ::=
KW_KILL INTEGER_LITERAL:value
{:
RESULT = new KillStmt(true, value.intValue());
:}
| KW_KILL KW_CONNECTION INTEGER_LITERAL:value
{:
RESULT = new KillStmt(true, value.intValue());
:}
| KW_KILL KW_QUERY INTEGER_LITERAL:value
{:
RESULT = new KillStmt(false, value.intValue());
:}
| KW_KILL KW_QUERY STRING_LITERAL:value
{:
RESULT = new KillStmt(value);
:}
;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, there are 2 ways to kill query:
- Kill query by query id:
KILL QUERY "query_id"; - Kill query by connection id:
KILL QUERY connection_id, where connection_id is an integer, not a string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, there are 2 ways to kill query:
- Kill query by query id:
KILL QUERY "query_id";- Kill query by connection id:
KILL QUERY connection_id, where connection_id is an integer, not a string.
the grammer is very weird. KILL QUERY but need a params of connection_id. could lead to misunderstand for people not read doc very carefully.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, there are 2 ways to kill query:
- Kill query by query id:
KILL QUERY "query_id";- Kill query by connection id:
KILL QUERY connection_id, where connection_id is an integer, not a string.the grammer is very weird.
KILL QUERYbut need a params of connection_id. could lead to misunderstand for people not read doc very carefully.
This is compatible with MySQL Kill Statement
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, there are 2 ways to kill query:
- Kill query by query id:
KILL QUERY "query_id";- Kill query by connection id:
KILL QUERY connection_id, where connection_id is an integer, not a string.the grammer is very weird.
KILL QUERYbut need a params of connection_id. could lead to misunderstand for people not read doc very carefully.
like describe on #50916, mysql-client use 'kill query connection_id' to make ctrl+c work, so we need support it to make mysql-client work well
cb392aa to
586acad
Compare
|
run buildall |
TPC-H: Total hot run time: 34100 ms |
TPC-DS: Total hot run time: 193066 ms |
ClickBench: Total hot run time: 29.07 s |
586acad to
81bdbd1
Compare
|
run buildall |
TPC-H: Total hot run time: 33940 ms |
TPC-DS: Total hot run time: 193501 ms |
ClickBench: Total hot run time: 29.42 s |
|
PR approved by at least one committer and no changes requested. |
|
PR approved by anyone and no changes requested. |
dataroaring
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…pache#50791) ### What problem does this PR solve? 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
### What problem does this PR solve? Followup #50791 Add a new FE HTTP API: `/rest/v2/manager/query/statistics/trace_id`. This API will return the query runtime statistic corresponding to a given trace id. The query statistics includes info such as real-time scan rows/bytes. Internally, Doris will get query id by trace id from all Frontends, and then fetch query statistics from BE. Use pattern: 1. User set custom trace id by: `set session_context="trace_id:my_trace_id"` 2. User executes a query in same session 3. Start a http client to get query statistics in real-time during the query process.  Also fix a bug in `CoordinatorContext.java`, to get real host. introduced from #41730 This PR also change the column name of `information_schema.processlist` table, to be same as column name in `show processlist`.
…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
What problem does this PR solve?
Related PR: #50776, #46882
Problem Summary:
Fix bug that
KILL connection_idis not supported in NereidsThis PR [Enhancement] (nereids)implement kill connection and query command in nereids #46882 implements
KILLin Nereids, but it miss the grammarKILL connection_idand treat it asKILL query_id. This PR fix it.Unify the core code of
KILLoperation in both old and new plannerAll core logic about
killare moved toKillUtilsclass. So that both old and new planner and can have same logic.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
killcommand 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.Support Kill query by trace id from all FE
User can set a custom
trace idbyset 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: [fix](kill) opt kill query doc doris-website#2371
Release note
None
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)