mirror of
https://github.com/MariaDB/server.git
synced 2025-12-03 05:41:09 +03:00
Adding an event that can be used to denote that an incident occured on the master. The event can be used to denote a gap in the replication stream, but can also be used to denote other incidents. In addition, the injector interface is extended with functions to generate an incident event. The function will also rotate the binary log after generating an incident event to get a fresh binary log.
48 lines
1.2 KiB
Plaintext
48 lines
1.2 KiB
Plaintext
--source include/master-slave.inc
|
|
--source include/have_debug.inc
|
|
|
|
--echo **** On Master ****
|
|
CREATE TABLE t1 (a INT);
|
|
|
|
INSERT INTO t1 VALUES (1),(2),(3);
|
|
SELECT * FROM t1;
|
|
|
|
SET @saved = @@debug;
|
|
SET SESSION debug="d,incident_database_resync_on_replace";
|
|
|
|
# This will generate an incident log event and store it in the binary
|
|
# log before the replace statement.
|
|
REPLACE INTO t1 VALUES (4);
|
|
SET SESSION debug=@saved;
|
|
--save_master_pos
|
|
SELECT * FROM t1;
|
|
|
|
connection slave;
|
|
--wait_for_slave_to_stop
|
|
|
|
# The 4 should not be inserted into the table, since the incident log
|
|
# event should have stop the slave.
|
|
--echo **** On Slave ****
|
|
SELECT * FROM t1;
|
|
|
|
--replace_result $MASTER_MYPORT MASTER_PORT
|
|
--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
|
|
--query_vertical SHOW SLAVE STATUS
|
|
|
|
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
|
|
START SLAVE;
|
|
--sync_with_master
|
|
|
|
# Now, we should have inserted the row into the table and the slave
|
|
# should be running. We should also have rotated to a new binary log.
|
|
|
|
SELECT * FROM t1;
|
|
--replace_result $MASTER_MYPORT MASTER_PORT
|
|
--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
|
|
--query_vertical SHOW SLAVE STATUS
|
|
|
|
DROP TABLE t1;
|
|
connection master;
|
|
DROP TABLE t1;
|
|
|