include/master-slave.inc [connection master] call mtr.add_suppression('Slave can not handle replication events with the checksum that master is configured to log'); call mtr.add_suppression('Replication event checksum verification failed'); call mtr.add_suppression('Relay log write failure: could not queue event from master'); call mtr.add_suppression('Master is configured to log replication events with checksum, but will not send such events to slaves that cannot process them'); set @master_save_binlog_checksum= @@global.binlog_checksum; set @save_master_verify_checksum = @@global.master_verify_checksum; select @@global.binlog_checksum as 'must be CRC32 because of the command line option'; must be CRC32 because of the command line option CRC32 select @@session.binlog_checksum as 'no session var'; ERROR HY000: Variable 'binlog_checksum' is a GLOBAL variable select @@global.master_verify_checksum as 'must be zero because of default'; must be zero because of default 0 select @@session.master_verify_checksum as 'no session var'; ERROR HY000: Variable 'master_verify_checksum' is a GLOBAL variable set @slave_save_binlog_checksum= @@global.binlog_checksum; set @save_slave_sql_verify_checksum = @@global.slave_sql_verify_checksum; select @@global.slave_sql_verify_checksum as 'must be one because of default'; must be one because of default 1 select @@session.slave_sql_verify_checksum as 'no session var'; ERROR HY000: Variable 'slave_sql_verify_checksum' is a GLOBAL variable show binary logs; Log_name File_size master-bin.000001 # set @@global.binlog_checksum = NONE; select @@global.binlog_checksum; @@global.binlog_checksum NONE *** must be rotations seen *** show binary logs; Log_name File_size master-bin.000001 # master-bin.000002 # set @@global.binlog_checksum = default; select @@global.binlog_checksum; @@global.binlog_checksum NONE set @@global.binlog_checksum = CRC32; select @@global.binlog_checksum; @@global.binlog_checksum CRC32 set @@global.binlog_checksum = CRC32; set @@global.master_verify_checksum = 0; set @@global.master_verify_checksum = default; set @@global.binlog_checksum = ADLER32; ERROR 42000: Variable 'binlog_checksum' can't be set to the value of 'ADLER32' set @@global.master_verify_checksum = 2; ERROR 42000: Variable 'master_verify_checksum' can't be set to the value of '2' set @@global.slave_sql_verify_checksum = 0; set @@global.slave_sql_verify_checksum = default; set @@global.slave_sql_verify_checksum = 2; ERROR 42000: Variable 'slave_sql_verify_checksum' can't be set to the value of '2' set @@global.binlog_checksum = NONE; create table t1 (a int); flush logs; flush logs; flush logs; flush logs; flush logs; flush logs; select count(*) as zero from t1; zero 0 include/stop_slave.inc set @@global.binlog_checksum = CRC32; insert into t1 values (1) /* will not be applied on slave due to simulation */; set @@global.debug_dbug='d,simulate_slave_unaware_checksum'; start slave; include/wait_for_slave_io_error.inc [errno=1236] Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'Slave can not handle replication events with the checksum that master is configured to log; the first event 'master-bin.000009' at 368, the last event read from 'master-bin.000010' at 4, the last byte read from 'master-bin.000010' at 249.'' select count(*) as zero from t1; zero 0 set @@global.debug_dbug=''; include/start_slave.inc set @@global.master_verify_checksum = 1; set @@session.debug_dbug='d,simulate_checksum_test_failure'; show binlog events; ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error set @@session.debug_dbug=''; set @@global.master_verify_checksum = default; include/stop_slave.inc create table t2 (a int); set @@global.debug_dbug='d,simulate_checksum_test_failure'; start slave io_thread; include/wait_for_slave_io_error.inc [errno=1595,1913] set @@global.debug_dbug=''; start slave io_thread; include/wait_for_slave_param.inc [Read_Master_Log_Pos] set @@global.slave_sql_verify_checksum = 1; set @@global.debug_dbug='d,simulate_checksum_test_failure'; start slave sql_thread; include/wait_for_slave_sql_error.inc [errno=1593] Last_SQL_Error = 'Error initializing relay log position: I/O error reading event at position 4' set @@global.debug_dbug=''; include/start_slave.inc select count(*) as 'must be zero' from t2; must be zero 0 stop slave; reset slave; set @@global.binlog_checksum= IF(floor((rand()*1000)%2), "CRC32", "NONE"); flush logs; set @@global.binlog_checksum= CRC32; reset master; flush logs; create table t3 (a int, b char(5)); include/start_slave.inc select count(*) as 'must be zero' from t3; must be zero 0 include/stop_slave.inc change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root'; flush logs; reset master; insert into t3 value (1, @@global.binlog_checksum); include/start_slave.inc flush logs; select count(*) as 'must be one' from t3; must be one 1 set @@global.binlog_checksum= IF(floor((rand()*1000)%2), "CRC32", "NONE"); insert into t3 value (1, @@global.binlog_checksum); drop table t1, t2, t3; set @@global.binlog_checksum = @master_save_binlog_checksum; set @@global.master_verify_checksum = @save_master_verify_checksum; *** Bug#59123 / MDEV-5799: INCIDENT_EVENT checksum written to error log as garbage characters *** CREATE TABLE t4 (a INT PRIMARY KEY); INSERT INTO t4 VALUES (1); SET sql_log_bin=0; CALL mtr.add_suppression("\\[ERROR\\] Can't generate a unique log-filename"); SET sql_log_bin=1; SET @old_dbug= @@GLOBAL.debug_dbug; SET debug_dbug= '+d,binlog_inject_new_name_error'; FLUSH LOGS; ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) SET debug_dbug= @old_dbug; INSERT INTO t4 VALUES (2); include/wait_for_slave_sql_error.inc [errno=1590] Last_SQL_Error = 'The incident LOST_EVENTS occured on the master. Message: error writing to the binary log' FOUND /Slave SQL: The incident LOST_EVENTS occured on the master\. Message: error writing to the binary log, Internal MariaDB error code: 1590/ in mysqld.2.err SELECT * FROM t4 ORDER BY a; a 1 STOP SLAVE IO_THREAD; SET sql_slave_skip_counter= 1; include/start_slave.inc SELECT * FROM t4 ORDER BY a; a 1 2 set @@global.binlog_checksum = @slave_save_binlog_checksum; set @@global.slave_sql_verify_checksum = @save_slave_sql_verify_checksum; End of tests DROP TABLE t4; include/rpl_end.inc