diff --git a/mysql-test/r/kill.result b/mysql-test/r/kill.result index 6e108fda634..091fdfbcc3c 100644 --- a/mysql-test/r/kill.result +++ b/mysql-test/r/kill.result @@ -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; diff --git a/mysql-test/t/kill.test b/mysql-test/t/kill.test index 6e97f3bbc33..b762900f1ec 100644 --- a/mysql-test/t/kill.test +++ b/mysql-test/t/kill.test @@ -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; diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt index d79fbccf486..0f519fdd33b 100644 --- a/sql/share/errmsg-utf8.txt +++ b/sql/share/errmsg-utf8.txt @@ -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" diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index f1ae9287080..5e58ceb9621 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -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));