mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
Merge tag 'mariadb-10.0.23' into 10.0-galera
This commit is contained in:
@ -2006,7 +2006,7 @@ public:
|
||||
*/
|
||||
MDL_request grl_protection;
|
||||
|
||||
Delayed_insert()
|
||||
Delayed_insert(SELECT_LEX *current_select)
|
||||
:locks_in_memory(0), table(0),tables_in_use(0),stacked_inserts(0),
|
||||
status(0), handler_thread_initialized(FALSE), group_count(0)
|
||||
{
|
||||
@ -2016,7 +2016,7 @@ 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= 0; // for my_message_sql
|
||||
thd.lex->current_select= current_select;
|
||||
thd.lex->sql_command= SQLCOM_INSERT; // For innodb::store_lock()
|
||||
/*
|
||||
Prevent changes to global.lock_wait_timeout from affecting
|
||||
@ -2193,7 +2193,7 @@ bool delayed_get_table(THD *thd, MDL_request *grl_protection_request,
|
||||
*/
|
||||
if (! (di= find_handler(thd, table_list)))
|
||||
{
|
||||
if (!(di= new Delayed_insert()))
|
||||
if (!(di= new Delayed_insert(thd->lex->current_select)))
|
||||
goto end_create;
|
||||
|
||||
thread_safe_increment32(&thread_count, &thread_count_lock);
|
||||
@ -2836,6 +2836,16 @@ pthread_handler_t handle_delayed_insert(void *arg)
|
||||
if (di->open_and_lock_table())
|
||||
goto err;
|
||||
|
||||
/*
|
||||
INSERT DELAYED generally expects thd->lex->current_select to be NULL,
|
||||
since this is not an attribute of the current thread. This can lead to
|
||||
problems if the thread that spawned the current one disconnects.
|
||||
current_select will then point to freed memory. But current_select is
|
||||
required to resolve the partition function. So, after fulfilling that
|
||||
requirement, we set the current_select to 0.
|
||||
*/
|
||||
thd->lex->current_select= NULL;
|
||||
|
||||
/* Tell client that the thread is initialized */
|
||||
mysql_cond_signal(&di->cond_client);
|
||||
|
||||
|
Reference in New Issue
Block a user