summaryrefslogtreecommitdiff
path: root/mysql-test/t/synchronization.test
diff options
context:
space:
mode:
authorvva@eagle.mysql.r18.ru <>2004-04-01 23:13:25 +0500
committervva@eagle.mysql.r18.ru <>2004-04-01 23:13:25 +0500
commit15cd52c6cb1e69b118f03e8cca4a3b61f3125534 (patch)
tree495f068123bd4b3ce62777dce35158c7a713c334 /mysql-test/t/synchronization.test
parent3bfbe6e0dd88d190c0f97720f6ee3ad80d113410 (diff)
downloadmariadb-git-15cd52c6cb1e69b118f03e8cca4a3b61f3125534.tar.gz
added synchronization in mysql_create_like_table
( fixed BUG #2385 CREATE TABLE LIKE lacks locking on source and destination table and added tests for it )
Diffstat (limited to 'mysql-test/t/synchronization.test')
-rw-r--r--mysql-test/t/synchronization.test44
1 files changed, 44 insertions, 0 deletions
diff --git a/mysql-test/t/synchronization.test b/mysql-test/t/synchronization.test
new file mode 100644
index 00000000000..84478cf7445
--- /dev/null
+++ b/mysql-test/t/synchronization.test
@@ -0,0 +1,44 @@
+-- source include/have_crypt.inc
+
+#
+# Test for Bug #2385 CREATE TABLE LIKE lacks locking on source and destination table
+#
+
+connect (con_to_sleep,localhost,lock_controller,,);
+connect (con_to_harm_sleeper,localhost,root,,);
+
+# locking of source:
+connection con_to_sleep;
+CREATE TABLE t1 (a int);
+send CREATE TABLE t2 LIKE t1;
+
+connection con_to_harm_sleeper;
+ALTER TABLE t1 add key(a);
+
+connection con_to_sleep;
+sleep 4;
+SHOW CREATE TABLE t2;
+drop table t1, t2;
+
+# locking of destination:
+connection con_to_sleep;
+CREATE TABLE t1 (a int);
+send CREATE TABLE t2 LIKE t1;
+
+connection con_to_harm_sleeper;
+sleep 1;
+CREATE TABLE t2 (b int);
+disable_query_log;
+select "-----------" as "let's take a look at result of create .. like : ";
+enable_query_log;
+
+connection con_to_sleep;
+sleep 1;
+--error 1
+reap;
+disable_query_log;
+select "" as "-----------";
+enable_query_log;
+SHOW CREATE TABLE t2;
+
+drop table t1, t2; \ No newline at end of file