1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-29872 MSAN/Valgrind uninitialised value errors in TABLE::vers_switch_partition

Delayed_insert has its own THD (initialized at mysql_insert()) and
hence its own LEX. Delayed_insert initalizes a very few parameters for
LEX and 'duplicates' is not in this list. Now we copy this missing
parameter from parser LEX (as well as sql_command).
This commit is contained in:
Aleksey Midenkov
2024-04-02 00:11:35 +03:00
parent d966e55c0a
commit c477697422
3 changed files with 27 additions and 4 deletions

View File

@ -2401,7 +2401,7 @@ public:
passed from connection thread to the handler thread.
*/
MDL_request grl_protection;
Delayed_insert(SELECT_LEX *current_select)
Delayed_insert(LEX *lex)
:locks_in_memory(0), thd(next_thread_id()),
table(0),tables_in_use(0), stacked_inserts(0),
status(0), retry(0), handler_thread_initialized(FALSE), group_count(0)
@ -2414,8 +2414,9 @@ public:
strmake_buf(thd.security_ctx->priv_user, thd.security_ctx->user);
thd.current_tablenr=0;
thd.set_command(COM_DELAYED_INSERT);
thd.lex->current_select= current_select;
thd.lex->sql_command= SQLCOM_INSERT; // For innodb::store_lock()
thd.lex->current_select= lex->current_select;
thd.lex->sql_command= lex->sql_command; // For innodb::store_lock()
thd.lex->duplicates= lex->duplicates;
/*
Prevent changes to global.lock_wait_timeout from affecting
delayed insert threads as any timeouts in delayed inserts
@ -2591,7 +2592,7 @@ bool delayed_get_table(THD *thd, MDL_request *grl_protection_request,
*/
if (! (di= find_handler(thd, table_list)))
{
if (!(di= new Delayed_insert(thd->lex->current_select)))
if (!(di= new Delayed_insert(thd->lex)))
goto end_create;
/*