summaryrefslogtreecommitdiff
path: root/sql/sql_insert.cc
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2022-02-04 14:11:46 +0100
committerOleksandr Byelkin <sanja@mariadb.com>2022-02-04 14:11:46 +0100
commit9ed8deb656d9378fc9c1c7fb12c15674b6323ab0 (patch)
tree5bc8e7e4182b9e5da99d2a2ba40736f3ac450efe /sql/sql_insert.cc
parent3351dfaab0599268eaf25f9d6995ef128910a8b9 (diff)
parentd87979b48c614dbba4afd1b235307ee354c27719 (diff)
downloadmariadb-git-9ed8deb656d9378fc9c1c7fb12c15674b6323ab0.tar.gz
Merge branch '10.6' into 10.7
Diffstat (limited to 'sql/sql_insert.cc')
-rw-r--r--sql/sql_insert.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 707b8a0d3bf..aecd70f1810 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -2525,6 +2525,11 @@ bool delayed_get_table(THD *thd, MDL_request *grl_protection_request,
di->table_list.alias.length= di->table_list.table_name.length= di->thd.query_length();
di->table_list.db= di->thd.db;
/*
+ Nulify select_lex because, if the thread that spawned the current one
+ disconnects, the select_lex will point to freed memory.
+ */
+ di->table_list.select_lex= NULL;
+ /*
We need the tickets so that they can be cloned in
handle_delayed_insert
*/
@@ -3183,6 +3188,8 @@ pthread_handler_t handle_delayed_insert(void *arg)
di->handler_thread_initialized= TRUE;
di->table_list.mdl_request.ticket= NULL;
+ thd->set_query_id(next_query_id());
+
if (di->open_and_lock_table())
goto err;
@@ -3301,6 +3308,7 @@ pthread_handler_t handle_delayed_insert(void *arg)
if (di->tables_in_use && ! thd->lock &&
(!thd->killed || di->stacked_inserts))
{
+ thd->set_query_id(next_query_id());
/*
Request for new delayed insert.
Lock the table, but avoid to be blocked by a global read lock.