Debian Codegraph @

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

raw
1 # ==== Purpose ====
2 #
3 # Verify that the server aborts with errors regardless of the value of
4 # binlog_error_action while restarting it with exhausted binlog index value.
5 #
6 # ==== Implementation ====
7 #
8 # 1. Manually update the index file to make the next binary log file
9 # be created with an exhausted binlog index value.
10 # 2. Shutdown the server.
11 # 3. Start the server with --binlog_error_action=IGNORE_ERROR/ABORT_SERVER.
12 # 4. Verify that the server aborts with errors.
13 # 5. Start the server after removing the binary log with exhausted index value.
14 # 6. Clean up.
15 # 7. Clean all configuration changes after running the test.
16 #
17 # ==== References ====
18 #
19 # Bug#28995220 SEGFAULT DURING SERVER START IF BINLOG INDEX VALUES ARE EXHAUSTED
20 # Bug#28980788 RESET MASTER TO ALLOWS INVALID INPUT WITHOUT ERROR'S, CAN LEAD
21 # TO SERVER HALTS
22
23 # This test script will be run only in non GR set up.
24 --source include/not_group_replication_plugin.inc
25 --source include/not_windows.inc
26 --source include/not_valgrind.inc
27
28 # Test in this file is binlog format agnostic, thus no need
29 # to rerun it for every format.
30 --source include/have_binlog_format_row.inc
31 --source include/have_log_bin.inc
32
33 call mtr.add_suppression("Next log extension: 2147483647. Remaining log filename extensions: 0. Please consider archiving some logs");
34 call mtr.add_suppression("Log filename extension number exhausted: 2147483647. Please fix this by archiving old logs and updating the index files.");
35 call mtr.add_suppression("Can't generate a unique log-filename .*");
36 call mtr.add_suppression("MYSQL_BIN_LOG::open failed to generate new file name.");
37 call mtr.add_suppression("Attempting backtrace. You can use the following information to find out*");
38
39 --write_file $MYSQLTEST_VARDIR/tmp/binlog_restart_server_with_exhausted_index_value.inc PROCEDURE
40 if ($server_params == '')
41 {
42 --die !!!ERROR IN TEST: you must set $server_params
43 }
44 if ($error_log == '')
45 {
46 --die !!!ERROR IN TEST: you must set $error_log
47 }
48 --let $mysqld=$MYSQLD_CMD --core-file --console > $error_log 2>&1 $server_params
49 --error 1
50 --exec $mysqld
51 # The server start aborts. Count should be 1 for all the below errors.
52 --let $grep_pattern=Aborting
53 --let $grep_file=$error_log
54 --let $grep_output=print_count
55 --source include/grep_pattern.inc
56
57 --let $grep_pattern=MYSQL_BIN_LOG::open failed to generate new file name.
58 --let $grep_file=$error_log
59 --let $grep_output=print_count
60 --source include/grep_pattern.inc
61
62 --let $grep_pattern=Can't generate a unique log-filename .*
63 --let $grep_file=$error_log
64 --let $grep_output=print_count
65 --source include/grep_pattern.inc
66
67 --let $grep_pattern=Log filename extension number exhausted: 2147483647. Please fix this by archiving old logs and updating the index files.
68 --let $grep_file=$error_log
69 --let $grep_output=print_count
70 --source include/grep_pattern.inc
71 #END OF
72 PROCEDURE
73
74 # Clear the existing binlogs
75 RESET MASTER;
76
77 --let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
78 --let $mysqld_datadir= `SELECT @@global.datadir`
79 --let $index_file= `SELECT @@global.log_bin_index`
80
81 # Shutdown the server and manually update the index file to make
82 # the next binary log file be created with an exhausted binlog index value.
83 --source include/shutdown_mysqld.inc
84 --remove_file $index_file
85 --write_file $index_file
86 ./binlog.2147483646
87 EOF
88 --move_file $mysqld_datadir/$binlog_file $mysqld_datadir/binlog.2147483646
89
90 # Restart the server
91 --source include/start_mysqld.inc
92 --source include/wait_until_connected_again.inc
93
94 --exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
95 --let $error_log= $MYSQLTEST_VARDIR/tmp/binlog_error_action.err
96
97 # Verify that FLUSH BINARY LOGS after the exhaustion of binlog index values
98 # causes the server to abort.
99 --error ER_BINLOG_LOGGING_IMPOSSIBLE
100 FLUSH BINARY LOGS;
101
102 --let $server_params= --binlog_error_action=IGNORE_ERROR
103 --source $MYSQLTEST_VARDIR/tmp/binlog_restart_server_with_exhausted_index_value.inc
104
105 --let $server_params= --binlog_error_action=ABORT_SERVER
106 --source $MYSQLTEST_VARDIR/tmp/binlog_restart_server_with_exhausted_index_value.inc
107
108 # Start the server after removing the binary log with exhausted index value.
109 --remove_file $MYSQLTEST_VARDIR/mysqld.1/data/binlog.index
110 --remove_file $MYSQLTEST_VARDIR/mysqld.1/data/binlog.2147483646
111 --remove_file $MYSQLTEST_VARDIR/mysqld.1/data/binlog.2147483647
112 --source include/start_mysqld.inc
113 --source include/wait_until_connected_again.inc
114 # Clean up.
115 --let $server_params=
116 --let $error_log=
117 --remove_file $MYSQLTEST_VARDIR/tmp/binlog_error_action.err
118 --remove_file $MYSQLTEST_VARDIR/tmp/binlog_restart_server_with_exhausted_index_value.inc
119
120 # Clean all configuration changes after running the test.
121 --source include/force_restart.inc