| 1 |
|
| 2 |
# BUG#40611: MySQL cannot make a binary log after sequential number beyond |
| 3 |
# unsigned long. |
| 4 |
# |
| 5 |
# Problem statement |
| 6 |
# ================= |
| 7 |
# |
| 8 |
# Extension for log file names might be created with negative |
| 9 |
# numbers (when counter used would wrap around), causing server |
| 10 |
# failure when incrementing -00001 (reaching number 000000 |
| 11 |
# extension). |
| 12 |
# |
| 13 |
# Test |
| 14 |
# ==== |
| 15 |
# This tests aims at testing the a patch that removes negatives |
| 16 |
# numbers from log name extensions and checks that the server |
| 17 |
# reports gracefully that the limit has been reached. |
| 18 |
# |
| 19 |
# It instruments index file to point to a log file close to |
| 20 |
# the new maximum and calls flush logs to get warning. |
| 21 |
# |
| 22 |
|
| 23 |
call mtr.add_suppression("Next log extension: 2147483647. Remaining log filename extensions: 0."); |
| 24 |
call mtr.add_suppression("Log filename extension number exhausted:"); |
| 25 |
call mtr.add_suppression("Can't generate a unique log-filename"); |
| 26 |
call mtr.add_suppression("Could not open .*"); |
| 27 |
-- source include/have_log_bin.inc |
| 28 |
RESET MASTER; |
| 29 |
|
| 30 |
-- let $MYSQLD_DATADIR= `select @@datadir` |
| 31 |
|
| 32 |
############################################### |
| 33 |
# check hitting maximum file name extension: |
| 34 |
############################################### |
| 35 |
|
| 36 |
########## |
| 37 |
# Prepare |
| 38 |
########## |
| 39 |
|
| 40 |
# 1. Stop master server |
| 41 |
-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
| 42 |
-- shutdown_server |
| 43 |
-- source include/wait_until_disconnected.inc |
| 44 |
|
| 45 |
# 2. Prepare log and index file |
| 46 |
-- copy_file $MYSQLD_DATADIR/binlog.index $MYSQLD_DATADIR/binlog.index.orig |
| 47 |
-- copy_file $MYSQLD_DATADIR/binlog.000001 $MYSQLD_DATADIR/binlog.2147483646 |
| 48 |
-- append_file $MYSQLD_DATADIR/binlog.index |
| 49 |
binlog.2147483646 |
| 50 |
EOF |
| 51 |
|
| 52 |
# 3. Restart the server |
| 53 |
-- exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
| 54 |
-- enable_reconnect |
| 55 |
-- source include/wait_until_connected_again.inc |
| 56 |
SET GLOBAL binlog_error_action= IGNORE_ERROR; |
| 57 |
########### |
| 58 |
# Assertion |
| 59 |
########### |
| 60 |
|
| 61 |
# assertion: should raise error |
| 62 |
-- error ER_NO_UNIQUE_LOGFILE |
| 63 |
FLUSH LOGS; |
| 64 |
|
| 65 |
############## |
| 66 |
# Clean up |
| 67 |
############## |
| 68 |
|
| 69 |
# 1. Stop the server |
| 70 |
-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
| 71 |
-- shutdown_server |
| 72 |
-- source include/wait_until_disconnected.inc |
| 73 |
|
| 74 |
# 2. Undo changes to index and log files |
| 75 |
-- remove_file $MYSQLD_DATADIR/binlog.index |
| 76 |
-- copy_file $MYSQLD_DATADIR/binlog.index.orig $MYSQLD_DATADIR/binlog.index |
| 77 |
-- remove_file $MYSQLD_DATADIR/binlog.index.orig |
| 78 |
|
| 79 |
-- remove_file $MYSQLD_DATADIR/binlog.2147483646 |
| 80 |
-- remove_file $MYSQLD_DATADIR/binlog.2147483647 |
| 81 |
|
| 82 |
# 3. Restart the server |
| 83 |
-- exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
| 84 |
-- enable_reconnect |
| 85 |
-- source include/wait_until_connected_again.inc |