mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
Some of the test cases reference to binlog position and these position numbers are written into result explicitly. It is difficult to maintain if log event format changes. There are a couple of cases explicit position number appears, we handle them in different ways A. 'CHANGE MASTER ...' with MASTER_LOG_POS or/and RELAY_LOG_POS options Use --replace_result to mask them. B. 'SHOW BINLOG EVENT ...' Replaced by show_binlog_events.inc or wait_for_binlog_event.inc. show_binlog_events.inc file's function is enhanced by given $binlog_file and $binlog_limit. C. 'SHOW SLAVE STATUS', 'show_slave_status.inc' and 'show_slave_status2.inc' For the test cases just care a few items in the result of 'SHOW SLAVE STATUS', only the items related to each test case are showed. 'show_slave_status.inc' is rebuild, only the given items in $status_items will be showed. 'check_slave_is_running.inc' and 'check_slave_no_error.inc' and 'check_slave_param.inc' are auxiliary files helping to show running status and error information easily.
112 lines
2.1 KiB
Plaintext
112 lines
2.1 KiB
Plaintext
stop slave;
|
|
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
|
reset master;
|
|
reset slave;
|
|
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
|
start slave;
|
|
*** Prepare tables and data ***
|
|
CREATE TABLE t1 (a INT NOT NULL, KEY(a)) ENGINE=innodb;
|
|
CREATE TABLE t2 (a INT) ENGINE=innodb;
|
|
CREATE TABLE t3 (a INT NOT NULL, KEY(a)) ENGINE=innodb;
|
|
SHOW CREATE TABLE t1;
|
|
Table Create Table
|
|
t1 CREATE TABLE `t1` (
|
|
`a` int(11) NOT NULL,
|
|
KEY `a` (`a`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
|
SHOW CREATE TABLE t2;
|
|
Table Create Table
|
|
t2 CREATE TABLE `t2` (
|
|
`a` int(11) DEFAULT NULL
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
|
SHOW CREATE TABLE t3;
|
|
Table Create Table
|
|
t3 CREATE TABLE `t3` (
|
|
`a` int(11) NOT NULL,
|
|
KEY `a` (`a`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
|
SHOW VARIABLES LIKE 'slave_transaction_retries';
|
|
Variable_name Value
|
|
slave_transaction_retries 2
|
|
include/stop_slave.inc
|
|
BEGIN;
|
|
INSERT INTO t1 VALUES (1);
|
|
INSERT INTO t2 VALUES (2), (2), (2), (2), (2), (2), (2), (2), (2), (2);
|
|
INSERT INTO t3 VALUES (3);
|
|
COMMIT;
|
|
|
|
*** Test deadlock ***
|
|
BEGIN;
|
|
SELECT * FROM t1 FOR UPDATE;
|
|
a
|
|
START SLAVE;
|
|
SELECT COUNT(*) FROM t2;
|
|
COUNT(*)
|
|
0
|
|
COMMIT;
|
|
SELECT * FROM t1;
|
|
a
|
|
1
|
|
SELECT * FROM t3;
|
|
a
|
|
3
|
|
Checking that both slave threads are running.
|
|
|
|
*** Test lock wait timeout ***
|
|
include/stop_slave.inc
|
|
DELETE FROM t2;
|
|
CHANGE MASTER TO MASTER_LOG_POS=MASTER_POS_BEGIN;
|
|
BEGIN;
|
|
SELECT * FROM t1 FOR UPDATE;
|
|
a
|
|
1
|
|
START SLAVE;
|
|
SELECT COUNT(*) FROM t2;
|
|
COUNT(*)
|
|
0
|
|
COMMIT;
|
|
include/start_slave.inc
|
|
SELECT * FROM t1;
|
|
a
|
|
1
|
|
1
|
|
SELECT * FROM t3;
|
|
a
|
|
3
|
|
3
|
|
Checking that both slave threads are running.
|
|
|
|
*** Test lock wait timeout and purged relay logs ***
|
|
SET @my_max_relay_log_size= @@global.max_relay_log_size;
|
|
SET global max_relay_log_size=0;
|
|
include/stop_slave.inc
|
|
DELETE FROM t2;
|
|
CHANGE MASTER TO MASTER_LOG_POS=MASTER_POS_BEGIN;
|
|
BEGIN;
|
|
SELECT * FROM t1 FOR UPDATE;
|
|
a
|
|
1
|
|
1
|
|
START SLAVE;
|
|
SELECT COUNT(*) FROM t2;
|
|
COUNT(*)
|
|
0
|
|
COMMIT;
|
|
include/start_slave.inc
|
|
SELECT * FROM t1;
|
|
a
|
|
1
|
|
1
|
|
1
|
|
SELECT * FROM t3;
|
|
a
|
|
3
|
|
3
|
|
3
|
|
Checking that both slave threads are running.
|
|
|
|
*** Clean up ***
|
|
DROP TABLE t1,t2,t3;
|
|
SET global max_relay_log_size= @my_max_relay_log_size;
|
|
End of 5.1 tests
|