Debian Codegraph @

mysql-test/suite/binlog/include/binlog_expire_warnings.inc

raw
1 # ==== Purpose ====
2 #
3 # Test one scenario using a combination of --expire-logs-days and
4 # --binlog-expire-logs-seconds. Verify that there are/aren't warnings
5 # as expected, and verify that the values of the global variables are
6 # as expected.
7 #
8 # ==== Usage ====
9 #
10 # --let $ofile = FILE
11 # --let $options = SERVER_OPTIONS
12 # --let $days = VALUE
13 # --let $seconds = VALUE
14 # --let $expect_binlog_off_days_and_seconds_warning = [0|1]
15 # --let $expect_seconds = VALUE
16 # --let $option_invoke_order = [days_then_seconds|seconds_then_days]
17 # --let $expect_days = VALUE
18 # --source include/binlog_expire_warnings.inc
19 #
20 # Parameters:
21 #
22 # $ofile
23 # Temporary file to use for the error log.
24 #
25 # $options
26 # Any additional options passed to mysqld during server start.
27 #
28 # $days
29 # The value to set for --expire-logs-days
30 #
31 # $seconds
32 # The value to set for --binlog-expire-logs-seconds
33 #
34 # $option_invoke_order
35 # In which order options --expire-logs-days and
36 # --binlog-expire-logs-seconds should be set.
37 # values are: days_then_seconds, seconds_then_days
38 #
39 # $expect_binlog_off_days_and_seconds_warning
40 # If zero, assert that there is no warning due to using
41 # --expire_logs_days or --binlog_expire_logs_seconds binlog disabled.
42 # If nonzero, assert that there is a warning due to using
43 # --expire_logs_days or --binlog_expire_logs_seconds binlog disabled.
44 #
45 # $expect_days
46 # Assert that @@global.expire_logs_days has this value.
47 #
48 # $expect_seconds
49 # Assert that @@global.binlog_expire_logs_seconds has this value.
50
51
52 --let $restart_parameters = --log-error=$ofile $options
53 if ($option_invoke_order == 'days_then_seconds')
54 {
55 if ($days != '') {
56 --let $restart_parameters = $restart_parameters --expire_logs_days=$days
57 }
58 if ($seconds != '') {
59 --let $restart_parameters = $restart_parameters --binlog-expire-logs-seconds=$seconds
60 }
61 }
62
63 if ($option_invoke_order == 'seconds_then_days')
64 {
65 if ($seconds != '') {
66 --let $restart_parameters = $restart_parameters --binlog-expire-logs-seconds=$seconds
67 }
68 if ($days != '') {
69 --let $restart_parameters = $restart_parameters --expire_logs_days=$days
70 }
71 }
72
73 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
74 --source include/restart_mysqld.inc
75
76 # For all the assert_grep.inc
77 --let $extra_debug_eval = LOAD_FILE("$ofile")
78
79 if (!$expect_binlog_off_days_and_seconds_warning) {
80 --let $assert_text = There shall be no binlog_off+seconds warning
81 --let $assert_count = 0
82 }
83
84 if ($expect_binlog_off_days_and_seconds_warning) {
85 --let $assert_text = There shall be a binlog_off+seconds warning
86 --let $assert_count = 1
87 }
88
89 --let $assert_file = $ofile
90 --let $assert_select = You need to use --log-bin to make --expire-logs-days, --binlog-expire-logs-seconds or --max-binlog-total-size work.
91 --let $assert_only_after = Shutdown complete
92 --source include/assert_grep.inc
93
94 # For all the assert.inc
95 --let $extra_debug_eval = CONCAT("days: ", @@global.expire_logs_days, " seconds: ", @@global.binlog_expire_logs_seconds)
96
97 --let $assert_text = binlog_expire_logs_seconds shall be $expect_seconds
98 --let $assert_cond = @@global.binlog_expire_logs_seconds = $expect_seconds
99 --source include/assert.inc
100
101 --let $assert_text = expire_logs_days shall be $expect_days
102 --let $assert_cond = @@global.expire_logs_days = $expect_days
103 --source include/assert.inc