diff options
author | Dmitry Lenev <dlenev@mysql.com> | 2010-02-15 14:23:36 +0300 |
---|---|---|
committer | Dmitry Lenev <dlenev@mysql.com> | 2010-02-15 14:23:36 +0300 |
commit | be3e256d25a853545c6ee04a8bf8e5b5907889c9 (patch) | |
tree | 39dde6eee8e819794694a0c0ad30156877e68e6a /mysql-test/r/flush.result | |
parent | eb0f09712e1b09955cc9e60d516ddf19336c9ffc (diff) | |
download | mariadb-git-be3e256d25a853545c6ee04a8bf8e5b5907889c9.tar.gz |
Fix for bug #51136 "Crash in pthread_rwlock_rdlock on
TEMPORARY + HANDLER + LOCK + SP".
Server crashed when one:
1) Opened HANDLER or acquired global read lock
2) Then locked one or several temporary tables with
LOCK TABLES statement (but no base tables).
3) Then issued any statement causing commit (explicit
or implicit).
4) Issued statement which should have closed HANDLER
or released global read lock.
The problem was that when entering LOCK TABLES mode in the
scenario described above we incorrectly set transactional
MDL sentinel to zero. As result during commit all metadata
locks were released (including lock for open HANDLER or
global metadata shared lock). Indeed, attempt to release
metadata lock for the second time which happened during
HANLDER CLOSE or during release of GLR caused crash.
This patch fixes problem by changing MDL_context's
set_trans_sentinel() method to set sentinel to correct
value (it should point to the most recent ticket).
mysql-test/include/handler.inc:
Added test for bug #51136 "Crash in pthread_rwlock_rdlock on
TEMPORARY + HANDLER + LOCK + SP".
mysql-test/r/flush.result:
Updated test results (see flush.test).
mysql-test/r/handler_innodb.result:
Updated test results (see include/handler.inc).
mysql-test/r/handler_myisam.result:
Updated test results (see include/handler.inc).
mysql-test/t/flush.test:
Added additional coverage for bug #51136 "Crash in
pthread_rwlock_rdlock on TEMPORARY + HANDLER + LOCK +
SP".
sql/mdl.h:
When setting new value of transactional sentinel use
pointer to the most recent ticket instead of value
returned by MDL_context::mdl_savepoint().
This allows to handle correctly situation when the new
value of sentinel should be the same as its current value
(MDL_context::mdl_savepoint() returns NULL in this case).
Diffstat (limited to 'mysql-test/r/flush.result')
-rw-r--r-- | mysql-test/r/flush.result | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/mysql-test/r/flush.result b/mysql-test/r/flush.result index 2be426d3a4a..2136bcd92f1 100644 --- a/mysql-test/r/flush.result +++ b/mysql-test/r/flush.result @@ -94,3 +94,20 @@ unlock tables; set global general_log= @old_general_log; set global read_only= @old_read_only; End of 5.1 tests +# +# Additional test for bug #51136 "Crash in pthread_rwlock_rdlock +# on TEMPORARY + HANDLER + LOCK + SP". +# Also see the main test for this bug in include/handler.inc. +# +drop tables if exists t1, t2; +create table t1 (i int); +create temporary table t2 (j int); +flush tables with read lock; +lock table t2 read; +# This commit should not release any MDL locks. +commit; +# The below statement crashed before the bug fix as it +# has attempted to release global shared metadata lock +# which was already released by commit. +unlock tables; +drop tables t1, t2; |