Commit 62b9be65 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-4066 semisync_master + temporary tables causes memory leaks

close (and auto-drop) temporary tables before
rolling back the last transaction in the connection.
parent 7fb55ee8
include/master-slave.inc
[connection master]
INSTALL PLUGIN rpl_semi_sync_master SONAME 'semisync_master.so';
CREATE TEMPORARY TABLE tmp (i INT);
include/rpl_end.inc
uninstall plugin rpl_semi_sync_master;
#
# MDEV-4066 semisync_master + temporary tables causes memory leaks
#
source include/have_semisync_plugin.inc;
source include/have_binlog_format_row.inc;
source include/master-slave.inc;
connection master;
--replace_result .dll .so
eval INSTALL PLUGIN rpl_semi_sync_master SONAME '$SEMISYNC_MASTER_SO';
--connect (con1,localhost,root,,)
CREATE TEMPORARY TABLE tmp (i INT);
--disconnect con1
source include/rpl_end.inc;
uninstall plugin rpl_semi_sync_master;
...@@ -1383,11 +1383,12 @@ void THD::cleanup(void) ...@@ -1383,11 +1383,12 @@ void THD::cleanup(void)
#error xid_state in the cache should be replaced by the allocated value #error xid_state in the cache should be replaced by the allocated value
} }
#endif #endif
{
close_temporary_tables(this);
transaction.xid_state.xa_state= XA_NOTR; transaction.xid_state.xa_state= XA_NOTR;
trans_rollback(this); trans_rollback(this);
xid_cache_delete(&transaction.xid_state); xid_cache_delete(&transaction.xid_state);
}
locked_tables_list.unlock_locked_tables(this); locked_tables_list.unlock_locked_tables(this);
mysql_ha_cleanup(this); mysql_ha_cleanup(this);
...@@ -1421,7 +1422,6 @@ void THD::cleanup(void) ...@@ -1421,7 +1422,6 @@ void THD::cleanup(void)
delete_dynamic(&user_var_events); delete_dynamic(&user_var_events);
my_hash_free(&user_vars); my_hash_free(&user_vars);
close_temporary_tables(this);
sp_cache_clear(&sp_proc_cache); sp_cache_clear(&sp_proc_cache);
sp_cache_clear(&sp_func_cache); sp_cache_clear(&sp_func_cache);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment