| 1 |
# ==== Purpose ==== |
| 2 |
# |
| 3 |
# To cover error branches when executing the command |
| 4 |
# 'ALTER INSTANCE ROTATE BINLOG MASTER KEY' on a binlogless slave. |
| 5 |
# |
| 6 |
# ==== Implementation ==== |
| 7 |
# |
| 8 |
# Please see rpl_rotate_binlog_master_key_errors.inc |
| 9 |
# |
| 10 |
# ==== References ==== |
| 11 |
# |
| 12 |
# Wl#12080 Add support to binary log encryption key rotation and cleanup |
| 13 |
|
| 14 |
--source include/master-slave.inc |
| 15 |
--source include/have_binlog_format_row.inc |
| 16 |
--source include/have_debug.inc |
| 17 |
--source include/have_debug_sync.inc |
| 18 |
|
| 19 |
--source include/rpl_connection_slave.inc |
| 20 |
call mtr.add_suppression("You need to use --log-bin to make --binlog-format work."); |
| 21 |
--let $SLAVE_DATADIR= `select @@datadir` |
| 22 |
--let $relay_log_base=`SELECT @@GLOBAL.relay_log` |
| 23 |
|
| 24 |
--let $first_relay_log_suffix=.000001 |
| 25 |
--let $rpl_log_file=$SLAVE_DATADIR$relay_log_base$first_relay_log_suffix |
| 26 |
--source include/rpl_get_log_encryption_key_id.inc |
| 27 |
--let $assert_text=The first relay log is encrypted using first master key |
| 28 |
--let $assert_cond= RIGHT("$rpl_encryption_key_id", 2) = "_1" |
| 29 |
--source include/assert.inc |
| 30 |
|
| 31 |
--source include/rpl_connection_master.inc |
| 32 |
CREATE TABLE t1 (c1 INT); |
| 33 |
INSERT INTO t1 VALUES (1); |
| 34 |
|
| 35 |
--source include/sync_slave_sql_with_master.inc |
| 36 |
|
| 37 |
# Verify that an error 'ER_BINLOG_MASTER_KEY_ROTATION_FAIL_TO_REENCRYPT_LOG' |
| 38 |
# is emitted to the client side on binlogless slave when executing the |
| 39 |
# command 'ALTER INSTANCE ROTATE BINLOG MASTER KEY' if there is an error |
| 40 |
# decrypting file password when re-encrypting a log file. |
| 41 |
--echo # Part 1: fail_to_decrypt_file_password |
| 42 |
--let $debug_point=fail_to_decrypt_file_password |
| 43 |
--let $expected_error=ER_BINLOG_MASTER_KEY_ROTATION_FAIL_TO_REENCRYPT_LOG |
| 44 |
--let $current_master_key_id=2 |
| 45 |
--let $rotated_master_key_id=3 |
| 46 |
--let $before_relay_log_suffix=.000003 |
| 47 |
--let $after_relay_log_suffix=.000004 |
| 48 |
--source suite/rpl/include/rpl_rotate_binlog_master_key_errors.inc |
| 49 |
|
| 50 |
# Verify that an error 'ER_BINLOG_MASTER_KEY_ROTATION_FAIL_TO_REENCRYPT_LOG' is emitted |
| 51 |
# to the client side on binlogless slave when executing the command |
| 52 |
# 'ALTER INSTANCE ROTATE BINLOG MASTER KEY' if there is an |
| 53 |
# error when opening a log file for re-encryption. |
| 54 |
--echo # Part 2: fail_to_open_log_file |
| 55 |
--let $debug_point=fail_to_open_log_file |
| 56 |
--let $expected_error=ER_BINLOG_MASTER_KEY_ROTATION_FAIL_TO_REENCRYPT_LOG |
| 57 |
--let $current_master_key_id=4 |
| 58 |
--let $rotated_master_key_id=5 |
| 59 |
--let $before_relay_log_suffix=.000005 |
| 60 |
--let $after_relay_log_suffix=.000006 |
| 61 |
--source suite/rpl/include/rpl_rotate_binlog_master_key_errors.inc |
| 62 |
|
| 63 |
# Verify that an error 'ER_BINLOG_MASTER_KEY_ROTATION_FAIL_TO_REENCRYPT_LOG' is emitted |
| 64 |
# to the client side on binlogless slave when executing the command |
| 65 |
# 'ALTER INSTANCE ROTATE BINLOG MASTER KEY' if there is an |
| 66 |
# error when opening an index file for re-encryption. |
| 67 |
--echo # Part 3: fail_to_open_index_file |
| 68 |
--let $debug_point=fail_to_open_index_file |
| 69 |
--let $expected_error=ER_BINLOG_MASTER_KEY_ROTATION_FAIL_TO_REENCRYPT_LOG |
| 70 |
--let $current_master_key_id=6 |
| 71 |
--let $rotated_master_key_id=7 |
| 72 |
--let $before_relay_log_suffix=.000007 |
| 73 |
--let $after_relay_log_suffix=.000008 |
| 74 |
--source suite/rpl/include/rpl_rotate_binlog_master_key_errors.inc |
| 75 |
|
| 76 |
# Cleanup |
| 77 |
--source include/rpl_connection_master.inc |
| 78 |
DROP TABLE t1; |
| 79 |
--source include/rpl_end.inc |