| 1 |
# ==== Purpose ==== |
| 2 |
# |
| 3 |
# Used by test `binlog_gtid.binlog_gtid_recovery_errors`, it sets up the |
| 4 |
# scenario for a malformed binary log file to be read during recovery, by: |
| 5 |
# 1. Getting the current binary log file name. |
| 6 |
# 2. Crashing the server. |
| 7 |
# 3. Replacing the current binlog file with a malformed binary log file, |
| 8 |
# tampered to trigger the given error scenario, |
| 9 |
# 4. Restarting the server. |
| 10 |
# |
| 11 |
# ==== Parameters ==== |
| 12 |
# |
| 13 |
# $recovery_scenario |
| 14 |
# The recovery scenario being executed. |
| 15 |
# |
| 16 |
# ==== References ==== |
| 17 |
# |
| 18 |
# WL#11300: Crash-safe XA + binary log |
| 19 |
# |
| 20 |
# Related tests; |
| 21 |
# see extra/xa_crash_safe_tests/setup.inc |
| 22 |
# |
| 23 |
if ($recovery_scenario == '') { |
| 24 |
--die ERROR: 'recovery_scenario' parameter needed by 'setup_scenario.inc' |
| 25 |
} |
| 26 |
|
| 27 |
--echo extra/binlog_tests/recovery/kill_copy_malformed_restart.inc [$recovery_scenario] |
| 28 |
|
| 29 |
--let $datadir = `SELECT @@GLOBAL.datadir` |
| 30 |
--let $last_binlog_file = query_get_value(SHOW MASTER STATUS, File, 1) |
| 31 |
--let $target_binlog_file = $datadir$last_binlog_file |
| 32 |
--let $target_binlog_file_bak = $target_binlog_file.bak |
| 33 |
|
| 34 |
--source include/kill_mysqld.inc |
| 35 |
|
| 36 |
--let $malformed_binlog_file = $MYSQL_TEST_DIR/std_data/binlog_recovery/$recovery_scenario.000001 |
| 37 |
--copy_file $target_binlog_file $target_binlog_file_bak |
| 38 |
--remove_file $target_binlog_file |
| 39 |
--copy_file $malformed_binlog_file $target_binlog_file |
| 40 |
--let $restart_parameters=--debug=+d,eval_force_bin_log_recovery |
| 41 |
--source include/start_mysqld_expecting_crash.inc |