| 1 |
call mtr.add_suppression('Attempting backtrace'); |
| 2 |
call mtr.add_suppression('MYSQL_BIN_LOG::purge_logs failed to process registered files that would be purged.'); |
| 3 |
call mtr.add_suppression('MYSQL_BIN_LOG::open failed to sync the index file'); |
| 4 |
call mtr.add_suppression('Turning logging off for the whole duration of the MySQL server process.'); |
| 5 |
call mtr.add_suppression('Could not open .*'); |
| 6 |
call mtr.add_suppression('MYSQL_BIN_LOG::purge_logs failed to clean registers before purging logs.'); |
| 7 |
RESET MASTER; |
| 8 |
flush logs; |
| 9 |
flush logs; |
| 10 |
flush logs; |
| 11 |
show binary logs; |
| 12 |
Log_name File_size Encrypted |
| 13 |
binlog.000001 # # |
| 14 |
binlog.000002 # # |
| 15 |
binlog.000003 # # |
| 16 |
binlog.000004 # # |
| 17 |
# Create a dedicated user to demonstrate the BINLOG_ADMIN privilege |
| 18 |
CREATE USER binlog_admin@localhost IDENTIFIED BY 'foo'; |
| 19 |
GRANT BINLOG_ADMIN ON *.* TO binlog_admin@localhost; |
| 20 |
purge binary logs TO 'binlog.000004'; |
| 21 |
Warnings: |
| 22 |
Warning 1612 Being purged log binlog.000001 was not found |
| 23 |
REVOKE binlog_admin ON *.* FROM binlog_admin@localhost; |
| 24 |
purge binary logs TO 'binlog.000004'; |
| 25 |
ERROR 42000: Access denied; you need (at least one of) the SUPER or BINLOG_ADMIN privilege(s) for this operation |
| 26 |
DROP USER binlog_admin@localhost; |
| 27 |
*** must show a list starting from the 'TO' argument of PURGE *** |
| 28 |
show binary logs; |
| 29 |
Log_name File_size Encrypted |
| 30 |
binlog.000004 # # |
| 31 |
reset master; |
| 32 |
flush logs; |
| 33 |
flush logs; |
| 34 |
flush logs; |
| 35 |
*** must be a warning binlog.000001 was not found *** |
| 36 |
Warnings: |
| 37 |
Warning 1868 file binlog.000004 was not purged because it is the active log file. |
| 38 |
Warning 1612 Being purged log binlog.000001 was not found |
| 39 |
*** must show one record, of the active binlog, left in the index file after PURGE *** |
| 40 |
show binary logs; |
| 41 |
Log_name File_size Encrypted |
| 42 |
binlog.000004 # # |
| 43 |
reset master; |
| 44 |
flush logs; |
| 45 |
flush logs; |
| 46 |
flush logs; |
| 47 |
purge binary logs TO 'binlog.000002'; |
| 48 |
ERROR HY000: Fatal error during log purge |
| 49 |
show warnings; |
| 50 |
Level Code Message |
| 51 |
Warning 1377 a problem with deleting binlog.000001; consider examining correspondence of your binlog index file to the actual binlog files |
| 52 |
Error 1377 Fatal error during log purge |
| 53 |
reset master; |
| 54 |
# crash_purge_before_update_index |
| 55 |
flush logs; |
| 56 |
SET SESSION debug="+d,crash_purge_before_update_index"; |
| 57 |
purge binary logs TO 'binlog.000002'; |
| 58 |
ERROR HY000: Lost connection to MySQL server during query |
| 59 |
SET @index=LOAD_FILE('MYSQLTEST_VARDIR/mysqld.1/data//binlog.index'); |
| 60 |
SELECT @index; |
| 61 |
@index |
| 62 |
binlog.000001 |
| 63 |
binlog.000002 |
| 64 |
binlog.000003 |
| 65 |
|
| 66 |
# crash_purge_non_critical_after_update_index |
| 67 |
flush logs; |
| 68 |
SET SESSION debug="+d,crash_purge_non_critical_after_update_index"; |
| 69 |
purge binary logs TO 'binlog.000004'; |
| 70 |
ERROR HY000: Lost connection to MySQL server during query |
| 71 |
SET @index=LOAD_FILE('MYSQLTEST_VARDIR/mysqld.1/data//binlog.index'); |
| 72 |
SELECT @index; |
| 73 |
@index |
| 74 |
binlog.000004 |
| 75 |
binlog.000005 |
| 76 |
|
| 77 |
# crash_purge_critical_after_update_index |
| 78 |
flush logs; |
| 79 |
SET SESSION debug="+d,crash_purge_critical_after_update_index"; |
| 80 |
purge binary logs TO 'binlog.000006'; |
| 81 |
ERROR HY000: Lost connection to MySQL server during query |
| 82 |
SET @index=LOAD_FILE('MYSQLTEST_VARDIR/mysqld.1/data//binlog.index'); |
| 83 |
SELECT @index; |
| 84 |
@index |
| 85 |
binlog.000006 |
| 86 |
binlog.000007 |
| 87 |
|
| 88 |
# crash_create_non_critical_before_update_index |
| 89 |
SET SESSION debug="+d,crash_create_non_critical_before_update_index"; |
| 90 |
flush logs; |
| 91 |
ERROR HY000: Lost connection to MySQL server during query |
| 92 |
SET @index=LOAD_FILE('MYSQLTEST_VARDIR/mysqld.1/data//binlog.index'); |
| 93 |
SELECT @index; |
| 94 |
@index |
| 95 |
binlog.000006 |
| 96 |
binlog.000007 |
| 97 |
binlog.000008 |
| 98 |
|
| 99 |
# crash_create_critical_before_update_index |
| 100 |
SET SESSION debug="+d,crash_create_critical_before_update_index"; |
| 101 |
flush logs; |
| 102 |
ERROR HY000: Lost connection to MySQL server during query |
| 103 |
SET @index=LOAD_FILE('MYSQLTEST_VARDIR/mysqld.1/data//binlog.index'); |
| 104 |
SELECT @index; |
| 105 |
@index |
| 106 |
binlog.000006 |
| 107 |
binlog.000007 |
| 108 |
binlog.000008 |
| 109 |
binlog.000009 |
| 110 |
|
| 111 |
# crash_create_after_update_index |
| 112 |
SET SESSION debug="+d,crash_create_after_update_index"; |
| 113 |
flush logs; |
| 114 |
ERROR HY000: Lost connection to MySQL server during query |
| 115 |
SET @index=LOAD_FILE('MYSQLTEST_VARDIR/mysqld.1/data//binlog.index'); |
| 116 |
SELECT @index; |
| 117 |
@index |
| 118 |
binlog.000006 |
| 119 |
binlog.000007 |
| 120 |
binlog.000008 |
| 121 |
binlog.000009 |
| 122 |
binlog.000010 |
| 123 |
binlog.000011 |
| 124 |
|
| 125 |
# |
| 126 |
# This should put the server in unsafe state and stop |
| 127 |
# accepting any command. If we inject a fault at this |
| 128 |
# point and continue the execution the server crashes. |
| 129 |
# |
| 130 |
SET @index=LOAD_FILE('MYSQLTEST_VARDIR/mysqld.1/data//binlog.index'); |
| 131 |
SELECT @index; |
| 132 |
@index |
| 133 |
binlog.000006 |
| 134 |
binlog.000007 |
| 135 |
binlog.000008 |
| 136 |
binlog.000009 |
| 137 |
binlog.000010 |
| 138 |
binlog.000011 |
| 139 |
|
| 140 |
# fault_injection_registering_index |
| 141 |
SET SESSION debug="+d,fault_injection_registering_index"; |
| 142 |
SET GLOBAL binlog_error_action= IGNORE_ERROR; |
| 143 |
flush logs; |
| 144 |
ERROR HY000: Can't open file: 'binlog.000012' (errno: 1 - Operation not permitted) |
| 145 |
SET @index=LOAD_FILE('MYSQLTEST_VARDIR/mysqld.1/data//binlog.index'); |
| 146 |
SELECT @index; |
| 147 |
@index |
| 148 |
binlog.000006 |
| 149 |
binlog.000007 |
| 150 |
binlog.000008 |
| 151 |
binlog.000009 |
| 152 |
binlog.000010 |
| 153 |
binlog.000011 |
| 154 |
|
| 155 |
# restart |
| 156 |
SET @index=LOAD_FILE('MYSQLTEST_VARDIR/mysqld.1/data//binlog.index'); |
| 157 |
SELECT @index; |
| 158 |
@index |
| 159 |
binlog.000006 |
| 160 |
binlog.000007 |
| 161 |
binlog.000008 |
| 162 |
binlog.000009 |
| 163 |
binlog.000010 |
| 164 |
binlog.000011 |
| 165 |
binlog.000012 |
| 166 |
|
| 167 |
# fault_injection_updating_index |
| 168 |
SET SESSION debug="+d,fault_injection_updating_index"; |
| 169 |
SET GLOBAL binlog_error_action= IGNORE_ERROR; |
| 170 |
flush logs; |
| 171 |
ERROR HY000: Can't open file: 'binlog.000013' (errno: 1 - Operation not permitted) |
| 172 |
SET @index=LOAD_FILE('MYSQLTEST_VARDIR/mysqld.1/data//binlog.index'); |
| 173 |
SELECT @index; |
| 174 |
@index |
| 175 |
binlog.000006 |
| 176 |
binlog.000007 |
| 177 |
binlog.000008 |
| 178 |
binlog.000009 |
| 179 |
binlog.000010 |
| 180 |
binlog.000011 |
| 181 |
binlog.000012 |
| 182 |
|
| 183 |
# restart |
| 184 |
SET @index=LOAD_FILE('MYSQLTEST_VARDIR/mysqld.1/data//binlog.index'); |
| 185 |
SELECT @index; |
| 186 |
@index |
| 187 |
binlog.000006 |
| 188 |
binlog.000007 |
| 189 |
binlog.000008 |
| 190 |
binlog.000009 |
| 191 |
binlog.000010 |
| 192 |
binlog.000011 |
| 193 |
binlog.000012 |
| 194 |
binlog.000013 |
| 195 |
|
| 196 |
# Test case6: Set DEBUG POINT before rename index file when |
| 197 |
# appending a binlog file name to index file. |
| 198 |
show binary logs; |
| 199 |
Log_name File_size Encrypted |
| 200 |
binlog.000006 # # |
| 201 |
binlog.000007 # # |
| 202 |
binlog.000008 # # |
| 203 |
binlog.000009 # # |
| 204 |
binlog.000010 # # |
| 205 |
binlog.000011 # # |
| 206 |
binlog.000012 # # |
| 207 |
binlog.000013 # # |
| 208 |
SET SESSION debug="+d,crash_create_before_rename_index_file"; |
| 209 |
flush logs; |
| 210 |
ERROR HY000: Lost connection to MySQL server during query |
| 211 |
# Restart the master server |
| 212 |
# Test if the index file has the correct data, |
| 213 |
# i.e. binlog file name is added. |
| 214 |
show binary logs; |
| 215 |
Log_name File_size Encrypted |
| 216 |
binlog.000006 # # |
| 217 |
binlog.000007 # # |
| 218 |
binlog.000008 # # |
| 219 |
binlog.000009 # # |
| 220 |
binlog.000010 # # |
| 221 |
binlog.000011 # # |
| 222 |
binlog.000012 # # |
| 223 |
binlog.000013 # # |
| 224 |
binlog.000014 # # |
| 225 |
binlog.000015 # # |
| 226 |
# Test case7: Set DEBUG POINT after rename index file when |
| 227 |
# appending a binlog file name to index file. |
| 228 |
SET SESSION debug="+d,crash_create_after_rename_index_file"; |
| 229 |
flush logs; |
| 230 |
ERROR HY000: Lost connection to MySQL server during query |
| 231 |
# Restart the master server |
| 232 |
# Test if the index file has the correct data, |
| 233 |
# i.e. binlog file name is added. |
| 234 |
show binary logs; |
| 235 |
Log_name File_size Encrypted |
| 236 |
binlog.000006 # # |
| 237 |
binlog.000007 # # |
| 238 |
binlog.000008 # # |
| 239 |
binlog.000009 # # |
| 240 |
binlog.000010 # # |
| 241 |
binlog.000011 # # |
| 242 |
binlog.000012 # # |
| 243 |
binlog.000013 # # |
| 244 |
binlog.000014 # # |
| 245 |
binlog.000015 # # |
| 246 |
binlog.000016 # # |
| 247 |
binlog.000017 # # |
| 248 |
# Test case8: Set DEBUG POINT after rename index file when |
| 249 |
# purging the index file. |
| 250 |
show binary logs; |
| 251 |
Log_name File_size Encrypted |
| 252 |
binlog.000006 # # |
| 253 |
binlog.000007 # # |
| 254 |
binlog.000008 # # |
| 255 |
binlog.000009 # # |
| 256 |
binlog.000010 # # |
| 257 |
binlog.000011 # # |
| 258 |
binlog.000012 # # |
| 259 |
binlog.000013 # # |
| 260 |
binlog.000014 # # |
| 261 |
binlog.000015 # # |
| 262 |
binlog.000016 # # |
| 263 |
binlog.000017 # # |
| 264 |
SET SESSION debug="+d,crash_create_after_rename_index_file"; |
| 265 |
purge binary logs TO 'binlog.000010'; |
| 266 |
ERROR HY000: Lost connection to MySQL server during query |
| 267 |
# Restart the master server |
| 268 |
# Test if the index file has the correct data, |
| 269 |
# i.e. requested binlog file names are removed. |
| 270 |
show binary logs; |
| 271 |
Log_name File_size Encrypted |
| 272 |
binlog.000010 # # |
| 273 |
binlog.000011 # # |
| 274 |
binlog.000012 # # |
| 275 |
binlog.000013 # # |
| 276 |
binlog.000014 # # |
| 277 |
binlog.000015 # # |
| 278 |
binlog.000016 # # |
| 279 |
binlog.000017 # # |
| 280 |
binlog.000018 # # |
| 281 |
# Test case9: Set DEBUG POINT befor rename index file when |
| 282 |
# purging the index file. |
| 283 |
show binary logs; |
| 284 |
Log_name File_size Encrypted |
| 285 |
binlog.000010 # # |
| 286 |
binlog.000011 # # |
| 287 |
binlog.000012 # # |
| 288 |
binlog.000013 # # |
| 289 |
binlog.000014 # # |
| 290 |
binlog.000015 # # |
| 291 |
binlog.000016 # # |
| 292 |
binlog.000017 # # |
| 293 |
binlog.000018 # # |
| 294 |
SET SESSION debug="+d,crash_create_before_rename_index_file"; |
| 295 |
purge binary logs TO 'binlog.000012'; |
| 296 |
ERROR HY000: Lost connection to MySQL server during query |
| 297 |
# Restart the master server |
| 298 |
# Test if the index file has the correct data, |
| 299 |
# i.e. requested binlog file names are removed. |
| 300 |
show binary logs; |
| 301 |
Log_name File_size Encrypted |
| 302 |
binlog.000012 # # |
| 303 |
binlog.000013 # # |
| 304 |
binlog.000014 # # |
| 305 |
binlog.000015 # # |
| 306 |
binlog.000016 # # |
| 307 |
binlog.000017 # # |
| 308 |
binlog.000018 # # |
| 309 |
binlog.000019 # # |
| 310 |
# Test case10: Inject a fault to copy part content to the temp file |
| 311 |
# when purging the index file. |
| 312 |
show binary logs; |
| 313 |
Log_name File_size Encrypted |
| 314 |
binlog.000012 # # |
| 315 |
binlog.000013 # # |
| 316 |
binlog.000014 # # |
| 317 |
binlog.000015 # # |
| 318 |
binlog.000016 # # |
| 319 |
binlog.000017 # # |
| 320 |
binlog.000018 # # |
| 321 |
binlog.000019 # # |
| 322 |
SET SESSION debug="+d,fault_injection_copy_part_file"; |
| 323 |
purge binary logs TO 'binlog.000014'; |
| 324 |
ERROR HY000: Lost connection to MySQL server during query |
| 325 |
# Restart the master server |
| 326 |
# Test the index file is complete, although is not purged successfully. |
| 327 |
show binary logs; |
| 328 |
Log_name File_size Encrypted |
| 329 |
binlog.000012 # # |
| 330 |
binlog.000013 # # |
| 331 |
binlog.000014 # # |
| 332 |
binlog.000015 # # |
| 333 |
binlog.000016 # # |
| 334 |
binlog.000017 # # |
| 335 |
binlog.000018 # # |
| 336 |
binlog.000019 # # |
| 337 |
binlog.000020 # # |
| 338 |
# Test case11: Bug #20381055SERVER CRASHES IF INDEX FILE IS OPENED BY |
| 339 |
SET SESSION debug="d,force_index_file_delete_failure"; |
| 340 |
call mtr.add_suppression("Failed to delete the existing index file"); |
| 341 |
call mtr.add_suppression("failed to move crash safe index file to index file"); |
| 342 |
call mtr.add_suppression("failed to update the index file"); |
| 343 |
PURGE BINARY LOGS TO 'binlog.000014';; |
| 344 |
ERROR HY000: I/O error reading log index file |
| 345 |
# Test the index file is complete, although is not purged successfully. |
| 346 |
# Also this will indicate that binary logging is not disabled. |
| 347 |
show binary logs; |
| 348 |
Log_name File_size Encrypted |
| 349 |
binlog.000012 # # |
| 350 |
binlog.000013 # # |
| 351 |
binlog.000014 # # |
| 352 |
binlog.000015 # # |
| 353 |
binlog.000016 # # |
| 354 |
binlog.000017 # # |
| 355 |
binlog.000018 # # |
| 356 |
binlog.000019 # # |
| 357 |
binlog.000020 # # |
| 358 |
SET GLOBAL binlog_error_action='IGNORE_ERROR'; |
| 359 |
FLUSH LOGS; |
| 360 |
ERROR HY000: Can't open file: 'binlog.000021' (errno: 1 - Operation not permitted) |
| 361 |
SHOW BINARY LOGS; |
| 362 |
ERROR HY000: You are not using binary logging |
| 363 |
# restart |
| 364 |
show binary logs; |
| 365 |
Log_name File_size Encrypted |
| 366 |
binlog.000012 # # |
| 367 |
binlog.000013 # # |
| 368 |
binlog.000014 # # |
| 369 |
binlog.000015 # # |
| 370 |
binlog.000016 # # |
| 371 |
binlog.000017 # # |
| 372 |
binlog.000018 # # |
| 373 |
binlog.000019 # # |
| 374 |
binlog.000020 # # |
| 375 |
binlog.000021 # # |
| 376 |
CREATE TABLE t1(i INT); |
| 377 |
SET GLOBAL binlog_error_action='IGNORE_ERROR'; |
| 378 |
SET SESSION debug="+d,force_index_file_delete_failure"; |
| 379 |
SET SESSION debug="+d,force_rotate"; |
| 380 |
INSERT INTO t1 VALUES (12); |
| 381 |
ERROR HY000: Can't open file: 'binlog.000022' (errno: 1 - Operation not permitted) |
| 382 |
SHOW BINARY LOGS; |
| 383 |
ERROR HY000: You are not using binary logging |
| 384 |
# restart |
| 385 |
show binary logs; |
| 386 |
Log_name File_size Encrypted |
| 387 |
binlog.000012 # # |
| 388 |
binlog.000013 # # |
| 389 |
binlog.000014 # # |
| 390 |
binlog.000015 # # |
| 391 |
binlog.000016 # # |
| 392 |
binlog.000017 # # |
| 393 |
binlog.000018 # # |
| 394 |
binlog.000019 # # |
| 395 |
binlog.000020 # # |
| 396 |
binlog.000021 # # |
| 397 |
binlog.000022 # # |
| 398 |
DROP TABLE t1; |
| 399 |
SET SESSION debug=""; |
| 400 |
# Test case11: Ends |
| 401 |
# Test case12: Bug#25839610 ABORT OCCUR DURING SLAVE BACKUP |
| 402 |
# WHEN RELAY LOG INDEX IS LOCK |
| 403 |
# This test verifies that serveral retries are performed |
| 404 |
# if there is a failure while deleting/renaming index files. |
| 405 |
SET SESSION debug="+d,simulate_index_file_delete_failure"; |
| 406 |
SET SESSION debug="+d,simulate_crash_safe_index_file_rename_failure"; |
| 407 |
FLUSH LOGS; |
| 408 |
include/assert_grep.inc [Retried for delete.] |
| 409 |
include/assert_grep.inc [Retried for rename.] |
| 410 |
SET SESSION debug=""; |
| 411 |
# Test case12: Ends |
| 412 |
SET GLOBAL binlog_error_action= ABORT_SERVER; |
| 413 |
RESET MASTER; |
| 414 |
End of tests |