| 1 |
# BUG#46166: MYSQL_BIN_LOG::new_file_impl is not propagating error |
| 2 |
# when generating new name. |
| 3 |
# |
| 4 |
# WHY |
| 5 |
# === |
| 6 |
# |
| 7 |
# We want to check whether error is reported or not when |
| 8 |
# new_file_impl fails (this may happen when rotation is not |
| 9 |
# possible because there is some problem finding an |
| 10 |
# unique filename). |
| 11 |
# |
| 12 |
# HOW |
| 13 |
# === |
| 14 |
# |
| 15 |
# Test cases are documented inline. |
| 16 |
# |
| 17 |
# The size of the data is tuned to match file sizes and rotations, so |
| 18 |
# it is only executed in statement-based replication. |
| 19 |
|
| 20 |
|
| 21 |
-- source include/no_valgrind_without_big.inc |
| 22 |
-- source include/force_myisam_default.inc |
| 23 |
-- source include/have_myisam.inc |
| 24 |
-- source include/have_debug.inc |
| 25 |
-- source include/have_binlog_format_statement.inc |
| 26 |
-- source include/master-slave.inc |
| 27 |
|
| 28 |
-- echo ####################################################################### |
| 29 |
-- echo ####################### PART 1: MASTER TESTS ########################## |
| 30 |
-- echo ####################################################################### |
| 31 |
|
| 32 |
|
| 33 |
### ACTION: stopping slave as it is not needed for the first part of |
| 34 |
### the test |
| 35 |
|
| 36 |
-- connection slave |
| 37 |
-- source include/stop_slave.inc |
| 38 |
-- connection master |
| 39 |
|
| 40 |
--disable_query_log |
| 41 |
call mtr.add_suppression("Can't generate a unique log-filename"); |
| 42 |
call mtr.add_suppression("Writing one row to the row-based binary log failed.*"); |
| 43 |
call mtr.add_suppression("Warning: [+-]?\d+ files and [+-]?\d+ streams is left open"); |
| 44 |
call mtr.add_suppression("Error writing file .*"); |
| 45 |
--enable_query_log |
| 46 |
|
| 47 |
--let $old_debug = `select @@global.debug` |
| 48 |
|
| 49 |
### ACTION: create a large file (> 4096 bytes) that will be later used |
| 50 |
### in LOAD DATA INFILE to check binlog errors in its vacinity |
| 51 |
-- let $load_file= $MYSQLTEST_VARDIR/tmp/bug_46166.data |
| 52 |
-- let $MYSQLD_DATADIR= `select @@datadir` |
| 53 |
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR |
| 54 |
-- eval SELECT repeat('x',8192) INTO OUTFILE '$load_file' |
| 55 |
|
| 56 |
### ACTION: create a small file (< 4096 bytes) that will be later used |
| 57 |
### in LOAD DATA INFILE to check for absence of binlog errors |
| 58 |
### when file loading this file does not force flushing and |
| 59 |
### rotating the binary log |
| 60 |
-- let $load_file2= $MYSQLTEST_VARDIR/tmp/bug_46166-2.data |
| 61 |
-- let $MYSQLD_DATADIR= `select @@datadir` |
| 62 |
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR |
| 63 |
-- eval SELECT repeat('x',10) INTO OUTFILE '$load_file2' |
| 64 |
|
| 65 |
RESET MASTER; |
| 66 |
|
| 67 |
-- echo ###################### TEST #1 |
| 68 |
|
| 69 |
### ASSERTION: no problem flushing logs (should show two binlogs) |
| 70 |
FLUSH LOGS; |
| 71 |
-- echo # assert: must show two binlogs |
| 72 |
-- source include/show_binary_logs.inc |
| 73 |
|
| 74 |
-- echo ###################### TEST #2 |
| 75 |
|
| 76 |
### ASSERTION: check that FLUSH LOGS actually fails and reports |
| 77 |
### failure back to the user if find_uniq_filename fails |
| 78 |
### (should show just one binlog) |
| 79 |
|
| 80 |
RESET MASTER; |
| 81 |
SET GLOBAL binlog_error_action= IGNORE_ERROR; |
| 82 |
--disable_query_log |
| 83 |
eval SET GLOBAL debug=IF(LENGTH('$old_debug') > 0, CONCAT('$old_debug', ":d,error_unique_log_filename"), 'd,error_unique_log_filename'); |
| 84 |
--enable_query_log |
| 85 |
-- error ER_NO_UNIQUE_LOGFILE |
| 86 |
FLUSH LOGS; |
| 87 |
-- echo # assert: must show one binlog |
| 88 |
--list_files $MYSQLD_DATADIR *master-bin.?????? |
| 89 |
|
| 90 |
### ACTION: clean up and move to next test |
| 91 |
--disable_query_log |
| 92 |
eval SET GLOBAL debug='$old_debug'; |
| 93 |
--enable_query_log |
| 94 |
# Restart the server to enable binary log. |
| 95 |
--let $rpl_server_number= 1 |
| 96 |
--source include/rpl_restart_server.inc |
| 97 |
RESET MASTER; |
| 98 |
|
| 99 |
-- echo ###################### TEST #3 |
| 100 |
|
| 101 |
### ACTION: create some tables (t1, t2, t4) and insert some values in |
| 102 |
### table t1 |
| 103 |
CREATE TABLE t1 (a INT); |
| 104 |
CREATE TABLE t2 (a VARCHAR(16383)) Engine=InnoDB; |
| 105 |
CREATE TABLE t4 (a VARCHAR(16383)) Engine=MyISAM; |
| 106 |
INSERT INTO t1 VALUES (1); |
| 107 |
RESET MASTER; |
| 108 |
|
| 109 |
### ASSERTION: we force rotation of the binary log because it exceeds |
| 110 |
### the max_binlog_size option (should show three binary |
| 111 |
### logs) |
| 112 |
|
| 113 |
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR |
| 114 |
-- eval LOAD DATA INFILE '$load_file' INTO TABLE t2 |
| 115 |
|
| 116 |
# shows two binary logs |
| 117 |
-- echo # assert: must show three binlog |
| 118 |
-- source include/show_binary_logs.inc |
| 119 |
|
| 120 |
# clean up the table and the binlog to be used in next part of test |
| 121 |
--disable_query_log |
| 122 |
eval SET GLOBAL debug='$old_debug'; |
| 123 |
--enable_query_log |
| 124 |
DELETE FROM t2; |
| 125 |
RESET MASTER; |
| 126 |
|
| 127 |
-- echo ###################### TEST #4 |
| 128 |
|
| 129 |
# Loading a row using LOAD DATA INFILE causing a binary log error |
| 130 |
# should be rolled back. |
| 131 |
|
| 132 |
SET GLOBAL binlog_error_action= IGNORE_ERROR; |
| 133 |
--disable_query_log |
| 134 |
eval SET GLOBAL debug=IF(LENGTH('$old_debug') > 0, CONCAT('$old_debug', ":d,info,debug,enter,return,query,error_unique_log_filename"), 'd,info,debug,enter,return,query,error_unique_log_filename'); |
| 135 |
--enable_query_log |
| 136 |
|
| 137 |
# Table should be empty to start with |
| 138 |
SELECT count(*) FROM t2; |
| 139 |
|
| 140 |
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR |
| 141 |
-- error ER_NO_UNIQUE_LOGFILE |
| 142 |
-- eval LOAD DATA INFILE '$load_file' INTO TABLE t2 |
| 143 |
|
| 144 |
# show table |
| 145 |
-- echo # assert: must still be empty since the LOAD DATA INFILE failed |
| 146 |
SELECT count(*) FROM t2; |
| 147 |
|
| 148 |
# clean up the table and the binlog to be used in next part of test |
| 149 |
--disable_query_log |
| 150 |
eval SET GLOBAL debug='$old_debug'; |
| 151 |
--enable_query_log |
| 152 |
DELETE FROM t2; |
| 153 |
# Restart the server to enable binary log. |
| 154 |
--let $rpl_server_number= 1 |
| 155 |
--source include/rpl_restart_server.inc |
| 156 |
RESET MASTER; |
| 157 |
|
| 158 |
-- echo ###################### TEST #5 |
| 159 |
|
| 160 |
### ASSERTION: load the small file into a transactional table and |
| 161 |
### check that it succeeds |
| 162 |
|
| 163 |
--disable_query_log |
| 164 |
eval SET GLOBAL debug=IF(LENGTH('$old_debug') > 0, CONCAT('$old_debug', ":d,error_unique_log_filename"), 'd,error_unique_log_filename'); |
| 165 |
--enable_query_log |
| 166 |
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR |
| 167 |
-- eval LOAD DATA INFILE '$load_file2' INTO TABLE t2 |
| 168 |
|
| 169 |
# show table |
| 170 |
-- echo # assert: must show one entry |
| 171 |
SELECT count(*) FROM t2; |
| 172 |
|
| 173 |
# clean up the table and the binlog to be used in next part of test |
| 174 |
--disable_query_log |
| 175 |
eval SET GLOBAL debug='$old_debug'; |
| 176 |
--enable_query_log |
| 177 |
DELETE FROM t2; |
| 178 |
RESET MASTER; |
| 179 |
|
| 180 |
-- echo ###################### TEST #6 |
| 181 |
|
| 182 |
# A failing LOAD DATA INFILE inside a transaction cause the commit to |
| 183 |
# fail, rolling back the entire statement. |
| 184 |
|
| 185 |
SET GLOBAL binlog_error_action= IGNORE_ERROR; |
| 186 |
--disable_query_log |
| 187 |
eval SET GLOBAL debug=IF(LENGTH('$old_debug') > 0, CONCAT('$old_debug', ":d,error_unique_log_filename"), 'd,error_unique_log_filename'); |
| 188 |
--enable_query_log |
| 189 |
|
| 190 |
-- echo # Table should be empty |
| 191 |
SELECT count(*) FROM t2; |
| 192 |
|
| 193 |
SET AUTOCOMMIT=0; |
| 194 |
INSERT INTO t2 VALUES ('muse'); |
| 195 |
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR |
| 196 |
-- eval LOAD DATA INFILE '$load_file' INTO TABLE t2 |
| 197 |
INSERT INTO t2 VALUES ('muse'); |
| 198 |
-- error ER_NO_UNIQUE_LOGFILE |
| 199 |
COMMIT; |
| 200 |
|
| 201 |
### ACTION: Show the contents of the table after the test |
| 202 |
-- echo # Table should still be empty since the commit failed. |
| 203 |
SELECT count(*) FROM t2; |
| 204 |
|
| 205 |
### ACTION: clean up and move to the next test |
| 206 |
SET AUTOCOMMIT= 1; |
| 207 |
--disable_query_log |
| 208 |
eval SET GLOBAL debug='$old_debug'; |
| 209 |
--enable_query_log |
| 210 |
DELETE FROM t2; |
| 211 |
# Restart the server to enable binary log. |
| 212 |
--let $rpl_server_number= 1 |
| 213 |
--source include/rpl_restart_server.inc |
| 214 |
RESET MASTER; |
| 215 |
|
| 216 |
-- echo ###################### TEST #7 |
| 217 |
|
| 218 |
### ASSERTION: check that on a non-transactional table, if rotation |
| 219 |
### fails then an error is reported and an incident event |
| 220 |
### is written to the current binary log. |
| 221 |
|
| 222 |
SET GLOBAL binlog_error_action= IGNORE_ERROR; |
| 223 |
--disable_query_log |
| 224 |
eval SET GLOBAL debug=IF(LENGTH('$old_debug') > 0, CONCAT('$old_debug', ":d,error_unique_log_filename"), 'd,error_unique_log_filename'); |
| 225 |
--enable_query_log |
| 226 |
SELECT count(*) FROM t4; |
| 227 |
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR |
| 228 |
-- error ER_NO_UNIQUE_LOGFILE |
| 229 |
-- eval LOAD DATA INFILE '$load_file' INTO TABLE t4 |
| 230 |
|
| 231 |
-- echo # assert: must show 1 entry |
| 232 |
SELECT count(*) FROM t4; |
| 233 |
|
| 234 |
--disable_query_log |
| 235 |
eval SET GLOBAL debug='$old_debug'; |
| 236 |
--enable_query_log |
| 237 |
|
| 238 |
# clean up and move to next test |
| 239 |
DELETE FROM t4; |
| 240 |
# Restart the server to enable binary log. |
| 241 |
--let $rpl_server_number= 1 |
| 242 |
--source include/rpl_restart_server.inc |
| 243 |
RESET MASTER; |
| 244 |
|
| 245 |
-- echo ###################### TEST #8 |
| 246 |
|
| 247 |
### ASSERTION: check that statements end up in error but they succeed |
| 248 |
### on changing the data. |
| 249 |
|
| 250 |
# Insert some rows into t2, we will both try to insert and delete from |
| 251 |
# it. |
| 252 |
|
| 253 |
SET GLOBAL binlog_error_action= IGNORE_ERROR; |
| 254 |
SET @xxx = REPEAT('xxx', 1000); |
| 255 |
SET @yyy = REPEAT('yyy', 1000); |
| 256 |
INSERT INTO t2 VALUES (@xxx),(@yyy); |
| 257 |
|
| 258 |
--disable_query_log |
| 259 |
eval SET GLOBAL debug=IF(LENGTH('$old_debug') > 0, CONCAT('$old_debug', ":d,error_unique_log_filename"), 'd,error_unique_log_filename'); |
| 260 |
--enable_query_log |
| 261 |
-- echo # must show 0 entries |
| 262 |
SELECT count(*) FROM t4; |
| 263 |
-- echo # must show 2 entries |
| 264 |
SELECT count(*) FROM t2; |
| 265 |
|
| 266 |
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR |
| 267 |
-- error ER_NO_UNIQUE_LOGFILE |
| 268 |
-- eval LOAD DATA INFILE '$load_file' INTO TABLE t4 |
| 269 |
|
| 270 |
# Restart the server to enable binary log. |
| 271 |
--let $rpl_server_number= 1 |
| 272 |
--source include/rpl_restart_server.inc |
| 273 |
|
| 274 |
SET GLOBAL binlog_error_action= IGNORE_ERROR; |
| 275 |
--disable_query_log |
| 276 |
eval SET GLOBAL debug=IF(LENGTH('$old_debug') > 0, CONCAT('$old_debug', ":d,error_unique_log_filename"), 'd,error_unique_log_filename'); |
| 277 |
--enable_query_log |
| 278 |
|
| 279 |
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR |
| 280 |
-- error ER_NO_UNIQUE_LOGFILE |
| 281 |
-- eval LOAD DATA INFILE '$load_file' INTO TABLE t2 |
| 282 |
|
| 283 |
# Restart the server to enable binary log. |
| 284 |
--let $rpl_server_number= 1 |
| 285 |
--source include/rpl_restart_server.inc |
| 286 |
|
| 287 |
SET GLOBAL binlog_error_action= IGNORE_ERROR; |
| 288 |
--disable_query_log |
| 289 |
eval SET GLOBAL debug=IF(LENGTH('$old_debug') > 0, CONCAT('$old_debug', ":d,error_unique_log_filename"), 'd,error_unique_log_filename'); |
| 290 |
--enable_query_log |
| 291 |
set @aaa = repeat('aaa',1000); |
| 292 |
set @bbb = repeat('bbb',1000); |
| 293 |
set @ccc = repeat('ccc',1000); |
| 294 |
-- error ER_NO_UNIQUE_LOGFILE |
| 295 |
INSERT INTO t2 VALUES (@aaa), (@bbb), (@ccc); |
| 296 |
|
| 297 |
-- echo # INFO: Count(*) Before Offending DELETEs |
| 298 |
-- echo # assert: must show 1 entry |
| 299 |
SELECT count(*) FROM t4; |
| 300 |
-- echo # assert: must show 2 entries since the LOAD DATA INFILE and |
| 301 |
-- echo # INSERT INTO above was rolled back due to error. Only the |
| 302 |
-- echo # original rows remain |
| 303 |
SELECT count(*) FROM t2; |
| 304 |
|
| 305 |
# Restart the server to enable binary log. |
| 306 |
--let $rpl_server_number= 1 |
| 307 |
--source include/rpl_restart_server.inc |
| 308 |
|
| 309 |
SET GLOBAL binlog_error_action= IGNORE_ERROR; |
| 310 |
--disable_query_log |
| 311 |
eval SET GLOBAL debug=IF(LENGTH('$old_debug') > 0, CONCAT('$old_debug', ":d,error_unique_log_filename"), 'd,error_unique_log_filename'); |
| 312 |
--enable_query_log |
| 313 |
|
| 314 |
SET @xxx = REPEAT('xxx', 1000); |
| 315 |
SET @yyy = REPEAT('yyy', 1000); |
| 316 |
-- error ER_NO_UNIQUE_LOGFILE |
| 317 |
DELETE FROM t4 WHERE a IN (@xxx, @yyy) or a <> '1'; |
| 318 |
|
| 319 |
# Restart the server to enable binary log. |
| 320 |
--let $rpl_server_number= 1 |
| 321 |
--source include/rpl_restart_server.inc |
| 322 |
|
| 323 |
SET GLOBAL binlog_error_action= IGNORE_ERROR; |
| 324 |
--disable_query_log |
| 325 |
eval SET GLOBAL debug=IF(LENGTH('$old_debug') > 0, CONCAT('$old_debug', ":d,error_unique_log_filename"), 'd,error_unique_log_filename'); |
| 326 |
--enable_query_log |
| 327 |
|
| 328 |
set @aaa = repeat('aaa',1000); |
| 329 |
set @bbb = repeat('bbb',1000); |
| 330 |
set @ccc = repeat('ccc',1000); |
| 331 |
-- error ER_NO_UNIQUE_LOGFILE |
| 332 |
DELETE FROM t2 WHERE a IN (@aaa, @bbb, @ccc) or a <> '1'; |
| 333 |
|
| 334 |
-- echo # INFO: Count(*) After Offending DELETEs |
| 335 |
-- echo # assert: must show zero entries |
| 336 |
SELECT count(*) FROM t4; |
| 337 |
-- echo # assert: must show 2 entries: the original two rows |
| 338 |
SELECT count(*) FROM t2; |
| 339 |
|
| 340 |
# remove fault injection |
| 341 |
--disable_query_log |
| 342 |
eval SET GLOBAL debug='$old_debug'; |
| 343 |
--enable_query_log |
| 344 |
|
| 345 |
# Empty t2 for following testing |
| 346 |
DELETE FROM t2; |
| 347 |
|
| 348 |
-- echo ###################### TEST #9 |
| 349 |
|
| 350 |
### ASSERTION: check that if we disable binlogging, then statements |
| 351 |
### succeed. |
| 352 |
SET GLOBAL binlog_error_action= IGNORE_ERROR; |
| 353 |
--disable_query_log |
| 354 |
eval SET GLOBAL debug=IF(LENGTH('$old_debug') > 0, CONCAT('$old_debug', ":d,error_unique_log_filename"), 'd,error_unique_log_filename'); |
| 355 |
--enable_query_log |
| 356 |
SET SQL_LOG_BIN=0; |
| 357 |
INSERT INTO t2 VALUES ('aaa'), ('bbb'), ('ccc'), ('ddd'); |
| 358 |
INSERT INTO t4 VALUES ('eee'), ('fff'), ('ggg'), ('hhh'); |
| 359 |
-- echo # assert: must show four entries |
| 360 |
SELECT count(*) FROM t2; |
| 361 |
SELECT count(*) FROM t4; |
| 362 |
DELETE FROM t2; |
| 363 |
DELETE FROM t4; |
| 364 |
-- echo # assert: must show zero entries |
| 365 |
SELECT count(*) FROM t2; |
| 366 |
SELECT count(*) FROM t4; |
| 367 |
SET SQL_LOG_BIN=1; |
| 368 |
--disable_query_log |
| 369 |
eval SET GLOBAL debug='$old_debug'; |
| 370 |
--enable_query_log |
| 371 |
|
| 372 |
-- echo ###################### TEST #10 |
| 373 |
|
| 374 |
### ASSERTION: check that error is reported if there is a failure |
| 375 |
### while registering the index file and the binary log |
| 376 |
### file or failure to write the rotate event. |
| 377 |
|
| 378 |
call mtr.add_suppression("MYSQL_BIN_LOG::open failed to sync the index file."); |
| 379 |
call mtr.add_suppression("Could not open .*"); |
| 380 |
|
| 381 |
# Restart the server to enable binary log. |
| 382 |
--let $rpl_server_number= 1 |
| 383 |
--source include/rpl_restart_server.inc |
| 384 |
RESET MASTER; |
| 385 |
SHOW WARNINGS; |
| 386 |
|
| 387 |
# +d,fault_injection_registering_index => injects fault on MYSQL_BIN_LOG::open |
| 388 |
# normalize strerror message for solaris10-sparc-64bit as long as errno is OK |
| 389 |
--disable_query_log |
| 390 |
eval SET GLOBAL debug=IF(LENGTH('$old_debug') > 0, CONCAT('$old_debug', ":d,fault_injection_registering_index"), 'd,fault_injection_registering_index'); |
| 391 |
SET GLOBAL binlog_error_action= IGNORE_ERROR; |
| 392 |
--enable_query_log |
| 393 |
-- replace_regex /\.[\\\/]master/master/ /errno: 1 - .*\)/errno: 1 - Operation not permitted)/ |
| 394 |
-- error ER_CANT_OPEN_FILE |
| 395 |
FLUSH LOGS; |
| 396 |
--disable_query_log |
| 397 |
eval SET GLOBAL debug='$old_debug'; |
| 398 |
--enable_query_log |
| 399 |
|
| 400 |
-- error ER_NO_BINARY_LOGGING |
| 401 |
SHOW BINARY LOGS; |
| 402 |
|
| 403 |
# issue some statements and check that they don't fail |
| 404 |
CREATE TABLE t5 (a INT); |
| 405 |
INSERT INTO t4 VALUES ('bbbbb'); |
| 406 |
INSERT INTO t2 VALUES ('aaaaa'); |
| 407 |
DELETE FROM t4; |
| 408 |
DELETE FROM t2; |
| 409 |
DROP TABLE t5; |
| 410 |
|
| 411 |
-- echo ###################### TEST #11 |
| 412 |
|
| 413 |
### ASSERTION: check that error is reported if there is a failure |
| 414 |
### while opening the index file and the binary log file or |
| 415 |
### failure to write the rotate event. |
| 416 |
|
| 417 |
# restart the server so that we have binlog again |
| 418 |
--let $rpl_server_number= 1 |
| 419 |
--source include/rpl_restart_server.inc |
| 420 |
|
| 421 |
# +d,fault_injection_openning_index => injects fault on MYSQL_BIN_LOG::open_index_file |
| 422 |
--disable_query_log |
| 423 |
eval SET GLOBAL debug=IF(LENGTH('$old_debug') > 0, CONCAT('$old_debug', ":d,fault_injection_openning_index"), 'd,fault_injection_openning_index'); |
| 424 |
SET GLOBAL binlog_error_action= IGNORE_ERROR; |
| 425 |
--enable_query_log |
| 426 |
# normalize strerror message for solaris10-sparc-64bit as long as errno is OK |
| 427 |
-- replace_regex /\.[\\\/]master/master/ /errno: 1 - .*\)/errno: 1 - Operation not permitted)/ |
| 428 |
-- error ER_CANT_OPEN_FILE |
| 429 |
FLUSH LOGS; |
| 430 |
--disable_query_log |
| 431 |
eval SET GLOBAL debug='$old_debug'; |
| 432 |
--enable_query_log |
| 433 |
|
| 434 |
RESET MASTER; |
| 435 |
|
| 436 |
# issue some statements and check that they don't fail |
| 437 |
CREATE TABLE t5 (a INT); |
| 438 |
INSERT INTO t4 VALUES ('bbbbb'); |
| 439 |
INSERT INTO t2 VALUES ('aaaaa'); |
| 440 |
DELETE FROM t4; |
| 441 |
DELETE FROM t2; |
| 442 |
DROP TABLE t5; |
| 443 |
|
| 444 |
# restart the server so that we have binlog again |
| 445 |
--let $rpl_server_number= 1 |
| 446 |
--source include/rpl_restart_server.inc |
| 447 |
|
| 448 |
-- echo ###################### TEST #12 |
| 449 |
|
| 450 |
### ASSERTION: check that error is reported if there is a failure |
| 451 |
### while writing the rotate event when creating a new log |
| 452 |
### file. |
| 453 |
|
| 454 |
# +d,fault_injection_new_file_rotate_event => injects fault on MYSQL_BIN_LOG::MYSQL_BIN_LOG::new_file_impl |
| 455 |
--disable_query_log |
| 456 |
eval SET GLOBAL debug=IF(LENGTH('$old_debug') > 0, CONCAT('$old_debug', ":d,fault_injection_new_file_rotate_event"), 'd,fault_injection_new_file_rotate_event'); |
| 457 |
SET GLOBAL binlog_error_action= IGNORE_ERROR; |
| 458 |
--enable_query_log |
| 459 |
-- error ER_ERROR_ON_WRITE |
| 460 |
FLUSH LOGS; |
| 461 |
--disable_query_log |
| 462 |
eval SET GLOBAL debug='$old_debug'; |
| 463 |
--enable_query_log |
| 464 |
|
| 465 |
RESET MASTER; |
| 466 |
# issue some statements and check that they don't fail |
| 467 |
CREATE TABLE t5 (a INT); |
| 468 |
INSERT INTO t4 VALUES ('bbbbb'); |
| 469 |
INSERT INTO t2 VALUES ('aaaaa'); |
| 470 |
DELETE FROM t4; |
| 471 |
DELETE FROM t2; |
| 472 |
DROP TABLE t5; |
| 473 |
|
| 474 |
# restart the server so that we have binlog again |
| 475 |
--let $rpl_server_number= 1 |
| 476 |
--source include/rpl_restart_server.inc |
| 477 |
|
| 478 |
## clean up |
| 479 |
--disable_query_log |
| 480 |
eval SET GLOBAL debug= '$old_debug'; |
| 481 |
--enable_query_log |
| 482 |
DROP TABLE t1, t2, t4; |
| 483 |
RESET MASTER; |
| 484 |
|
| 485 |
# restart slave again |
| 486 |
-- connection slave |
| 487 |
-- source include/start_slave.inc |
| 488 |
-- connection master |
| 489 |
|
| 490 |
-- echo ####################################################################### |
| 491 |
-- echo ####################### PART 2: SLAVE TESTS ########################### |
| 492 |
-- echo ####################################################################### |
| 493 |
|
| 494 |
### setup |
| 495 |
--source include/rpl_reset.inc |
| 496 |
-- connection slave |
| 497 |
|
| 498 |
# slave suppressions |
| 499 |
|
| 500 |
call mtr.add_suppression("Replica I/O for channel '': Relay log write failure: could not queue event from source.*"); |
| 501 |
call mtr.add_suppression("Error writing file .*"); |
| 502 |
call mtr.add_suppression("Could not open .*"); |
| 503 |
call mtr.add_suppression("MYSQL_BIN_LOG::open failed to sync the index file."); |
| 504 |
call mtr.add_suppression("Can't generate a unique log-filename .*"); |
| 505 |
-- echo ###################### TEST #13 |
| 506 |
SET GLOBAL binlog_error_action= IGNORE_ERROR; |
| 507 |
|
| 508 |
#### ASSERTION: check against unique log filename error |
| 509 |
-- let $io_thd_injection_fault_flag= error_unique_log_filename |
| 510 |
-- let $slave_io_errno= 13122 |
| 511 |
-- let $show_slave_io_error= 1 |
| 512 |
-- source include/io_thd_fault_injection.inc |
| 513 |
|
| 514 |
-- echo ###################### TEST #14 |
| 515 |
SET GLOBAL binlog_error_action= IGNORE_ERROR; |
| 516 |
|
| 517 |
#### ASSERTION: check against rotate failing |
| 518 |
-- let $io_thd_injection_fault_flag= fault_injection_new_file_rotate_event |
| 519 |
-- let $slave_io_errno= 13122 |
| 520 |
-- let $show_slave_io_error= 1 |
| 521 |
-- source include/io_thd_fault_injection.inc |
| 522 |
|
| 523 |
-- echo ###################### TEST #15 |
| 524 |
SET GLOBAL binlog_error_action= IGNORE_ERROR; |
| 525 |
|
| 526 |
#### ASSERTION: check against relay log open failure |
| 527 |
-- let $io_thd_injection_fault_flag= fault_injection_registering_index |
| 528 |
-- let $slave_io_errno= 13122 |
| 529 |
-- let $show_slave_io_error= 1 |
| 530 |
-- source include/io_thd_fault_injection.inc |
| 531 |
|
| 532 |
-- echo ###################### TEST #16 |
| 533 |
SET GLOBAL binlog_error_action= IGNORE_ERROR; |
| 534 |
|
| 535 |
#### ASSERTION: check against relay log index open failure |
| 536 |
-- let $io_thd_injection_fault_flag= fault_injection_openning_index |
| 537 |
-- let $slave_io_errno= 13122 |
| 538 |
-- let $show_slave_io_error= 1 |
| 539 |
-- source include/io_thd_fault_injection.inc |
| 540 |
|
| 541 |
### clean up |
| 542 |
-- source include/stop_slave_sql.inc |
| 543 |
--disable_query_log |
| 544 |
eval SET GLOBAL debug='$old_debug'; |
| 545 |
--enable_query_log |
| 546 |
-- remove_file $MYSQLTEST_VARDIR/tmp/bug_46166.data |
| 547 |
-- remove_file $MYSQLTEST_VARDIR/tmp/bug_46166-2.data |
| 548 |
RESET SLAVE; |
| 549 |
RESET MASTER; |
| 550 |
--let $rpl_only_running_threads= 1 |
| 551 |
--source include/rpl_end.inc |