From 762fe015c15cdf5e0bdc57ac1f9f6f71e7484560 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Sat, 4 Feb 2023 16:35:30 +1100 Subject: MDEV-30558: ER_KILL_{,QUERY_}DENIED_ERROR - normalize id type 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. --- sql/share/errmsg-utf8.txt | 10 +++++----- sql/sql_parse.cc | 12 ++++++------ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt index dde8337f01c..8bc2b784830 100644 --- a/sql/share/errmsg-utf8.txt +++ b/sql/share/errmsg-utf8.txt @@ -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'" diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 7840f581789..a00e5b82b12 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -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 *); @@ -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()), @@ -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); @@ -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 @@ -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 */ } -- cgit v1.2.1