summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <vva@eagle.mysql.r18.ru>2004-04-01 23:13:25 +0500
committerunknown <vva@eagle.mysql.r18.ru>2004-04-01 23:13:25 +0500
commitf2116615bed09a5b2bb6f113ba3ea1beebcb5e54 (patch)
tree495f068123bd4b3ce62777dce35158c7a713c334 /mysql-test
parentb26165d3a2eeb748b9bd5573f9bac7b73d5f9a37 (diff)
downloadmariadb-git-f2116615bed09a5b2bb6f113ba3ea1beebcb5e54.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 ) sql/mysql_priv.h: added code TEST_SYNCHRONIZATION for --exit-info option sql/mysqld.cc: fixed -debug prefix sql/sql_table.cc: added synchronization in mysql_create_like_table (fixed BUG #2385 CREATE TABLE LIKE lacks locking on source and destination table)
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/include/have_debug.inc4
-rw-r--r--mysql-test/r/have_debug.require2
-rw-r--r--mysql-test/t/synchronization-master.opt1
-rw-r--r--mysql-test/t/synchronization.test44
4 files changed, 51 insertions, 0 deletions
diff --git a/mysql-test/include/have_debug.inc b/mysql-test/include/have_debug.inc
new file mode 100644
index 00000000000..63c0c008b21
--- /dev/null
+++ b/mysql-test/include/have_debug.inc
@@ -0,0 +1,4 @@
+-- require r/have_debug.require
+disable_query_log;
+select instr(version(),convert('debug' using utf8))!=0;
+enable_query_log;
diff --git a/mysql-test/r/have_debug.require b/mysql-test/r/have_debug.require
new file mode 100644
index 00000000000..3ef51a3a6db
--- /dev/null
+++ b/mysql-test/r/have_debug.require
@@ -0,0 +1,2 @@
+instr(version(),convert('debug' using utf8))!=0;
+1 \ No newline at end of file
diff --git a/mysql-test/t/synchronization-master.opt b/mysql-test/t/synchronization-master.opt
new file mode 100644
index 00000000000..710a0395d55
--- /dev/null
+++ b/mysql-test/t/synchronization-master.opt
@@ -0,0 +1 @@
+--exit-info=2048 \ No newline at end of file
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