mirror of
https://github.com/MariaDB/server.git
synced 2025-01-24 07:44:22 +01:00
d364bf85bc
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. mysql-test/r/rpl_loaddata2.result: Cleanup mysql-test/r/rpl_redirect.result: Cleanup mysql-test/r/rpl_slave_status.result: Cleanup mysql-test/t/rpl_LD_INFILE.test: Most rpl tests need to execute sync_slave_with_master to ensure that cleanup is done on slave mysql-test/t/rpl_drop_temp.test: Most rpl tests need to execute sync_slave_with_master to ensure that cleanup is done on slave mysql-test/t/rpl_ignore_table.test: Most rpl tests need to execute sync_slave_with_master to ensure that cleanup is done on slave mysql-test/t/rpl_loaddata2.test: Most rpl tests need to execute sync_slave_with_master to ensure that cleanup is done on slave mysql-test/t/rpl_loaddata_m.test: Most rpl tests need to execute sync_slave_with_master to ensure that cleanup is done on slave mysql-test/t/rpl_loaddata_s.test: Most rpl tests need to execute sync_slave_with_master to ensure that cleanup is done on slave mysql-test/t/rpl_loadfile.test: Most rpl tests need to execute sync_slave_with_master to ensure that cleanup is done on slave mysql-test/t/rpl_multi_update4.test: Most rpl tests need to execute sync_slave_with_master to ensure that cleanup is done on slave mysql-test/t/rpl_ndb_basic.test: Most rpl tests need to execute sync_slave_with_master to ensure that cleanup is done on slave mysql-test/t/rpl_redirect.test: Most rpl tests need to execute sync_slave_with_master to ensure that cleanup is done on slave mysql-test/t/rpl_row_func001.test: Most rpl tests need to execute sync_slave_with_master to ensure that cleanup is done on slave mysql-test/t/rpl_row_func002.test: Most rpl tests need to execute sync_slave_with_master to ensure that cleanup is done on slave mysql-test/t/rpl_row_sp001.test: Most rpl tests need to execute sync_slave_with_master to ensure that cleanup is done on slave mysql-test/t/rpl_row_sp005.test: Most rpl tests need to execute sync_slave_with_master to ensure that cleanup is done on slave mysql-test/t/rpl_row_sp008.test: Most rpl tests need to execute sync_slave_with_master to ensure that cleanup is done on slave mysql-test/t/rpl_row_sp009.test: Most rpl tests need to execute sync_slave_with_master to ensure that cleanup is done on slave mysql-test/t/rpl_row_sp010.test: Most rpl tests need to execute sync_slave_with_master to ensure that cleanup is done on slave mysql-test/t/rpl_row_sp011.test: Most rpl tests need to execute sync_slave_with_master to ensure that cleanup is done on slave mysql-test/t/rpl_row_sp012.test: Most rpl tests need to execute sync_slave_with_master to ensure that cleanup is done on slave mysql-test/t/rpl_row_trig001.test: Most rpl tests need to execute sync_slave_with_master to ensure that cleanup is done on slave mysql-test/t/rpl_row_trig002.test: Most rpl tests need to execute sync_slave_with_master to ensure that cleanup is done on slave mysql-test/t/rpl_skip_error.test: Most rpl tests need to execute sync_slave_with_master to ensure that cleanup is done on slave mysql-test/t/rpl_slave_status.test: Most rpl tests need to execute sync_slave_with_master to ensure that cleanup is done on slave mysql-test/t/rpl_sp.test: Most rpl tests need to execute sync_slave_with_master to ensure that cleanup is done on slave mysql-test/t/rpl_sp004.test: Most rpl tests need to execute sync_slave_with_master to ensure that cleanup is done on slave
147 lines
4 KiB
Text
147 lines
4 KiB
Text
--source include/have_ndb.inc
|
|
--source include/have_binlog_format_row.inc
|
|
--source include/master-slave.inc
|
|
|
|
|
|
|
|
#
|
|
# Bug #11087
|
|
#
|
|
# connect to the master and create tabe t1 in gotoslave database
|
|
--connection master
|
|
CREATE TABLE `t1` ( `nid` int(11) NOT NULL default '0',
|
|
`nom` char(4) default NULL,
|
|
`prenom` char(4) default NULL,
|
|
PRIMARY KEY (`nid`))
|
|
ENGINE=ndbcluster DEFAULT CHARSET=latin1;
|
|
|
|
INSERT INTO t1 VALUES(1,"XYZ1","ABC1");
|
|
select * from t1 order by nid;
|
|
|
|
--sync_slave_with_master
|
|
# connect to slave and ensure data it there.
|
|
--connection slave
|
|
select * from t1 order by nid;
|
|
|
|
--connection master
|
|
delete from t1;
|
|
INSERT INTO t1 VALUES(1,"XYZ2","ABC2");
|
|
# Make sure all rows are on the master
|
|
select * from t1 order by nid;
|
|
|
|
# make sure all rows are on the slave.
|
|
--sync_slave_with_master
|
|
--connection slave
|
|
# Bug #11087 would have row with nid 2 missing
|
|
select * from t1 order by nid;
|
|
|
|
--connection master
|
|
DROP table t1;
|
|
|
|
#
|
|
# Test replication of table with no primary key
|
|
#
|
|
--connection master
|
|
CREATE TABLE `t1` ( `nid` int(11) NOT NULL default '0',
|
|
`nom` char(4) default NULL,
|
|
`prenom` char(4) default NULL)
|
|
ENGINE=ndbcluster DEFAULT CHARSET=latin1;
|
|
|
|
INSERT INTO t1 VALUES(1,"XYZ1","ABC1"),(2,"AAA","BBB"),(3,"CCC","DDD");
|
|
select * from t1 order by nid;
|
|
|
|
--sync_slave_with_master
|
|
# connect to slave and ensure data it there.
|
|
--connection slave
|
|
select * from t1 order by nid;
|
|
|
|
--connection master
|
|
delete from t1 where nid = 2;
|
|
INSERT INTO t1 VALUES(4,"EEE","FFF");
|
|
# Make sure all rows are on the master
|
|
select * from t1 order by nid;
|
|
|
|
# make sure all rows are on the slave.
|
|
--sync_slave_with_master
|
|
--connection slave
|
|
select * from t1 order by nid;
|
|
|
|
--connection master
|
|
UPDATE t1 set nid=nid+1;
|
|
UPDATE t1 set nom="CCP" where nid = 4;
|
|
select * from t1 order by nid;
|
|
|
|
# make sure all rows are on the slave.
|
|
--sync_slave_with_master
|
|
--connection slave
|
|
select * from t1 order by nid;
|
|
|
|
--connection master
|
|
DROP table t1;
|
|
|
|
##################################################################
|
|
#
|
|
# Check that retries are made on the slave on some temporary errors
|
|
#
|
|
|
|
#
|
|
# 1. Deadlock
|
|
#
|
|
--connection master
|
|
CREATE TABLE `t1` ( `nid` int(11) NOT NULL default '0',
|
|
`nom` char(4) default NULL,
|
|
`prenom` char(4) default NULL,
|
|
PRIMARY KEY USING HASH (`nid`))
|
|
ENGINE=ndbcluster DEFAULT CHARSET=latin1;
|
|
INSERT INTO t1 VALUES(1,"XYZ1","ABC1");
|
|
|
|
# cause a lock on that row on the slave
|
|
--sync_slave_with_master
|
|
--connection slave
|
|
BEGIN;
|
|
UPDATE t1 SET `nom`="LOCK" WHERE `nid`=1;
|
|
|
|
# set number of retries low so we fail the retries
|
|
set GLOBAL slave_transaction_retries=1;
|
|
|
|
# now do a change to this row on the master
|
|
# will deadlock on the slave because of lock above
|
|
--connection master
|
|
UPDATE t1 SET `nom`="DEAD" WHERE `nid`=1;
|
|
|
|
# wait for deadlock to be detected
|
|
# sleep longer than dead lock detection timeout in config
|
|
# we do this 2 times, once with few retries to verify that we
|
|
# get a failure with the set sleep, and once with the _same_
|
|
# sleep, but with more retries to get it to succeed
|
|
--sleep 5
|
|
|
|
# replication should have stopped, since max retries where not enough
|
|
# verify with show slave status
|
|
--connection slave
|
|
--replace_result $MASTER_MYPORT MASTER_PORT
|
|
--replace_column 1 <Slave_IO_State> 7 <Read_Master_Log_Pos> 8 <Relay_Log_File> 9 <Relay_Log_Pos> 16 <Replicate_Ignore_Table> 22 <Exec_Master_Log_Pos> 23 <Relay_Log_Space> 33 <Seconds_Behind_Master>
|
|
SHOW SLAVE STATUS;
|
|
|
|
# now set max retries high enough to succeed, and start slave again
|
|
set GLOBAL slave_transaction_retries=10;
|
|
START SLAVE;
|
|
|
|
# wait for deadlock to be detected and retried
|
|
# should be the same sleep as above for test to be valid
|
|
--sleep 5
|
|
|
|
# commit transaction to release lock on row and let replication succeed
|
|
select * from t1 order by nid;
|
|
COMMIT;
|
|
|
|
# verify that the row succeded to be applied on the slave
|
|
--connection master
|
|
--sync_slave_with_master
|
|
--connection slave
|
|
select * from t1 order by nid;
|
|
|
|
# cleanup
|
|
--connection master
|
|
DROP TABLE t1;
|
|
sync_slave_with_master;
|