mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Ensure that thd->user_var_events_alloc is always relevant
If binary logging is not enabled thd->user_var_events_alloc would never be initialized.
This commit is contained in:
@ -1135,6 +1135,7 @@ sp_head::execute(THD *thd, bool merge_da_on_success)
|
|||||||
uint old_server_status;
|
uint old_server_status;
|
||||||
const uint status_backup_mask= SERVER_STATUS_CURSOR_EXISTS |
|
const uint status_backup_mask= SERVER_STATUS_CURSOR_EXISTS |
|
||||||
SERVER_STATUS_LAST_ROW_SENT;
|
SERVER_STATUS_LAST_ROW_SENT;
|
||||||
|
MEM_ROOT *user_var_events_alloc_saved= 0;
|
||||||
Reprepare_observer *save_reprepare_observer= thd->m_reprepare_observer;
|
Reprepare_observer *save_reprepare_observer= thd->m_reprepare_observer;
|
||||||
Object_creation_ctx *UNINIT_VAR(saved_creation_ctx);
|
Object_creation_ctx *UNINIT_VAR(saved_creation_ctx);
|
||||||
Diagnostics_area *da= thd->get_stmt_da();
|
Diagnostics_area *da= thd->get_stmt_da();
|
||||||
@ -1326,9 +1327,11 @@ sp_head::execute(THD *thd, bool merge_da_on_success)
|
|||||||
Will write this SP statement into binlog separately.
|
Will write this SP statement into binlog separately.
|
||||||
TODO: consider changing the condition to "not inside event union".
|
TODO: consider changing the condition to "not inside event union".
|
||||||
*/
|
*/
|
||||||
MEM_ROOT *user_var_events_alloc_saved= thd->user_var_events_alloc;
|
|
||||||
if (thd->locked_tables_mode <= LTM_LOCK_TABLES)
|
if (thd->locked_tables_mode <= LTM_LOCK_TABLES)
|
||||||
|
{
|
||||||
|
user_var_events_alloc_saved= thd->user_var_events_alloc;
|
||||||
thd->user_var_events_alloc= thd->mem_root;
|
thd->user_var_events_alloc= thd->mem_root;
|
||||||
|
}
|
||||||
|
|
||||||
sql_digest_state *parent_digest= thd->m_digest;
|
sql_digest_state *parent_digest= thd->m_digest;
|
||||||
thd->m_digest= NULL;
|
thd->m_digest= NULL;
|
||||||
|
@ -772,6 +772,12 @@ THD::THD(my_thread_id id, bool is_wsrep_applier)
|
|||||||
init_sql_alloc(&main_mem_root, ALLOC_ROOT_MIN_BLOCK_SIZE, 0,
|
init_sql_alloc(&main_mem_root, ALLOC_ROOT_MIN_BLOCK_SIZE, 0,
|
||||||
MYF(MY_THREAD_SPECIFIC));
|
MYF(MY_THREAD_SPECIFIC));
|
||||||
|
|
||||||
|
/*
|
||||||
|
Allocation of user variables for binary logging is always done with main
|
||||||
|
mem root
|
||||||
|
*/
|
||||||
|
user_var_events_alloc= mem_root;
|
||||||
|
|
||||||
stmt_arena= this;
|
stmt_arena= this;
|
||||||
thread_stack= 0;
|
thread_stack= 0;
|
||||||
scheduler= thread_scheduler; // Will be fixed later
|
scheduler= thread_scheduler; // Will be fixed later
|
||||||
|
@ -7483,10 +7483,9 @@ void THD::reset_for_next_command(bool do_clear_error)
|
|||||||
thd->thread_specific_used= FALSE;
|
thd->thread_specific_used= FALSE;
|
||||||
|
|
||||||
if (opt_bin_log)
|
if (opt_bin_log)
|
||||||
{
|
|
||||||
reset_dynamic(&thd->user_var_events);
|
reset_dynamic(&thd->user_var_events);
|
||||||
thd->user_var_events_alloc= thd->mem_root;
|
DBUG_ASSERT(thd->user_var_events_alloc == &thd->main_mem_root);
|
||||||
}
|
|
||||||
thd->get_stmt_da()->reset_for_next_command();
|
thd->get_stmt_da()->reset_for_next_command();
|
||||||
thd->rand_used= 0;
|
thd->rand_used= 0;
|
||||||
thd->m_sent_row_count= thd->m_examined_row_count= 0;
|
thd->m_sent_row_count= thd->m_examined_row_count= 0;
|
||||||
|
Reference in New Issue
Block a user