[Commits] 74b4ead: MDEV-5096 - Wrong error message on attempt to kill somebody else's query ID

svoj at mariadb.org svoj at mariadb.org
Mon Feb 9 11:46:02 EET 2015


revision-id: 74b4ead8ef32eb2bb96b17dafac514ffba28963a
parent(s): f13939061d468a47985dee0268652a6fe2db7862
committer: Sergey Vojtovich
branch nick: 10.1
timestamp: 2015-02-09 13:41:24 +0400
message:

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".

---
 mysql-test/r/kill.result  | 12 ++++++++++++
 mysql-test/t/kill.test    | 26 ++++++++++++++++++++++++++
 sql/share/errmsg-utf8.txt |  4 ++++
 sql/sql_parse.cc          |  3 ++-
 4 files changed, 44 insertions(+), 1 deletion(-)

diff --git a/mysql-test/r/kill.result b/mysql-test/r/kill.result
index 6e108fd..091fdfb 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 at 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 at localhost;
 SET DEBUG_SYNC = 'RESET';
 DROP FUNCTION MY_KILL;
diff --git a/mysql-test/t/kill.test b/mysql-test/t/kill.test
index 6e97f3b..b762900 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 at 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 at localhost;
+
+
 SET DEBUG_SYNC = 'RESET';
 DROP FUNCTION MY_KILL;
diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt
index 381370e..36db74d 100644
--- a/sql/share/errmsg-utf8.txt
+++ b/sql/share/errmsg-utf8.txt
@@ -7125,3 +7125,7 @@ ER_ROLE_CREATE_EXISTS
         eng "Can't create role '%-.64s'; it already exists"
 ER_ROLE_DROP_EXISTS
         eng "Can't drop role '%-.64s'; it doesn't exist"
+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 64e016f..5efe61a 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -7966,7 +7966,8 @@ THD *find_thread_by_id(longlong id, bool query_id)
       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));


More information about the commits mailing list