mirror of
https://github.com/MariaDB/server.git
synced 2025-12-13 20:03:16 +03:00
Major replication test framework cleanup. This does the following:
- Ensure that all tests clean up the replication state when they
finish, by making check-testcase check the output of SHOW SLAVE STATUS.
This implies:
- Slave must not be running after test finished. This is good
because it removes the risk for sporadic errors in subsequent
tests when a test forgets to sync correctly.
- Slave SQL and IO errors must be cleared when test ends. This is
good because we will notice if a test gets an unexpected error in
the slave threads near the end.
- We no longer have to clean up before a test starts.
- Ensure that all tests that wait for an error in one of the slave
threads waits for a specific error. It is no longer possible to
source wait_for_slave_[sql|io]_to_stop.inc when there is an error
in one of the slave threads. This is good because:
- If a test expects an error but there is a bug that causes
another error to happen, or if it stops the slave thread without
an error, then we will notice.
- When developing tests, wait_for_*_to_[start|stop].inc will fail
immediately if there is an error in the relevant slave thread.
Before this patch, we had to wait for the timeout.
- Remove duplicated and repeated code for setting up unusual replication
topologies. Now, there is a single file that is capable of setting
up arbitrary topologies (include/rpl_init.inc, but
include/master-slave.inc is still available for the most common
topology). Tests can now end with include/rpl_end.inc, which will clean
up correctly no matter what topology is used. The topology can be
changed with include/rpl_change_topology.inc.
- Improved debug information when tests fail. This includes:
- debug info is printed on all servers configured by include/rpl_init.inc
- User can set $rpl_debug=1, which makes auxiliary replication files
print relevant debug info.
- Improved documentation for all auxiliary replication files. Now they
describe purpose, usage, parameters, and side effects.
- Many small code cleanups:
- Made have_innodb.inc output a sensible error message.
- Moved contents of rpl000017-slave.sh into rpl000017.test
- Added mysqltest variables that expose the current state of
disable_warnings/enable_warnings and friends.
- Too many to list here: see per-file comments for details.
380 lines
9.2 KiB
Plaintext
380 lines
9.2 KiB
Plaintext
include/master-slave.inc
|
|
[connection master]
|
|
|
|
---Setup Section --
|
|
set timestamp=1000000000;
|
|
DROP TABLE IF EXISTS t1,t2,t3;
|
|
CREATE TABLE t1(word VARCHAR(20));
|
|
CREATE TABLE t2(id INT AUTO_INCREMENT NOT NULL PRIMARY KEY);
|
|
CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT);
|
|
|
|
---Test1 check table load --
|
|
SELECT COUNT(*) from t1;
|
|
COUNT(*)
|
|
351
|
|
SELECT COUNT(*) from t2;
|
|
COUNT(*)
|
|
500
|
|
SELECT COUNT(*) from t3;
|
|
COUNT(*)
|
|
500
|
|
SELECT * FROM t1 ORDER BY word LIMIT 5;
|
|
word
|
|
Aarhus
|
|
Aarhus
|
|
Aarhus
|
|
Aarhus
|
|
Aarhus
|
|
SELECT * FROM t2 ORDER BY id LIMIT 5;
|
|
id
|
|
1
|
|
2
|
|
3
|
|
4
|
|
5
|
|
SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5;
|
|
c1 c3 c4 c5
|
|
1 2006-02-22 00:00:00 Tested in Texas 2.2
|
|
2 2006-02-22 00:00:00 Tested in Texas 4.4
|
|
3 2006-02-22 00:00:00 Tested in Texas 6.6
|
|
4 2006-02-22 00:00:00 Tested in Texas 8.8
|
|
5 2006-02-22 00:00:00 Tested in Texas 11
|
|
SELECT COUNT(*) from t1;
|
|
COUNT(*)
|
|
351
|
|
SELECT COUNT(*) from t2;
|
|
COUNT(*)
|
|
500
|
|
SELECT COUNT(*) from t3;
|
|
COUNT(*)
|
|
500
|
|
SELECT * FROM t1 ORDER BY word LIMIT 5;
|
|
word
|
|
Aarhus
|
|
Aarhus
|
|
Aarhus
|
|
Aarhus
|
|
Aarhus
|
|
SELECT * FROM t2 ORDER BY id LIMIT 5;
|
|
id
|
|
1
|
|
2
|
|
3
|
|
4
|
|
5
|
|
SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5;
|
|
c1 c3 c4 c5
|
|
1 2006-02-22 00:00:00 Tested in Texas 2.2
|
|
2 2006-02-22 00:00:00 Tested in Texas 4.4
|
|
3 2006-02-22 00:00:00 Tested in Texas 6.6
|
|
4 2006-02-22 00:00:00 Tested in Texas 8.8
|
|
5 2006-02-22 00:00:00 Tested in Texas 11
|
|
insert into t1 values ("Alas");
|
|
flush logs;
|
|
|
|
--- Test 1 Dump binlog to file --
|
|
|
|
--- Test 1 delete tables, clean master and slave --
|
|
DROP TABLE t1;
|
|
DROP TABLE t2;
|
|
DROP TABLE t3;
|
|
stop slave;
|
|
reset master;
|
|
reset slave;
|
|
start slave;
|
|
|
|
--- Test 1 Load from Dump binlog file --
|
|
|
|
--- Test 1 Check Load Results --
|
|
SELECT COUNT(*) from t1;
|
|
COUNT(*)
|
|
352
|
|
SELECT COUNT(*) from t2;
|
|
COUNT(*)
|
|
500
|
|
SELECT COUNT(*) from t3;
|
|
COUNT(*)
|
|
500
|
|
SELECT * FROM t1 ORDER BY word LIMIT 5;
|
|
word
|
|
Aarhus
|
|
Aarhus
|
|
Aarhus
|
|
Aarhus
|
|
Aarhus
|
|
SELECT * FROM t2 ORDER BY id LIMIT 5;
|
|
id
|
|
1
|
|
2
|
|
3
|
|
4
|
|
5
|
|
SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5;
|
|
c1 c3 c4 c5
|
|
1 2006-02-22 00:00:00 Tested in Texas 2.2
|
|
2 2006-02-22 00:00:00 Tested in Texas 4.4
|
|
3 2006-02-22 00:00:00 Tested in Texas 6.6
|
|
4 2006-02-22 00:00:00 Tested in Texas 8.8
|
|
5 2006-02-22 00:00:00 Tested in Texas 11
|
|
SELECT COUNT(*) from t1;
|
|
COUNT(*)
|
|
352
|
|
SELECT COUNT(*) from t2;
|
|
COUNT(*)
|
|
500
|
|
SELECT COUNT(*) from t3;
|
|
COUNT(*)
|
|
500
|
|
SELECT * FROM t1 ORDER BY word LIMIT 5;
|
|
word
|
|
Aarhus
|
|
Aarhus
|
|
Aarhus
|
|
Aarhus
|
|
Aarhus
|
|
SELECT * FROM t2 ORDER BY id LIMIT 5;
|
|
id
|
|
1
|
|
2
|
|
3
|
|
4
|
|
5
|
|
SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5;
|
|
c1 c3 c4 c5
|
|
1 2006-02-22 00:00:00 Tested in Texas 2.2
|
|
2 2006-02-22 00:00:00 Tested in Texas 4.4
|
|
3 2006-02-22 00:00:00 Tested in Texas 6.6
|
|
4 2006-02-22 00:00:00 Tested in Texas 8.8
|
|
5 2006-02-22 00:00:00 Tested in Texas 11
|
|
|
|
--- Test 2 position test --
|
|
Warning: The option '--position' is deprecated and will be removed in a future release. Please use --start-position instead.
|
|
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
|
|
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
|
|
DELIMITER /*!*/;
|
|
ROLLBACK/*!*/;
|
|
use test/*!*/;
|
|
SET TIMESTAMP=1000000000/*!*/;
|
|
SET @@session.pseudo_thread_id=999999999/*!*/;
|
|
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
|
|
SET @@session.sql_mode=0/*!*/;
|
|
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
|
|
/*!\C latin1 *//*!*/;
|
|
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
|
|
SET @@session.lc_time_names=0/*!*/;
|
|
SET @@session.collation_database=DEFAULT/*!*/;
|
|
CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT)
|
|
/*!*/;
|
|
DELIMITER ;
|
|
# End of log file
|
|
ROLLBACK /* added by mysqlbinlog */;
|
|
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
|
|
|
|
--- Test 3 First Remote test --
|
|
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
|
|
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
|
|
DELIMITER /*!*/;
|
|
ROLLBACK/*!*/;
|
|
use test/*!*/;
|
|
SET TIMESTAMP=1000000000/*!*/;
|
|
SET @@session.pseudo_thread_id=999999999/*!*/;
|
|
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
|
|
SET @@session.sql_mode=0/*!*/;
|
|
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
|
|
/*!\C latin1 *//*!*/;
|
|
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
|
|
SET @@session.lc_time_names=0/*!*/;
|
|
SET @@session.collation_database=DEFAULT/*!*/;
|
|
DROP TABLE IF EXISTS t1,t2,t3
|
|
/*!*/;
|
|
SET TIMESTAMP=1000000000/*!*/;
|
|
CREATE TABLE t1(word VARCHAR(20))
|
|
/*!*/;
|
|
SET TIMESTAMP=1000000000/*!*/;
|
|
CREATE TABLE t2(id INT AUTO_INCREMENT NOT NULL PRIMARY KEY)
|
|
/*!*/;
|
|
SET TIMESTAMP=1000000000/*!*/;
|
|
CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT)
|
|
/*!*/;
|
|
DELIMITER ;
|
|
# End of log file
|
|
ROLLBACK /* added by mysqlbinlog */;
|
|
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
|
|
|
|
--- Test 4 Second Remote test --
|
|
DROP TABLE t1;
|
|
DROP TABLE t2;
|
|
DROP TABLE t3;
|
|
stop slave;
|
|
reset master;
|
|
reset slave;
|
|
start slave;
|
|
SELECT COUNT(*) from t1;
|
|
COUNT(*)
|
|
352
|
|
SELECT COUNT(*) from t2;
|
|
COUNT(*)
|
|
500
|
|
SELECT COUNT(*) from t3;
|
|
COUNT(*)
|
|
500
|
|
SELECT * FROM t1 ORDER BY word LIMIT 5;
|
|
word
|
|
Aarhus
|
|
Aarhus
|
|
Aarhus
|
|
Aarhus
|
|
Aarhus
|
|
SELECT * FROM t2 ORDER BY id LIMIT 5;
|
|
id
|
|
1
|
|
2
|
|
3
|
|
4
|
|
5
|
|
SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5;
|
|
c1 c3 c4 c5
|
|
1 2006-02-22 00:00:00 Tested in Texas 2.2
|
|
2 2006-02-22 00:00:00 Tested in Texas 4.4
|
|
3 2006-02-22 00:00:00 Tested in Texas 6.6
|
|
4 2006-02-22 00:00:00 Tested in Texas 8.8
|
|
5 2006-02-22 00:00:00 Tested in Texas 11
|
|
SELECT COUNT(*) from t1;
|
|
COUNT(*)
|
|
352
|
|
SELECT COUNT(*) from t2;
|
|
COUNT(*)
|
|
500
|
|
SELECT COUNT(*) from t3;
|
|
COUNT(*)
|
|
500
|
|
SELECT * FROM t1 ORDER BY word LIMIT 5;
|
|
word
|
|
Aarhus
|
|
Aarhus
|
|
Aarhus
|
|
Aarhus
|
|
Aarhus
|
|
SELECT * FROM t2 ORDER BY id LIMIT 5;
|
|
id
|
|
1
|
|
2
|
|
3
|
|
4
|
|
5
|
|
SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5;
|
|
c1 c3 c4 c5
|
|
1 2006-02-22 00:00:00 Tested in Texas 2.2
|
|
2 2006-02-22 00:00:00 Tested in Texas 4.4
|
|
3 2006-02-22 00:00:00 Tested in Texas 6.6
|
|
4 2006-02-22 00:00:00 Tested in Texas 8.8
|
|
5 2006-02-22 00:00:00 Tested in Texas 11
|
|
|
|
--- Test 5 LOAD DATA --
|
|
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
|
|
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
|
|
DELIMITER /*!*/;
|
|
DELIMITER ;
|
|
# End of log file
|
|
ROLLBACK /* added by mysqlbinlog */;
|
|
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
|
|
|
|
--- Test 6 reading stdin --
|
|
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
|
|
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
|
|
DELIMITER /*!*/;
|
|
ROLLBACK/*!*/;
|
|
use test/*!*/;
|
|
SET TIMESTAMP=1000000000/*!*/;
|
|
SET @@session.pseudo_thread_id=999999999/*!*/;
|
|
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
|
|
SET @@session.sql_mode=0/*!*/;
|
|
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
|
|
/*!\C latin1 *//*!*/;
|
|
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
|
|
SET @@session.lc_time_names=0/*!*/;
|
|
SET @@session.collation_database=DEFAULT/*!*/;
|
|
DROP TABLE IF EXISTS t1,t2,t3
|
|
/*!*/;
|
|
SET TIMESTAMP=1000000000/*!*/;
|
|
CREATE TABLE t1(word VARCHAR(20))
|
|
/*!*/;
|
|
SET TIMESTAMP=1000000000/*!*/;
|
|
CREATE TABLE t2(id INT AUTO_INCREMENT NOT NULL PRIMARY KEY)
|
|
/*!*/;
|
|
SET TIMESTAMP=1000000000/*!*/;
|
|
CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT)
|
|
/*!*/;
|
|
DELIMITER ;
|
|
# End of log file
|
|
ROLLBACK /* added by mysqlbinlog */;
|
|
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
|
|
|
|
--- Test 7 reading stdin w/position --
|
|
Warning: The option '--position' is deprecated and will be removed in a future release. Please use --start-position instead.
|
|
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
|
|
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
|
|
DELIMITER /*!*/;
|
|
ROLLBACK/*!*/;
|
|
use test/*!*/;
|
|
SET TIMESTAMP=1000000000/*!*/;
|
|
SET @@session.pseudo_thread_id=999999999/*!*/;
|
|
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
|
|
SET @@session.sql_mode=0/*!*/;
|
|
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
|
|
/*!\C latin1 *//*!*/;
|
|
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
|
|
SET @@session.lc_time_names=0/*!*/;
|
|
SET @@session.collation_database=DEFAULT/*!*/;
|
|
CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT)
|
|
/*!*/;
|
|
DELIMITER ;
|
|
# End of log file
|
|
ROLLBACK /* added by mysqlbinlog */;
|
|
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
|
|
|
|
--- Test 8 switch internal charset --
|
|
stop slave;
|
|
reset master;
|
|
reset slave;
|
|
start slave;
|
|
create table t4 (f text character set utf8);
|
|
create table t5 (f text character set cp932);
|
|
flush logs;
|
|
rename table t4 to t04, t5 to t05;
|
|
select HEX(f) from t04;
|
|
HEX(f)
|
|
E382BD
|
|
select HEX(f) from t4;
|
|
HEX(f)
|
|
E382BD
|
|
select HEX(f) from t05;
|
|
HEX(f)
|
|
835C
|
|
select HEX(f) from t5;
|
|
HEX(f)
|
|
835C
|
|
select HEX(f) from t04;
|
|
HEX(f)
|
|
E382BD
|
|
select HEX(f) from t4;
|
|
HEX(f)
|
|
E382BD
|
|
select HEX(f) from t05;
|
|
HEX(f)
|
|
835C
|
|
select HEX(f) from t5;
|
|
HEX(f)
|
|
835C
|
|
|
|
--- Test cleanup --
|
|
DROP TABLE IF EXISTS t1;
|
|
CREATE TABLE t1 (a INT NOT NULL KEY, b INT);
|
|
INSERT INTO t1 VALUES(1,1);
|
|
SELECT * FROM t1;
|
|
a b
|
|
1 1
|
|
FLUSH LOGS;
|
|
DROP TABLE IF EXISTS t1, t2, t3, t04, t05, t4, t5;
|
|
include/rpl_end.inc
|