1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-09 22:24:09 +03:00

MDEV-5096 - Wrong error message on attempt to kill somebody else's query ID

Attempting to kill query owned by different user now returns better error:
"You are not owner of query N" instead of "You are not owner of thread N".
This commit is contained in:
Sergey Vojtovich
2015-02-09 13:41:24 +04:00
parent d517886482
commit 35a019837e
4 changed files with 44 additions and 1 deletions

View File

@@ -308,5 +308,17 @@ SLEEP(1000)
1 1
KILL QUERY ID 0; KILL QUERY ID 0;
ERROR HY000: Unknown query id: 0 ERROR HY000: Unknown query id: 0
#
# MDEV-5096 - Wrong error message on attempt to kill somebody else's
# query ID
#
CREATE USER u1@localhost;
SELECT SLEEP(1000);
KILL QUERY ID ID;
ERROR HY000: You are not owner of query ID
KILL QUERY ID @id;
SLEEP(1000)
1
DROP USER u1@localhost;
SET DEBUG_SYNC = 'RESET'; SET DEBUG_SYNC = 'RESET';
DROP FUNCTION MY_KILL; DROP FUNCTION MY_KILL;

View File

@@ -647,5 +647,31 @@ reap;
--error ER_NO_SUCH_QUERY --error ER_NO_SUCH_QUERY
KILL QUERY ID 0; KILL QUERY ID 0;
--echo #
--echo # MDEV-5096 - Wrong error message on attempt to kill somebody else's
--echo # query ID
--echo #
CREATE USER u1@localhost;
send SELECT SLEEP(1000);
connection con1;
let $wait_condition= SELECT @id:=QUERY_ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO='SELECT SLEEP(1000)';
source include/wait_condition.inc;
let $id= `SELECT @id`;
connect(con5, localhost, u1,,);
--replace_result $id ID
--error ER_KILL_QUERY_DENIED_ERROR
eval KILL QUERY ID $id;
connection con1;
KILL QUERY ID @id;
connection default;
reap;
disconnect con5;
DROP USER u1@localhost;
SET DEBUG_SYNC = 'RESET'; SET DEBUG_SYNC = 'RESET';
DROP FUNCTION MY_KILL; DROP FUNCTION MY_KILL;

View File

@@ -7129,3 +7129,7 @@ ER_CANNOT_CONVERT_CHARACTER
eng "Cannot convert '%s' character 0x%-.64s to '%s'" eng "Cannot convert '%s' character 0x%-.64s to '%s'"
ER_INVALID_DEFAULT_VALUE_FOR_FIELD 22007 ER_INVALID_DEFAULT_VALUE_FOR_FIELD 22007
eng "Incorrect default value '%-.128s' for column '%.192s'" eng "Incorrect default value '%-.128s' for column '%.192s'"
ER_KILL_QUERY_DENIED_ERROR
eng "You are not owner of query %lu"
ger "Sie sind nicht Eigentümer von Abfrage %lu"
rus "Вы не являетесь владельцем запроса %lu"

View File

@@ -8038,7 +8038,8 @@ kill_one_thread(THD *thd, longlong id, killed_state kill_signal, killed_type typ
error=0; error=0;
} }
else else
error=ER_KILL_DENIED_ERROR; error= (type == KILL_TYPE_QUERY ? ER_KILL_QUERY_DENIED_ERROR :
ER_KILL_DENIED_ERROR);
mysql_mutex_unlock(&tmp->LOCK_thd_data); mysql_mutex_unlock(&tmp->LOCK_thd_data);
} }
DBUG_PRINT("exit", ("%d", error)); DBUG_PRINT("exit", ("%d", error));