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

tidb does not support session timeout #7047

Closed
aylen opened this issue Jul 13, 2018 · 5 comments
Closed

tidb does not support session timeout #7047

aylen opened this issue Jul 13, 2018 · 5 comments
Labels
type/question The issue belongs to a question.

Comments

@aylen
Copy link

aylen commented Jul 13, 2018

Use jdbc to connect to tidb. After executing the timeout, perform RPC on the mysql server through jdbc protocol, and call mysql “KILL QUERY” command to end the operation of the current connection.because tidb does not support this command,When migrating from mysql to tidb, you need to modify a lot of existing code, can support the official mysql protocol roll operation

@alivxxx
Copy link
Contributor

alivxxx commented Jul 13, 2018

PTAL @tiancaiamao

@tiancaiamao
Copy link
Contributor

See here https://github.com/pingcap/docs/blob/master/FAQ.md or (中文 here)

Can kill be executed in TiDB?
You can kill DML statements. First use show processlist to find the ID corresponding with the session, and then run kill tidb [session id].

Does TiDB support session timeout?
Currently, TiDB does not support session timeout in the database level. If you want to implement session timeout, use the session ID started by side records in the absence of LB (Load Balancing), and customize the session timeout on the application. After timeout, kill SQL using kill tidb [session id] on the node that starts the query. It is currently recommended to implement session timeout using applications. When the timeout time is reached, the application layer reports an exception and continues to execute subsequent program segments.

@aylen

@alivxxx alivxxx added the type/question The issue belongs to a question. label Jul 13, 2018
@aylen
Copy link
Author

aylen commented Jul 14, 2018

if database is mysql, jdbc cancall mysql “KILL QUERY” command to end the operation of the current connection.
if database is tidb ,it does not support kill query.

now migrating from mysql to tidb, you need to modify a lot of existing code, can support the official mysql protocol roll operation, so hope Official support

@morgo
Copy link
Contributor

morgo commented Feb 8, 2019

TiDB recently added support for wait_timeout, so connections will idle out and close. I've created an issue for the docs to update the FAQ: pingcap/docs#888

In regards to a MySQL compatible KILL, because TiDB connection IDs are local to a server, there is actually some risk that if deployed behind a load balancer (recommended) you could kill a connection of the same server ID on a different server! This is the rationale behind changing the syntax to KILL TIDB x. There is a server option called compatible-kill-query which you can enable if you are not using a load balancer / can guarantee you are routing to the correct server. I have an issue open in docs to update this too: pingcap/docs#831

@ghost
Copy link

ghost commented Jul 22, 2020

I am going to close this issue as stale. Please feel free to re-open if you have additional questions. Thanks!

@ghost ghost closed this as completed Jul 22, 2020
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/question The issue belongs to a question.
Projects
None yet
Development

No branches or pull requests

4 participants