Commit eb67ad31 authored by unknown's avatar unknown

Merge nleippe@work.mysql.com:/home/bk/mysql-4.1

into mysql.com:/home/nick/mysql/repository/mysql-4.1


sql/sql_yacc.yy:
  Auto merged
parents 9bb3936f d172cc9a
...@@ -4,7 +4,7 @@ connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT,); ...@@ -4,7 +4,7 @@ connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT,);
connect (slave1,127.0.0.1,root,,test,$SLAVE_MYPORT,); connect (slave1,127.0.0.1,root,,test,$SLAVE_MYPORT,);
connection slave; connection slave;
--error 0,1199 --error 0,1199
!slave stop; !stop slave;
@r/slave-stopped.result show status like 'Slave_running'; @r/slave-stopped.result show status like 'Slave_running';
connection master; connection master;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
...@@ -13,7 +13,7 @@ connection slave; ...@@ -13,7 +13,7 @@ connection slave;
reset slave; reset slave;
# Clean up old test tables # Clean up old test tables
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
slave start; start slave;
@r/slave-running.result show status like 'Slave_running'; @r/slave-running.result show status like 'Slave_running';
# Set the default connection to 'master' # Set the default connection to 'master'
......
...@@ -192,6 +192,7 @@ CHARACTER_SET=latin1 ...@@ -192,6 +192,7 @@ CHARACTER_SET=latin1
DBUSER="" DBUSER=""
START_WAIT_TIMEOUT=10 START_WAIT_TIMEOUT=10
STOP_WAIT_TIMEOUT=10 STOP_WAIT_TIMEOUT=10
TEST_REPLICATION=0
while test $# -gt 0; do while test $# -gt 0; do
case "$1" in case "$1" in
...@@ -265,6 +266,9 @@ while test $# -gt 0; do ...@@ -265,6 +266,9 @@ while test $# -gt 0; do
--user-test=*) --user-test=*)
USER_TEST=`$ECHO "$1" | $SED -e "s;--user-test=;;"` USER_TEST=`$ECHO "$1" | $SED -e "s;--user-test=;;"`
;; ;;
--rpl)
TEST_REPLICATION=1
;;
--mysqld=*) --mysqld=*)
TMP=`$ECHO "$1" | $SED -e "s;--mysqld=;;"` TMP=`$ECHO "$1" | $SED -e "s;--mysqld=;;"`
EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT $TMP" EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT $TMP"
...@@ -1289,15 +1293,22 @@ $ECHO $DASH72 ...@@ -1289,15 +1293,22 @@ $ECHO $DASH72
if [ -z "$1" ] ; if [ -z "$1" ] ;
then then
if [ x$RECORD = x1 ]; then if [ x$RECORD = x1 ]; then
$ECHO "Will not run in record mode without a specific test case." $ECHO "Will not run in record mode without a specific test case."
else else
for tf in $TESTDIR/*.$TESTSUFFIX if [ x$TEST_REPLICATION = x1 ]; then
do for tf in $TESTDIR/rpl*.$TESTSUFFIX
run_testcase $tf do
done run_testcase $tf
$RM -f $TIMEFILE # Remove for full test done
fi else
for tf in $TESTDIR/*.$TESTSUFFIX
do
run_testcase $tf
done
fi
$RM -f $TIMEFILE # Remove for full test
fi
else else
while [ ! -z "$1" ]; do while [ ! -z "$1" ]; do
tname=`$BASENAME $1 .test` tname=`$BASENAME $1 .test`
......
slave stop; stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master; reset master;
reset slave; reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
slave start; start slave;
drop table if exists t1,t2,t3; drop table if exists t1,t2,t3;
create table t1 (word char(20) not null); create table t1 (word char(20) not null);
load data infile '../../std_data/words.dat' into table t1; load data infile '../../std_data/words.dat' into table t1;
...@@ -30,9 +30,9 @@ abandoned ...@@ -30,9 +30,9 @@ abandoned
abandoning abandoning
abandonment abandonment
abandons abandons
slave stop; stop slave;
set password for root@"localhost" = password('foo'); set password for root@"localhost" = password('foo');
slave start; start slave;
set password for root@"localhost" = password(''); set password for root@"localhost" = password('');
create table t3(n int); create table t3(n int);
insert into t3 values(1),(2); insert into t3 values(1),(2);
...@@ -45,13 +45,13 @@ sum(length(word)) ...@@ -45,13 +45,13 @@ sum(length(word))
141 141
drop table t1,t3; drop table t1,t3;
reset master; reset master;
slave stop; stop slave;
reset slave; reset slave;
create table t1(n int); create table t1(n int);
select get_lock("hold_slave",10); select get_lock("hold_slave",10);
get_lock("hold_slave",10) get_lock("hold_slave",10)
1 1
slave start; start slave;
select release_lock("hold_slave"); select release_lock("hold_slave");
release_lock("hold_slave") release_lock("hold_slave")
1 1
...@@ -68,7 +68,7 @@ kill @id; ...@@ -68,7 +68,7 @@ kill @id;
drop table t2; drop table t2;
Server shutdown in progress Server shutdown in progress
set global sql_slave_skip_counter=1; set global sql_slave_skip_counter=1;
slave start; start slave;
select count(*) from t1; select count(*) from t1;
count(*) count(*)
5000 5000
......
slave stop; stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master; reset master;
reset slave; reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
slave start; start slave;
drop table if exists t1; drop table if exists t1;
create table t1 (n int auto_increment primary key); create table t1 (n int auto_increment primary key);
set insert_id = 2000; set insert_id = 2000;
...@@ -17,7 +17,7 @@ show slave hosts; ...@@ -17,7 +17,7 @@ show slave hosts;
Server_id Host Port Rpl_recovery_rank Master_id Server_id Host Port Rpl_recovery_rank Master_id
2 127.0.0.1 9999 2 1 2 127.0.0.1 9999 2 1
drop table t1; drop table t1;
slave stop; stop slave;
drop table if exists t2; drop table if exists t2;
create table t2(id int auto_increment primary key, created datetime); create table t2(id int auto_increment primary key, created datetime);
set timestamp=12345; set timestamp=12345;
...@@ -25,7 +25,7 @@ insert into t2 set created=now(); ...@@ -25,7 +25,7 @@ insert into t2 set created=now();
select * from t2; select * from t2;
id created id created
1 1970-01-01 06:25:45 1 1970-01-01 06:25:45
slave start; start slave;
select * from t2; select * from t2;
id created id created
1 1970-01-01 06:25:45 1 1970-01-01 06:25:45
......
slave stop; stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master; reset master;
reset slave; reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
slave start; start slave;
drop table if exists t1; drop table if exists t1;
create table t1(n int primary key); create table t1(n int primary key);
insert into t1 values (1),(2),(2); insert into t1 values (1),(2),(2);
......
slave stop; stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master; reset master;
reset slave; reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
slave start; start slave;
set SQL_LOG_BIN=0; set SQL_LOG_BIN=0;
drop table if exists t1; drop table if exists t1;
create table t1 (word char(20) not null, index(word)); create table t1 (word char(20) not null, index(word));
......
slave stop; stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master; reset master;
reset slave; reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
slave start; start slave;
drop table if exists t1; drop table if exists t1;
CREATE TABLE t1 (name varchar(64), age smallint(3)); CREATE TABLE t1 (name varchar(64), age smallint(3));
INSERT INTO t1 SET name='Andy', age=31; INSERT INTO t1 SET name='Andy', age=31;
......
slave stop; stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master; reset master;
reset slave; reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
slave start; start slave;
set SQL_LOG_BIN=0,timestamp=200006; set SQL_LOG_BIN=0,timestamp=200006;
drop table if exists t1; drop table if exists t1;
create table t1(t timestamp not null,a char(1)); create table t1(t timestamp not null,a char(1));
......
slave stop; stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master; reset master;
reset slave; reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
slave start; start slave;
drop table if exists foo; drop table if exists foo;
create table foo (n int); create table foo (n int);
insert into foo values(4); insert into foo values(4);
......
slave stop; stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master; reset master;
reset slave; reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
slave start; start slave;
use test; use test;
drop table if exists foo; drop table if exists foo;
create table foo (n int); create table foo (n int);
......
slave stop; stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master; reset master;
reset slave; reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
slave start; start slave;
drop database if exists foo; drop database if exists foo;
create database foo; create database foo;
drop database if exists bar; drop database if exists bar;
......
slave stop; stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master; reset master;
reset slave; reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
slave start; start slave;
drop table if exists t1; drop table if exists t1;
drop table if exists t1; drop table if exists t1;
create table t1 (n int not null auto_increment primary key); create table t1 (n int not null auto_increment primary key);
......
slave stop; stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master; reset master;
reset slave; reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
slave start; start slave;
drop table if exists t1; drop table if exists t1;
create table t1 (n int); create table t1 (n int);
insert into t1 values(1); insert into t1 values(1);
slave stop; stop slave;
slave start; start slave;
insert into t1 values(2); insert into t1 values(2);
select * from t1; select * from t1;
n n
......
slave stop; stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master; reset master;
reset slave; reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
slave start; start slave;
drop table if exists t1,t2,t3; drop table if exists t1,t2,t3;
create table t2 (n int); create table t2 (n int);
create temporary table t1 (n int); create temporary table t1 (n int);
......
slave stop; stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master; reset master;
reset slave; reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
slave start; start slave;
drop table if exists t2; drop table if exists t2;
create table t2(n int); create table t2(n int);
create temporary table t1 (n int); create temporary table t1 (n int);
......
...@@ -14,7 +14,7 @@ master_password='',master_port=MASTER_PORT; ...@@ -14,7 +14,7 @@ master_password='',master_port=MASTER_PORT;
show slave status; show slave status;
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
127.0.0.1 root MASTER_PORT 7 4 slave-relay-bin.001 4 No No 0 0 0 4 127.0.0.1 root MASTER_PORT 7 4 slave-relay-bin.001 4 No No 0 0 0 4
slave start; start slave;
show slave status; show slave status;
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
127.0.0.1 root MASTER_PORT 7 master-bin.001 79 slave-relay-bin.001 120 master-bin.001 Yes Yes 0 0 79 120 127.0.0.1 root MASTER_PORT 7 master-bin.001 79 slave-relay-bin.001 120 master-bin.001 Yes Yes 0 0 79 120
......
reset master; reset master;
grant replication slave on *.* to replicate@localhost identified by 'aaaaaaaaaaaaaaab'; grant replication slave on *.* to replicate@localhost identified by 'aaaaaaaaaaaaaaab';
grant replication slave on *.* to replicate@127.0.0.1 identified by 'aaaaaaaaaaaaaaab'; grant replication slave on *.* to replicate@127.0.0.1 identified by 'aaaaaaaaaaaaaaab';
slave start; start slave;
drop table if exists t1; drop table if exists t1;
create table t1(n int); create table t1(n int);
insert into t1 values(24); insert into t1 values(24);
......
reset slave; reset slave;
slave start; start slave;
show master logs; show binary logs;
Log_name Log_name
master-bin.001 master-bin.001
master-bin.002 master-bin.002
......
slave stop; stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master; reset master;
reset slave; reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
slave start; start slave;
drop database if exists d1; drop database if exists d1;
create database d1; create database d1;
create table d1.t1 ( n int); create table d1.t1 ( n int);
......
slave stop; stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master; reset master;
reset slave; reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
slave start; start slave;
drop table if exists t1; drop table if exists t1;
show slave status; show slave status;
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
......
slave stop; stop slave;
reset master; reset master;
reset slave; reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
slave start; start slave;
show variables like 'rpl_recovery_rank'; show variables like 'rpl_recovery_rank';
Variable_name Value Variable_name Value
rpl_recovery_rank 1 rpl_recovery_rank 1
...@@ -17,14 +17,14 @@ rpl_recovery_rank 2 ...@@ -17,14 +17,14 @@ rpl_recovery_rank 2
show status like 'Rpl_status'; show status like 'Rpl_status';
Variable_name Value Variable_name Value
Rpl_status ACTIVE_SLAVE Rpl_status ACTIVE_SLAVE
slave start; start slave;
show variables like 'rpl_recovery_rank'; show variables like 'rpl_recovery_rank';
Variable_name Value Variable_name Value
rpl_recovery_rank 3 rpl_recovery_rank 3
show status like 'Rpl_status'; show status like 'Rpl_status';
Variable_name Value Variable_name Value
Rpl_status ACTIVE_SLAVE Rpl_status ACTIVE_SLAVE
slave start; start slave;
show variables like 'rpl_recovery_rank'; show variables like 'rpl_recovery_rank';
Variable_name Value Variable_name Value
rpl_recovery_rank 4 rpl_recovery_rank 4
......
slave stop; stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master; reset master;
reset slave; reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
slave start; start slave;
change master to master_host='127.0.0.1',master_user='root', change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=MASTER_PORT; master_password='',master_port=MASTER_PORT;
slave start; start slave;
slave stop; stop slave;
change master to master_host='127.0.0.1',master_user='root', change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=SLAVE_PORT; master_password='',master_port=SLAVE_PORT;
slave start; start slave;
flush logs; flush logs;
show slave status; show slave status;
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
......
slave stop; stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master; reset master;
reset slave; reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
slave start; start slave;
create table t1(n int); create table t1(n int);
insert into t1 values(get_lock("lock",2)); insert into t1 values(get_lock("lock",2));
select get_lock("lock",2); select get_lock("lock",2);
......
slave stop; stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master; reset master;
reset slave; reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
slave start; start slave;
slave stop; stop slave;
reset master; reset master;
reset slave; reset slave;
reset master; reset master;
...@@ -36,9 +36,9 @@ show binlog events from 79 limit 2,1; ...@@ -36,9 +36,9 @@ show binlog events from 79 limit 2,1;
Log_name Pos Event_type Server_id Orig_log_pos Info Log_name Pos Event_type Server_id Orig_log_pos Info
master-bin.001 200 Query 1 200 use `test`; insert into t1 values (NULL) master-bin.001 200 Query 1 200 use `test`; insert into t1 values (NULL)
flush logs; flush logs;
slave start; start slave;
flush logs; flush logs;
slave stop; stop slave;
create table t1 (n int); create table t1 (n int);
insert into t1 values (1); insert into t1 values (1);
drop table t1; drop table t1;
...@@ -59,12 +59,12 @@ Log_name Pos Event_type Server_id Orig_log_pos Info ...@@ -59,12 +59,12 @@ Log_name Pos Event_type Server_id Orig_log_pos Info
master-bin.002 4 Query 1 4 use `test`; create table t1 (n int) master-bin.002 4 Query 1 4 use `test`; create table t1 (n int)
master-bin.002 62 Query 1 62 use `test`; insert into t1 values (1) master-bin.002 62 Query 1 62 use `test`; insert into t1 values (1)
master-bin.002 122 Query 1 122 use `test`; drop table t1 master-bin.002 122 Query 1 122 use `test`; drop table t1
show master logs; show binary logs;
Log_name Log_name
master-bin.001 master-bin.001
master-bin.002 master-bin.002
slave start; start slave;
show master logs; show binary logs;
Log_name Log_name
slave-bin.001 slave-bin.001
slave-bin.002 slave-bin.002
......
slave stop; stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master; reset master;
reset slave; reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
slave start; start slave;
show master status; show master status;
File Position Binlog_do_db Binlog_ignore_db File Position Binlog_do_db Binlog_ignore_db
master-bin.001 79 master-bin.001 79
...@@ -11,17 +11,17 @@ show slave status; ...@@ -11,17 +11,17 @@ show slave status;
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
127.0.0.1 root MASTER_PORT 1 master-bin.001 79 slave-relay-bin.002 120 master-bin.001 Yes Yes 0 0 79 124 127.0.0.1 root MASTER_PORT 1 master-bin.001 79 slave-relay-bin.002 120 master-bin.001 Yes Yes 0 0 79 124
change master to master_log_pos=73; change master to master_log_pos=73;
slave stop; stop slave;
change master to master_log_pos=73; change master to master_log_pos=73;
show slave status; show slave status;
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
127.0.0.1 root MASTER_PORT 1 master-bin.001 73 slave-relay-bin.001 4 master-bin.001 No No 0 0 73 4 127.0.0.1 root MASTER_PORT 1 master-bin.001 73 slave-relay-bin.001 4 master-bin.001 No No 0 0 73 4
slave start; start slave;
show slave status; show slave status;
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
127.0.0.1 root MASTER_PORT 1 master-bin.001 73 slave-relay-bin.001 4 master-bin.001 No Yes 0 0 73 4 127.0.0.1 root MASTER_PORT 1 master-bin.001 73 slave-relay-bin.001 4 master-bin.001 No Yes 0 0 73 4
change master to master_log_pos=173; change master to master_log_pos=173;
slave start; start slave;
show slave status; show slave status;
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
127.0.0.1 root MASTER_PORT 1 master-bin.001 173 slave-relay-bin.001 4 master-bin.001 No Yes 0 0 173 4 127.0.0.1 root MASTER_PORT 1 master-bin.001 173 slave-relay-bin.001 4 master-bin.001 No Yes 0 0 173 4
...@@ -33,7 +33,7 @@ drop table if exists t1; ...@@ -33,7 +33,7 @@ drop table if exists t1;
create table t1 (n int); create table t1 (n int);
insert into t1 values (1),(2),(3); insert into t1 values (1),(2),(3);
change master to master_log_pos=79; change master to master_log_pos=79;
slave start; start slave;
select * from t1; select * from t1;
n n
1 1
......
slave stop; stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master; reset master;
reset slave; reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
slave start; start slave;
create table t1(n int auto_increment primary key); create table t1(n int auto_increment primary key);
insert into t1 values (2); insert into t1 values (2);
insert into t1 values(NULL); insert into t1 values(NULL);
insert into t1 values(NULL); insert into t1 values(NULL);
delete from t1 where n = 2; delete from t1 where n = 2;
slave start; start slave;
slave stop; stop slave;
create table t2(n int); create table t2(n int);
drop table t2; drop table t2;
insert into t1 values(NULL); insert into t1 values(NULL);
slave start; start slave;
select * from t1; select * from t1;
n n
1 1
......
slave stop; stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master; reset master;
reset slave; reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
slave start; start slave;
SHOW SLAVE STATUS; SHOW SLAVE STATUS;
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
SHOW SLAVE HOSTS; SHOW SLAVE HOSTS;
......
slave start; start slave;
Could not initialize master info structure, check permisions on master.info Could not initialize master info structure, check permisions on master.info
slave start; start slave;
Could not initialize master info structure, check permisions on master.info Could not initialize master info structure, check permisions on master.info
change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root'; change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root';
Could not initialize master info Could not initialize master info
reset slave; reset slave;
change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root'; change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root';
reset master; reset master;
slave start; start slave;
drop table if exists t1, t2, t3, t4; drop table if exists t1, t2, t3, t4;
create temporary table temp_table (a char(80) not null); create temporary table temp_table (a char(80) not null);
insert into temp_table values ("testing temporary tables"); insert into temp_table values ("testing temporary tables");
...@@ -25,7 +25,7 @@ drop table if exists t2; ...@@ -25,7 +25,7 @@ drop table if exists t2;
create table t2(m int not null auto_increment primary key); create table t2(m int not null auto_increment primary key);
insert into t2 values (34),(67),(123); insert into t2 values (34),(67),(123);
flush logs; flush logs;
show master logs; show binary logs;
Log_name Log_name
master-bin.001 master-bin.001
master-bin.002 master-bin.002
...@@ -39,9 +39,9 @@ insert into t2 values(1234); ...@@ -39,9 +39,9 @@ insert into t2 values(1234);
set insert_id=1234; set insert_id=1234;
insert into t2 values(NULL); insert into t2 values(NULL);
set global sql_slave_skip_counter=1; set global sql_slave_skip_counter=1;
slave start; start slave;
purge master logs to 'master-bin.003'; purge master logs to 'master-bin.003';
show master logs; show binary logs;
Log_name Log_name
master-bin.003 master-bin.003
insert into t2 values (65); insert into t2 values (65);
...@@ -60,7 +60,7 @@ insert into temp_table values ("testing temporary tables part 2"); ...@@ -60,7 +60,7 @@ insert into temp_table values ("testing temporary tables part 2");
drop table if exists t3; drop table if exists t3;
create table t3 (n int); create table t3 (n int);
create table t4 select * from temp_table; create table t4 select * from temp_table;
show master logs; show binary logs;
Log_name Log_name
master-bin.003 master-bin.003
master-bin.004 master-bin.004
......
slave stop; stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master; reset master;
reset slave; reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
slave start; start slave;
drop table if exists t1; drop table if exists t1;
create table t1 (n int not null primary key); create table t1 (n int not null primary key);
insert into t1 values (1); insert into t1 values (1);
......
slave stop; stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master; reset master;
reset slave; reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
slave start; start slave;
create table t2(n int); create table t2(n int);
create table t1(n int not null auto_increment primary key); create table t1(n int not null auto_increment primary key);
insert into t1 values (NULL),(NULL); insert into t1 values (NULL),(NULL);
truncate table t1; truncate table t1;
insert into t1 values (4),(NULL); insert into t1 values (4),(NULL);
slave stop; stop slave;
slave start; start slave;
insert into t1 values (NULL),(NULL); insert into t1 values (NULL),(NULL);
flush logs; flush logs;
truncate table t1; truncate table t1;
......
...@@ -12,11 +12,11 @@ select * from t1; ...@@ -12,11 +12,11 @@ select * from t1;
save_master_pos; save_master_pos;
connection slave; connection slave;
sync_with_master; sync_with_master;
slave stop; stop slave;
connection master; connection master;
set password for root@"localhost" = password('foo'); set password for root@"localhost" = password('foo');
connection slave; connection slave;
slave start; start slave;
connection master; connection master;
# #
# Give slave time to do at last one failed connect retry # Give slave time to do at last one failed connect retry
...@@ -43,7 +43,7 @@ sync_with_master; ...@@ -43,7 +43,7 @@ sync_with_master;
connection master; connection master;
reset master; reset master;
connection slave; connection slave;
slave stop; stop slave;
reset slave; reset slave;
connection master; connection master;
...@@ -62,7 +62,7 @@ enable_query_log; ...@@ -62,7 +62,7 @@ enable_query_log;
# Try to cause a large relay log lag on the slave # Try to cause a large relay log lag on the slave
connection slave; connection slave;
select get_lock("hold_slave",10); select get_lock("hold_slave",10);
slave start; start slave;
#hope this is long enough for I/O thread to fetch over 16K relay log data #hope this is long enough for I/O thread to fetch over 16K relay log data
sleep 3; sleep 3;
select release_lock("hold_slave"); select release_lock("hold_slave");
...@@ -100,7 +100,7 @@ wait_for_slave_to_stop; ...@@ -100,7 +100,7 @@ wait_for_slave_to_stop;
# show slave status; # show slave status;
set global sql_slave_skip_counter=1; set global sql_slave_skip_counter=1;
slave start; start slave;
select count(*) from t1; select count(*) from t1;
connection master1; connection master1;
drop table t1; drop table t1;
......
...@@ -3,18 +3,14 @@ drop table if exists t1; ...@@ -3,18 +3,14 @@ drop table if exists t1;
create table t1 (n int auto_increment primary key); create table t1 (n int auto_increment primary key);
set insert_id = 2000; set insert_id = 2000;
insert into t1 values (NULL),(NULL),(NULL); insert into t1 values (NULL),(NULL),(NULL);
save_master_pos; sync_slave_with_master;
connection slave;
sync_with_master;
select * from t1; select * from t1;
connection master; connection master;
--replace_result $SLAVE_MYPORT 9999 --replace_result $SLAVE_MYPORT 9999
show slave hosts; show slave hosts;
drop table t1; drop table t1;
save_master_pos; sync_slave_with_master;
connection slave; stop slave;
sync_with_master;
slave stop;
connection master; connection master;
drop table if exists t2; drop table if exists t2;
create table t2(id int auto_increment primary key, created datetime); create table t2(id int auto_increment primary key, created datetime);
...@@ -23,11 +19,9 @@ insert into t2 set created=now(); ...@@ -23,11 +19,9 @@ insert into t2 set created=now();
select * from t2; select * from t2;
save_master_pos; save_master_pos;
connection slave; connection slave;
slave start; start slave;
sync_with_master; sync_with_master;
select * from t2; select * from t2;
connection master; connection master;
drop table t2; drop table t2;
save_master_pos; sync_slave_with_master;
connection slave;
sync_with_master;
...@@ -2,20 +2,14 @@ source include/master-slave.inc; ...@@ -2,20 +2,14 @@ source include/master-slave.inc;
drop table if exists t1; drop table if exists t1;
create table t1 (n int); create table t1 (n int);
insert into t1 values(1); insert into t1 values(1);
save_master_pos; sync_slave_with_master;
connection slave; stop slave;
sync_with_master; start slave;
slave stop;
slave start;
connection master; connection master;
insert into t1 values(2); insert into t1 values(2);
save_master_pos;
connection slave;
#let slave catch up #let slave catch up
sync_with_master; sync_slave_with_master;
select * from t1; select * from t1;
connection master; connection master;
drop table t1; drop table t1;
save_master_pos; sync_slave_with_master;
connection slave;
sync_with_master;
...@@ -18,7 +18,7 @@ eval change master to master_host='127.0.0.1',master_user='root', ...@@ -18,7 +18,7 @@ eval change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=$MASTER_MYPORT; master_password='',master_port=$MASTER_MYPORT;
--replace_result $MASTER_MYPORT MASTER_PORT --replace_result $MASTER_MYPORT MASTER_PORT
show slave status; show slave status;
slave start; start slave;
sync_with_master; sync_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT --replace_result $MASTER_MYPORT MASTER_PORT
show slave status; show slave status;
...@@ -26,12 +26,8 @@ connection master; ...@@ -26,12 +26,8 @@ connection master;
drop table if exists t1; drop table if exists t1;
create table t1 (n int); create table t1 (n int);
insert into t1 values (10),(45),(90); insert into t1 values (10),(45),(90);
save_master_pos; sync_slave_with_master;
connection slave;
sync_with_master;
select * from t1; select * from t1;
connection master; connection master;
drop table t1; drop table t1;
save_master_pos; sync_slave_with_master;
connection slave;
sync_with_master;
...@@ -5,17 +5,13 @@ reset master; ...@@ -5,17 +5,13 @@ reset master;
grant replication slave on *.* to replicate@localhost identified by 'aaaaaaaaaaaaaaab'; grant replication slave on *.* to replicate@localhost identified by 'aaaaaaaaaaaaaaab';
grant replication slave on *.* to replicate@127.0.0.1 identified by 'aaaaaaaaaaaaaaab'; grant replication slave on *.* to replicate@127.0.0.1 identified by 'aaaaaaaaaaaaaaab';
connection slave; connection slave;
slave start; start slave;
connection master; connection master;
drop table if exists t1; drop table if exists t1;
create table t1(n int); create table t1(n int);
insert into t1 values(24); insert into t1 values(24);
save_master_pos; sync_slave_with_master;
connection slave;
sync_with_master;
select * from t1; select * from t1;
connection master; connection master;
drop table t1; drop table t1;
save_master_pos; sync_slave_with_master;
connection slave;
sync_with_master;
...@@ -10,18 +10,14 @@ server_stop master; ...@@ -10,18 +10,14 @@ server_stop master;
server_start master; server_start master;
connection slave; connection slave;
reset slave; reset slave;
slave start; start slave;
connection master; connection master;
show master logs; show binary logs;
drop table if exists t1; drop table if exists t1;
create table t1(n int); create table t1(n int);
insert into t1 values (3351); insert into t1 values (3351);
save_master_pos; sync_slave_with_master;
connection slave;
sync_with_master;
select * from t1; select * from t1;
connection master; connection master;
drop table t1; drop table t1;
save_master_pos; sync_slave_with_master;
connection slave;
sync_with_master;
...@@ -7,18 +7,16 @@ show variables like 'rpl_recovery_rank'; ...@@ -7,18 +7,16 @@ show variables like 'rpl_recovery_rank';
show status like 'Rpl_status'; show status like 'Rpl_status';
create table t1(n int); create table t1(n int);
drop table t1; drop table t1;
save_master_pos; sync_slave_with_master;
connection slave;
sync_with_master;
show variables like 'rpl_recovery_rank'; show variables like 'rpl_recovery_rank';
show status like 'Rpl_status'; show status like 'Rpl_status';
connection slave_sec; connection slave_sec;
slave start; start slave;
sync_with_master; sync_with_master;
show variables like 'rpl_recovery_rank'; show variables like 'rpl_recovery_rank';
show status like 'Rpl_status'; show status like 'Rpl_status';
connection slave_ter; connection slave_ter;
slave start; start slave;
sync_with_master; sync_with_master;
show variables like 'rpl_recovery_rank'; show variables like 'rpl_recovery_rank';
show status like 'Rpl_status'; show status like 'Rpl_status';
...@@ -7,13 +7,13 @@ connection slave; ...@@ -7,13 +7,13 @@ connection slave;
--replace_result $MASTER_MYPORT MASTER_PORT --replace_result $MASTER_MYPORT MASTER_PORT
eval change master to master_host='127.0.0.1',master_user='root', eval change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=$MASTER_MYPORT; master_password='',master_port=$MASTER_MYPORT;
slave start; start slave;
connection master; connection master;
slave stop; stop slave;
--replace_result $SLAVE_MYPORT SLAVE_PORT --replace_result $SLAVE_MYPORT SLAVE_PORT
eval change master to master_host='127.0.0.1',master_user='root', eval change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=$SLAVE_MYPORT; master_password='',master_port=$SLAVE_MYPORT;
slave start; start slave;
flush logs; flush logs;
sleep 5; sleep 5;
--replace_result $SLAVE_MYPORT SLAVE_PORT --replace_result $SLAVE_MYPORT SLAVE_PORT
......
...@@ -2,7 +2,7 @@ source include/master-slave.inc; ...@@ -2,7 +2,7 @@ source include/master-slave.inc;
#clean up slave binlogs #clean up slave binlogs
connection slave; connection slave;
slave stop; stop slave;
reset master; reset master;
reset slave; reset slave;
let $VERSION=`select version()`; let $VERSION=`select version()`;
...@@ -26,10 +26,10 @@ flush logs; ...@@ -26,10 +26,10 @@ flush logs;
save_master_pos; save_master_pos;
connection slave; connection slave;
slave start; start slave;
sync_with_master; sync_with_master;
flush logs; flush logs;
slave stop; stop slave;
connection master; connection master;
# Create some entries for second log # Create some entries for second log
...@@ -40,12 +40,12 @@ drop table t1; ...@@ -40,12 +40,12 @@ drop table t1;
--replace_result $VERSION VERSION --replace_result $VERSION VERSION
show binlog events; show binlog events;
show binlog events in 'master-bin.002'; show binlog events in 'master-bin.002';
show master logs; show binary logs;
save_master_pos; save_master_pos;
connection slave; connection slave;
slave start; start slave;
sync_with_master; sync_with_master;
show master logs; show binary logs;
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT $VERSION VERSION --replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT $VERSION VERSION
show binlog events in 'slave-bin.001' from 4; show binlog events in 'slave-bin.001' from 4;
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT $VERSION VERSION --replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT $VERSION VERSION
......
...@@ -3,25 +3,23 @@ ...@@ -3,25 +3,23 @@
# #
source include/master-slave.inc; source include/master-slave.inc;
show master status; show master status;
save_master_pos; sync_slave_with_master;
connection slave;
sync_with_master;
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT --replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
show slave status; show slave status;
change master to master_log_pos=73; change master to master_log_pos=73;
sleep 5; sleep 5;
slave stop; stop slave;
change master to master_log_pos=73; change master to master_log_pos=73;
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT --replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
show slave status; show slave status;
slave start; start slave;
sleep 5; sleep 5;
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT --replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
show slave status; show slave status;
change master to master_log_pos=173; change master to master_log_pos=173;
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT --replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
slave start; start slave;
sleep 2; sleep 2;
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT --replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
show slave status; show slave status;
...@@ -34,11 +32,9 @@ insert into t1 values (1),(2),(3); ...@@ -34,11 +32,9 @@ insert into t1 values (1),(2),(3);
save_master_pos; save_master_pos;
connection slave; connection slave;
change master to master_log_pos=79; change master to master_log_pos=79;
slave start; start slave;
sync_with_master; sync_with_master;
select * from t1; select * from t1;
connection master; connection master;
drop table t1; drop table t1;
save_master_pos; sync_slave_with_master;
connection slave;
sync_with_master;
...@@ -4,9 +4,7 @@ source include/master-slave.inc; ...@@ -4,9 +4,7 @@ source include/master-slave.inc;
# first, cause a duplicate key problem on the slave # first, cause a duplicate key problem on the slave
create table t1(n int auto_increment primary key); create table t1(n int auto_increment primary key);
save_master_pos; sync_slave_with_master;
connection slave;
sync_with_master;
insert into t1 values (2); insert into t1 values (2);
connection master; connection master;
insert into t1 values(NULL); insert into t1 values(NULL);
...@@ -16,11 +14,11 @@ connection slave; ...@@ -16,11 +14,11 @@ connection slave;
sleep 3; # there is no way around this sleep - we have to wait until sleep 3; # there is no way around this sleep - we have to wait until
# the slave tries to run the query, fails and aborts slave thread # the slave tries to run the query, fails and aborts slave thread
delete from t1 where n = 2; delete from t1 where n = 2;
slave start; start slave;
sync_with_master; sync_with_master;
#now the buggy slave would be confused on the offset but it can replicate #now the buggy slave would be confused on the offset but it can replicate
#in order to make it break, we need to stop/start the slave one more time #in order to make it break, we need to stop/start the slave one more time
slave stop; stop slave;
connection master; connection master;
# to be able to really confuse the slave, we need some non-auto-increment # to be able to really confuse the slave, we need some non-auto-increment
# events in the log # events in the log
...@@ -29,7 +27,7 @@ drop table t2; ...@@ -29,7 +27,7 @@ drop table t2;
insert into t1 values(NULL); insert into t1 values(NULL);
save_master_pos; save_master_pos;
connection slave; connection slave;
slave start; start slave;
#now the truth comes out - if the slave is buggy, it will never sync because #now the truth comes out - if the slave is buggy, it will never sync because
#the slave thread is not able to read events #the slave thread is not able to read events
sync_with_master; sync_with_master;
...@@ -37,7 +35,5 @@ select * from t1; ...@@ -37,7 +35,5 @@ select * from t1;
#clean up #clean up
connection master; connection master;
drop table t1; drop table t1;
save_master_pos; sync_slave_with_master;
connection slave;
sync_with_master;
...@@ -15,10 +15,10 @@ system cat /dev/null > var/slave-data/master.info; ...@@ -15,10 +15,10 @@ system cat /dev/null > var/slave-data/master.info;
system chmod 000 var/slave-data/master.info; system chmod 000 var/slave-data/master.info;
connection slave; connection slave;
--error 1201 --error 1201
slave start; start slave;
system chmod 600 var/slave-data/master.info; system chmod 600 var/slave-data/master.info;
--error 1201 --error 1201
slave start; start slave;
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT --replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
# Will get error 13 on Unix systems becasue file is not readable # Will get error 13 on Unix systems becasue file is not readable
!eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT, master_user='root'; !eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT, master_user='root';
...@@ -28,7 +28,7 @@ eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT, master ...@@ -28,7 +28,7 @@ eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT, master
connection master; connection master;
reset master; reset master;
connection slave; connection slave;
slave start; start slave;
connection master; connection master;
drop table if exists t1, t2, t3, t4; drop table if exists t1, t2, t3, t4;
...@@ -40,9 +40,7 @@ create temporary table temp_table (a char(80) not null); ...@@ -40,9 +40,7 @@ create temporary table temp_table (a char(80) not null);
insert into temp_table values ("testing temporary tables"); insert into temp_table values ("testing temporary tables");
create table t1 (s text); create table t1 (s text);
insert into t1 values('Could not break slave'),('Tried hard'); insert into t1 values('Could not break slave'),('Tried hard');
save_master_pos; sync_slave_with_master;
connection slave;
sync_with_master;
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT --replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
show slave status; show slave status;
select * from t1; select * from t1;
...@@ -52,12 +50,10 @@ drop table if exists t2; ...@@ -52,12 +50,10 @@ drop table if exists t2;
create table t2(m int not null auto_increment primary key); create table t2(m int not null auto_increment primary key);
insert into t2 values (34),(67),(123); insert into t2 values (34),(67),(123);
flush logs; flush logs;
show master logs; show binary logs;
create table t3 select * from temp_table; create table t3 select * from temp_table;
save_master_pos; sync_slave_with_master;
connection slave;
sync_with_master;
select * from t3; select * from t3;
connection master; connection master;
...@@ -83,21 +79,17 @@ wait_for_slave_to_stop; ...@@ -83,21 +79,17 @@ wait_for_slave_to_stop;
#restart slave skipping one event #restart slave skipping one event
set global sql_slave_skip_counter=1; set global sql_slave_skip_counter=1;
slave start; start slave;
connection master; connection master;
save_master_pos;
#let slave catch up #let slave catch up
connection slave; sync_slave_with_master;
sync_with_master;
connection master; connection master;
purge master logs to 'master-bin.003'; purge master logs to 'master-bin.003';
show master logs; show binary logs;
insert into t2 values (65); insert into t2 values (65);
save_master_pos; sync_slave_with_master;
connection slave;
sync_with_master;
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT --replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
show slave status; show slave status;
select * from t2; select * from t2;
...@@ -121,12 +113,12 @@ while ($1) ...@@ -121,12 +113,12 @@ while ($1)
} }
enable_query_log; enable_query_log;
create table t4 select * from temp_table; create table t4 select * from temp_table;
show master logs; show binary logs;
show master status; show master status;
save_master_pos; save_master_pos;
connection slave; connection slave;
#slave stop; #stop slave;
#slave start; #start slave;
sync_with_master; sync_with_master;
select * from t4; select * from t4;
...@@ -140,6 +132,4 @@ unlock tables; ...@@ -140,6 +132,4 @@ unlock tables;
#clean up #clean up
connection master; connection master;
drop table if exists t1,t2,t3,t4; drop table if exists t1,t2,t3,t4;
save_master_pos; sync_slave_with_master;
connection slave;
sync_with_master;
...@@ -9,22 +9,16 @@ insert into t1 values (NULL),(NULL); ...@@ -9,22 +9,16 @@ insert into t1 values (NULL),(NULL);
truncate table t1; truncate table t1;
# We have to use 4 in the following to make this test work with all table types # We have to use 4 in the following to make this test work with all table types
insert into t1 values (4),(NULL); insert into t1 values (4),(NULL);
save_master_pos; sync_slave_with_master;
connection slave; stop slave;
sync_with_master; start slave;
slave stop;
slave start;
connection master; connection master;
insert into t1 values (NULL),(NULL); insert into t1 values (NULL),(NULL);
flush logs; flush logs;
truncate table t1; truncate table t1;
insert into t1 values (10),(NULL),(NULL),(NULL),(NULL),(NULL); insert into t1 values (10),(NULL),(NULL),(NULL),(NULL),(NULL);
save_master_pos; sync_slave_with_master;
connection slave;
sync_with_master;
select * from t1; select * from t1;
connection master; connection master;
drop table t1,t2; drop table t1,t2;
save_master_pos; sync_slave_with_master;
connection slave;
sync_with_master;
...@@ -743,17 +743,31 @@ double Item_func_round::val() ...@@ -743,17 +743,31 @@ double Item_func_round::val()
double Item_func_rand::val() double Item_func_rand::val()
{ {
THD* thd = current_thd;
if (arg_count) if (arg_count)
{ // Only use argument once in query { // Only use argument once in query
uint32 tmp= (uint32) (args[0]->val_int()); uint32 tmp= (uint32) (args[0]->val_int());
randominit(&current_thd->rand,(uint32) (tmp*0x10001L+55555555L), randominit(&thd->rand,(uint32) (tmp*0x10001L+55555555L),
(uint32) (tmp*0x10000001L)); (uint32) (tmp*0x10000001L));
#ifdef DELETE_ITEMS #ifdef DELETE_ITEMS
delete args[0]; delete args[0];
#endif #endif
arg_count=0; arg_count=0;
} }
return rnd(&current_thd->rand); else if (!thd->rand_used)
{
// no need to send a Rand log event if seed was given eg: RAND(seed),
// as it will be replicated in the query as such.
// save the seed only the first time RAND() is used in the query
// once events are forwarded rather than recreated,
// the following can be skipped if inside the slave thread
thd->rand_used=1;
thd->rand_saved_seed1=thd->rand.seed1;
thd->rand_saved_seed2=thd->rand.seed2;
}
return rnd(&thd->rand);
} }
longlong Item_func_sign::val_int() longlong Item_func_sign::val_int()
......
...@@ -1072,6 +1072,13 @@ bool MYSQL_LOG::write(Log_event* event_info) ...@@ -1072,6 +1072,13 @@ bool MYSQL_LOG::write(Log_event* event_info)
if (e.write(file)) if (e.write(file))
goto err; goto err;
} }
if (thd && thd->rand_used)
{
Rand_log_event e(thd,thd->rand_saved_seed1,thd->rand_saved_seed2);
e.set_log_pos(this);
if (e.write(file))
goto err;
}
if (thd && thd->variables.convert_set) if (thd && thd->variables.convert_set)
{ {
char buf[1024] = "SET CHARACTER SET "; char buf[1024] = "SET CHARACTER SET ";
......
...@@ -348,6 +348,18 @@ void Intvar_log_event::pack_info(String* packet) ...@@ -348,6 +348,18 @@ void Intvar_log_event::pack_info(String* packet)
net_store_data(packet, tmp.ptr(), tmp.length()); net_store_data(packet, tmp.ptr(), tmp.length());
} }
void Rand_log_event::pack_info(String* packet)
{
char buf1[256], buf[22];
String tmp(buf1, sizeof(buf1), system_charset_info);
tmp.length(0);
tmp.append("randseed1=");
tmp.append(llstr(seed1, buf));
tmp.append(",randseed2=");
tmp.append(llstr(seed2, buf));
net_store_data(packet, tmp.ptr(), tmp.length());
}
void Slave_log_event::pack_info(String* packet) void Slave_log_event::pack_info(String* packet)
{ {
char buf1[256], buf[22], *end; char buf1[256], buf[22], *end;
...@@ -376,6 +388,9 @@ void Log_event::init_show_field_list(List<Item>* field_list) ...@@ -376,6 +388,9 @@ void Log_event::init_show_field_list(List<Item>* field_list)
field_list->push_back(new Item_empty_string("Info", 20)); field_list->push_back(new Item_empty_string("Info", 20));
} }
/*
* only called by SHOW BINLOG EVENTS
*/
int Log_event::net_send(THD* thd, const char* log_name, my_off_t pos) int Log_event::net_send(THD* thd, const char* log_name, my_off_t pos)
{ {
String* packet = &thd->packet; String* packet = &thd->packet;
...@@ -610,6 +625,9 @@ Log_event* Log_event::read_log_event(const char* buf, int event_len, ...@@ -610,6 +625,9 @@ Log_event* Log_event::read_log_event(const char* buf, int event_len,
case INTVAR_EVENT: case INTVAR_EVENT:
ev = new Intvar_log_event(buf, old_format); ev = new Intvar_log_event(buf, old_format);
break; break;
case RAND_EVENT:
ev = new Rand_log_event(buf, old_format);
break;
default: default:
break; break;
} }
...@@ -915,6 +933,41 @@ void Intvar_log_event::print(FILE* file, bool short_form, char* last_db) ...@@ -915,6 +933,41 @@ void Intvar_log_event::print(FILE* file, bool short_form, char* last_db)
} }
#endif #endif
/*****************************************************************************
*
* Rand log event
*
****************************************************************************/
Rand_log_event::Rand_log_event(const char* buf, bool old_format)
:Log_event(buf, old_format)
{
buf += (old_format) ? OLD_HEADER_LEN : LOG_EVENT_HEADER_LEN;
seed1 = uint8korr(buf+RAND_SEED1_OFFSET);
seed2 = uint8korr(buf+RAND_SEED2_OFFSET);
}
int Rand_log_event::write_data(IO_CACHE* file)
{
char buf[16];
int8store(buf + RAND_SEED1_OFFSET, seed1);
int8store(buf + RAND_SEED2_OFFSET, seed2);
return my_b_safe_write(file, (byte*) buf, sizeof(buf));
}
#ifdef MYSQL_CLIENT
void Rand_log_event::print(FILE* file, bool short_form, char* last_db)
{
char llbuff[22];
if (!short_form)
{
print_header(file);
fprintf(file, "\tRand\n");
}
fprintf(file, "SET RAND SEED1=%s;\n", llstr(seed1, llbuff));
fprintf(file, "SET RAND SEED2=%s;\n", llstr(seed2, llbuff));
fflush(file);
}
#endif
int Load_log_event::write_data_header(IO_CACHE* file) int Load_log_event::write_data_header(IO_CACHE* file)
{ {
...@@ -1926,6 +1979,14 @@ int Intvar_log_event::exec_event(struct st_relay_log_info* rli) ...@@ -1926,6 +1979,14 @@ int Intvar_log_event::exec_event(struct st_relay_log_info* rli)
return 0; return 0;
} }
int Rand_log_event::exec_event(struct st_relay_log_info* rli)
{
thd->rand.seed1 = seed1;
thd->rand.seed2 = seed2;
rli->inc_pending(get_event_len());
return 0;
}
int Slave_log_event::exec_event(struct st_relay_log_info* rli) int Slave_log_event::exec_event(struct st_relay_log_info* rli)
{ {
if (mysql_bin_log.is_open()) if (mysql_bin_log.is_open())
......
...@@ -152,6 +152,11 @@ struct sql_ex_info ...@@ -152,6 +152,11 @@ struct sql_ex_info
#define I_TYPE_OFFSET 0 #define I_TYPE_OFFSET 0
#define I_VAL_OFFSET 1 #define I_VAL_OFFSET 1
/* Rand event post-header */
#define RAND_SEED1_OFFSET 0
#define RAND_SEED2_OFFSET 8
/* Load event post-header */ /* Load event post-header */
#define L_THREAD_ID_OFFSET 0 #define L_THREAD_ID_OFFSET 0
...@@ -199,7 +204,7 @@ enum Log_event_type ...@@ -199,7 +204,7 @@ enum Log_event_type
START_EVENT = 1, QUERY_EVENT =2, STOP_EVENT=3, ROTATE_EVENT = 4, START_EVENT = 1, QUERY_EVENT =2, STOP_EVENT=3, ROTATE_EVENT = 4,
INTVAR_EVENT=5, LOAD_EVENT=6, SLAVE_EVENT=7, CREATE_FILE_EVENT=8, INTVAR_EVENT=5, LOAD_EVENT=6, SLAVE_EVENT=7, CREATE_FILE_EVENT=8,
APPEND_BLOCK_EVENT=9, EXEC_LOAD_EVENT=10, DELETE_FILE_EVENT=11, APPEND_BLOCK_EVENT=9, EXEC_LOAD_EVENT=10, DELETE_FILE_EVENT=11,
NEW_LOAD_EVENT=12 NEW_LOAD_EVENT=12, RAND_EVENT=13
}; };
enum Int_event_type enum Int_event_type
...@@ -497,6 +502,34 @@ public: ...@@ -497,6 +502,34 @@ public:
bool is_valid() { return 1; } bool is_valid() { return 1; }
}; };
/*****************************************************************************
*
* Rand log event class
*
****************************************************************************/
class Rand_log_event: public Log_event
{
public:
ulonglong seed1;
ulonglong seed2;
#ifndef MYSQL_CLIENT
Rand_log_event(THD* thd_arg, ulonglong seed1_arg, ulonglong seed2_arg)
:Log_event(thd_arg),seed1(seed1_arg),seed2(seed2_arg)
{}
void pack_info(String* packet);
int exec_event(struct st_relay_log_info* rli);
#else
void print(FILE* file, bool short_form = 0, char* last_db = 0);
#endif
Rand_log_event(const char* buf, bool old_format);
~Rand_log_event() {}
Log_event_type get_type_code() { return RAND_EVENT;}
int get_data_size() { return sizeof(ulonglong) * 2; }
int write_data(IO_CACHE* file);
bool is_valid() { return 1; }
};
class Stop_log_event: public Log_event class Stop_log_event: public Log_event
{ {
......
...@@ -290,7 +290,7 @@ int segfaulted = 0; // ensure we do not enter SIGSEGV handler twice ...@@ -290,7 +290,7 @@ int segfaulted = 0; // ensure we do not enter SIGSEGV handler twice
*/ */
static bool kill_in_progress=FALSE; static bool kill_in_progress=FALSE;
static struct rand_struct sql_rand; struct rand_struct sql_rand; // used by sql_class.cc:THD::THD()
static int cleanup_done; static int cleanup_done;
static char **defaults_argv; static char **defaults_argv;
char glob_hostname[FN_REFLEN]; char glob_hostname[FN_REFLEN];
...@@ -2416,15 +2416,6 @@ static void create_new_thread(THD *thd) ...@@ -2416,15 +2416,6 @@ static void create_new_thread(THD *thd)
for (uint i=0; i < 8 ; i++) // Generate password teststring for (uint i=0; i < 8 ; i++) // Generate password teststring
thd->scramble[i]= (char) (rnd(&sql_rand)*94+33); thd->scramble[i]= (char) (rnd(&sql_rand)*94+33);
thd->scramble[8]=0; thd->scramble[8]=0;
/*
We need good random number initialization for new thread
Just coping global one will not work
*/
{
ulong tmp=(ulong) (rnd(&sql_rand) * 3000000);
randominit(&(thd->rand), tmp + (ulong) start_time,
tmp + (ulong) thread_id);
}
thd->real_id=pthread_self(); // Keep purify happy thd->real_id=pthread_self(); // Keep purify happy
/* Start a new thread to handle connection */ /* Start a new thread to handle connection */
......
...@@ -37,6 +37,8 @@ ...@@ -37,6 +37,8 @@
#include <mysys_err.h> #include <mysys_err.h>
#include <assert.h> #include <assert.h>
extern struct rand_struct sql_rand;
/***************************************************************************** /*****************************************************************************
** Instansiate templates ** Instansiate templates
*****************************************************************************/ *****************************************************************************/
...@@ -79,7 +81,7 @@ static void free_var(user_var_entry *entry) ...@@ -79,7 +81,7 @@ static void free_var(user_var_entry *entry)
THD::THD():user_time(0), fatal_error(0), THD::THD():user_time(0), fatal_error(0),
last_insert_id_used(0), last_insert_id_used(0),
insert_id_used(0), in_lock_tables(0), insert_id_used(0), rand_used(0), in_lock_tables(0),
global_read_lock(0), bootstrap(0) global_read_lock(0), bootstrap(0)
{ {
host=user=priv_user=db=query=ip=0; host=user=priv_user=db=query=ip=0;
...@@ -172,6 +174,18 @@ THD::THD():user_time(0), fatal_error(0), ...@@ -172,6 +174,18 @@ THD::THD():user_time(0), fatal_error(0),
transaction.trans_log.end_of_file= max_binlog_cache_size; transaction.trans_log.end_of_file= max_binlog_cache_size;
} }
#endif #endif
/*
We need good random number initialization for new thread
Just coping global one will not work
*/
{
pthread_mutex_lock(&LOCK_thread_count);
ulong tmp=(ulong) (rnd(&sql_rand) * 3000000);
randominit(&rand, tmp + (ulong) start_time,
tmp + (ulong) thread_id);
pthread_mutex_unlock(&LOCK_thread_count);
}
} }
/* Do operations that may take a long time */ /* Do operations that may take a long time */
......
...@@ -501,7 +501,8 @@ public: ...@@ -501,7 +501,8 @@ public:
bool set_query_id,locked,count_cuted_fields,some_tables_deleted; bool set_query_id,locked,count_cuted_fields,some_tables_deleted;
bool no_errors, allow_sum_func, password; bool no_errors, allow_sum_func, password;
bool fatal_error; bool fatal_error;
bool query_start_used,last_insert_id_used,insert_id_used; bool query_start_used,last_insert_id_used,insert_id_used,rand_used;
ulonglong rand_saved_seed1, rand_saved_seed2;
bool system_thread,in_lock_tables,global_read_lock; bool system_thread,in_lock_tables,global_read_lock;
bool query_error, bootstrap, cleanup_done; bool query_error, bootstrap, cleanup_done;
bool safe_to_cache_query; bool safe_to_cache_query;
......
...@@ -2912,6 +2912,7 @@ mysql_init_query(THD *thd) ...@@ -2912,6 +2912,7 @@ mysql_init_query(THD *thd)
thd->total_warn_count=0; // Warnings for this query thd->total_warn_count=0; // Warnings for this query
thd->last_insert_id_used= thd->query_start_used= thd->insert_id_used=0; thd->last_insert_id_used= thd->query_start_used= thd->insert_id_used=0;
thd->sent_row_count= thd->examined_row_count= 0; thd->sent_row_count= thd->examined_row_count= 0;
thd->rand_used=0;
thd->safe_to_cache_query= 1; thd->safe_to_cache_query= 1;
thd->lex.param_list.empty(); thd->lex.param_list.empty();
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
......
...@@ -1423,6 +1423,20 @@ opt_to: ...@@ -1423,6 +1423,20 @@ opt_to:
| AS {}; | AS {};
slave: slave:
START_SYM SLAVE slave_thread_opts
{
LEX *lex=Lex;
lex->sql_command = SQLCOM_SLAVE_START;
lex->type = 0;
}
|
STOP_SYM SLAVE slave_thread_opts
{
LEX *lex=Lex;
lex->sql_command = SQLCOM_SLAVE_STOP;
lex->type = 0;
};
|
SLAVE START_SYM slave_thread_opts SLAVE START_SYM slave_thread_opts
{ {
LEX *lex=Lex; LEX *lex=Lex;
...@@ -2971,7 +2985,7 @@ show_param: ...@@ -2971,7 +2985,7 @@ show_param:
Lex->mi.pos = $12; Lex->mi.pos = $12;
Lex->mi.server_id = $16; Lex->mi.server_id = $16;
} }
| MASTER_SYM LOGS_SYM | BINARY LOGS_SYM
{ {
Lex->sql_command = SQLCOM_SHOW_BINLOGS; Lex->sql_command = SQLCOM_SHOW_BINLOGS;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment