summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <ingo@mysql.com>2006-07-04 10:02:11 +0200
committerunknown <ingo@mysql.com>2006-07-04 10:02:11 +0200
commit597ee0392c6457f22ac450609557cd117fe1f235 (patch)
tree0d83d5fae0e2ee575858f6cd66a909db278d2c56 /mysql-test
parent2ef57b836248f945657c7bd0fe02fa7fe3660b54 (diff)
parent0f93a64effb53f2902698a9d6f020f89d0edd26a (diff)
downloadmariadb-git-597ee0392c6457f22ac450609557cd117fe1f235.tar.gz
Merge mysql.com:/home/mydev/mysql-5.0-tmp_merge
into mysql.com:/home/mydev/mysql-5.1-amerge mysys/thr_lock.c: Auto merged sql/mysql_priv.h: Auto merged sql/sql_handler.cc: Auto merged sql/sql_insert.cc: Auto merged mysql-test/r/lock_multi.result: Manual merge mysql-test/t/lock_multi.test: Manual merge sql/lock.cc: Manual merge sql/sql_base.cc: Manual merge sql/sql_parse.cc: Manual merge sql/sql_table.cc: Manual merge
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/lock_multi.result15
-rw-r--r--mysql-test/t/lock_multi.test103
2 files changed, 92 insertions, 26 deletions
diff --git a/mysql-test/r/lock_multi.result b/mysql-test/r/lock_multi.result
index f8cf539bd02..d7ba9174408 100644
--- a/mysql-test/r/lock_multi.result
+++ b/mysql-test/r/lock_multi.result
@@ -66,6 +66,21 @@ Select_priv
N
use test;
use test;
+CREATE TABLE t1 (c1 int);
+LOCK TABLE t1 WRITE;
+ FLUSH TABLES WITH READ LOCK;
+CREATE TABLE t2 (c1 int);
+UNLOCK TABLES;
+UNLOCK TABLES;
+DROP TABLE t1, t2;
+CREATE TABLE t1 (c1 int);
+LOCK TABLE t1 WRITE;
+ FLUSH TABLES WITH READ LOCK;
+CREATE TABLE t2 AS SELECT * FROM t1;
+ERROR HY000: Table 't2' was not locked with LOCK TABLES
+UNLOCK TABLES;
+UNLOCK TABLES;
+DROP TABLE t1;
CREATE DATABASE mysqltest_1;
FLUSH TABLES WITH READ LOCK;
DROP DATABASE mysqltest_1;
diff --git a/mysql-test/t/lock_multi.test b/mysql-test/t/lock_multi.test
index 5bebec49b88..37b8fbda376 100644
--- a/mysql-test/t/lock_multi.test
+++ b/mysql-test/t/lock_multi.test
@@ -192,32 +192,6 @@ disconnect con2;
DROP DATABASE mysqltest_1;
#
-# Bug #17264: MySQL Server freeze
-#
-connection locker;
-create table t1 (f1 int(12) unsigned not null auto_increment, primary key(f1)) engine=innodb;
-lock tables t1 write;
-connection writer;
---sleep 2
-delimiter //;
-send alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; //
-delimiter ;//
-connection reader;
---sleep 2
-delimiter //;
-send alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; //
-delimiter ;//
-connection locker;
---sleep 2
-unlock tables;
-connection writer;
-reap;
-connection reader;
-reap;
-connection locker;
-drop table t1;
-
-# End of 5.0 tests
# Bug#16986 - Deadlock condition with MyISAM tables
#
connection locker;
@@ -246,4 +220,81 @@ connection locker;
use test;
#
connection default;
+#
+# Test if CREATE TABLE with LOCK TABLE deadlocks.
+#
+connection writer;
+CREATE TABLE t1 (c1 int);
+LOCK TABLE t1 WRITE;
+#
+# This waits until t1 is unlocked.
+connection locker;
+send FLUSH TABLES WITH READ LOCK;
+--sleep 1
+#
+# This must not block.
+connection writer;
+CREATE TABLE t2 (c1 int);
+UNLOCK TABLES;
+#
+# This awakes now.
+connection locker;
+reap;
+UNLOCK TABLES;
+#
+connection default;
+DROP TABLE t1, t2;
+#
+# Test if CREATE TABLE SELECT with LOCK TABLE deadlocks.
+#
+connection writer;
+CREATE TABLE t1 (c1 int);
+LOCK TABLE t1 WRITE;
+#
+# This waits until t1 is unlocked.
+connection locker;
+send FLUSH TABLES WITH READ LOCK;
+--sleep 1
+#
+# This must not block.
+connection writer;
+--error 1100
+CREATE TABLE t2 AS SELECT * FROM t1;
+UNLOCK TABLES;
+#
+# This awakes now.
+connection locker;
+reap;
+UNLOCK TABLES;
+#
+connection default;
+DROP TABLE t1;
+
+#
+# Bug #17264: MySQL Server freeze
+#
+connection locker;
+create table t1 (f1 int(12) unsigned not null auto_increment, primary key(f1)) engine=innodb;
+lock tables t1 write;
+connection writer;
+--sleep 2
+delimiter //;
+send alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; //
+delimiter ;//
+connection reader;
+--sleep 2
+delimiter //;
+send alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; //
+delimiter ;//
+connection locker;
+--sleep 2
+unlock tables;
+connection writer;
+reap;
+connection reader;
+reap;
+connection locker;
+drop table t1;
+
+# End of 5.0 tests