| 1 |
|
| 2 |
# |
| 3 |
# testing of purging of binary log files bug#18199/Bug#18453 |
| 4 |
# |
| 5 |
source include/have_log_bin.inc; |
| 6 |
# Don't test this under valgrind, memory leaks will occur |
| 7 |
--source include/not_valgrind.inc |
| 8 |
source include/have_debug.inc; |
| 9 |
# Avoid CrashReporter popup on Mac |
| 10 |
--source include/not_crashrep.inc |
| 11 |
call mtr.add_suppression('Attempting backtrace'); |
| 12 |
call mtr.add_suppression('MYSQL_BIN_LOG::purge_logs failed to process registered files that would be purged.'); |
| 13 |
call mtr.add_suppression('MYSQL_BIN_LOG::open failed to sync the index file'); |
| 14 |
call mtr.add_suppression('Turning logging off for the whole duration of the MySQL server process.'); |
| 15 |
call mtr.add_suppression('Could not open .*'); |
| 16 |
call mtr.add_suppression('MYSQL_BIN_LOG::purge_logs failed to clean registers before purging logs.'); |
| 17 |
let $old=`select @@debug`; |
| 18 |
let $saved_binlog_error_action=`SELECT @@GLOBAL.binlog_error_action`; |
| 19 |
|
| 20 |
RESET MASTER; |
| 21 |
|
| 22 |
let $MYSQLD_DATADIR= `select @@datadir`; |
| 23 |
let $INDEX=$MYSQLD_DATADIR/binlog.index; |
| 24 |
|
| 25 |
# |
| 26 |
# testing purge binary logs TO |
| 27 |
# |
| 28 |
|
| 29 |
flush logs; |
| 30 |
flush logs; |
| 31 |
flush logs; |
| 32 |
|
| 33 |
source include/show_binary_logs.inc; |
| 34 |
remove_file $MYSQLD_DATADIR/binlog.000001; |
| 35 |
|
| 36 |
--echo # Create a dedicated user to demonstrate the BINLOG_ADMIN privilege |
| 37 |
CREATE USER binlog_admin@localhost IDENTIFIED BY 'foo'; |
| 38 |
GRANT BINLOG_ADMIN ON *.* TO binlog_admin@localhost; |
| 39 |
connect(con1, localhost, binlog_admin, foo, test); |
| 40 |
|
| 41 |
# there must be a warning with file names |
| 42 |
replace_regex /\.[\\\/]binlog/binlog/; |
| 43 |
purge binary logs TO 'binlog.000004'; |
| 44 |
|
| 45 |
connection default; |
| 46 |
REVOKE binlog_admin ON *.* FROM binlog_admin@localhost; |
| 47 |
connection con1; |
| 48 |
--error ER_SPECIFIC_ACCESS_DENIED_ERROR |
| 49 |
purge binary logs TO 'binlog.000004'; |
| 50 |
connection default; |
| 51 |
DROP USER binlog_admin@localhost; |
| 52 |
disconnect con1; |
| 53 |
|
| 54 |
--echo *** must show a list starting from the 'TO' argument of PURGE *** |
| 55 |
source include/show_binary_logs.inc; |
| 56 |
|
| 57 |
# |
| 58 |
# testing purge binary logs BEFORE |
| 59 |
# |
| 60 |
|
| 61 |
reset master; |
| 62 |
|
| 63 |
flush logs; |
| 64 |
flush logs; |
| 65 |
flush logs; |
| 66 |
remove_file $MYSQLD_DATADIR/binlog.000001; |
| 67 |
|
| 68 |
--echo *** must be a warning binlog.000001 was not found *** |
| 69 |
let $date=`select NOW() + INTERVAL 1 MINUTE`; |
| 70 |
--disable_query_log |
| 71 |
replace_regex /\.[\\\/]binlog/binlog/; |
| 72 |
eval purge binary logs BEFORE '$date'; |
| 73 |
--enable_query_log |
| 74 |
|
| 75 |
--echo *** must show one record, of the active binlog, left in the index file after PURGE *** |
| 76 |
source include/show_binary_logs.inc; |
| 77 |
|
| 78 |
# |
| 79 |
# testing a fatal error |
| 80 |
# Turning a binlog file into a directory must be a portable setup |
| 81 |
# |
| 82 |
|
| 83 |
reset master; |
| 84 |
|
| 85 |
flush logs; |
| 86 |
flush logs; |
| 87 |
flush logs; |
| 88 |
|
| 89 |
remove_file $MYSQLD_DATADIR/binlog.000001; |
| 90 |
mkdir $MYSQLD_DATADIR/binlog.000001; |
| 91 |
|
| 92 |
--error ER_BINLOG_PURGE_FATAL_ERR |
| 93 |
purge binary logs TO 'binlog.000002'; |
| 94 |
replace_regex /\.[\\\/]binlog/binlog/; |
| 95 |
show warnings; |
| 96 |
rmdir $MYSQLD_DATADIR/binlog.000001; |
| 97 |
--disable_warnings |
| 98 |
reset master; |
| 99 |
--enable_warnings |
| 100 |
|
| 101 |
--echo # crash_purge_before_update_index |
| 102 |
flush logs; |
| 103 |
|
| 104 |
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
| 105 |
SET SESSION debug="+d,crash_purge_before_update_index"; |
| 106 |
--error 2013 |
| 107 |
purge binary logs TO 'binlog.000002'; |
| 108 |
|
| 109 |
--enable_reconnect |
| 110 |
--source include/wait_until_connected_again.inc |
| 111 |
|
| 112 |
file_exists $MYSQLD_DATADIR/binlog.000001; |
| 113 |
file_exists $MYSQLD_DATADIR/binlog.000002; |
| 114 |
file_exists $MYSQLD_DATADIR/binlog.000003; |
| 115 |
--chmod 0644 $INDEX |
| 116 |
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR |
| 117 |
-- eval SET @index=LOAD_FILE('$index') |
| 118 |
-- replace_regex /\.[\\\/]binlog/binlog/ |
| 119 |
SELECT @index; |
| 120 |
|
| 121 |
--echo # crash_purge_non_critical_after_update_index |
| 122 |
flush logs; |
| 123 |
|
| 124 |
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
| 125 |
SET SESSION debug="+d,crash_purge_non_critical_after_update_index"; |
| 126 |
--error 2013 |
| 127 |
purge binary logs TO 'binlog.000004'; |
| 128 |
|
| 129 |
--enable_reconnect |
| 130 |
--source include/wait_until_connected_again.inc |
| 131 |
|
| 132 |
--error 1 |
| 133 |
file_exists $MYSQLD_DATADIR/binlog.000001; |
| 134 |
--error 1 |
| 135 |
file_exists $MYSQLD_DATADIR/binlog.000002; |
| 136 |
--error 1 |
| 137 |
file_exists $MYSQLD_DATADIR/binlog.000003; |
| 138 |
--chmod 0644 $INDEX |
| 139 |
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR |
| 140 |
-- eval SET @index=LOAD_FILE('$index') |
| 141 |
-- replace_regex /\.[\\\/]binlog/binlog/ |
| 142 |
SELECT @index; |
| 143 |
|
| 144 |
--echo # crash_purge_critical_after_update_index |
| 145 |
flush logs; |
| 146 |
|
| 147 |
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
| 148 |
SET SESSION debug="+d,crash_purge_critical_after_update_index"; |
| 149 |
--error 2013 |
| 150 |
purge binary logs TO 'binlog.000006'; |
| 151 |
|
| 152 |
--enable_reconnect |
| 153 |
--source include/wait_until_connected_again.inc |
| 154 |
|
| 155 |
--error 1 |
| 156 |
file_exists $MYSQLD_DATADIR/binlog.000004; |
| 157 |
--error 1 |
| 158 |
file_exists $MYSQLD_DATADIR/binlog.000005; |
| 159 |
file_exists $MYSQLD_DATADIR/binlog.000006; |
| 160 |
file_exists $MYSQLD_DATADIR/binlog.000007; |
| 161 |
--error 1 |
| 162 |
file_exists $MYSQLD_DATADIR/binlog.000008; |
| 163 |
--chmod 0644 $INDEX |
| 164 |
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR |
| 165 |
-- eval SET @index=LOAD_FILE('$index') |
| 166 |
-- replace_regex /\.[\\\/]binlog/binlog/ |
| 167 |
SELECT @index; |
| 168 |
|
| 169 |
--echo # crash_create_non_critical_before_update_index |
| 170 |
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
| 171 |
SET SESSION debug="+d,crash_create_non_critical_before_update_index"; |
| 172 |
--error 2013 |
| 173 |
flush logs; |
| 174 |
|
| 175 |
--enable_reconnect |
| 176 |
--source include/wait_until_connected_again.inc |
| 177 |
|
| 178 |
file_exists $MYSQLD_DATADIR/binlog.000008; |
| 179 |
--error 1 |
| 180 |
file_exists $MYSQLD_DATADIR/binlog.000009; |
| 181 |
--chmod 0644 $INDEX |
| 182 |
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR |
| 183 |
-- eval SET @index=LOAD_FILE('$index') |
| 184 |
-- replace_regex /\.[\\\/]binlog/binlog/ |
| 185 |
SELECT @index; |
| 186 |
|
| 187 |
--echo # crash_create_critical_before_update_index |
| 188 |
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
| 189 |
SET SESSION debug="+d,crash_create_critical_before_update_index"; |
| 190 |
--error 2013 |
| 191 |
flush logs; |
| 192 |
|
| 193 |
--enable_reconnect |
| 194 |
--source include/wait_until_connected_again.inc |
| 195 |
|
| 196 |
file_exists $MYSQLD_DATADIR/binlog.000009; |
| 197 |
--error 1 |
| 198 |
file_exists $MYSQLD_DATADIR/binlog.000010; |
| 199 |
--error 1 |
| 200 |
file_exists $MYSQLD_DATADIR/binlog.000011; |
| 201 |
--chmod 0644 $INDEX |
| 202 |
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR |
| 203 |
-- eval SET @index=LOAD_FILE('$index') |
| 204 |
-- replace_regex /\.[\\\/]binlog/binlog/ |
| 205 |
SELECT @index; |
| 206 |
|
| 207 |
--echo # crash_create_after_update_index |
| 208 |
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
| 209 |
SET SESSION debug="+d,crash_create_after_update_index"; |
| 210 |
--error 2013 |
| 211 |
flush logs; |
| 212 |
|
| 213 |
--enable_reconnect |
| 214 |
--source include/wait_until_connected_again.inc |
| 215 |
|
| 216 |
file_exists $MYSQLD_DATADIR/binlog.000010; |
| 217 |
file_exists $MYSQLD_DATADIR/binlog.000011; |
| 218 |
--chmod 0644 $INDEX |
| 219 |
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR |
| 220 |
-- eval SET @index=LOAD_FILE('$index') |
| 221 |
-- replace_regex /\.[\\\/]binlog/binlog/ |
| 222 |
SELECT @index; |
| 223 |
|
| 224 |
--echo # |
| 225 |
--echo # This should put the server in unsafe state and stop |
| 226 |
--echo # accepting any command. If we inject a fault at this |
| 227 |
--echo # point and continue the execution the server crashes. |
| 228 |
--echo # |
| 229 |
|
| 230 |
--chmod 0644 $INDEX |
| 231 |
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR |
| 232 |
-- eval SET @index=LOAD_FILE('$index') |
| 233 |
-- replace_regex /\.[\\\/]binlog/binlog/ |
| 234 |
SELECT @index; |
| 235 |
|
| 236 |
--echo # fault_injection_registering_index |
| 237 |
SET SESSION debug="+d,fault_injection_registering_index"; |
| 238 |
SET GLOBAL binlog_error_action= IGNORE_ERROR; |
| 239 |
# normalize strerror message for solaris10-sparc-64bit as long as errno is OK |
| 240 |
-- replace_regex /\.[\\\/]binlog/binlog/ /errno: 1 - .*\)/errno: 1 - Operation not permitted)/ |
| 241 |
-- error ER_CANT_OPEN_FILE |
| 242 |
flush logs; |
| 243 |
|
| 244 |
--chmod 0644 $INDEX |
| 245 |
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR |
| 246 |
-- eval SET @index=LOAD_FILE('$index') |
| 247 |
-- replace_regex /\.[\\\/]binlog/binlog/ |
| 248 |
SELECT @index; |
| 249 |
|
| 250 |
--source include/restart_mysqld.inc |
| 251 |
|
| 252 |
--chmod 0644 $INDEX |
| 253 |
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR |
| 254 |
-- eval SET @index=LOAD_FILE('$index') |
| 255 |
-- replace_regex /\.[\\\/]binlog/binlog/ |
| 256 |
SELECT @index; |
| 257 |
|
| 258 |
--echo # fault_injection_updating_index |
| 259 |
SET SESSION debug="+d,fault_injection_updating_index"; |
| 260 |
SET GLOBAL binlog_error_action= IGNORE_ERROR; |
| 261 |
# normalize strerror message for solaris10-sparc-64bit as long as errno is OK |
| 262 |
-- replace_regex /\.[\\\/]binlog/binlog/ /errno: 1 - .*\)/errno: 1 - Operation not permitted)/ |
| 263 |
-- error ER_CANT_OPEN_FILE |
| 264 |
flush logs; |
| 265 |
|
| 266 |
--chmod 0644 $INDEX |
| 267 |
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR |
| 268 |
-- eval SET @index=LOAD_FILE('$index') |
| 269 |
-- replace_regex /\.[\\\/]binlog/binlog/ |
| 270 |
SELECT @index; |
| 271 |
|
| 272 |
--source include/restart_mysqld.inc |
| 273 |
|
| 274 |
--chmod 0644 $INDEX |
| 275 |
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR |
| 276 |
-- eval SET @index=LOAD_FILE('$index') |
| 277 |
-- replace_regex /\.[\\\/]binlog/binlog/ |
| 278 |
SELECT @index; |
| 279 |
|
| 280 |
# |
| 281 |
# WL#5493 |
| 282 |
# Test case6 verifies if the index file has the correct data, |
| 283 |
# i.e. if binlog file name is added after the master restarts |
| 284 |
# when setting DEBUG POINT before renaming index file. |
| 285 |
# |
| 286 |
# Test case7 verifies if the index file has the correct data, |
| 287 |
# i.e. if binlog file name is added after the master restarts |
| 288 |
# when setting DEBUG POINT after renaming index file. |
| 289 |
# |
| 290 |
# Test case8 verifies if the index file has the correct data, |
| 291 |
# i.e. if requested binlog file names are removed after the |
| 292 |
# master restarts when setting DEBUG POINT after purging index |
| 293 |
# file. |
| 294 |
# |
| 295 |
# Test case9 verifies if the index file has the correct data, |
| 296 |
# i.e. if requested binlog file names are removed after the |
| 297 |
# master restarts when setting DEBUG POINT before purging index |
| 298 |
# file. |
| 299 |
# |
| 300 |
# Test case10 verifies if the index file has the correct data, |
| 301 |
# i.e. although requested binlog file names are not removed |
| 302 |
# after the master restarts when injecting a fault to the |
| 303 |
# temp file in the process of purging the index file. |
| 304 |
# |
| 305 |
|
| 306 |
-- echo # Test case6: Set DEBUG POINT before rename index file when |
| 307 |
-- echo # appending a binlog file name to index file. |
| 308 |
-- source include/show_binary_logs.inc |
| 309 |
file_exists $MYSQLD_DATADIR/binlog.000013; |
| 310 |
--error 1 |
| 311 |
file_exists $MYSQLD_DATADIR/binlog.000014; |
| 312 |
|
| 313 |
# Write file to make mysql-test-run.pl expect crash and restart |
| 314 |
SET SESSION debug="+d,crash_create_before_rename_index_file"; |
| 315 |
-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
| 316 |
|
| 317 |
--error 2013 |
| 318 |
flush logs; |
| 319 |
|
| 320 |
-- source include/wait_until_disconnected.inc |
| 321 |
-- enable_reconnect |
| 322 |
-- echo # Restart the master server |
| 323 |
-- exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
| 324 |
-- source include/wait_until_connected_again.inc |
| 325 |
-- disable_reconnect |
| 326 |
|
| 327 |
-- echo # Test if the index file has the correct data, |
| 328 |
-- echo # i.e. binlog file name is added. |
| 329 |
-- source include/show_binary_logs.inc |
| 330 |
file_exists $MYSQLD_DATADIR/binlog.000014; |
| 331 |
file_exists $MYSQLD_DATADIR/binlog.000015; |
| 332 |
--error 1 |
| 333 |
file_exists $MYSQLD_DATADIR/binlog.000016; |
| 334 |
|
| 335 |
-- echo # Test case7: Set DEBUG POINT after rename index file when |
| 336 |
-- echo # appending a binlog file name to index file. |
| 337 |
# Write file to make mysql-test-run.pl expect crash and restart |
| 338 |
SET SESSION debug="+d,crash_create_after_rename_index_file"; |
| 339 |
-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
| 340 |
|
| 341 |
-- error 2013 |
| 342 |
flush logs; |
| 343 |
|
| 344 |
-- source include/wait_until_disconnected.inc |
| 345 |
-- enable_reconnect |
| 346 |
-- echo # Restart the master server |
| 347 |
-- exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
| 348 |
-- source include/wait_until_connected_again.inc |
| 349 |
-- disable_reconnect |
| 350 |
|
| 351 |
-- echo # Test if the index file has the correct data, |
| 352 |
-- echo # i.e. binlog file name is added. |
| 353 |
-- source include/show_binary_logs.inc |
| 354 |
file_exists $MYSQLD_DATADIR/binlog.000016; |
| 355 |
file_exists $MYSQLD_DATADIR/binlog.000017; |
| 356 |
--error 1 |
| 357 |
file_exists $MYSQLD_DATADIR/binlog.000018; |
| 358 |
|
| 359 |
-- echo # Test case8: Set DEBUG POINT after rename index file when |
| 360 |
-- echo # purging the index file. |
| 361 |
|
| 362 |
-- source include/show_binary_logs.inc |
| 363 |
# Write file to make mysql-test-run.pl expect crash and restart |
| 364 |
SET SESSION debug="+d,crash_create_after_rename_index_file"; |
| 365 |
-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
| 366 |
|
| 367 |
-- error 2013 |
| 368 |
purge binary logs TO 'binlog.000010'; |
| 369 |
|
| 370 |
-- source include/wait_until_disconnected.inc |
| 371 |
-- enable_reconnect |
| 372 |
-- echo # Restart the master server |
| 373 |
-- exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
| 374 |
-- source include/wait_until_connected_again.inc |
| 375 |
-- disable_reconnect |
| 376 |
|
| 377 |
-- echo # Test if the index file has the correct data, |
| 378 |
-- echo # i.e. requested binlog file names are removed. |
| 379 |
-- source include/show_binary_logs.inc |
| 380 |
-- error 1 |
| 381 |
file_exists $MYSQLD_DATADIR/binlog.000008; |
| 382 |
-- error 1 |
| 383 |
file_exists $MYSQLD_DATADIR/binlog.000009; |
| 384 |
file_exists $MYSQLD_DATADIR/binlog.000010; |
| 385 |
|
| 386 |
-- echo # Test case9: Set DEBUG POINT befor rename index file when |
| 387 |
-- echo # purging the index file. |
| 388 |
|
| 389 |
-- source include/show_binary_logs.inc |
| 390 |
# Write file to make mysql-test-run.pl expect crash and restart |
| 391 |
SET SESSION debug="+d,crash_create_before_rename_index_file"; |
| 392 |
-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
| 393 |
|
| 394 |
-- error 2013 |
| 395 |
purge binary logs TO 'binlog.000012'; |
| 396 |
|
| 397 |
-- source include/wait_until_disconnected.inc |
| 398 |
-- enable_reconnect |
| 399 |
-- echo # Restart the master server |
| 400 |
-- exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
| 401 |
-- source include/wait_until_connected_again.inc |
| 402 |
-- disable_reconnect |
| 403 |
|
| 404 |
-- echo # Test if the index file has the correct data, |
| 405 |
-- echo # i.e. requested binlog file names are removed. |
| 406 |
-- source include/show_binary_logs.inc |
| 407 |
-- error 1 |
| 408 |
file_exists $MYSQLD_DATADIR/binlog.000010; |
| 409 |
-- error 1 |
| 410 |
file_exists $MYSQLD_DATADIR/binlog.000011; |
| 411 |
file_exists $MYSQLD_DATADIR/binlog.000012; |
| 412 |
|
| 413 |
-- echo # Test case10: Inject a fault to copy part content to the temp file |
| 414 |
-- echo # when purging the index file. |
| 415 |
|
| 416 |
-- source include/show_binary_logs.inc |
| 417 |
# Write file to make mysql-test-run.pl expect crash and restart |
| 418 |
SET SESSION debug="+d,fault_injection_copy_part_file"; |
| 419 |
-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
| 420 |
|
| 421 |
-- error 2013 |
| 422 |
purge binary logs TO 'binlog.000014'; |
| 423 |
|
| 424 |
-- source include/wait_until_disconnected.inc |
| 425 |
-- enable_reconnect |
| 426 |
-- echo # Restart the master server |
| 427 |
-- exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
| 428 |
-- source include/wait_until_connected_again.inc |
| 429 |
-- disable_reconnect |
| 430 |
|
| 431 |
-- echo # Test the index file is complete, although is not purged successfully. |
| 432 |
-- source include/show_binary_logs.inc |
| 433 |
file_exists $MYSQLD_DATADIR/binlog.000012; |
| 434 |
file_exists $MYSQLD_DATADIR/binlog.000013; |
| 435 |
file_exists $MYSQLD_DATADIR/binlog.000014; |
| 436 |
|
| 437 |
-- echo # Test case11: Bug #20381055SERVER CRASHES IF INDEX FILE IS OPENED BY |
| 438 |
# OTHER APPLICATION AND PURGE IS ISSUED. |
| 439 |
# This test case test the server behaviour if index file cannot be |
| 440 |
# deleted. |
| 441 |
SET SESSION debug="d,force_index_file_delete_failure"; |
| 442 |
|
| 443 |
# Add supressions |
| 444 |
call mtr.add_suppression("Failed to delete the existing index file"); |
| 445 |
call mtr.add_suppression("failed to move crash safe index file to index file"); |
| 446 |
call mtr.add_suppression("failed to update the index file"); |
| 447 |
|
| 448 |
# When index file cannot be recreated during purge binary logs command, |
| 449 |
# it should throw error but it should not disable binary logging. |
| 450 |
-- error ER_IO_ERR_LOG_INDEX_READ |
| 451 |
-- eval PURGE BINARY LOGS TO 'binlog.000014'; |
| 452 |
|
| 453 |
-- echo # Test the index file is complete, although is not purged successfully. |
| 454 |
-- echo # Also this will indicate that binary logging is not disabled. |
| 455 |
-- source include/show_binary_logs.inc |
| 456 |
file_exists $MYSQLD_DATADIR/binlog.000012; |
| 457 |
file_exists $MYSQLD_DATADIR/binlog.000013; |
| 458 |
file_exists $MYSQLD_DATADIR/binlog.000014; |
| 459 |
|
| 460 |
# When index file cannot be recreated during FLUSH LOGS command, |
| 461 |
# it should throw error and binary logging should be disabled. |
| 462 |
SET GLOBAL binlog_error_action='IGNORE_ERROR'; |
| 463 |
# normalize strerror message for solaris10-sparc-64bit as long as errno is OK |
| 464 |
--replace_regex /\.[\\\/]binlog/binlog/ /errno: 1 - .*\)/errno: 1 - Operation not permitted)/ |
| 465 |
--error ER_CANT_OPEN_FILE |
| 466 |
FLUSH LOGS; |
| 467 |
|
| 468 |
--error ER_NO_BINARY_LOGGING |
| 469 |
SHOW BINARY LOGS; |
| 470 |
--source include/restart_mysqld.inc |
| 471 |
--source include/show_binary_logs.inc |
| 472 |
CREATE TABLE t1(i INT); |
| 473 |
SET GLOBAL binlog_error_action='IGNORE_ERROR'; |
| 474 |
SET SESSION debug="+d,force_index_file_delete_failure"; |
| 475 |
SET SESSION debug="+d,force_rotate"; |
| 476 |
|
| 477 |
# When index file cannot be recreated during DML command which |
| 478 |
# is trying to rotate the binary log, it should throw error and |
| 479 |
# binary logging should be disabled. |
| 480 |
# normalize strerror message for solaris10-sparc-64bit as long as errno is OK |
| 481 |
--replace_regex /\.[\\\/]binlog/binlog/ /errno: 1 - .*\)/errno: 1 - Operation not permitted)/ |
| 482 |
--error ER_CANT_OPEN_FILE |
| 483 |
INSERT INTO t1 VALUES (12); |
| 484 |
|
| 485 |
--error ER_NO_BINARY_LOGGING |
| 486 |
SHOW BINARY LOGS; |
| 487 |
|
| 488 |
--source include/restart_mysqld.inc |
| 489 |
-- source include/show_binary_logs.inc |
| 490 |
DROP TABLE t1; |
| 491 |
eval SET SESSION debug="$old"; |
| 492 |
-- echo # Test case11: Ends |
| 493 |
|
| 494 |
|
| 495 |
--echo # Test case12: Bug#25839610 ABORT OCCUR DURING SLAVE BACKUP |
| 496 |
--echo # WHEN RELAY LOG INDEX IS LOCK |
| 497 |
--echo # This test verifies that serveral retries are performed |
| 498 |
--echo # if there is a failure while deleting/renaming index files. |
| 499 |
|
| 500 |
--disable_warnings |
| 501 |
SET SESSION debug="+d,simulate_index_file_delete_failure"; |
| 502 |
SET SESSION debug="+d,simulate_crash_safe_index_file_rename_failure"; |
| 503 |
FLUSH LOGS; |
| 504 |
|
| 505 |
# Check that delete retry is present in the error log |
| 506 |
--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err |
| 507 |
--let $assert_count = 5 |
| 508 |
--let $assert_select = Retrying delete |
| 509 |
--let $assert_text = Retried for delete. |
| 510 |
--source include/assert_grep.inc |
| 511 |
|
| 512 |
# Check that rename retry is present in the error log |
| 513 |
--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err |
| 514 |
--let $assert_count = 5 |
| 515 |
--let $assert_select = Retrying rename |
| 516 |
--let $assert_text = Retried for rename. |
| 517 |
--source include/assert_grep.inc |
| 518 |
--enable_warnings |
| 519 |
eval SET SESSION debug="$old"; |
| 520 |
--echo # Test case12: Ends |
| 521 |
|
| 522 |
eval SET GLOBAL binlog_error_action= $saved_binlog_error_action; |
| 523 |
|
| 524 |
# Reset Master deletes all binary log files listed in the index file, resets |
| 525 |
# the binary log index file to be empty and creates a new binary log file. |
| 526 |
RESET MASTER; |
| 527 |
|
| 528 |
--echo End of tests |