| 1 |
include/master-slave.inc |
| 2 |
[connection master] |
| 3 |
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); |
| 4 |
call mtr.add_suppression("Slave SQL: The incident LOST_EVENTS occurred on the master. .*"); |
| 5 |
call mtr.add_suppression("Write to binary log failed: Multi-row statements required more than .max_binlog_stmt_cache_size.* "); |
| 6 |
call mtr.add_suppression("Write to binary log failed: Multi-statement transaction required more than .max_binlog_cache_size.* "); |
| 7 |
call mtr.add_suppression("Incident event write to the binary log file failed"); |
| 8 |
call mtr.add_suppression("handlerton rollback failed"); |
| 9 |
ALTER DATABASE test CHARACTER SET latin1 COLLATE latin1_swedish_ci; |
| 10 |
"*********** Annotate Event write failure **************" |
| 11 |
SET GLOBAL max_binlog_cache_size = 4096; |
| 12 |
SET GLOBAL binlog_cache_size = 4096; |
| 13 |
SET GLOBAL max_binlog_stmt_cache_size = 4096; |
| 14 |
SET GLOBAL binlog_stmt_cache_size = 4096; |
| 15 |
disconnect master; |
| 16 |
connect master,127.0.0.1,root,,test,$MASTER_MYPORT,; |
| 17 |
CREATE TABLE t1(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=MYISAM; |
| 18 |
connection master; |
| 19 |
"#######################################################################" |
| 20 |
"# Test Case1: Annotate event write failure for MyISAM #" |
| 21 |
"#######################################################################" |
| 22 |
ERROR HY000: Multi-row statements required more than 'max_binlog_stmt_cache_size' bytes of storage. |
| 23 |
# Validating update was not binlogged.. |
| 24 |
# ..success |
| 25 |
# Validating that the inserted data was saved on the master.. |
| 26 |
# ..success |
| 27 |
connection slave; |
| 28 |
include/wait_for_slave_sql_error_and_skip.inc [errno=1590] |
| 29 |
# Validating that the insert was not replicated to the slave.. |
| 30 |
# ..success |
| 31 |
"#######################################################################" |
| 32 |
"# Test Case2: Annotate event write failure for INNODB #" |
| 33 |
"#######################################################################" |
| 34 |
connection master; |
| 35 |
CREATE TABLE t2(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=INNODB; |
| 36 |
ERROR HY000: Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mariadbd variable and try again |
| 37 |
# Validating binlog GTID position progressed from first insert.. |
| 38 |
# ..success |
| 39 |
# Validating that only the first insert into t2 saved.. |
| 40 |
# ..success |
| 41 |
include/save_master_gtid.inc |
| 42 |
connection slave; |
| 43 |
include/sync_with_master_gtid.inc |
| 44 |
# Validating the first insert into t2 replicated to slave.. |
| 45 |
include/diff_tables.inc [master:test.t2,slave:test.t2] |
| 46 |
# ..success |
| 47 |
"#######################################################################" |
| 48 |
"# Test Case3: Annotate event write failure for mixed engine UPDATE #" |
| 49 |
"#######################################################################" |
| 50 |
connection master; |
| 51 |
ERROR HY000: Multi-row statements required more than 'max_binlog_stmt_cache_size' bytes of storage. |
| 52 |
# Validating update was not binlogged.. |
| 53 |
# ..success |
| 54 |
# Validating non-transactional part of update saved.. |
| 55 |
# ..success |
| 56 |
# Validating transactional part of update was rolled back.. |
| 57 |
# ..success |
| 58 |
include/save_master_gtid.inc |
| 59 |
connection slave; |
| 60 |
include/wait_for_slave_sql_error_and_skip.inc [errno=1590] |
| 61 |
# Validating the rolled-back multi-engine update did not replicate to slave at all.. |
| 62 |
# ..success |
| 63 |
connection master; |
| 64 |
"****** Clean up *******" |
| 65 |
SET GLOBAL max_binlog_cache_size= ORIGINAL_VALUE; |
| 66 |
SET GLOBAL binlog_cache_size= ORIGINAL_VALUE; |
| 67 |
SET GLOBAL max_binlog_stmt_cache_size= ORIGINAL_VALUE; |
| 68 |
SET GLOBAL binlog_stmt_cache_size= ORIGINAL_VALUE; |
| 69 |
DROP TABLE t1,t2; |
| 70 |
"*********** TABLE MAP Event write failure **************" |
| 71 |
CREATE TABLE tm (f INT) ENGINE=MYISAM; |
| 72 |
CREATE TABLE ti (f INT) ENGINE=INNODB; |
| 73 |
INSERT INTO tm VALUES (10); |
| 74 |
INSERT INTO ti VALUES (20); |
| 75 |
connection slave; |
| 76 |
"#######################################################################" |
| 77 |
"# Test Case4: Table_map event write failure for trans engine UPDATE #" |
| 78 |
"#######################################################################" |
| 79 |
# Transaction should be rolled back without writing incident event |
| 80 |
connection master; |
| 81 |
SET debug_dbug="+d,table_map_write_error"; |
| 82 |
UPDATE ti, tm set ti.f=30; |
| 83 |
ERROR HY000: Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mariadbd variable and try again |
| 84 |
# Validating update was not binlogged.. |
| 85 |
# ..success |
| 86 |
# Validating update was rolled back from storage engines.. |
| 87 |
# ..success |
| 88 |
include/save_master_gtid.inc |
| 89 |
connection slave; |
| 90 |
include/sync_with_master_gtid.inc |
| 91 |
"#######################################################################" |
| 92 |
"# Test Case5: Table_map event write failure for mixed engine UPDATE #" |
| 93 |
"#######################################################################" |
| 94 |
connection master; |
| 95 |
# In case of mixed engines if non trans table is updated write INCIDENT event |
| 96 |
UPDATE ti,tm SET tm.f=88, ti.f=120; |
| 97 |
ERROR HY000: Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mariadbd variable and try again |
| 98 |
# Validating update was not binlogged.. |
| 99 |
# ..success |
| 100 |
# Validating that only the non-transactional update saved on master.. |
| 101 |
# ..success |
| 102 |
connection slave; |
| 103 |
include/wait_for_slave_sql_error_and_skip.inc [errno=1590] |
| 104 |
# Validating that neither of the updates replicated to slave.. |
| 105 |
# ..success |
| 106 |
"#######################################################################" |
| 107 |
"# Test Case6: Committing a transaction consisting of two updates: |
| 108 |
"# S1) Update transactional table |
| 109 |
"# S2) Update transactional table |
| 110 |
"# with a table_map event write failure on the second event should |
| 111 |
"# roll-back only the second update without incident |
| 112 |
"#######################################################################" |
| 113 |
connection master; |
| 114 |
SET debug_dbug=""; |
| 115 |
BEGIN; |
| 116 |
UPDATE ti, tm set ti.f=40; |
| 117 |
SET debug_dbug="+d,table_map_write_error"; |
| 118 |
UPDATE ti, tm set ti.f=50; |
| 119 |
ERROR HY000: Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mariadbd variable and try again |
| 120 |
COMMIT; |
| 121 |
# Validating binlog GTID position progressed from first update.. |
| 122 |
# ..success |
| 123 |
# Validating the first update saved.. |
| 124 |
# ..and that the second update did not save.. |
| 125 |
# ..success |
| 126 |
# Validating that only the first update replicated to slave without incident |
| 127 |
connection master; |
| 128 |
include/save_master_gtid.inc |
| 129 |
connection slave; |
| 130 |
include/sync_with_master_gtid.inc |
| 131 |
include/diff_tables.inc [master:test.ti,slave:test.ti] |
| 132 |
"#######################################################################" |
| 133 |
"# Test Case7: Rolling back a transaction consisting of two updates: |
| 134 |
"# S1) Update transactional table |
| 135 |
"# S2) Update transactional table |
| 136 |
"# with a table_map event write failure on the second event should |
| 137 |
"# roll-back both updates without incident |
| 138 |
"#######################################################################" |
| 139 |
connection master; |
| 140 |
SET debug_dbug=""; |
| 141 |
BEGIN; |
| 142 |
UPDATE ti, tm set ti.f=60; |
| 143 |
SET debug_dbug="+d,table_map_write_error"; |
| 144 |
UPDATE ti, tm set ti.f=70; |
| 145 |
ERROR HY000: Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mariadbd variable and try again |
| 146 |
ROLLBACK; |
| 147 |
# Validating update was not binlogged.. |
| 148 |
# ..success |
| 149 |
# Validating that neither update saved on master.. |
| 150 |
# ..success |
| 151 |
# Validating the transaction did not replicate to the slave |
| 152 |
connection master; |
| 153 |
include/save_master_gtid.inc |
| 154 |
connection slave; |
| 155 |
include/sync_with_master_gtid.inc |
| 156 |
include/diff_tables.inc [master:test.ti,slave:test.ti] |
| 157 |
"#######################################################################" |
| 158 |
"# Test Case8: Committing a transaction consisting of two updates: |
| 159 |
"# S1) Update transactional table |
| 160 |
"# S2) Update mixed trans/non-trans tables |
| 161 |
"# with a table_map event write failure on the second event should |
| 162 |
"# roll-back only the second update with incident |
| 163 |
"#######################################################################" |
| 164 |
connection master; |
| 165 |
BEGIN; |
| 166 |
SET debug_dbug=""; |
| 167 |
UPDATE ti, tm set ti.f=80; |
| 168 |
SET debug_dbug="+d,table_map_write_error"; |
| 169 |
UPDATE ti, tm set ti.f=90,tm.f=99; |
| 170 |
ERROR HY000: Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mariadbd variable and try again |
| 171 |
COMMIT; |
| 172 |
# Validating binlog GTID position progressed from first update.. |
| 173 |
# ..success |
| 174 |
# Validating the first update saved.. |
| 175 |
# ..and the transactional part of the second update did not save.. |
| 176 |
# ..whereas the non-trans part of the second update did save.. |
| 177 |
# ..success |
| 178 |
# Validating that the incident propagated to the slave |
| 179 |
connection slave; |
| 180 |
include/wait_for_slave_sql_error_and_skip.inc [errno=1590] |
| 181 |
# Validating that the first update replicated to the slave.. |
| 182 |
# ..and neither part of the second update replicated.. |
| 183 |
# ..success |
| 184 |
"#######################################################################" |
| 185 |
"# Test Case9: Rolling back a transaction consisting of two updates: |
| 186 |
"# S1) Update transactional table |
| 187 |
"# S2) Update mixed trans/non-trans tables |
| 188 |
"# with a table_map event write failure on the second event should |
| 189 |
"# roll-back both transactional updates, preserve the non-transactional |
| 190 |
"# update on the master (only), and write an incident event |
| 191 |
"#######################################################################" |
| 192 |
connection master; |
| 193 |
SET debug_dbug=""; |
| 194 |
BEGIN; |
| 195 |
UPDATE ti, tm set ti.f=100; |
| 196 |
SET debug_dbug="+d,table_map_write_error"; |
| 197 |
UPDATE ti, tm set ti.f=110,tm.f=111; |
| 198 |
ERROR HY000: Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mariadbd variable and try again |
| 199 |
ROLLBACK; |
| 200 |
# Validating update was not binlogged.. |
| 201 |
# ..success |
| 202 |
# Validating trans updates rollback, but the non-trans update stays.. |
| 203 |
# ..success |
| 204 |
# Validating that the incident propagated to the slave |
| 205 |
connection slave; |
| 206 |
include/wait_for_slave_sql_error_and_skip.inc [errno=1590] |
| 207 |
# Validating that none of the updates replicated to the slave |
| 208 |
include/diff_tables.inc [master:test.ti,slave:test.ti] |
| 209 |
# ..success |
| 210 |
"#######################################################################" |
| 211 |
"# Test Case10: If an incident event fails to write, a specific error |
| 212 |
"# should be logged |
| 213 |
"# |
| 214 |
"# Note: This test case is the same as test case 5, with the caveat of |
| 215 |
"# the incident event failing to write. |
| 216 |
"#######################################################################" |
| 217 |
connection master; |
| 218 |
SET debug_dbug="d,table_map_write_error,incident_event_write_error"; |
| 219 |
UPDATE ti, tm set ti.f=120, tm.f=122; |
| 220 |
ERROR HY000: Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mariadbd variable and try again |
| 221 |
# Validate error message indicating incident event failed to write |
| 222 |
FOUND 1 /Incident event write to the binary log file failed/ in mysqld.1.err |
| 223 |
connection master; |
| 224 |
"******** Clean Up **********" |
| 225 |
SET GLOBAL debug_dbug = ''; |
| 226 |
DROP TABLE tm,ti; |
| 227 |
ALTER DATABASE test CHARACTER SET utf8mb4 COLLATE utf8mb4_uca1400_ai_ci; |
| 228 |
include/rpl_end.inc |