Commit c4776974 authored by Aleksey Midenkov's avatar Aleksey Midenkov

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).
parent d966e55c
......@@ -3463,6 +3463,11 @@ unlock tables;
drop table t1, t2;
set timestamp= default;
#
# MDEV-29872 MSAN/Valgrind uninitialised value errors in TABLE::vers_switch_partition
#
create table t (a int) with system versioning partition by system_time limit 100 partitions 3;
drop table t;
#
# End of 10.9 tests
#
set global innodb_stats_persistent= @save_persistent;
......@@ -2690,6 +2690,23 @@ unlock tables;
drop table t1, t2;
set timestamp= default;
--echo #
--echo # MDEV-29872 MSAN/Valgrind uninitialised value errors in TABLE::vers_switch_partition
--echo #
create table t (a int) with system versioning partition by system_time limit 100 partitions 3;
let $emb= `select if(version() like '%embedded%', 1, 0)`;
if (!$emb)
{
--disable_result_log
--disable_query_log
--error ER_DELAYED_NOT_SUPPORTED
insert delayed into t () values ();
--enable_query_log
--enable_result_log
}
# cleanup
drop table t;
--echo #
--echo # End of 10.9 tests
--echo #
......
......@@ -2401,7 +2401,7 @@ class Delayed_insert :public ilink {
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 @@ class Delayed_insert :public ilink {
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;
/*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment