Commit 35a01983 authored by Sergey Vojtovich's avatar Sergey Vojtovich

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".
parent d5178864
......@@ -308,5 +308,17 @@ SLEEP(1000)
1
KILL 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';
DROP FUNCTION MY_KILL;
......@@ -647,5 +647,31 @@ reap;
--error ER_NO_SUCH_QUERY
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';
DROP FUNCTION MY_KILL;
......@@ -7129,3 +7129,7 @@ ER_CANNOT_CONVERT_CHARACTER
eng "Cannot convert '%s' character 0x%-.64s to '%s'"
ER_INVALID_DEFAULT_VALUE_FOR_FIELD 22007
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"
......@@ -8038,7 +8038,8 @@ kill_one_thread(THD *thd, longlong id, killed_state kill_signal, killed_type typ
error=0;
}
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);
}
DBUG_PRINT("exit", ("%d", error));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment