From e089fcce4c67a715f3f2f5eec6a6d1b248a41106 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 23 Aug 2002 21:41:27 +0300 Subject: Added testing of temporary tables with replication mysql-test/t/rpl_rotate_logs-master.opt: Rename: mysql-test/t/rpl000016-master.opt -> mysql-test/t/rpl_rotate_logs-master.opt mysql-test/t/rpl_rotate_logs-slave.sh: Rename: mysql-test/t/rpl000016-slave.sh -> mysql-test/t/rpl_rotate_logs-slave.sh mysql-test/t/rpl_rotate_logs-slave-master-info.opt: Rename: mysql-test/t/rpl000016-slave-master-info.opt -> mysql-test/t/rpl_rotate_logs-slave-master-info.opt BitKeeper/etc/ignore: Added mit-pthreads/include/bits mit-pthreads/include/pthread/machdep.h mit-pthreads/include/pthread/posix.h mit-pthreads/include/sys mit-pthreads/machdep.c mit-pthreads/pg++ mit-pthreads/pgcc sql-bench/innotest1 sql-bench/innotest1a sql-bench/innotest1b sql-bench/innotest2 sql-bench/innotest2a sql-bench/innotest2b to the ignore list mysql-test/r/rpl_rotate_logs.result: Added testing of temporary tables mysql-test/t/rpl000018.test: Commented test mysql-test/t/rpl_rotate_logs.test: Added testing of temporary tables --- mysql-test/t/rpl000016-master.opt | 1 - mysql-test/t/rpl000016-slave-master-info.opt | 1 - mysql-test/t/rpl000016-slave.sh | 1 - mysql-test/t/rpl000016.test | 104 --------------- mysql-test/t/rpl000018.test | 5 + mysql-test/t/rpl_rotate_logs-master.opt | 1 + mysql-test/t/rpl_rotate_logs-slave-master-info.opt | 1 + mysql-test/t/rpl_rotate_logs-slave.sh | 1 + mysql-test/t/rpl_rotate_logs.test | 141 +++++++++++++++++++++ 9 files changed, 149 insertions(+), 107 deletions(-) delete mode 100644 mysql-test/t/rpl000016-master.opt delete mode 100644 mysql-test/t/rpl000016-slave-master-info.opt delete mode 100755 mysql-test/t/rpl000016-slave.sh delete mode 100644 mysql-test/t/rpl000016.test create mode 100644 mysql-test/t/rpl_rotate_logs-master.opt create mode 100644 mysql-test/t/rpl_rotate_logs-slave-master-info.opt create mode 100755 mysql-test/t/rpl_rotate_logs-slave.sh create mode 100644 mysql-test/t/rpl_rotate_logs.test (limited to 'mysql-test/t') diff --git a/mysql-test/t/rpl000016-master.opt b/mysql-test/t/rpl000016-master.opt deleted file mode 100644 index f27601e0d7d..00000000000 --- a/mysql-test/t/rpl000016-master.opt +++ /dev/null @@ -1 +0,0 @@ --O max_binlog_size=2048 diff --git a/mysql-test/t/rpl000016-slave-master-info.opt b/mysql-test/t/rpl000016-slave-master-info.opt deleted file mode 100644 index 80190bf6d29..00000000000 --- a/mysql-test/t/rpl000016-slave-master-info.opt +++ /dev/null @@ -1 +0,0 @@ ---server-id=2 diff --git a/mysql-test/t/rpl000016-slave.sh b/mysql-test/t/rpl000016-slave.sh deleted file mode 100755 index 62748605af1..00000000000 --- a/mysql-test/t/rpl000016-slave.sh +++ /dev/null @@ -1 +0,0 @@ -rm -f $MYSQL_TEST_DIR/var/slave-data/master.info diff --git a/mysql-test/t/rpl000016.test b/mysql-test/t/rpl000016.test deleted file mode 100644 index c9b6ccabcd2..00000000000 --- a/mysql-test/t/rpl000016.test +++ /dev/null @@ -1,104 +0,0 @@ -connect (master,localhost,root,,test,0,mysql-master.sock); -connect (slave,localhost,root,,test,0,mysql-slave.sock); -system cat /dev/null > var/slave-data/master.info; -system chmod 000 var/slave-data/master.info; -connection slave; -!slave start; -system chmod 600 var/slave-data/master.info; -!slave start; -!eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT, - master_user='root'; -reset slave; -eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT, - master_user='root'; -connection master; -reset master; -connection slave; -slave start; -connection master; -drop table if exists t1; -create table t1 (s text); -insert into t1 values('Could not break slave'),('Tried hard'); -save_master_pos; -connection slave; -sync_with_master; ---replace_result 9306 9999 3334 9999 3335 9999 -show slave status; -select * from t1; -connection master; -flush logs; -drop table if exists t2; -create table t2(m int not null auto_increment primary key); -insert into t2 values (34),(67),(123); -save_master_pos; -flush logs; -show master logs; - -#now lets make some duplicate key mess and see if we can recover from it - -#first insert a value on the slave -connection slave; -sync_with_master; -insert into t2 values(1234); - -#same value on the master -connection master; -save_master_pos; -set insert_id=1234; -insert into t2 values(NULL); -connection slave; -sync_with_master; - -#the slave may have already stopped, so we ignore the error -!slave stop; - -#restart slave skipping one event -set sql_slave_skip_counter=1; -slave start; - -connection master; -save_master_pos; - -#let slave catch up -connection slave; -sync_with_master; -connection master; -purge master logs to 'master-bin.003'; -show master logs; -insert into t2 values (65); -save_master_pos; -connection slave; -sync_with_master; ---replace_result 9306 9999 3334 9999 3335 9999 -show slave status; -select * from t2; -connection master; -let $1=100; -drop table if exists t3; -create table t3 (n int); -while ($1) -{ -#eval means expand $ expressions - eval insert into t3 values($1 + 4); - dec $1; -} -show master logs; -show master status; -save_master_pos; -connection slave; -slave stop; -slave start; -sync_with_master; ---replace_result 9306 9999 3334 9999 3335 9999 -show slave status; -# because of concurrent insert, the table may not be up to date -# if we do not lock -lock tables t3 read; -select count(*) from t3 where n >= 4; -unlock tables; -#clean up -connection master; -drop table if exists t1,t2,t3; -save_master_pos; -connection slave; -sync_with_master; diff --git a/mysql-test/t/rpl000018.test b/mysql-test/t/rpl000018.test index 44236323d1d..e1204bad975 100644 --- a/mysql-test/t/rpl000018.test +++ b/mysql-test/t/rpl000018.test @@ -1,3 +1,8 @@ +# +# Running test with abort-slave-event-count=1 +# This will force slave to reconnect after every event +# + connect (master,localhost,root,,test,0,mysql-master.sock); connect (slave,localhost,root,,test,0,mysql-slave.sock); connection slave; diff --git a/mysql-test/t/rpl_rotate_logs-master.opt b/mysql-test/t/rpl_rotate_logs-master.opt new file mode 100644 index 00000000000..f27601e0d7d --- /dev/null +++ b/mysql-test/t/rpl_rotate_logs-master.opt @@ -0,0 +1 @@ +-O max_binlog_size=2048 diff --git a/mysql-test/t/rpl_rotate_logs-slave-master-info.opt b/mysql-test/t/rpl_rotate_logs-slave-master-info.opt new file mode 100644 index 00000000000..80190bf6d29 --- /dev/null +++ b/mysql-test/t/rpl_rotate_logs-slave-master-info.opt @@ -0,0 +1 @@ +--server-id=2 diff --git a/mysql-test/t/rpl_rotate_logs-slave.sh b/mysql-test/t/rpl_rotate_logs-slave.sh new file mode 100755 index 00000000000..62748605af1 --- /dev/null +++ b/mysql-test/t/rpl_rotate_logs-slave.sh @@ -0,0 +1 @@ +rm -f $MYSQL_TEST_DIR/var/slave-data/master.info diff --git a/mysql-test/t/rpl_rotate_logs.test b/mysql-test/t/rpl_rotate_logs.test new file mode 100644 index 00000000000..ab88def5b2d --- /dev/null +++ b/mysql-test/t/rpl_rotate_logs.test @@ -0,0 +1,141 @@ +# +# Test are run with max_binlog_size=2048 to force automatic rotation of the +# binary log +# Tests done: +# - Check that slaves reports correct failures if master.info has strange +# modes/information +# - Automatic binary log rotation +# - Ensure that temporary tables works over flush logs and binary log +# changes +# - Test creating a duplicate key error and recover from it +# +connect (master,localhost,root,,test,0,mysql-master.sock); +connect (slave,localhost,root,,test,0,mysql-slave.sock); +system cat /dev/null > var/slave-data/master.info; +system chmod 000 var/slave-data/master.info; +connection slave; +!slave start; +system chmod 600 var/slave-data/master.info; +!slave start; +!eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT, + master_user='root'; +reset slave; +eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT, + master_user='root'; +connection master; +reset master; +connection slave; +slave start; +connection master; + +drop table if exists t1, t2, t3, t4; + +# +# Test FLUSH LOGS +# +create temporary table temp_table (a char(80) not null); +insert into temp_table values ("testing temporary tables"); +create table t1 (s text); +insert into t1 values('Could not break slave'),('Tried hard'); +save_master_pos; +connection slave; +sync_with_master; +--replace_result 9306 9999 3334 9999 3335 9999 +show slave status; +select * from t1; +connection master; +flush logs; +drop table if exists t2; +create table t2(m int not null auto_increment primary key); +insert into t2 values (34),(67),(123); +flush logs; +show master logs; +create table t3 select * from temp_table; + +save_master_pos; +connection slave; +sync_with_master; + +select * from t3; +connection master; +drop table temp_table, t3; + +# +# Now lets make some duplicate key mess and see if we can recover from it +# + +# First insert a value on the slave +connection slave; +insert into t2 values(1234); + +#same value on the master +connection master; +save_master_pos; +set insert_id=1234; +insert into t2 values(NULL); +connection slave; +sync_with_master; + +#the slave may have already stopped, so we ignore the error +!slave stop; + +#restart slave skipping one event +set sql_slave_skip_counter=1; +slave start; + +connection master; +save_master_pos; + +#let slave catch up +connection slave; +sync_with_master; +connection master; +purge master logs to 'master-bin.003'; +show master logs; +insert into t2 values (65); +save_master_pos; +connection slave; +sync_with_master; +--replace_result 9306 9999 3334 9999 3335 9999 +show slave status; +select * from t2; + +# +# Test forcing the replication log to rotate +# + +connection master; +create temporary table temp_table (a char(80) not null); +insert into temp_table values ("testing temporary tables part 2"); +let $1=100; +drop table if exists t3; +create table t3 (n int); +while ($1) +{ +#eval means expand $ expressions + eval insert into t3 values($1 + 4); + dec $1; +} +create table t4 select * from temp_table; +show master logs; +show master status; +save_master_pos; +connection slave; +#slave stop; +#slave start; +sync_with_master; +select * from t4; + +--replace_result 9306 9999 3334 9999 3335 9999 +show slave status; +# because of concurrent insert, the table may not be up to date +# if we do not lock +lock tables t3 read; +select count(*) from t3 where n >= 4; +unlock tables; +#clean up +connection master; +drop table if exists t1,t2,t3; +save_master_pos; +connection slave; +sync_with_master; -- cgit v1.2.1