diff options
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/multi_update.result | 27 | ||||
-rw-r--r-- | mysql-test/r/rpl000007.result | 20 | ||||
-rw-r--r-- | mysql-test/r/rpl_replicate_do.result | 28 | ||||
-rw-r--r-- | mysql-test/r/rpl_rotate_logs.result | 3 | ||||
-rw-r--r-- | mysql-test/t/multi_update.test | 28 | ||||
-rw-r--r-- | mysql-test/t/rpl000007-slave.opt | 1 | ||||
-rw-r--r-- | mysql-test/t/rpl000007.test | 24 | ||||
-rw-r--r-- | mysql-test/t/rpl_replicate_do-slave.opt | 1 | ||||
-rw-r--r-- | mysql-test/t/rpl_replicate_do.test | 30 | ||||
-rw-r--r-- | mysql-test/t/rpl_rotate_logs.test | 4 |
10 files changed, 116 insertions, 50 deletions
diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result index 9dff4fba825..ce3f7e90f6b 100644 --- a/mysql-test/r/multi_update.result +++ b/mysql-test/r/multi_update.result @@ -150,4 +150,29 @@ n n delete t1,t2 from t2 left outer join t1 using (n); select * from t2 left outer join t1 using (n); n n -drop table if exists t1,t2 ; +drop table t1,t2 ; +create table t1 (n int(10) not null primary key, d int(10)); +create table t2 (n int(10) not null primary key, d int(10)); +insert into t1 values(1,1); +insert into t2 values(1,10),(2,20); +LOCK TABLES t1 write, t2 read; +DELETE t1.*, t2.* FROM t1,t2 where t1.n=t2.n; +Table 't2' was locked with a READ lock and can't be updated +UPDATE t1,t2 SET t1.d=t2.d,t2.d=30 WHERE t1.n=t2.n; +Table 't2' was locked with a READ lock and can't be updated +UPDATE t1,t2 SET t1.d=t2.d WHERE t1.n=t2.n; +Table 't2' was locked with a READ lock and can't be updated +unlock tables; +LOCK TABLES t1 write, t2 write; +UPDATE t1,t2 SET t1.d=t2.d WHERE t1.n=t2.n; +select * from t1; +n d +1 10 +DELETE t1.*, t2.* FROM t1,t2 where t1.n=t2.n; +select * from t1; +n d +select * from t2; +n d +2 20 +unlock tables; +drop table t1,t2; diff --git a/mysql-test/r/rpl000007.result b/mysql-test/r/rpl000007.result deleted file mode 100644 index c2823bf1203..00000000000 --- a/mysql-test/r/rpl000007.result +++ /dev/null @@ -1,20 +0,0 @@ -slave stop; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -slave start; -drop table if exists foo; -create table foo (n int); -insert into foo values(4); -drop table if exists foo; -create table foo (s char(20)); -load data infile '../../std_data/words.dat' into table foo; -insert into foo values('five'); -drop table if exists bar; -create table bar (m int); -insert into bar values(15); -select foo.n,bar.m from foo,bar; -n m -4 15 -drop table if exists bar,foo; diff --git a/mysql-test/r/rpl_replicate_do.result b/mysql-test/r/rpl_replicate_do.result new file mode 100644 index 00000000000..372d8c07f64 --- /dev/null +++ b/mysql-test/r/rpl_replicate_do.result @@ -0,0 +1,28 @@ +slave stop; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +slave start; +drop table if exists t11; +drop table if exists t11; +create table t2 (n int); +insert into t2 values(4); +create table t2 (s char(20)); +load data infile '../../std_data/words.dat' into table t2; +insert into t2 values('five'); +create table t1 (m int); +insert into t1 values(15),(16),(17); +update t1 set m=20 where m=16; +delete from t1 where m=17; +create table t11 select * from t1; +select * from t1; +m +15 +20 +select * from t2; +n +4 +select * from t11; +Table 'test.t11' doesn't exist +drop table if exists t1,t2,t3,t11; diff --git a/mysql-test/r/rpl_rotate_logs.result b/mysql-test/r/rpl_rotate_logs.result index 63d5b0b63e1..741c53fe52b 100644 --- a/mysql-test/r/rpl_rotate_logs.result +++ b/mysql-test/r/rpl_rotate_logs.result @@ -1,3 +1,5 @@ +drop table if exists t1, t2, t3, t4; +drop table if exists t1, t2, t3, t4; slave start; Could not initialize master info structure, check permisions on master.info slave start; @@ -8,7 +10,6 @@ reset slave; change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root'; reset master; slave start; -drop table if exists t1, t2, t3, t4; create temporary table temp_table (a char(80) not null); insert into temp_table values ("testing temporary tables"); create table t1 (s text); diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test index 7d855dd54ea..b3a51ff65bc 100644 --- a/mysql-test/t/multi_update.test +++ b/mysql-test/t/multi_update.test @@ -147,4 +147,30 @@ insert into t2 values (1),(2),(4),(8),(16),(32); select * from t2 left outer join t1 using (n); delete t1,t2 from t2 left outer join t1 using (n); select * from t2 left outer join t1 using (n); -drop table if exists t1,t2 ; +drop table t1,t2 ; + +# +# Test with locking +# + +create table t1 (n int(10) not null primary key, d int(10)); +create table t2 (n int(10) not null primary key, d int(10)); +insert into t1 values(1,1); +insert into t2 values(1,10),(2,20); +LOCK TABLES t1 write, t2 read; +--error 1099 +DELETE t1.*, t2.* FROM t1,t2 where t1.n=t2.n; +--error 1099 +UPDATE t1,t2 SET t1.d=t2.d,t2.d=30 WHERE t1.n=t2.n; +# The following should be fixed to not give an error +--error 1099 +UPDATE t1,t2 SET t1.d=t2.d WHERE t1.n=t2.n; +unlock tables; +LOCK TABLES t1 write, t2 write; +UPDATE t1,t2 SET t1.d=t2.d WHERE t1.n=t2.n; +select * from t1; +DELETE t1.*, t2.* FROM t1,t2 where t1.n=t2.n; +select * from t1; +select * from t2; +unlock tables; +drop table t1,t2; diff --git a/mysql-test/t/rpl000007-slave.opt b/mysql-test/t/rpl000007-slave.opt deleted file mode 100644 index 9ff99337d1f..00000000000 --- a/mysql-test/t/rpl000007-slave.opt +++ /dev/null @@ -1 +0,0 @@ ---replicate-do-table=test.bar diff --git a/mysql-test/t/rpl000007.test b/mysql-test/t/rpl000007.test deleted file mode 100644 index 8ff1e1782cc..00000000000 --- a/mysql-test/t/rpl000007.test +++ /dev/null @@ -1,24 +0,0 @@ -#this one assumes we are ignoring updates on table foo, but doing -#the ones on bar -source include/master-slave.inc; -connection slave; -drop table if exists foo; -create table foo (n int); -insert into foo values(4); -connection master; -drop table if exists foo; -create table foo (s char(20)); -load data infile '../../std_data/words.dat' into table foo; -insert into foo values('five'); -drop table if exists bar; -create table bar (m int); -insert into bar values(15); -save_master_pos; -connection slave; -sync_with_master; -select foo.n,bar.m from foo,bar; -connection master; -drop table if exists bar,foo; -save_master_pos; -connection slave; -sync_with_master; diff --git a/mysql-test/t/rpl_replicate_do-slave.opt b/mysql-test/t/rpl_replicate_do-slave.opt new file mode 100644 index 00000000000..da345474216 --- /dev/null +++ b/mysql-test/t/rpl_replicate_do-slave.opt @@ -0,0 +1 @@ +--replicate-do-table=test.t1 diff --git a/mysql-test/t/rpl_replicate_do.test b/mysql-test/t/rpl_replicate_do.test new file mode 100644 index 00000000000..0800062dc05 --- /dev/null +++ b/mysql-test/t/rpl_replicate_do.test @@ -0,0 +1,30 @@ +# This test assumes we are ignoring updates on table t2, but doing +# updates on t1 + +source include/master-slave.inc; +drop table if exists t11; +connection slave; +drop table if exists t11; +create table t2 (n int); +insert into t2 values(4); +connection master; +create table t2 (s char(20)); +load data infile '../../std_data/words.dat' into table t2; +insert into t2 values('five'); +create table t1 (m int); +insert into t1 values(15),(16),(17); +update t1 set m=20 where m=16; +delete from t1 where m=17; +create table t11 select * from t1; +save_master_pos; +connection slave; +sync_with_master; +select * from t1; +select * from t2; +--error 1146 +select * from t11; +connection master; +drop table if exists t1,t2,t3,t11; +save_master_pos; +connection slave; +sync_with_master; diff --git a/mysql-test/t/rpl_rotate_logs.test b/mysql-test/t/rpl_rotate_logs.test index 5d8f150cdea..a9bb98932ed 100644 --- a/mysql-test/t/rpl_rotate_logs.test +++ b/mysql-test/t/rpl_rotate_logs.test @@ -10,10 +10,12 @@ # - Test creating a duplicate key error and recover from it # connect (master,localhost,root,,test,0,master.sock); +drop table if exists t1, t2, t3, t4; connect (slave,localhost,root,,test,0,slave.sock); system cat /dev/null > var/slave-data/master.info; system chmod 000 var/slave-data/master.info; connection slave; +drop table if exists t1, t2, t3, t4; --error 1201 slave start; system chmod 600 var/slave-data/master.info; @@ -31,8 +33,6 @@ connection slave; slave start; connection master; -drop table if exists t1, t2, t3, t4; - # # Test FLUSH LOGS # |