[MDEV-10474] Impossible to use KILL command for CREATE TABLE query (CONNECT table) Created: 2016-08-01 Updated: 2017-10-17 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - Connect |
| Affects Version/s: | 10.1.12 |
| Fix Version/s: | 10.1 |
| Type: | Bug | Priority: | Major |
| Reporter: | Sergey Antonyuk | Assignee: | Olivier Bertrand |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | None | ||
| Environment: |
3.2.0-4-amd64 #1 SMP Debian 3.2.35-2 x86_64 GNU/Linux |
||
| Description |
|
1) Create remote connection to DB: CREATE TABLE ... ENGINE=CONNECT TABLE_TYPE=MYSQL SRCDEF='slow query' 2) SHOW PROCESSLIST command shows the state of the query "creating table", command = "Query". 3) Try to kill the query by KILL ID command. SHOW PROCESSLIST command shows "Killed" but the query freezes untill it will finish on the remote server (it can take a very long time). 4) The desired behaviour is to kill the query remotely or/and speed up the local KILL command. |
| Comments |
| Comment by Sergey Antonyuk [ 2016-08-02 ] |
|
The query is also stay freezed in the DB (show process list shows creating table state) if I kill console mysql client. |
| Comment by Elena Stepanova [ 2016-08-30 ] |
|
I don't know if it's even possible to propagate kill onto the remote server, I'll leave it to Olivier to decide. |
| Comment by Olivier Bertrand [ 2016-08-30 ] |
|
Hmmm... in fact I have no idea on how to do it. |
| Comment by Egor Karavaev (Inactive) [ 2016-08-31 ] |
|
I was able to so solve the part about killing the local query by using async versions of the mysql_real_connect/mysql_real_query functions (https://mariadb.com/kb/en/mariadb/using-the-non-blocking-library/) in myconn.cpp and by checking if the current mysql thread is killed via thd_killed in the wait loop. I used 1s as a timeout for poll and haven't noticed any performance downgrades, as a result I was able to kill long lasting local queries instantly and force the caller to reestablish connection by returning a error, which is good enough solution in case of network and related problems. |