mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
MDEV-23915 ER_KILL_DENIED_ERROR not passed a thread id
The 10.5 test error main.grant_kill showed up a incorrect thread id on a big endian architecture. The cause of this is the sql_kill_user function assumed the error was ER_OUT_OF_RESOURCES, when the the actual error was ER_KILL_DENIED_ERROR. ER_KILL_DENIED_ERROR as an error message requires a thread id to be passed as unsigned long, however a user/host was passed. ER_OUT_OF_RESOURCES doesn't even take a user/host, despite the optimistic comment. We remove this being passed as an argument to the function so that when MDEV-21978 is implemented one less compiler format warning is generated (which would have caught this error sooner). Thanks Otto for reporting and Marko for analysis.
This commit is contained in:
@ -1,8 +1,12 @@
|
|||||||
connection node_2;
|
connection node_2;
|
||||||
SET GLOBAL wsrep_slave_threads=2;
|
SET GLOBAL wsrep_slave_threads=2;
|
||||||
|
KILL ID;
|
||||||
Got one of the listed errors
|
Got one of the listed errors
|
||||||
|
KILL QUERY ID;
|
||||||
Got one of the listed errors
|
Got one of the listed errors
|
||||||
|
KILL ID;
|
||||||
Got one of the listed errors
|
Got one of the listed errors
|
||||||
|
KILL QUERY ID;
|
||||||
Got one of the listed errors
|
Got one of the listed errors
|
||||||
SET GLOBAL wsrep_slave_threads=1;
|
SET GLOBAL wsrep_slave_threads=1;
|
||||||
connection node_1;
|
connection node_1;
|
||||||
|
@ -15,21 +15,23 @@ SET GLOBAL wsrep_slave_threads=2;
|
|||||||
|
|
||||||
--let $applier_thread = `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'wsrep applier idle' LIMIT 1`
|
--let $applier_thread = `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'wsrep applier idle' LIMIT 1`
|
||||||
|
|
||||||
--disable_query_log
|
--replace_result $applier_thread ID
|
||||||
--error ER_KILL_DENIED_ERROR,ER_KILL_DENIED_ERROR
|
--error ER_KILL_DENIED_ERROR,ER_KILL_DENIED_ERROR
|
||||||
--eval KILL $applier_thread
|
--eval KILL $applier_thread
|
||||||
|
|
||||||
|
--replace_result $applier_thread ID
|
||||||
--error ER_KILL_DENIED_ERROR,ER_KILL_DENIED_ERROR
|
--error ER_KILL_DENIED_ERROR,ER_KILL_DENIED_ERROR
|
||||||
--eval KILL QUERY $applier_thread
|
--eval KILL QUERY $applier_thread
|
||||||
|
|
||||||
--let $aborter_thread = `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'wsrep aborter idle' LIMIT 1`
|
--let $aborter_thread = `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'wsrep aborter idle' LIMIT 1`
|
||||||
|
|
||||||
|
--replace_result $aborter_thread ID
|
||||||
--error ER_KILL_DENIED_ERROR,ER_KILL_DENIED_ERROR
|
--error ER_KILL_DENIED_ERROR,ER_KILL_DENIED_ERROR
|
||||||
--eval KILL $aborter_thread
|
--eval KILL $aborter_thread
|
||||||
|
|
||||||
|
--replace_result $aborter_thread ID
|
||||||
--error ER_KILL_DENIED_ERROR,ER_KILL_DENIED_ERROR
|
--error ER_KILL_DENIED_ERROR,ER_KILL_DENIED_ERROR
|
||||||
--eval KILL QUERY $aborter_thread
|
--eval KILL QUERY $aborter_thread
|
||||||
--enable_query_log
|
|
||||||
|
|
||||||
SET GLOBAL wsrep_slave_threads=1;
|
SET GLOBAL wsrep_slave_threads=1;
|
||||||
|
|
||||||
|
@ -9117,15 +9117,17 @@ void sql_kill_user(THD *thd, LEX_USER *user, killed_state state)
|
|||||||
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL)
|
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL)
|
||||||
}
|
}
|
||||||
#endif /* WITH_WSREP */
|
#endif /* WITH_WSREP */
|
||||||
if (!(error= kill_threads_for_user(thd, user, state, &rows)))
|
switch (error= kill_threads_for_user(thd, user, state, &rows))
|
||||||
my_ok(thd, rows);
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
/*
|
case 0:
|
||||||
This is probably ER_OUT_OF_RESOURCES, but in the future we may
|
my_ok(thd, rows);
|
||||||
want to write the name of the user we tried to kill
|
break;
|
||||||
*/
|
case ER_KILL_DENIED_ERROR:
|
||||||
my_error(error, MYF(0), user->host.str, user->user.str);
|
my_error(error, MYF(0), (unsigned long) thd->thread_id);
|
||||||
|
break;
|
||||||
|
case ER_OUT_OF_RESOURCES:
|
||||||
|
default:
|
||||||
|
my_error(error, MYF(0));
|
||||||
}
|
}
|
||||||
#ifdef WITH_WSREP
|
#ifdef WITH_WSREP
|
||||||
return;
|
return;
|
||||||
|
Reference in New Issue
Block a user