summaryrefslogtreecommitdiff
path: root/sql/sql_class.cc
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2015-07-25 15:14:40 +0300
committerMonty <monty@mariadb.org>2015-07-25 15:15:52 +0300
commite40bc659335f7f8b69427ed2d215c34c045a5ed7 (patch)
tree30392d66cf4125fd987415c8fa141795eff2a08c /sql/sql_class.cc
parent7115341473947882994a5857db8113f7b08a516f (diff)
downloadmariadb-git-e40bc659335f7f8b69427ed2d215c34c045a5ed7.tar.gz
Fixed memory loss detected on P8. This can happen when we call after_flush but never call after_rollback() or after_commit().
The old code used pthread_setspecific() to store temporary data used by the thread. This is not safe when used with thread pool, as the thread may change for the transaction. The fix is to save the data in THD, which is guaranteed to be properly freed. I also fixed the code so that we don't do a malloc() for every transaction.
Diffstat (limited to 'sql/sql_class.cc')
-rw-r--r--sql/sql_class.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index a4a4b370658..7b97d5839fc 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -877,6 +877,7 @@ THD::THD()
file_id = 0;
query_id= 0;
query_name_consts= 0;
+ semisync_info= 0;
db_charset= global_system_variables.collation_database;
bzero(ha_data, sizeof(ha_data));
mysys_var=0;
@@ -1493,6 +1494,7 @@ THD::~THD()
mysql_audit_free_thd(this);
if (rli_slave)
rli_slave->cleanup_after_session();
+ my_free(semisync_info);
#endif
free_root(&main_mem_root, MYF(0));