diff --git a/mysql-test/suite/versioning/r/partition.result b/mysql-test/suite/versioning/r/partition.result index fb9244c223c..02cecea692e 100644 --- a/mysql-test/suite/versioning/r/partition.result +++ b/mysql-test/suite/versioning/r/partition.result @@ -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; diff --git a/mysql-test/suite/versioning/t/partition.test b/mysql-test/suite/versioning/t/partition.test index 280b45c5328..5707746f96c 100644 --- a/mysql-test/suite/versioning/t/partition.test +++ b/mysql-test/suite/versioning/t/partition.test @@ -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 # diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index c579ad17550..875a7964de4 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -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; /*