| 1 |
# ==== Requirements ==== |
| 2 |
# |
| 3 |
# Verify the logic for warnings related to expire-logs-days and |
| 4 |
# binlog-expire-logs-seconds on server start: |
| 5 |
# |
| 6 |
# R0. All the following shall hold with binlog disabled and binlog enabled. |
| 7 |
# |
| 8 |
# R1. Deprecation warnings: |
| 9 |
# |
| 10 |
# R1.1. expire-logs-days is not used: no deprecation warning. |
| 11 |
# |
| 12 |
# R1.2. expire-logs-days is used explicitly: deprecation warning. |
| 13 |
# |
| 14 |
# R3. Combination warnings: |
| 15 |
# |
| 16 |
# R3.1. Both expire-logs-days and binlog-expire-logs-seconds are |
| 17 |
# explicitly passed and set to nonzero: server shall generate |
| 18 |
# a warning for this incompatible combination. |
| 19 |
# |
| 20 |
# R3.2. At least one of expire-logs-days and |
| 21 |
# binlog-expire-logs-seconds is either set to 0 not passed |
| 22 |
# at all: server shall not generate a warning for |
| 23 |
# incompatible combinations. |
| 24 |
# |
| 25 |
# R4. Binlog off warnings: |
| 26 |
# |
| 27 |
# R4.1. If the binary log is disabled, using any of |
| 28 |
# binlog-expire-logs-seconds or expire_logs_days shall |
| 29 |
# generate a warning. |
| 30 |
# |
| 31 |
# R4.2. If the binary log is enabled, or if |
| 32 |
# binlog-expire-logs-seconds / expire_logs_days is not used, |
| 33 |
# there shall be no warning for this case. |
| 34 |
# |
| 35 |
# R5. Values: |
| 36 |
# |
| 37 |
# R5.1. None of expire-logs-days or binlog-expire-logs-seconds is |
| 38 |
# set: both shall use their default values (days=0, |
| 39 |
# seconds=60*60*24*30) |
| 40 |
# |
| 41 |
# R5.2. Exactly one of expire-logs-days or binlog-expire-logs-seconds |
| 42 |
# is set: that value is used and the other option is set to zero. |
| 43 |
# |
| 44 |
# R5.3. Both expire-logs-days or binlog-expire-logs-seconds are |
| 45 |
# set, and at least one of them is set to zero: both are set |
| 46 |
# to the given values. |
| 47 |
# |
| 48 |
# R5.4. Both expire-logs-days and binlog-expire-logs-seconds are |
| 49 |
# set, and both are non-zero: binlog_expire_logs_seconds is |
| 50 |
# set to the specified value, and expire_logs_days is set to |
| 51 |
# 0. |
| 52 |
# |
| 53 |
# ==== Implementation ==== |
| 54 |
# |
| 55 |
# Test all combinations of: |
| 56 |
# |
| 57 |
# - log-bin: on, off |
| 58 |
# - expire-logs-days: not set, set to 0, set to nonzero |
| 59 |
# - binlog-expire-logs-seconds: not set, set to 0, set to nonzero |
| 60 |
# |
| 61 |
# For each such scenario, state the expected warnings and values, and |
| 62 |
# use extra/binlog_tests/binlog_expire_warnings.inc to execute the |
| 63 |
# scenario. |
| 64 |
# |
| 65 |
# ==== References ==== |
| 66 |
# |
| 67 |
# WL#10924: Deprecate expire_logs_days |
| 68 |
# BUG#26483363: WARNING ABOUT EXPIRE-LOGS-DAYS |
| 69 |
# BUG#27699608: WARNING FOR CONFLICTING EXPIRE-LOGS-[DAYS|SECONDS] SUPPRESSED WITH SKIP-LOG-BIN |
| 70 |
|
| 71 |
# No need to run multiple times. |
| 72 |
--source include/have_binlog_format_row.inc |
| 73 |
|
| 74 |
# Restarts the server with new options. |
| 75 |
--source include/force_restart.inc |
| 76 |
|
| 77 |
# A bit slow, since it restarts the server many times. Also, this is |
| 78 |
# unlikely to break in the future, so not important to run frequently. |
| 79 |
--source include/big_test.inc |
| 80 |
|
| 81 |
|
| 82 |
--let $ofile = $MYSQLTEST_VARDIR/tmp/binlog_expire_warnings-output.err |
| 83 |
|
| 84 |
--let $i = 0 |
| 85 |
while ($i < 2) { |
| 86 |
|
| 87 |
if ($i == 0) { |
| 88 |
--echo #### Binary log ENABLED #### |
| 89 |
--let $options = |
| 90 |
--let $binlog_off = 0 |
| 91 |
} |
| 92 |
if ($i == 1) { |
| 93 |
--echo #### Binary log DISABLED #### |
| 94 |
--let $options = --skip-log-bin |
| 95 |
--let $binlog_off = 1 |
| 96 |
} |
| 97 |
|
| 98 |
--echo ==== Don't set any option ==== |
| 99 |
|
| 100 |
--let $days = |
| 101 |
--let $seconds = |
| 102 |
--let $expect_deprecation_warning = 0 |
| 103 |
--let $expect_combination_warning = 0 |
| 104 |
--let $expect_binlog_off_and_days_warning = 0 |
| 105 |
--let $expect_binlog_off_and_seconds_warning = 0 |
| 106 |
--let $expect_days = 0 |
| 107 |
--let $expect_seconds = 60*60*24*30 |
| 108 |
--source extra/binlog_tests/binlog_expire_warnings.inc |
| 109 |
|
| 110 |
--echo ==== Set one option to zero ==== |
| 111 |
|
| 112 |
--echo ---- days=0 ---- |
| 113 |
--let $days = 0 |
| 114 |
--let $seconds = |
| 115 |
--let $expect_deprecation_warning = 1 |
| 116 |
--let $expect_combination_warning = 0 |
| 117 |
--let $expect_binlog_off_and_days_warning = $binlog_off |
| 118 |
--let $expect_binlog_off_and_seconds_warning = 0 |
| 119 |
--let $expect_days = 0 |
| 120 |
--let $expect_seconds = 0 |
| 121 |
--source extra/binlog_tests/binlog_expire_warnings.inc |
| 122 |
|
| 123 |
--echo ---- seconds=0 ---- |
| 124 |
--let $days = |
| 125 |
--let $seconds = 0 |
| 126 |
--let $expect_deprecation_warning = 0 |
| 127 |
--let $expect_combination_warning = 0 |
| 128 |
--let $expect_binlog_off_and_days_warning = 0 |
| 129 |
--let $expect_binlog_off_and_seconds_warning = $binlog_off |
| 130 |
--let $expect_days = 0 |
| 131 |
--let $expect_seconds = 0 |
| 132 |
--source extra/binlog_tests/binlog_expire_warnings.inc |
| 133 |
|
| 134 |
--echo ==== Set one option to non-zero ==== |
| 135 |
|
| 136 |
--echo ---- days=14 ---- |
| 137 |
--let $days = 14 |
| 138 |
--let $seconds = |
| 139 |
--let $expect_deprecation_warning = 1 |
| 140 |
--let $expect_combination_warning = 0 |
| 141 |
--let $expect_binlog_off_and_days_warning = $binlog_off |
| 142 |
--let $expect_binlog_off_and_seconds_warning = 0 |
| 143 |
--let $expect_days = 14 |
| 144 |
--let $expect_seconds = 0 |
| 145 |
--source extra/binlog_tests/binlog_expire_warnings.inc |
| 146 |
|
| 147 |
--echo ---- seconds=3600 ---- |
| 148 |
--let $days = |
| 149 |
--let $seconds = 3600 |
| 150 |
--let $expect_deprecation_warning = 0 |
| 151 |
--let $expect_combination_warning = 0 |
| 152 |
--let $expect_binlog_off_and_days_warning = 0 |
| 153 |
--let $expect_binlog_off_and_seconds_warning = $binlog_off |
| 154 |
--let $expect_days = 0 |
| 155 |
--let $expect_seconds = 3600 |
| 156 |
--source extra/binlog_tests/binlog_expire_warnings.inc |
| 157 |
|
| 158 |
--echo ==== Set both options to zero ==== |
| 159 |
|
| 160 |
--let $days = 0 |
| 161 |
--let $seconds = 0 |
| 162 |
--let $expect_deprecation_warning = 1 |
| 163 |
--let $expect_combination_warning = 0 |
| 164 |
--let $expect_binlog_off_and_days_warning = $binlog_off |
| 165 |
--let $expect_binlog_off_and_seconds_warning = $binlog_off |
| 166 |
--let $expect_days = 0 |
| 167 |
--let $expect_seconds = 0 |
| 168 |
--source extra/binlog_tests/binlog_expire_warnings.inc |
| 169 |
|
| 170 |
--echo ==== Set both options: one to zero and one to non-zero ==== |
| 171 |
|
| 172 |
--echo ---- seconds=0 days=14 ---- |
| 173 |
--let $days = 14 |
| 174 |
--let $seconds = 0 |
| 175 |
--let $expect_deprecation_warning = 1 |
| 176 |
--let $expect_combination_warning = 0 |
| 177 |
--let $expect_binlog_off_and_days_warning = $binlog_off |
| 178 |
--let $expect_binlog_off_and_seconds_warning = $binlog_off |
| 179 |
--let $expect_days = 14 |
| 180 |
--let $expect_seconds = 0 |
| 181 |
--source extra/binlog_tests/binlog_expire_warnings.inc |
| 182 |
|
| 183 |
--echo ---- seconds=14 days=0 ---- |
| 184 |
--let $days = 0 |
| 185 |
--let $seconds = 14 |
| 186 |
--let $expect_deprecation_warning = 1 |
| 187 |
--let $expect_combination_warning = 0 |
| 188 |
--let $expect_binlog_off_and_days_warning = $binlog_off |
| 189 |
--let $expect_binlog_off_and_seconds_warning = $binlog_off |
| 190 |
--let $expect_days = 0 |
| 191 |
--let $expect_seconds = 14 |
| 192 |
--source extra/binlog_tests/binlog_expire_warnings.inc |
| 193 |
|
| 194 |
--echo ==== Set both options to non-zero ==== |
| 195 |
|
| 196 |
--let $days = 14 |
| 197 |
--let $seconds = 14 |
| 198 |
--let $expect_deprecation_warning = 1 |
| 199 |
--let $expect_combination_warning = 1 |
| 200 |
--let $expect_binlog_off_and_days_warning = $binlog_off |
| 201 |
--let $expect_binlog_off_and_seconds_warning = $binlog_off |
| 202 |
--let $expect_days = 0 |
| 203 |
--let $expect_seconds = 14 |
| 204 |
--source extra/binlog_tests/binlog_expire_warnings.inc |
| 205 |
|
| 206 |
--inc $i |
| 207 |
} |
| 208 |
|
| 209 |
# cleanup |
| 210 |
--remove_file $ofile |