From 315f5d27c4579220ce56f56d29ff299ad715ec11 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 6 Apr 2004 19:17:13 +0500 Subject: fixed the tests mysql-test/t/synchronization.test for Bug #2385 CREATE TABLE LIKE lacks locking on source and destination table BitKeeper/deleted/.del-synchronization-master.opt~265be23ead00949: Delete: mysql-test/t/synchronization-master.opt BitKeeper/deleted/.del-have_debug.require~d981522532c711b2: Delete: mysql-test/r/have_debug.require BitKeeper/deleted/.del-have_debug.inc~f4dc5160b9912226: Delete: mysql-test/include/have_debug.inc mysql-test/r/synchronization.result: fixed the test for Bug #2385 CREATE TABLE LIKE lacks locking on source and destination table mysql-test/t/synchronization.test: fixed the test for Bug #2385 CREATE TABLE LIKE lacks locking on source and destination table sql/sql_table.cc: deleted test sleep from mysql_create_like_table --- mysql-test/include/have_debug.inc | 4 - mysql-test/r/have_debug.require | 2 - mysql-test/r/synchronization.result | 169 +++++++++++++++++++++++++++++--- mysql-test/t/synchronization-master.opt | 1 - mysql-test/t/synchronization.test | 64 +++++------- sql/sql_table.cc | 5 - 6 files changed, 180 insertions(+), 65 deletions(-) delete mode 100644 mysql-test/include/have_debug.inc delete mode 100644 mysql-test/r/have_debug.require delete mode 100644 mysql-test/t/synchronization-master.opt diff --git a/mysql-test/include/have_debug.inc b/mysql-test/include/have_debug.inc deleted file mode 100644 index 63c0c008b21..00000000000 --- a/mysql-test/include/have_debug.inc +++ /dev/null @@ -1,4 +0,0 @@ --- 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 deleted file mode 100644 index 13f85741049..00000000000 --- a/mysql-test/r/have_debug.require +++ /dev/null @@ -1,2 +0,0 @@ -instr(version(),convert('debug' using utf8))!=0 -1 diff --git a/mysql-test/r/synchronization.result b/mysql-test/r/synchronization.result index 87800939ed9..ad9443c86da 100644 --- a/mysql-test/r/synchronization.result +++ b/mysql-test/r/synchronization.result @@ -1,23 +1,162 @@ -CREATE TABLE t1 (a int); - CREATE TABLE t2 LIKE t1; -ALTER TABLE t1 add key(a); +CREATE TABLE t1 (x1 int); + ALTER TABLE t1 CHANGE x1 x2 int; +CREATE TABLE t2 LIKE t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` int(11) default NULL + `xx` int(11) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -drop table t1, t2; -CREATE TABLE t1 (a int); - CREATE TABLE t2 LIKE t1; -CREATE TABLE t2 (b int); -let's take a look at result of create .. like : ------------ -ERROR HY000: Can't create/write to file './test/t2.frm' (Errcode: 17) ------------ - +DROP TABLE t2; + ALTER TABLE t1 CHANGE x2 x1 int; +CREATE TABLE t2 LIKE t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `b` int(11) default NULL + `xx` int(11) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -drop table t1, t2; +DROP TABLE t2; + ALTER TABLE t1 CHANGE x1 x2 int; +CREATE TABLE t2 LIKE t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `xx` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; + ALTER TABLE t1 CHANGE x2 x1 int; +CREATE TABLE t2 LIKE t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `xx` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; + ALTER TABLE t1 CHANGE x1 x2 int; +CREATE TABLE t2 LIKE t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `xx` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; + ALTER TABLE t1 CHANGE x2 x1 int; +CREATE TABLE t2 LIKE t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `xx` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; + ALTER TABLE t1 CHANGE x1 x2 int; +CREATE TABLE t2 LIKE t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `xx` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; + ALTER TABLE t1 CHANGE x2 x1 int; +CREATE TABLE t2 LIKE t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `xx` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; + ALTER TABLE t1 CHANGE x1 x2 int; +CREATE TABLE t2 LIKE t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `xx` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; + ALTER TABLE t1 CHANGE x2 x1 int; +CREATE TABLE t2 LIKE t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `xx` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; + ALTER TABLE t1 CHANGE x1 x2 int; +CREATE TABLE t2 LIKE t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `xx` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; + ALTER TABLE t1 CHANGE x2 x1 int; +CREATE TABLE t2 LIKE t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `xx` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; + ALTER TABLE t1 CHANGE x1 x2 int; +CREATE TABLE t2 LIKE t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `xx` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; + ALTER TABLE t1 CHANGE x2 x1 int; +CREATE TABLE t2 LIKE t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `xx` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; + ALTER TABLE t1 CHANGE x1 x2 int; +CREATE TABLE t2 LIKE t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `xx` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; + ALTER TABLE t1 CHANGE x2 x1 int; +CREATE TABLE t2 LIKE t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `xx` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; + ALTER TABLE t1 CHANGE x1 x2 int; +CREATE TABLE t2 LIKE t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `xx` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; + ALTER TABLE t1 CHANGE x2 x1 int; +CREATE TABLE t2 LIKE t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `xx` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; + ALTER TABLE t1 CHANGE x1 x2 int; +CREATE TABLE t2 LIKE t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `xx` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; + ALTER TABLE t1 CHANGE x2 x1 int; +CREATE TABLE t2 LIKE t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `xx` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +DROP TABLE t1; diff --git a/mysql-test/t/synchronization-master.opt b/mysql-test/t/synchronization-master.opt deleted file mode 100644 index 710a0395d55..00000000000 --- a/mysql-test/t/synchronization-master.opt +++ /dev/null @@ -1 +0,0 @@ ---exit-info=2048 \ No newline at end of file diff --git a/mysql-test/t/synchronization.test b/mysql-test/t/synchronization.test index bbea4c44dad..7bdeaa8a740 100644 --- a/mysql-test/t/synchronization.test +++ b/mysql-test/t/synchronization.test @@ -1,45 +1,33 @@ --- source include/have_debug.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,,); +connect (con1,localhost,root,,); +connect (con2,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; -sleep 1; -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 +CREATE TABLE t1 (x1 int); +let $1= 10; +while ($1) +{ + connection con1; + send ALTER TABLE t1 CHANGE x1 x2 int; + connection con2; + CREATE TABLE t2 LIKE t1; + replace_result x1 xx x2 xx; + SHOW CREATE TABLE t2; + DROP TABLE t2; + connection con1; + reap; + send ALTER TABLE t1 CHANGE x2 x1 int; + connection con2; + CREATE TABLE t2 LIKE t1; + replace_result x1 xx x2 xx; + SHOW CREATE TABLE t2; + DROP TABLE t2; + connection con1; + reap; + dec $1; +} +DROP TABLE t1; diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 5e358f76d3f..343bcda9102 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -1963,11 +1963,6 @@ int mysql_create_like_table(THD* thd, TABLE_LIST* table, /* Create a new table by copying from source table */ -#ifndef DBUG_OFF - // The code stated below is for test synchronization.test Bug #2385 - if (test_flags & TEST_SYNCHRONIZATION) - sleep(3); -#endif if (my_copy(src_path, dst_path, MYF(MY_WME|MY_DONT_OVERWRITE_FILE))) goto err; -- cgit v1.2.1