pingcap / tidb

TiDB is an open-source, cloud-native, distributed, MySQL-Compatible database for elastic scale and real-time analytics. Try AI-powered Chat2Query free at : https://www.pingcap.com/tidb-serverless/
https://pingcap.com
Apache License 2.0
36.53k stars 5.74k forks source link

Can't use pt-kill to kill TiDB connections #27932

Open time-and-fate opened 2 years ago

time-and-fate commented 2 years ago

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

time-and-fate commented 2 years ago

/type compatibility

znhh6018 commented 2 years ago

/assign

znhh6018 commented 2 years ago

I'm careless about this issue ,I may need some time to learn about parse rules ,so let me unassign first, I will finish it later if no one does during this time. /unassign

wangggong commented 2 years ago

/assign

znhh6018 commented 2 years ago

@wangggong ,hey bro.Are you still working on this issue.I've finished and I want to PR. If you are almost done ,I will choose another issue.

wangggong commented 2 years ago

If you have finished I just unassign it. Sorry for didn't finish it...

znhh6018 commented 2 years ago

Thanks 'old' brother !!!

znhh6018 commented 2 years ago

MVR)T_2DIMUF~`P $D` 0P @bb7133 Hi , bro . What does the red line text mean, replace 'For' with 'TestVisitFrameBound' ? and I haven't modify this part codes in my branch.