diff options
author | davi@mysql.com/endora.local <> | 2007-11-28 10:18:01 -0200 |
---|---|---|
committer | davi@mysql.com/endora.local <> | 2007-11-28 10:18:01 -0200 |
commit | bd3f76d767e7dc78a73d68501271dcae9b0853aa (patch) | |
tree | 52f66ce381fbd991bde1883dbc2af7d811e16be4 /mysql-test/t/lock_multi.test | |
parent | 9817d93edb65758128262bbf96beaab13be29d39 (diff) | |
download | mariadb-git-bd3f76d767e7dc78a73d68501271dcae9b0853aa.tar.gz |
Bug#31479 Bad lock interaction if CREATE TABLE LIKE is killed
Kill of a CREATE TABLE source_table LIKE statement waiting for a
name-lock on the source table causes a bad lock interaction.
The mysql_create_like_table() has a bug that if the connection is
killed while waiting for the name-lock on the source table, it will
jump to the wrong error path and try to unlock the source table and
LOCK_open, but both weren't locked.
The solution is to simple return when the name lock request is killed,
it's safe to do so because no lock was acquired and no cleanup is needed.
Original bug report also contains description of other problems
related to this scenario but they either already fixed in 5.1 or
will be addressed separately (see bug report for details).
Diffstat (limited to 'mysql-test/t/lock_multi.test')
-rw-r--r-- | mysql-test/t/lock_multi.test | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/mysql-test/t/lock_multi.test b/mysql-test/t/lock_multi.test index d670bb55a18..649c1a4efbd 100644 --- a/mysql-test/t/lock_multi.test +++ b/mysql-test/t/lock_multi.test @@ -249,4 +249,36 @@ reap; connection locker; drop table t1; +# +# Bug#31479 Bad lock interaction if CREATE TABLE LIKE is killed +# + +--disable_warnings +drop table if exists t1; +--enable_warnings +create table t1 (a int); +--echo connection: locker +connection locker; +lock tables t1 read; +--echo connection: writer +connection writer; +let $ID= `select connection_id()`; +--send create table t2 like t1; +--echo connection: default +connection default; +let $show_type= open tables where in_use=2 and name_locked=1; +let $show_pattern= '%t1%2%1'; +--source include/wait_show_pattern.inc +--echo kill query +disable_query_log; +eval kill query $ID; +enable_query_log; +connection writer; +--error ER_QUERY_INTERRUPTED +--reap +connection locker; +unlock tables; +connection default; +drop table t1; + # End of 5.0 tests |