Debian Codegraph @

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

raw
1 # ==== Purpose ====
2 #
3 # Test that persisted binlog_expire_logs_* options take effect during binlog
4 # rotations that occur during server start.
5 #
6 # ==== Requirements ====
7 #
8 # R1. If binlog_expire_logs_auto_purge=0 is a persisted option, binary logs must
9 # not be purged during server start, even if binary logs have expired
10 # according to compiled-in defaults, command-line options, or
11 # configuration options.
12 #
13 # R2. If binlog_expire_logs_seconds is a persisted option with a high value,
14 # binary logs must not be purged during server start, even if binary logs
15 # have expired according to compiled-in defaults, command-line options, or
16 # configuration options.
17 #
18 # ==== Implementation ====
19 #
20 # 1. This test has --binlog-expire-logs-seconds=1 configured in its .opt file.
21 #
22 # 2.1. Disable purge using SET PERSIST binlog_expire_logs_auto_purge = 0.
23 #
24 # 2.2. Rotate the binary log twice and verify that there are three files.
25 #
26 # 2.3. Stop the server, sleep > 1 second, start the server again.
27 #
28 # 2.4. R1: Verify that there are four files (another one created at server
29 # start, none purged).
30 #
31 # 2.5. Clean up using RESET PERSIST.
32 #
33 # 3.1. Disable purge using SET PERSIST binlog_expire_logs_auto_purge = 0.
34 #
35 # 3.2. Rotate the binary log twice and verify that there are three files.
36 #
37 # 3.3. Stop the server, sleep > 1 second, start the server again.
38 #
39 # 3.4. R1: Verify that there are four files (another one created at server
40 # start, none purged).
41 #
42 # 3.5. Clean up using RESET PERSIST.
43 #
44 # ==== References ====
45 #
46 # BUG#38554467: Binary log may be purged before persited binlog_expire_* options are loaded
47
48 # This test is agnostic to binlog format.
49 --source include/have_binlog_format_row.inc
50
51 # This test restarts the server twice, and has a .opt file that might make it
52 # restart a third time.
53 --source include/big_test.inc
54
55 --let $i = 0
56 while ($i < 2) {
57 # Make the binlog serial number deterministic.
58 RESET MASTER;
59
60 # 2.1/3.1. In each iteration, test a different way to increase the expiration
61 # time.
62 if ($i == 0) {
63 SET PERSIST binlog_expire_logs_auto_purge = 0;
64 }
65 if ($i == 1) {
66 SET PERSIST binlog_expire_logs_seconds = 1000000;
67 }
68
69 # 2.2. Flush twice, expect 3 binary logs.
70 FLUSH BINARY LOGS;
71 FLUSH BINARY LOGS;
72 --source include/show_binary_logs.inc
73
74 # 2.3. Restart the server, letting the binary logs age > 1 second so that the
75 # period configured on the command line expires.
76 --source include/stop_mysqld.inc
77 --sleep 2
78 --source include/start_mysqld.inc
79
80 # 2.4. Verify that there are four files
81 --source include/show_binary_logs.inc
82
83 # 2.5. Clean up.
84 RESET PERSIST;
85
86 --inc $i
87 }
88
89 # Clean up. We need this because SET PERSIST sets the global option value, but
90 # RESET PERSIST doesn't.
91 SET GLOBAL binlog_expire_logs_seconds = 1;