Debian Codegraph @

mysql-test/suite/binlog/t/binlog_max_extension.test

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