| 1 |
include/master-slave.inc |
| 2 |
[connection master] |
| 3 |
connection slave; |
| 4 |
include/stop_slave.inc |
| 5 |
CHANGE MASTER TO MASTER_USE_GTID=NO; |
| 6 |
include/start_slave.inc |
| 7 |
connection master; |
| 8 |
call mtr.add_suppression('Slave can not handle replication events with the checksum that master is configured to log'); |
| 9 |
call mtr.add_suppression('Replication event checksum verification failed'); |
| 10 |
call mtr.add_suppression('Relay log write failure: could not queue event from master'); |
| 11 |
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'); |
| 12 |
connection master; |
| 13 |
set @master_save_binlog_checksum= @@global.binlog_checksum; |
| 14 |
set @save_master_verify_checksum = @@global.master_verify_checksum; |
| 15 |
select @@global.binlog_checksum as 'must be CRC32 because of the command line option'; |
| 16 |
must be CRC32 because of the command line option |
| 17 |
CRC32 |
| 18 |
select @@session.binlog_checksum as 'no session var'; |
| 19 |
ERROR HY000: Variable 'binlog_checksum' is a GLOBAL variable |
| 20 |
select @@global.master_verify_checksum as 'must be zero because of default'; |
| 21 |
must be zero because of default |
| 22 |
0 |
| 23 |
select @@session.master_verify_checksum as 'no session var'; |
| 24 |
ERROR HY000: Variable 'master_verify_checksum' is a GLOBAL variable |
| 25 |
connection slave; |
| 26 |
set @slave_save_binlog_checksum= @@global.binlog_checksum; |
| 27 |
set @save_slave_sql_verify_checksum = @@global.slave_sql_verify_checksum; |
| 28 |
select @@global.slave_sql_verify_checksum as 'must be one because of default'; |
| 29 |
must be one because of default |
| 30 |
1 |
| 31 |
select @@session.slave_sql_verify_checksum as 'no session var'; |
| 32 |
ERROR HY000: Variable 'slave_sql_verify_checksum' is a GLOBAL variable |
| 33 |
connection master; |
| 34 |
show binary logs; |
| 35 |
Log_name File_size |
| 36 |
master-bin.000001 # |
| 37 |
set @@global.binlog_checksum = NONE; |
| 38 |
select @@global.binlog_checksum; |
| 39 |
@@global.binlog_checksum |
| 40 |
NONE |
| 41 |
*** must be rotations seen *** |
| 42 |
show binary logs; |
| 43 |
Log_name File_size |
| 44 |
master-bin.000001 # |
| 45 |
master-bin.000002 # |
| 46 |
set @@global.binlog_checksum = default; |
| 47 |
select @@global.binlog_checksum; |
| 48 |
@@global.binlog_checksum |
| 49 |
CRC32 |
| 50 |
set @@global.binlog_checksum = CRC32; |
| 51 |
select @@global.binlog_checksum; |
| 52 |
@@global.binlog_checksum |
| 53 |
CRC32 |
| 54 |
set @@global.binlog_checksum = CRC32; |
| 55 |
set @@global.master_verify_checksum = 0; |
| 56 |
set @@global.master_verify_checksum = default; |
| 57 |
set @@global.binlog_checksum = ADLER32; |
| 58 |
ERROR 42000: Variable 'binlog_checksum' can't be set to the value of 'ADLER32' |
| 59 |
set @@global.master_verify_checksum = 2; |
| 60 |
ERROR 42000: Variable 'master_verify_checksum' can't be set to the value of '2' |
| 61 |
connection slave; |
| 62 |
set @@global.slave_sql_verify_checksum = 0; |
| 63 |
set @@global.slave_sql_verify_checksum = default; |
| 64 |
set @@global.slave_sql_verify_checksum = 2; |
| 65 |
ERROR 42000: Variable 'slave_sql_verify_checksum' can't be set to the value of '2' |
| 66 |
connection master; |
| 67 |
set @@global.binlog_checksum = NONE; |
| 68 |
create table t1 (a int); |
| 69 |
flush logs; |
| 70 |
flush logs; |
| 71 |
flush logs; |
| 72 |
connection slave; |
| 73 |
flush logs; |
| 74 |
flush logs; |
| 75 |
flush logs; |
| 76 |
select count(*) as zero from t1; |
| 77 |
zero |
| 78 |
0 |
| 79 |
include/stop_slave.inc |
| 80 |
connection master; |
| 81 |
set @@global.binlog_checksum = CRC32; |
| 82 |
insert into t1 values (1) /* will not be applied on slave due to simulation */; |
| 83 |
connection slave; |
| 84 |
set @saved_dbug = @@global.debug_dbug; |
| 85 |
set @@global.debug_dbug='d,simulate_slave_unaware_checksum'; |
| 86 |
start slave; |
| 87 |
include/wait_for_slave_io_error.inc [errno=1236] |
| 88 |
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 375, the last event read from 'master-bin.000010' at 4, the last byte read from 'master-bin.000010' at 256.'' |
| 89 |
select count(*) as zero from t1; |
| 90 |
zero |
| 91 |
0 |
| 92 |
set @@global.debug_dbug = @saved_dbug; |
| 93 |
connection slave; |
| 94 |
include/start_slave.inc |
| 95 |
connection master; |
| 96 |
set @@global.master_verify_checksum = 1; |
| 97 |
set @save_dbug = @@session.debug_dbug; |
| 98 |
set @@session.debug_dbug='d,simulate_checksum_test_failure'; |
| 99 |
show binlog events; |
| 100 |
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error |
| 101 |
SET debug_dbug= @save_dbug; |
| 102 |
set @@global.master_verify_checksum = default; |
| 103 |
connection slave; |
| 104 |
connection slave; |
| 105 |
include/stop_slave.inc |
| 106 |
connection master; |
| 107 |
create table t2 (a int); |
| 108 |
connection slave; |
| 109 |
set @saved_dbug = @@global.debug_dbug; |
| 110 |
set @@global.debug_dbug='d,simulate_checksum_test_failure'; |
| 111 |
start slave io_thread; |
| 112 |
include/wait_for_slave_io_error.inc [errno=1595,1913] |
| 113 |
set @@global.debug_dbug = @saved_dbug; |
| 114 |
start slave io_thread; |
| 115 |
include/wait_for_slave_param.inc [Read_Master_Log_Pos] |
| 116 |
set @@global.slave_sql_verify_checksum = 1; |
| 117 |
set @@global.debug_dbug='d,simulate_checksum_test_failure'; |
| 118 |
start slave sql_thread; |
| 119 |
include/wait_for_slave_sql_error.inc [errno=1593] |
| 120 |
Last_SQL_Error = 'Error initializing relay log position: I/O error reading event at position 4' |
| 121 |
set @@global.debug_dbug = @saved_dbug; |
| 122 |
include/start_slave.inc |
| 123 |
connection master; |
| 124 |
connection slave; |
| 125 |
select count(*) as 'must be zero' from t2; |
| 126 |
must be zero |
| 127 |
0 |
| 128 |
connection slave; |
| 129 |
stop slave; |
| 130 |
include/reset_slave.inc |
| 131 |
Warnings: |
| 132 |
Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'No' to 'Slave_Pos' |
| 133 |
set @@global.binlog_checksum= IF(floor((rand()*1000)%2), "CRC32", "NONE"); |
| 134 |
flush logs; |
| 135 |
connection master; |
| 136 |
set @@global.binlog_checksum= CRC32; |
| 137 |
reset master; |
| 138 |
flush logs; |
| 139 |
create table t3 (a int, b char(5)); |
| 140 |
connection slave; |
| 141 |
include/start_slave.inc |
| 142 |
connection master; |
| 143 |
connection slave; |
| 144 |
select count(*) as 'must be zero' from t3; |
| 145 |
must be zero |
| 146 |
0 |
| 147 |
include/stop_slave.inc |
| 148 |
change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root'; |
| 149 |
connection master; |
| 150 |
flush logs; |
| 151 |
reset master; |
| 152 |
insert into t3 value (1, @@global.binlog_checksum); |
| 153 |
connection slave; |
| 154 |
include/start_slave.inc |
| 155 |
flush logs; |
| 156 |
connection master; |
| 157 |
connection slave; |
| 158 |
select count(*) as 'must be one' from t3; |
| 159 |
must be one |
| 160 |
1 |
| 161 |
connection master; |
| 162 |
set @@global.binlog_checksum= IF(floor((rand()*1000)%2), "CRC32", "NONE"); |
| 163 |
insert into t3 value (1, @@global.binlog_checksum); |
| 164 |
connection slave; |
| 165 |
connection master; |
| 166 |
drop table t1, t2, t3; |
| 167 |
set @@global.binlog_checksum = @master_save_binlog_checksum; |
| 168 |
set @@global.master_verify_checksum = @save_master_verify_checksum; |
| 169 |
connection slave; |
| 170 |
*** Bug#59123 / MDEV-5799: INCIDENT_EVENT checksum written to error log as garbage characters *** |
| 171 |
connection master; |
| 172 |
CREATE TABLE t4 (a INT PRIMARY KEY); |
| 173 |
INSERT INTO t4 VALUES (1); |
| 174 |
SET sql_log_bin=0; |
| 175 |
CALL mtr.add_suppression("\\[ERROR\\] Can't generate a unique log-filename"); |
| 176 |
SET sql_log_bin=1; |
| 177 |
SET @old_dbug= @@GLOBAL.debug_dbug; |
| 178 |
SET debug_dbug= '+d,binlog_inject_new_name_error'; |
| 179 |
FLUSH LOGS; |
| 180 |
ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) |
| 181 |
SET debug_dbug= @old_dbug; |
| 182 |
INSERT INTO t4 VALUES (2); |
| 183 |
connection slave; |
| 184 |
include/wait_for_slave_sql_error.inc [errno=1590] |
| 185 |
Last_SQL_Error = 'The incident LOST_EVENTS occurred on the master. Message: error writing to the binary log' |
| 186 |
FOUND 1 /Slave SQL: The incident LOST_EVENTS occurred on the master\. Message: error writing to the binary log, Internal MariaDB error code: 1590/ in mysqld.2.err |
| 187 |
SELECT * FROM t4 ORDER BY a; |
| 188 |
a |
| 189 |
1 |
| 190 |
STOP SLAVE IO_THREAD; |
| 191 |
SET sql_slave_skip_counter= 1; |
| 192 |
include/start_slave.inc |
| 193 |
connection master; |
| 194 |
connection slave; |
| 195 |
SELECT * FROM t4 ORDER BY a; |
| 196 |
a |
| 197 |
1 |
| 198 |
2 |
| 199 |
connection slave; |
| 200 |
set @@global.binlog_checksum = @slave_save_binlog_checksum; |
| 201 |
set @@global.slave_sql_verify_checksum = @save_slave_sql_verify_checksum; |
| 202 |
End of tests |
| 203 |
connection master; |
| 204 |
DROP TABLE t4; |
| 205 |
include/rpl_end.inc |