You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

199 lines
7.0 KiB

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