pingcap/tidb

Can't use pt-kill to kill TiDB connections

Open

#27,932 opened on Sep 9, 2021

View on GitHub
 (8 comments) (0 reactions) (0 assignees)Go (40,090 stars) (6,186 forks)batch import
component/parsergood first issueseverity/moderatesig/sql-infratype/bugtype/compatibility

Description

Bug Report

Can't use pt-kill from percona-toolkit to kill TiDB connections.

Because it uses a kill '1' syntax, but tidb only supports kill 1.

1. Minimal reproduce step (Required)

Run a tidb locally, and run select sleep(50); in a connection. Then run pt-kill --kill --user=root --match-command=Query --host=127.0.0.1 --port=4000 -v.

2. What did you expect to see? (Required)

Successfully kill the sleep(50) connection.

3. What did you see instead (Required)

In pt-kill's output:

Error killing 3: DBD::mysql::st execute failed: You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use line 1 column 8 near "'3'"  [for Statement "KILL ?" with ParamValues: 0=3] at /usr/bin/vendor_perl/pt-kill line 7046.

In tidb's output:

[WARN] [session.go:1330] ["parse SQL failed"] [conn=7] [error="line 1 column 8 near \"'3'\" "] [SQL="KILL '3'"]
[INFO] [conn.go:997] ["command dispatched failed"] [conn=7] [connInfo="id:7, addr:127.0.0.1:44316 status:10, collation:latin1_swedish_ci, user:root"] [command=Query] [status="inTxn:0, autocommit:1"] [sql="KILL '3'"] [txn_mode=OPTIMISTIC] [err="[parser:1064]You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use line 1 column 8 near \"'3'\" "]

4. What is your TiDB version? (Required)

master

Contributor guide