|
| 1 | +############################################################################## |
| 2 | +# ==== Purpose ==== |
| 3 | +# The purpose of this test is to verify that, when an issue occurs in the |
| 4 | +# applier and it identifies the transaction can be retried, applier uses |
| 5 | +# relay log file name mentioned in the index file instead of calculating |
| 6 | +# the file name based on the configured server option(--relay-log). |
| 7 | +# |
| 8 | +# ==== Requirement ==== |
| 9 | +# When an issue occurs in the applier and it identifies the transaction can |
| 10 | +# be retired, the applier should use the relaylog file name mentioned in the |
| 11 | +# index file instead of calculating the file name from the configured |
| 12 | +# server option. |
| 13 | +# |
| 14 | +# ==== Implementation ==== |
| 15 | +# 1. Create source-replica topology |
| 16 | +# 2. Copy test relay-log files to replica data directory |
| 17 | +# 3. Create a new channel on replica |
| 18 | +# 4. Add a debug point to simulate replica retry transaction |
| 19 | +# 5. Start replica |
| 20 | +# 6. Wait till replica apply all txns successfully |
| 21 | +# 7. Verify that there is a retry transaction warning |
| 22 | +# 8. Clean up |
| 23 | +# |
| 24 | +# ==== References ==== |
| 25 | +# BUG#36395631:Replica applier retries ignore the relay log index file |
| 26 | +############################################################################### |
| 27 | + |
| 28 | + |
| 29 | +--source include/have_debug.inc |
| 30 | +--source include/have_binlog_format_row.inc |
| 31 | +--let $option_name = replica_transaction_retries |
| 32 | +--let $option_operator = > |
| 33 | +--let $option_value = 1 |
| 34 | +--source include/only_with_option.inc |
| 35 | + |
| 36 | +--echo # |
| 37 | +--echo # 1. Create source-replica topology |
| 38 | +--let $rpl_skip_start_slave=1 |
| 39 | +--source include/rpl/init_source_replica.inc |
| 40 | + |
| 41 | +--source include/rpl/connection_replica.inc |
| 42 | +CALL mtr.add_suppression('A replica with the same server_uuid/server_id as this replica has connected to the source.*'); |
| 43 | + |
| 44 | +--echo # |
| 45 | +--echo # 2. Copy test relay-log files to replica data directory |
| 46 | +--let $datadir= `SELECT @@datadir` |
| 47 | +--copy_file $MYSQL_TEST_DIR/std_data/replicated-bin.000001 $datadir/replicate-relay-bin.000001 |
| 48 | +--copy_file $MYSQL_TEST_DIR/std_data/replicated-bin.000002 $datadir/replicate-relay-bin.000002 |
| 49 | +--copy_file $MYSQL_TEST_DIR/std_data/replicated-bin.index $datadir/slave-relay-bin-pitr.index |
| 50 | + |
| 51 | +--echo # |
| 52 | +--echo # 3. Create a new channel on replica |
| 53 | +--replace_result $MASTER_MYPORT MASTER_PORT |
| 54 | +--eval CHANGE REPLICATION SOURCE TO RELAY_LOG_FILE='replicate-relay-bin.000001', RELAY_LOG_POS=4, SOURCE_USER='root', SOURCE_HOST='127.0.0.1', SOURCE_PORT=$MASTER_MYPORT FOR CHANNEL 'PITR' |
| 55 | + |
| 56 | +--echo # |
| 57 | +--echo # 4. Add a debug point to simulate replica retry transaction |
| 58 | +--let $debug_point= simulate_error_ha_delete_row_lock_wait_timeout |
| 59 | +--source include/add_debug_point.inc |
| 60 | + |
| 61 | +--echo # |
| 62 | +--echo # 5. Start replica |
| 63 | +--let $rpl_channel_name= 'PITR' |
| 64 | +--source include/rpl/start_replica.inc |
| 65 | +--source include/rpl/assert_replica_running.inc |
| 66 | +--source include/rpl/assert_replica_no_error.inc |
| 67 | + |
| 68 | +--echo # |
| 69 | +--echo # 6. Wait till replica apply all txns successfully |
| 70 | +--let $slave_param= Replica_SQL_Running_State |
| 71 | +--let $slave_param_value= Replica has read all relay log; waiting for more updates |
| 72 | +--source include/rpl/wait_for_replica_status.inc |
| 73 | + |
| 74 | +--echo # |
| 75 | +--echo # 7. Verify that there is a retry transaction warning |
| 76 | +--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.2.err |
| 77 | +--let $assert_match= Error 'Lock wait timeout exceeded; try restarting transaction' on query |
| 78 | +--let $assert_select= Replica SQL |
| 79 | +--let $assert_text= Found error message regarding retry transaction |
| 80 | +--source include/assert_grep.inc |
| 81 | + |
| 82 | +--echo # |
| 83 | +--echo # 8. Cleanup |
| 84 | +--let $debug_point= simulate_error_ha_delete_row_lock_wait_timeout |
| 85 | +--source include/remove_debug_point.inc |
| 86 | + |
| 87 | +--let $rpl_channel_name= 'PITR' |
| 88 | +--source include/rpl/stop_replica.inc |
| 89 | + |
| 90 | +RESET REPLICA ALL FOR CHANNEL 'PITR'; |
| 91 | + |
| 92 | +--let $rpl_channel_name= |
| 93 | +source include/rpl/start_replica.inc; |
| 94 | + |
| 95 | +--source include/rpl/deinit.inc |
0 commit comments