diff options
author | unknown <sasha@mysql.sashanet.com> | 2001-01-24 12:47:09 -0700 |
---|---|---|
committer | unknown <sasha@mysql.sashanet.com> | 2001-01-24 12:47:09 -0700 |
commit | b302ee39bc8e5f26f3fe95b47a3f42ad11cc5f40 (patch) | |
tree | 54c202a8cc62eff35c59e9d92f78316d8240b6da /mysql-test | |
parent | 0ee9e34a72c3206b0c57c7d555a54c8b4396f8fc (diff) | |
download | mariadb-git-b302ee39bc8e5f26f3fe95b47a3f42ad11cc5f40.tar.gz |
fixed improper read of log name from master.info which broke slave server restart
fixed sync bugs in three test cases
added offset argument to sync_with_master to mysqltest to be able to fix sync bugs
added a test case for slave startup with existing master.info
expanded mysql-test-run.sh to be able to run pre-start shell script initializations
client/mysqltest.c:
added offset argument to sync_with_master
mysql-test/mysql-test-run.sh:
added option to run master or slave initialization shell script
mysql-test/r/rpl000016.result:
fixed bug in test case
mysql-test/t/rpl000012.test:
fixed syncronization bug
mysql-test/t/rpl000013.test:
fixed sync bug
mysql-test/t/rpl000016.test:
fixed ambiguous show slave status.
sql/slave.cc:
fixed bug that broke slave server start with existing master.info,
Monty's optimization was not chopping off newline from logname.
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/mysql-test-run.sh | 15 | ||||
-rw-r--r-- | mysql-test/r/rpl000016.result | 2 | ||||
-rw-r--r-- | mysql-test/r/rpl000017.result | 2 | ||||
-rw-r--r-- | mysql-test/t/rpl000012.test | 14 | ||||
-rw-r--r-- | mysql-test/t/rpl000013.test | 12 | ||||
-rw-r--r-- | mysql-test/t/rpl000016.test | 10 | ||||
-rw-r--r-- | mysql-test/t/rpl000017-slave.opt | 1 | ||||
-rwxr-xr-x | mysql-test/t/rpl000017-slave.sh | 9 | ||||
-rw-r--r-- | mysql-test/t/rpl000017.test | 19 |
9 files changed, 73 insertions, 11 deletions
diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh index a63e909d823..79fee8d493a 100644 --- a/mysql-test/mysql-test-run.sh +++ b/mysql-test/mysql-test-run.sh @@ -72,6 +72,7 @@ cd .. BASEDIR=`pwd` cd $CWD MYSQL_TEST_DIR=$BASEDIR/mysql-test +export MYSQL_TEST_DIR STD_DATA=$MYSQL_TEST_DIR/std_data hostname=`hostname` # Installed in the mysql privilege table @@ -336,6 +337,11 @@ gcov_collect () { start_master() { [ x$MASTER_RUNNING = 1 ] && return + #run master initialization shell script if one exists + if [ -f "$master_init_script" ] ; + then + /bin/sh $master_init_script + fi cd $BASEDIR # for gcov # Remove old berkeley db log files that can confuse the server $RM -f $MASTER_MYDDIR/log.* @@ -375,6 +381,13 @@ start_slave() { [ x$SKIP_SLAVE = x1 ] && return [ x$SLAVE_RUNNING = 1 ] && return + + #run slave initialization shell script if one exists + if [ -f "$slave_init_script" ] ; + then + /bin/sh $slave_init_script + fi + if [ -z "$SLAVE_MASTER_INFO" ] ; then master_info="--master-user=root \ --master-connect-retry=1 \ @@ -502,6 +515,8 @@ run_testcase () tname=`$BASENAME $tf .test` master_opt_file=$TESTDIR/$tname-master.opt slave_opt_file=$TESTDIR/$tname-slave.opt + master_init_script=$TESTDIR/$tname-master.sh + slave_init_script=$TESTDIR/$tname-slave.sh slave_master_info_file=$TESTDIR/$tname-slave-master-info.opt SKIP_SLAVE=`$EXPR \( $tname : rpl \) = 0` diff --git a/mysql-test/r/rpl000016.result b/mysql-test/r/rpl000016.result index 96e36475c92..39ea7234e2a 100644 --- a/mysql-test/r/rpl000016.result +++ b/mysql-test/r/rpl000016.result @@ -7,8 +7,6 @@ Log_name master-bin.001 master-bin.002 master-bin.003 -Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter -127.0.0.1 root 9306 60 master-bin.003 129 Yes 1062 error 'Duplicate entry '1234' for key 1' on query 'insert into t2 values(1234)' 0 Log_name master-bin.003 Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter diff --git a/mysql-test/r/rpl000017.result b/mysql-test/r/rpl000017.result new file mode 100644 index 00000000000..e4f324047f8 --- /dev/null +++ b/mysql-test/r/rpl000017.result @@ -0,0 +1,2 @@ +n +24 diff --git a/mysql-test/t/rpl000012.test b/mysql-test/t/rpl000012.test index 495cb81167e..eddd3ede1d7 100644 --- a/mysql-test/t/rpl000012.test +++ b/mysql-test/t/rpl000012.test @@ -10,20 +10,26 @@ connection master1; create temporary table t1 (n int); insert into t1 values (4),(5); insert into t2 select * from t1; +save_master_pos; disconnect master; +connection slave; + +#add 1 to the saved position, so we will catch drop table on disconnect +#for sure +sync_with_master 1; connection master1; insert into t2 values(6); -disconnect master1; -connect (master2,localhost,root,,test,0,mysql-master.sock); -connection master2; save_master_pos; +disconnect master1; connection slave; -sync_with_master; +#same trick - make sure we catch drop of temporary table on disconnect +sync_with_master 1; @r/rpl000012.result select * from t2; @r/rpl000012.status.result show status like 'Slave_open_temp_tables'; # # Clean up # +connect (master2,localhost,root,,test,0,mysql-master.sock); connection master2; drop table if exists t1,t2; save_master_pos; diff --git a/mysql-test/t/rpl000013.test b/mysql-test/t/rpl000013.test index f5056839791..f870d017fa3 100644 --- a/mysql-test/t/rpl000013.test +++ b/mysql-test/t/rpl000013.test @@ -13,20 +13,24 @@ connection master1; create temporary table t1 (n int); insert into t1 values (4),(5); insert into t2 select * from t1; +save_master_pos; disconnect master; +connection slave; +#add 1 to catch drop table +sync_with_master 1; connection master1; insert into t2 values(6); -disconnect master1; -connect (master2,localhost,root,,test,0,mysql-master.sock); -connection master2; save_master_pos; +disconnect master1; connection slave; -sync_with_master; +# same trick to go one more event +sync_with_master 1; @r/rpl000013.result select * from t2; @r/rpl000013.status.result show status like 'Slave_open_temp_tables'; # # Clean up # +connect (master2,localhost,root,,test,0,mysql-master.sock); connection master2; drop table if exists t1,t2; save_master_pos; diff --git a/mysql-test/t/rpl000016.test b/mysql-test/t/rpl000016.test index e0e035a4ae0..fd30188ea89 100644 --- a/mysql-test/t/rpl000016.test +++ b/mysql-test/t/rpl000016.test @@ -31,28 +31,34 @@ 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; insert into t2 values(1234); 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; -show slave status; connection master; purge master logs to 'master-bin.003'; show master logs; @@ -74,6 +80,8 @@ while ($1) show master logs; save_master_pos; connection slave; +slave stop; +slave start; sync_with_master; select count(*) from t3 where n = 4; #clean up diff --git a/mysql-test/t/rpl000017-slave.opt b/mysql-test/t/rpl000017-slave.opt new file mode 100644 index 00000000000..58a964c90d0 --- /dev/null +++ b/mysql-test/t/rpl000017-slave.opt @@ -0,0 +1 @@ +--skip-slave-start diff --git a/mysql-test/t/rpl000017-slave.sh b/mysql-test/t/rpl000017-slave.sh new file mode 100755 index 00000000000..fe875f1a778 --- /dev/null +++ b/mysql-test/t/rpl000017-slave.sh @@ -0,0 +1,9 @@ +cat > $MYSQL_TEST_DIR/var/slave-data/master.info <<EOF +master-bin.001 +4 +127.0.0.1 +root + +9306 +1 +EOF diff --git a/mysql-test/t/rpl000017.test b/mysql-test/t/rpl000017.test new file mode 100644 index 00000000000..c93d861bec8 --- /dev/null +++ b/mysql-test/t/rpl000017.test @@ -0,0 +1,19 @@ +connect (master,localhost,root,,test,0,mysql-master.sock); +connect (slave,localhost,root,,test,0,mysql-slave.sock); +connection master; +reset master; +connection slave; +slave start; +connection master; +drop table if exists t1; +create table t1(n int); +insert into t1 values(24); +save_master_pos; +connection slave; +sync_with_master; +select * from t1; +connection master; +drop table t1; +save_master_pos; +connection slave; +sync_with_master; |