mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
MDEV-7938 MariaDB Crashes Suddenly while writing binlogs
on disconnect THD must clean user_var_events array before dropping temporary tables. Otherwise when binlogging a DROP, it'll access user_var_events, but they were allocated in the already freed memroot.
This commit is contained in:
@@ -0,0 +1,8 @@
|
|||||||
|
create table t1 (i int);
|
||||||
|
create trigger tr after insert on t1 for each row set @b=@a;
|
||||||
|
create temporary table tmp like t1;
|
||||||
|
insert into t1 values (1);
|
||||||
|
select * from t1;
|
||||||
|
i
|
||||||
|
1
|
||||||
|
drop table t1;
|
@@ -0,0 +1,17 @@
|
|||||||
|
#
|
||||||
|
# MDEV-7938 MariaDB Crashes Suddenly while writing binlogs
|
||||||
|
#
|
||||||
|
--source include/have_log_bin.inc
|
||||||
|
--source include/have_binlog_format_mixed.inc
|
||||||
|
|
||||||
|
--connect(con1,localhost,root,,)
|
||||||
|
create table t1 (i int);
|
||||||
|
create trigger tr after insert on t1 for each row set @b=@a;
|
||||||
|
|
||||||
|
create temporary table tmp like t1;
|
||||||
|
insert into t1 values (1);
|
||||||
|
--disconnect con1
|
||||||
|
|
||||||
|
--connection default
|
||||||
|
select * from t1;
|
||||||
|
drop table t1;
|
@@ -1394,6 +1394,7 @@ void THD::cleanup(void)
|
|||||||
mysql_ha_cleanup(this);
|
mysql_ha_cleanup(this);
|
||||||
locked_tables_list.unlock_locked_tables(this);
|
locked_tables_list.unlock_locked_tables(this);
|
||||||
|
|
||||||
|
delete_dynamic(&user_var_events);
|
||||||
close_temporary_tables(this);
|
close_temporary_tables(this);
|
||||||
|
|
||||||
transaction.xid_state.xa_state= XA_NOTR;
|
transaction.xid_state.xa_state= XA_NOTR;
|
||||||
@@ -1427,7 +1428,6 @@ void THD::cleanup(void)
|
|||||||
debug_sync_end_thread(this);
|
debug_sync_end_thread(this);
|
||||||
#endif /* defined(ENABLED_DEBUG_SYNC) */
|
#endif /* defined(ENABLED_DEBUG_SYNC) */
|
||||||
|
|
||||||
delete_dynamic(&user_var_events);
|
|
||||||
my_hash_free(&user_vars);
|
my_hash_free(&user_vars);
|
||||||
sp_cache_clear(&sp_proc_cache);
|
sp_cache_clear(&sp_proc_cache);
|
||||||
sp_cache_clear(&sp_func_cache);
|
sp_cache_clear(&sp_func_cache);
|
||||||
|
Reference in New Issue
Block a user