mirror of
https://github.com/MariaDB/server.git
synced 2025-04-26 11:49:09 +03:00
This commit makes replicas crash-safe by default by changing the Using_Gtid value to be Slave_Pos on a fresh slave start and after RESET SLAVE is issued. If the primary server does not support GTIDs (i.e., version < 10), the replica will fall back to Using_Gtid=No on slave start and after RESET SLAVE. The following additional informational messages/warnings are added: 1. When Using_Gtid is automatically changed. That is, if RESET SLAVE reverts Using_Gtid back to Slave_Pos, or Using_Gtid is inferred to No from a CHANGE MASTER TO given with log coordinates without MASTER_USE_GTID. 2. If options are ignored in CHANGE MASTER TO. If CHANGE MASTER TO is given with log coordinates, yet also specifies MASTER_USE_GTID=Slave_Pos, a warning message is given that the log coordinate options are ignored. Additionally, an MTR macro has been added for RESET SLAVE, reset_slave.inc, which provides modes/options for resetting a slave in log coordinate or gtid modes. When in log coordinates mode, the macro will execute CHANGE MASTER TO MASTER_USE_GTID=No after the RESET SLAVE command. When in GTID mode, an extra parameter, reset_slave_keep_gtid_state, can be set to reset or preserve the value of gtid_slave_pos. Reviewed By: =========== Andrei Elkin <andrei.elkin@mariadb.com>
68 lines
2.7 KiB
Plaintext
68 lines
2.7 KiB
Plaintext
include/master-slave.inc
|
|
[connection master]
|
|
connection slave;
|
|
include/stop_slave.inc
|
|
CHANGE MASTER TO MASTER_USE_GTID=NO;
|
|
include/start_slave.inc
|
|
connection master;
|
|
call mtr.add_suppression('Found invalid event in binary log');
|
|
call mtr.add_suppression('Slave I/O: Relay log write failure: could not queue event from master');
|
|
call mtr.add_suppression('event read from binlog did not pass crc check');
|
|
call mtr.add_suppression('Replication event checksum verification failed');
|
|
call mtr.add_suppression('Event crc check failed! Most likely there is event corruption');
|
|
call mtr.add_suppression('Slave SQL: Error initializing relay log position: I/O error reading event at position .*, error.* 1593');
|
|
SET @old_master_verify_checksum = @@master_verify_checksum;
|
|
# 1. Creating test table/data and set corruption position for testing
|
|
connection master;
|
|
* insert/update/delete rows in table t1 *
|
|
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10), c VARCHAR(100));
|
|
include/stop_slave.inc
|
|
# 2. Corruption in master binlog and SHOW BINLOG EVENTS
|
|
SET @saved_dbug = @@global.debug_dbug;
|
|
SET @@global.debug_dbug="d,corrupt_read_log_event_char";
|
|
SHOW BINLOG EVENTS;
|
|
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error
|
|
SET @@global.debug_dbug=@saved_dbug;
|
|
# 3. Master read a corrupted event from binlog and send the error to slave
|
|
SET @@global.debug_dbug="d,corrupt_read_log_event2_set";
|
|
connection slave;
|
|
START SLAVE IO_THREAD;
|
|
include/wait_for_slave_io_error.inc [errno=1236]
|
|
connection master;
|
|
SET @@global.debug_dbug=@saved_dbug;
|
|
# 4. Master read a corrupted event from binlog and send it to slave
|
|
connection master;
|
|
SET GLOBAL master_verify_checksum=0;
|
|
SET @@global.debug_dbug="d,corrupt_read_log_event2_set";
|
|
connection slave;
|
|
START SLAVE IO_THREAD;
|
|
include/wait_for_slave_io_error.inc [errno=1595,1743]
|
|
connection master;
|
|
SET @@global.debug_dbug=@saved_dbug;
|
|
SET GLOBAL master_verify_checksum=1;
|
|
# 5. Slave. Corruption in network
|
|
connection slave;
|
|
SET @saved_dbug_slave = @@GLOBAL.debug_dbug;
|
|
SET @@global.debug_dbug="d,corrupt_queue_event";
|
|
START SLAVE IO_THREAD;
|
|
include/wait_for_slave_io_error.inc [errno=1595,1743]
|
|
SET @@global.debug_dbug=@saved_dbug_slave;
|
|
# 6. Slave. Corruption in relay log
|
|
SET @@global.debug_dbug="d,corrupt_read_log_event_char";
|
|
START SLAVE SQL_THREAD;
|
|
include/wait_for_slave_sql_error.inc [errno=1593]
|
|
SET @@global.debug_dbug=@saved_dbug_slave;
|
|
# 7. Seek diff for tables on master and slave
|
|
connection slave;
|
|
include/start_slave.inc
|
|
connection master;
|
|
connection slave;
|
|
include/diff_tables.inc [master:test.t1, slave:test.t1]
|
|
# 8. Clean up
|
|
connection master;
|
|
set @@global.debug_dbug = @saved_dbug;
|
|
SET GLOBAL master_verify_checksum = @old_master_verify_checksum;
|
|
DROP TABLE t1;
|
|
connection slave;
|
|
include/rpl_end.inc
|