Commit 11dde18f authored by lars@mysql.com's avatar lars@mysql.com

BUG#17339: Most rpl tests need to execute sync_slave_with_master to ensure...

BUG#17339: Most rpl tests need to execute sync_slave_with_master to ensure that cleanup is done on slave
For this particular bug report it was rpl_loadfile.test that did not make proper cleanup, but the patch
includes fixes for other tests aswell.
parent 004f3990
...@@ -150,3 +150,4 @@ Aberdeen ...@@ -150,3 +150,4 @@ Aberdeen
Abernathy Abernathy
aberrant aberrant
aberration aberration
drop table t1;
...@@ -39,4 +39,3 @@ n ...@@ -39,4 +39,3 @@ n
4 4
5 5
drop table t1; drop table t1;
drop table t1;
...@@ -53,3 +53,4 @@ Master_SSL_Cipher ...@@ -53,3 +53,4 @@ Master_SSL_Cipher
Master_SSL_Key Master_SSL_Key
Seconds_Behind_Master NULL Seconds_Behind_Master NULL
drop table t1; drop table t1;
drop table t1;
...@@ -27,11 +27,12 @@ save_master_pos; ...@@ -27,11 +27,12 @@ save_master_pos;
sync_slave_with_master; sync_slave_with_master;
connection slave; connection slave;
SELECT * FROM test.t1 ORDER BY a DESC; SELECT * FROM test.t1 ORDER BY a DESC;
connection master;
# Lets cleanup
#show binlog events;
# Cleanup
#show binlog events;
connection master;
DROP TABLE test.t1; DROP TABLE test.t1;
sync_slave_with_master;
# End of 5.0 test case # End of 5.0 test case
...@@ -18,7 +18,10 @@ disconnect master; ...@@ -18,7 +18,10 @@ disconnect master;
connection slave; connection slave;
--real_sleep 3 # time for DROP to be written --real_sleep 3 # time for DROP to be written
show status like 'Slave_open_temp_tables'; show status like 'Slave_open_temp_tables';
# Cleanup
connection default; connection default;
drop database mysqltest; drop database mysqltest;
sync_slave_with_master;
# End of 4.1 tests # End of 4.1 tests
...@@ -23,6 +23,8 @@ UPDATE test.t4 NATURAL JOIN test.t1 SET t1.a=5; ...@@ -23,6 +23,8 @@ UPDATE test.t4 NATURAL JOIN test.t1 SET t1.a=5;
sync_slave_with_master; sync_slave_with_master;
SELECT * FROM t4; SELECT * FROM t4;
# Cleanup
connection master; connection master;
DROP TABLE t1; DROP TABLE t1;
DROP TABLE t4; DROP TABLE t4;
sync_slave_with_master;
...@@ -4,11 +4,11 @@ CREATE TABLE t1 (word CHAR(20) NOT NULL); ...@@ -4,11 +4,11 @@ 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;
SELECT * FROM t1 ORDER BY word; SELECT * FROM t1 ORDER BY word;
sync_slave_with_master; sync_slave_with_master;
SELECT * FROM t1 ORDER BY word;
########## # Check
# Change Author: JBM SELECT * FROM t1 ORDER BY word;
# Change Date: 2006-01-16
# Change: Added Order by for NDB
##########
# Cleanup
connection master;
drop table t1;
sync_slave_with_master;
...@@ -42,8 +42,11 @@ SHOW TABLES; ...@@ -42,8 +42,11 @@ SHOW TABLES;
SELECT COUNT(*) FROM mysqltest.t1; SELECT COUNT(*) FROM mysqltest.t1;
#show binlog events; #show binlog events;
# Cleanup
connection master; connection master;
DROP DATABASE mysqltest; DROP DATABASE mysqltest;
DROP TABLE test.t1; DROP TABLE test.t1;
sync_slave_with_master;
# End of test # End of test
...@@ -22,3 +22,8 @@ sync_with_master; ...@@ -22,3 +22,8 @@ sync_with_master;
select count(*) from test.t1; # check that LOAD was replicated select count(*) from test.t1; # check that LOAD was replicated
--replace_column 2 # 5 # --replace_column 2 # 5 #
show binlog events from 102; # should be nothing show binlog events from 102; # should be nothing
# Cleanup
connection master;
drop table test.t1;
sync_slave_with_master;
...@@ -40,8 +40,10 @@ sync_slave_with_master; ...@@ -40,8 +40,10 @@ sync_slave_with_master;
connection slave; connection slave;
SELECT * FROM test.t1 ORDER BY blob_column; SELECT * FROM test.t1 ORDER BY blob_column;
# Lets cleanup # Cleanup
connection master; connection master;
DROP PROCEDURE IF EXISTS test.p1; DROP PROCEDURE IF EXISTS test.p1;
DROP TABLE test.t1; DROP TABLE test.t1;
sync_slave_with_master;
# End of 5.0 test case # End of 5.0 test case
...@@ -15,7 +15,7 @@ connection slave; ...@@ -15,7 +15,7 @@ connection slave;
drop database if exists d2; drop database if exists d2;
--enable_warnings --enable_warnings
### Test ### Do on master
connection master; connection master;
create database d1; # accepted by slave create database d1; # accepted by slave
...@@ -30,15 +30,16 @@ insert into t2 select id + 3 from t1; ...@@ -30,15 +30,16 @@ insert into t2 select id + 3 from t1;
update t1 join t2 using (id) set t1.id = 0; update t1 join t2 using (id) set t1.id = 0;
insert into d1.t0 values (0); # replication works insert into d1.t0 values (0); # replication works
### Check on slave
sync_slave_with_master; sync_slave_with_master;
use d1; use d1;
#connection slave;
select * from t0 where id=0; # must find select * from t0 where id=0; # must find
### Clean-up ### Clean-up
connection master; connection master;
drop database d1; drop database d1;
drop database d2; drop database d2;
sync_slave_with_master;
# End of test # End of test
...@@ -144,3 +144,4 @@ select * from t1 order by nid; ...@@ -144,3 +144,4 @@ select * from t1 order by nid;
# cleanup # cleanup
--connection master --connection master
DROP TABLE t1; DROP TABLE t1;
sync_slave_with_master;
...@@ -38,8 +38,10 @@ disable_rpl_parse; ...@@ -38,8 +38,10 @@ disable_rpl_parse;
SELECT * FROM t1 ORDER BY n; SELECT * FROM t1 ORDER BY n;
connection slave; connection slave;
SELECT * FROM t1 ORDER BY n; SELECT * FROM t1 ORDER BY n;
drop table t1;
# Cleanup
connection master; connection master;
drop table t1; drop table t1;
sync_slave_with_master;
# End of 4.1 tests # End of 4.1 tests
...@@ -48,9 +48,10 @@ connection master; ...@@ -48,9 +48,10 @@ connection master;
#Used for debugging #Used for debugging
#show binlog events; #show binlog events;
# Lets cleanup # Cleanup
DROP FUNCTION test.f1; DROP FUNCTION test.f1;
DROP TABLE test.t1; DROP TABLE test.t1;
sync_slave_with_master;
# End of 5.0 test case # End of 5.0 test case
...@@ -87,10 +87,10 @@ connection master; ...@@ -87,10 +87,10 @@ connection master;
--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > ./var/tmp/func002_master.sql --exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > ./var/tmp/func002_master.sql
--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > ./var/tmp/func002_slave.sql --exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > ./var/tmp/func002_slave.sql
# First lets cleanupi # Cleanup
DROP FUNCTION test.f1; DROP FUNCTION test.f1;
DROP TABLE test.t1; DROP TABLE test.t1;
sync_slave_with_master;
# the test will show that the diff statement failed and no reject file # the test will show that the diff statement failed and no reject file
# will be created. You will need to go to the mysql-test dir and diff # will be created. You will need to go to the mysql-test dir and diff
...@@ -99,6 +99,5 @@ DROP TABLE test.t1; ...@@ -99,6 +99,5 @@ DROP TABLE test.t1;
exec diff ./var/tmp/func002_master.sql ./var/tmp/func002_slave.sql; exec diff ./var/tmp/func002_master.sql ./var/tmp/func002_slave.sql;
# End of 5.0 test case # End of 5.0 test case
...@@ -124,10 +124,12 @@ SELECT * FROM t2 ORDER BY a; ...@@ -124,10 +124,12 @@ SELECT * FROM t2 ORDER BY a;
# First lets cleanup # First lets cleanup
connection master;
DROP PROCEDURE test.p1; DROP PROCEDURE test.p1;
DROP PROCEDURE test.p2; DROP PROCEDURE test.p2;
DROP TABLE test.t1; DROP TABLE test.t1;
DROP TABLE test.t2; DROP TABLE test.t2;
sync_slave_with_master;
# Lets compare. Note: If they match test will pass, if they do not match # Lets compare. Note: If they match test will pass, if they do not match
# the test will show that the diff statement failed and not reject file # the test will show that the diff statement failed and not reject file
......
...@@ -97,10 +97,14 @@ connection master; ...@@ -97,10 +97,14 @@ connection master;
ALTER PROCEDURE test.p1 MODIFIES SQL DATA; ALTER PROCEDURE test.p1 MODIFIES SQL DATA;
#show binlog events; #show binlog events;
# Cleanup
connection master;
DROP PROCEDURE IF EXISTS test.p1; DROP PROCEDURE IF EXISTS test.p1;
DROP PROCEDURE IF EXISTS test.p2; DROP PROCEDURE IF EXISTS test.p2;
DROP TABLE IF EXISTS test.t1; DROP TABLE IF EXISTS test.t1;
DROP TABLE IF EXISTS test.t2; DROP TABLE IF EXISTS test.t2;
DROP TABLE IF EXISTS test.t3; DROP TABLE IF EXISTS test.t3;
sync_slave_with_master;
# End of 5.0 test case # End of 5.0 test case
...@@ -51,8 +51,11 @@ let $VERSION=`select version()`; ...@@ -51,8 +51,11 @@ let $VERSION=`select version()`;
--replace_result $VERSION VERSION --replace_result $VERSION VERSION
show binlog events; show binlog events;
# Cleanup
connection master;
DROP PROCEDURE IF EXISTS test.p1; DROP PROCEDURE IF EXISTS test.p1;
DROP TABLE IF EXISTS test.t1; DROP TABLE IF EXISTS test.t1;
sync_slave_with_master;
# End of 5.0 test case # End of 5.0 test case
...@@ -94,14 +94,12 @@ connection slave; ...@@ -94,14 +94,12 @@ connection slave;
sync_with_master; sync_with_master;
SELECT * FROM test.t2 ORDER BY a; SELECT * FROM test.t2 ORDER BY a;
# Cleanup
connection master; connection master;
#show binlog events; #show binlog events;
# lets cleanup
DROP PROCEDURE test.p1; DROP PROCEDURE test.p1;
DROP TABLE test.t1; DROP TABLE test.t1;
DROP TABLE test.t2; DROP TABLE test.t2;
sync_slave_with_master;
# End of 5.0 test case # End of 5.0 test case
...@@ -66,16 +66,15 @@ connection slave; ...@@ -66,16 +66,15 @@ connection slave;
sync_with_master; sync_with_master;
SELECT * FROM test.t2; SELECT * FROM test.t2;
# Cleanup
connection master; connection master;
#show binlog events; #show binlog events;
# lets cleanup
DROP PROCEDURE IF EXISTS test.p1; DROP PROCEDURE IF EXISTS test.p1;
DROP PROCEDURE IF EXISTS test.p2; DROP PROCEDURE IF EXISTS test.p2;
DROP PROCEDURE IF EXISTS test.p3; DROP PROCEDURE IF EXISTS test.p3;
DROP PROCEDURE IF EXISTS test.p4; DROP PROCEDURE IF EXISTS test.p4;
DROP TABLE IF EXISTS test.t1; DROP TABLE IF EXISTS test.t1;
DROP TABLE IF EXISTS test.t2; DROP TABLE IF EXISTS test.t2;
sync_slave_with_master;
# End of 5.0 test case # End of 5.0 test case
...@@ -78,15 +78,13 @@ CALL test.p1(); ...@@ -78,15 +78,13 @@ CALL test.p1();
#SELECT * FROM test.t2; #SELECT * FROM test.t2;
sync_slave_with_master; sync_slave_with_master;
#SELECT * FROM test.t2; #SELECT * FROM test.t2;
connection master;
#show binlog events;
# lets cleanup
--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > ./var/tmp/sp011_master.sql --exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > ./var/tmp/sp011_master.sql
--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > ./var/tmp/sp011_slave.sql --exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > ./var/tmp/sp011_slave.sql
# Cleanup
connection master;
#show binlog events;
DROP PROCEDURE IF EXISTS test.p1; DROP PROCEDURE IF EXISTS test.p1;
DROP PROCEDURE IF EXISTS test.p2; DROP PROCEDURE IF EXISTS test.p2;
DROP PROCEDURE IF EXISTS test.p3; DROP PROCEDURE IF EXISTS test.p3;
...@@ -96,9 +94,7 @@ DROP PROCEDURE IF EXISTS test.p6; ...@@ -96,9 +94,7 @@ DROP PROCEDURE IF EXISTS test.p6;
DROP PROCEDURE IF EXISTS test.p7; DROP PROCEDURE IF EXISTS test.p7;
DROP TABLE IF EXISTS test.t1; DROP TABLE IF EXISTS test.t1;
DROP TABLE IF EXISTS test.t2; DROP TABLE IF EXISTS test.t2;
sync_slave_with_master;
# First lets cleanup
# Lets compare. Note: If they match test will pass, if they do not match # Lets compare. Note: If they match test will pass, if they do not match
# the test will show that the diff statement failed and not reject file # the test will show that the diff statement failed and not reject file
......
...@@ -61,14 +61,14 @@ SELECT USER(); ...@@ -61,14 +61,14 @@ SELECT USER();
CALL test.p3(); CALL test.p3();
CALL test.p2(); CALL test.p2();
# Cleanup
connection master; connection master;
# lets cleanup
DROP PROCEDURE IF EXISTS test.p1; DROP PROCEDURE IF EXISTS test.p1;
DROP PROCEDURE IF EXISTS test.p3; DROP PROCEDURE IF EXISTS test.p3;
DROP PROCEDURE IF EXISTS test.p2; DROP PROCEDURE IF EXISTS test.p2;
DROP TABLE IF EXISTS test.t1; DROP TABLE IF EXISTS test.t1;
DROP TABLE IF EXISTS test.t2; DROP TABLE IF EXISTS test.t2;
sync_slave_with_master;
# End of 5.0 test case # End of 5.0 test case
...@@ -78,8 +78,8 @@ let $message=<End test section 2 (Tiggers & SP)>; ...@@ -78,8 +78,8 @@ let $message=<End test section 2 (Tiggers & SP)>;
--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > ./var/tmp/trig001_master.sql --exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > ./var/tmp/trig001_master.sql
--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > ./var/tmp/trig001_slave.sql --exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > ./var/tmp/trig001_slave.sql
# First lets cleanup # Cleanup
connection master;
DROP PROCEDURE test.p2; DROP PROCEDURE test.p2;
DROP PROCEDURE test.p3; DROP PROCEDURE test.p3;
DROP TRIGGER test.t2_ai; DROP TRIGGER test.t2_ai;
...@@ -87,6 +87,7 @@ DROP TRIGGER test.t3_bi_t2; ...@@ -87,6 +87,7 @@ DROP TRIGGER test.t3_bi_t2;
DROP TABLE test.t1; DROP TABLE test.t1;
DROP TABLE test.t2; DROP TABLE test.t2;
DROP TABLE test.t3; DROP TABLE test.t3;
sync_slave_with_master;
# Lets compare. Note: If they match test will pass, if they do not match # Lets compare. Note: If they match test will pass, if they do not match
# the test will show that the diff statement failed and not reject file # the test will show that the diff statement failed and not reject file
......
...@@ -67,15 +67,14 @@ save_master_pos; ...@@ -67,15 +67,14 @@ save_master_pos;
connection slave; connection slave;
sync_with_master; sync_with_master;
SELECT * FROM test.t1 ORDER BY id; SELECT * FROM test.t1 ORDER BY id;
connection master;
# Cleanup
connection master;
#show binlog events; #show binlog events;
# cleanup
DROP TRIGGER test.t2_ai; DROP TRIGGER test.t2_ai;
DROP TABLE test.t1; DROP TABLE test.t1;
DROP TABLE test.t2; DROP TABLE test.t2;
DROP TABLE test.t3; DROP TABLE test.t3;
sync_slave_with_master;
# End of 5.0 test case # End of 5.0 test case
########################################## ##########################################
# 2006-02-07 By JBM: Added order by # 2006-02-07 By JBM: Added order by
######################################### #########################################
# Note that errors are ignored by opt file.
source include/master-slave.inc; source include/master-slave.inc;
create table t1 (n int not null primary key); create table t1 (n int not null primary key);
...@@ -9,14 +10,20 @@ connection slave; ...@@ -9,14 +10,20 @@ connection slave;
sync_with_master; sync_with_master;
insert into t1 values (1); insert into t1 values (1);
connection master; connection master;
# Here we expect (ignored) error, since 1 is already in slave table
insert into t1 values (1); insert into t1 values (1);
# These should work fine
insert into t1 values (2),(3); insert into t1 values (2),(3);
save_master_pos; save_master_pos;
connection slave; connection slave;
sync_with_master; sync_with_master;
select * from t1 ORDER BY n; select * from t1 ORDER BY n;
# Cleanup
connection master; connection master;
drop table t1; drop table t1;
sync_with_master; sync_slave_with_master;
# End of 4.1 tests # End of 4.1 tests
# Test case for BUG #10780
--source include/master-slave.inc --source include/master-slave.inc
############################################################################
# Test case for BUG#10780
#
# REQUIREMENT
# A slave without replication privileges should have Slave_IO_Running = No
# 1. Create new replication user
connection master; connection master;
grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl'; grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl';
connection slave; connection slave;
stop slave; stop slave;
change master to master_user='rpl',master_password='rpl'; change master to master_user='rpl',master_password='rpl';
start slave; start slave;
# 2. Do replication as new user
connection master; connection master;
--disable_warnings --disable_warnings
drop table if exists t1; drop table if exists t1;
...@@ -16,12 +26,19 @@ save_master_pos; ...@@ -16,12 +26,19 @@ save_master_pos;
connection slave; connection slave;
sync_with_master; sync_with_master;
select * from t1; select * from t1;
# 3. Delete new replication user
connection master; connection master;
delete from mysql.user where user='rpl'; delete from mysql.user where user='rpl';
flush privileges; flush privileges;
connection slave; connection slave;
# 4. Restart slave without privileges
# (slave.err will contain access denied error for this START SLAVE command)
stop slave; stop slave;
start slave; start slave;
# 5. Make sure Slave_IO_Running = No
--replace_result $MASTER_MYPORT MASTER_MYPORT --replace_result $MASTER_MYPORT MASTER_MYPORT
# Column 1 is replaced, since the output can be either # Column 1 is replaced, since the output can be either
# "Connecting to master" or "Waiting for master update" # "Connecting to master" or "Waiting for master update"
...@@ -29,8 +46,12 @@ start slave; ...@@ -29,8 +46,12 @@ start slave;
--vertical_results --vertical_results
show slave status; show slave status;
# Cleanup (Note that slave IO thread is not running)
connection slave;
drop table t1;
connection master; connection master;
drop table t1; drop table t1;
sync_with_master;
# end of test case for BUG#10780
# end of 4.1 tests # end of 4.1 tests
...@@ -429,17 +429,10 @@ CALL p1('test'); ...@@ -429,17 +429,10 @@ CALL p1('test');
SELECT * FROM t1; SELECT * FROM t1;
sync_slave_with_master; sync_slave_with_master;
connection slave;
SELECT * FROM t1; SELECT * FROM t1;
# Cleanup. # Cleanup
connection master; connection master;
DROP PROCEDURE p1; DROP PROCEDURE p1;
# cleanup
connection master;
drop table t1; drop table t1;
reset master; sync_slave_with_master;
...@@ -75,21 +75,21 @@ sync_with_master; ...@@ -75,21 +75,21 @@ sync_with_master;
SELECT * FROM test.t1; SELECT * FROM test.t1;
SELECT * FROM test.t2; SELECT * FROM test.t2;
#SELECT * FROM test.t3; #SELECT * FROM test.t3;
connection master;
#show binlog events;
# If the test fails, you will need to diff the dumps to see why.
--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > ./var/tmp/sp004_master.sql --exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > ./var/tmp/sp004_master.sql
--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > ./var/tmp/sp004_slave.sql --exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > ./var/tmp/sp004_slave.sql
# Cleanup
connection master;
#show binlog events;
DROP PROCEDURE IF EXISTS test.p1; DROP PROCEDURE IF EXISTS test.p1;
DROP PROCEDURE IF EXISTS test.p2; DROP PROCEDURE IF EXISTS test.p2;
DROP TABLE IF EXISTS test.t1; DROP TABLE IF EXISTS test.t1;
DROP TABLE IF EXISTS test.t2; DROP TABLE IF EXISTS test.t2;
DROP TABLE IF EXISTS test.t3; DROP TABLE IF EXISTS test.t3;
#sync_slave_with_master; sync_slave_with_master;
# If the test fails, you will need to diff the dumps to see why.
-- exec diff ./var/tmp/sp004_master.sql ./var/tmp/sp004_slave.sql -- exec diff ./var/tmp/sp004_master.sql ./var/tmp/sp004_slave.sql
......
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