Skip to content

Commit

Permalink
MDEV-30558: ER_KILL_{,QUERY_}DENIED_ERROR - normalize id type
Browse files Browse the repository at this point in the history
The error string from ER_KILL_QUERY_DENIED_ERROR took a different
type to ER_KILL_DENIED_ERROR for the thread id. This shows
up in differences on 32 big endian arches like powerpc (Deb notation).

Normalize the passing of the THD->id to its real type of my_thread_id,
and cast to (long long) on output. As such normalize the
ER_KILL_QUERY_DENIED_ERROR to that convention too.

Note for upwards merge, convert the type to %lld on new translations
of ER_KILL_QUERY_DENIED_ERROR.
  • Loading branch information
grooverdan committed Feb 7, 2023
1 parent 40adf52 commit 762fe01
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions sql/share/errmsg-utf8.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8268,11 +8268,11 @@ ER_INVALID_DEFAULT_VALUE_FOR_FIELD 22007
eng "Incorrect default value '%-.128T' for column '%.192s'"
hindi "गलत डिफ़ॉल्ट मान '%-.128T' कॉलम '%.192s' के लिए"
ER_KILL_QUERY_DENIED_ERROR
chi "你不是查询%lu的所有者"
eng "You are not owner of query %lu"
ger "Sie sind nicht Eigentümer von Abfrage %lu"
hindi "आप क्वेरी %lu के OWNER नहीं हैं"
rus "Вы не являетесь владельцем запроса %lu"
chi "你不是查询%lld的所有者"
eng "You are not owner of query %lld"
ger "Sie sind nicht Eigentümer von Abfrage %lld"
hindi "आप क्वेरी %lld के OWNER नहीं हैं"
rus "Вы не являетесь владельцем запроса %lld"
ER_NO_EIS_FOR_FIELD
chi "没有收集无关的统计信息列'%s'"
eng "Engine-independent statistics are not collected for column '%s'"
Expand Down
12 changes: 6 additions & 6 deletions sql/sql_parse.cc
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ static bool wsrep_mysql_parse(THD *thd, char *rawbuf, uint length,
*/

static bool execute_sqlcom_select(THD *thd, TABLE_LIST *all_tables);
static void sql_kill(THD *thd, longlong id, killed_state state, killed_type type);
static void sql_kill(THD *thd, my_thread_id id, killed_state state, killed_type type);
static void sql_kill_user(THD *thd, LEX_USER *user, killed_state state);
static bool lock_tables_precheck(THD *thd, TABLE_LIST *tables);
static bool execute_show_status(THD *, TABLE_LIST *);
Expand Down Expand Up @@ -5616,7 +5616,7 @@ mysql_execute_command(THD *thd)
MYF(0));
goto error;
}
sql_kill(thd, it->val_int(), lex->kill_signal, lex->kill_type);
sql_kill(thd, (my_thread_id) it->val_int(), lex->kill_signal, lex->kill_type);
}
else
sql_kill_user(thd, get_current_user(thd, lex->users_list.head()),
Expand Down Expand Up @@ -9146,12 +9146,12 @@ THD *find_thread_by_id(longlong id, bool query_id)
*/

uint
kill_one_thread(THD *thd, longlong id, killed_state kill_signal, killed_type type)
kill_one_thread(THD *thd, my_thread_id id, killed_state kill_signal, killed_type type)
{
THD *tmp;
uint error= (type == KILL_TYPE_QUERY ? ER_NO_SUCH_QUERY : ER_NO_SUCH_THREAD);
DBUG_ENTER("kill_one_thread");
DBUG_PRINT("enter", ("id: %lld signal: %d", id, kill_signal));
DBUG_PRINT("enter", ("id: %lld signal: %d", (long long) id, kill_signal));
tmp= find_thread_by_id(id, type == KILL_TYPE_QUERY);
if (!tmp)
DBUG_RETURN(error);
Expand Down Expand Up @@ -9323,7 +9323,7 @@ static uint kill_threads_for_user(THD *thd, LEX_USER *user,
*/

static
void sql_kill(THD *thd, longlong id, killed_state state, killed_type type)
void sql_kill(THD *thd, my_thread_id id, killed_state state, killed_type type)
{
uint error;
#ifdef WITH_WSREP
Expand Down Expand Up @@ -9352,7 +9352,7 @@ void sql_kill(THD *thd, longlong id, killed_state state, killed_type type)
wsrep_error_label:
error= (type == KILL_TYPE_QUERY ? ER_KILL_QUERY_DENIED_ERROR :
ER_KILL_DENIED_ERROR);
my_error(error, MYF(0), id);
my_error(error, MYF(0), (long long) id);
#endif /* WITH_WSREP */
}

Expand Down

0 comments on commit 762fe01

Please sign in to comment.