diff options
author | Praveenkumar.Hulakund <praveenkumar.hulakund@oracle.com> | 2015-01-14 13:15:20 +0530 |
---|---|---|
committer | Praveenkumar.Hulakund <praveenkumar.hulakund@oracle.com> | 2015-01-14 13:15:20 +0530 |
commit | 23321f629b465f17fd0d91d442aa736183b355b2 (patch) | |
tree | 61cd86dbc9084faa7c8defed6c14c4908e78f192 /sql/slave.cc | |
parent | d009d48d8cae272d1675b88a8eebae4b6090e454 (diff) | |
download | mariadb-git-23321f629b465f17fd0d91d442aa736183b355b2.tar.gz |
Bug#19786309 - CRASH IN UNLOCK TABLES AFTER LOCKING AND TRUNCATING TEMPORARY TABLE.
Attempt to truncate temporary table using Blackhole storage and
locked by LOCK TABLES caused assertion failure and crashes.
Blackhole is a transaction-aware engine. While creating the temporary
table in transaction-aware engine, temporary table of type
"TRANSACTIONAL_TMP_TABLE" is created. For such temporary tables
a THR_LOCK lock is acquired by the LOCK TABLE operation. References
to them are also added into MYSQL_LOCK::table[] array. Also for
Blackhole engine, flag HTON_CAN_RECREATE is set.
While truncating temporary tables, no locks are taken and
recreate_temporary_table() is called for engines having
"HTON_CAN_RECREATE" in flag.
Function closefrm() is called from the recreate_temporary_table(),
to close the current temporary table. In closefrm(), the lock on
table expected is "F_UNLCK". In debug builds, assert condition on
this fails when lock of type "F_WRLCK" is acquired by LOCK TABLE
operation on temporary tables using Blackhole engine.
In non-debug builds closefrm() simply freed TABLE object leaving
dangling pointer to this object in MYSQL_LOCK::table[] array which
might lead to crashes later.
Fix:
---------
To fix this issue, we now unlock and remove table from MYSQL_LOCK::table[]
array before calling close_temporary_table() in recreate_temporary_table().
This is achieved by calling mysql_lock_remove() function for this table.
Diffstat (limited to 'sql/slave.cc')
0 files changed, 0 insertions, 0 deletions