1
0
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:
Daniel Black
2022-02-23 10:10:01 +11:00
parent 03c3dc6365
commit 99837c61a6
3 changed files with 18 additions and 10 deletions

View File

@ -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)
}
#endif /* WITH_WSREP */
if (!(error= kill_threads_for_user(thd, user, state, &rows)))
my_ok(thd, rows);
else
switch (error= kill_threads_for_user(thd, user, state, &rows))
{
/*
This is probably ER_OUT_OF_RESOURCES, but in the future we may
want to write the name of the user we tried to kill
*/
my_error(error, MYF(0), user->host.str, user->user.str);
case 0:
my_ok(thd, rows);
break;
case ER_KILL_DENIED_ERROR:
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
return;