| 1 |
# ==== Purpose ==== |
| 2 |
# Testing that temporary error is processed |
| 3 |
# when the slave info repository type is TABLE. |
| 4 |
# |
| 5 |
# ==== Implementation ==== |
| 6 |
# At applying a transaction the slave applier thread is made blocked |
| 7 |
# to time out. Upon a few retries, zero included, |
| 8 |
# the temporary error gets escalated to the regular and the slave applier stops. |
| 9 |
# After the blocking condition is removed the restarted applier |
| 10 |
# succeeds. |
| 11 |
# |
| 12 |
# ==== References ==== |
| 13 |
# BUG#21095969 RPL+LOCK_WAIT_TIMEOUT: BOOL TRANS_CHECK_STATE ASSERTS |
| 14 |
# `THD->GET_TRANSACTION()..` |
| 15 |
|
| 16 |
# This test case is binary log format agnostic though. |
| 17 |
--source include/have_binlog_format_row.inc |
| 18 |
--source include/not_group_replication_plugin.inc |
| 19 |
|
| 20 |
--source include/master-slave.inc |
| 21 |
|
| 22 |
--source include/rpl_connection_master.inc |
| 23 |
CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 INT) ENGINE= InnoDB; |
| 24 |
|
| 25 |
--sync_slave_with_master |
| 26 |
--source include/stop_slave.inc |
| 27 |
call mtr.add_suppression("The replica coordinator and worker threads are stopped, possibly leaving data in inconsistent state"); |
| 28 |
call mtr.add_suppression(".*worker thread retried transaction.*time.*in vain, giving up.*"); |
| 29 |
SET @saved_replica_transaction_retries = @@GLOBAL.replica_transaction_retries; |
| 30 |
SET @saved_innodb_lock_wait_timeout = @@GLOBAL.innodb_lock_wait_timeout; |
| 31 |
SET @saved_master_info_repository = @@GLOBAL.master_info_repository; |
| 32 |
SET @saved_relay_log_info_repository = @@GLOBAL.relay_log_info_repository; |
| 33 |
SET @@GLOBAL.innodb_lock_wait_timeout = 1; |
| 34 |
--let $repo_type_name = 'TABLE' |
| 35 |
--replace_result $repo_type_name TYPE |
| 36 |
--eval SET @@GLOBAL.master_info_repository = $repo_type_name |
| 37 |
--replace_result $repo_type_name TYPE |
| 38 |
--eval SET @@GLOBAL.relay_log_info_repository = $repo_type_name |
| 39 |
|
| 40 |
# To block the SQL thread |
| 41 |
--source include/rpl_connection_slave1.inc |
| 42 |
BEGIN; |
| 43 |
INSERT INTO t1 VALUES (7,0); |
| 44 |
|
| 45 |
# Generate data at the master to be replicated |
| 46 |
--source include/rpl_connection_master.inc |
| 47 |
INSERT INTO t1 VALUES (7,7); |
| 48 |
|
| 49 |
# Retry 0 and 1 time to test both execution branches. |
| 50 |
|
| 51 |
--let $retry_counted = 0 |
| 52 |
--let $retry_number = 0 |
| 53 |
while ($retry_number < 2) |
| 54 |
{ |
| 55 |
--source include/rpl_connection_slave.inc |
| 56 |
--eval SET @@GLOBAL.replica_transaction_retries = $retry_number |
| 57 |
--source include/start_slave.inc |
| 58 |
|
| 59 |
--echo ### Specified retry number is expected ### |
| 60 |
|
| 61 |
# Notice the status var accumulates retries over the loop |
| 62 |
--let $retry_counted = `SELECT $retry_counted + $retry_number` |
| 63 |
--let $status_col = count_transactions_retries |
| 64 |
--let $status_col_value = $retry_counted |
| 65 |
--let $table = replication_applier_status |
| 66 |
--source include/wait_for_rpl_pfs_status.inc |
| 67 |
|
| 68 |
--echo ### Timeout error is expected ### |
| 69 |
|
| 70 |
--let $slave_sql_errno= convert_error(ER_LOCK_WAIT_TIMEOUT) |
| 71 |
--source include/wait_for_slave_sql_error.inc |
| 72 |
|
| 73 |
--inc $retry_number |
| 74 |
} |
| 75 |
|
| 76 |
--source include/rpl_connection_slave1.inc |
| 77 |
ROLLBACK; |
| 78 |
|
| 79 |
--echo #### Cleanup #### |
| 80 |
|
| 81 |
--source include/rpl_connection_slave.inc |
| 82 |
--source include/stop_slave.inc |
| 83 |
--disable_warnings |
| 84 |
SET @@GLOBAL.replica_transaction_retries = @saved_replica_transaction_retries; |
| 85 |
SET @@GLOBAL.master_info_repository = @saved_master_info_repository; |
| 86 |
SET @@GLOBAL.relay_log_info_repository = @saved_relay_log_info_repository; |
| 87 |
SET @@GLOBAL.innodb_lock_wait_timeout = @saved_innodb_lock_wait_timeout ; |
| 88 |
--enable_warnings |
| 89 |
--source include/start_slave.inc |
| 90 |
|
| 91 |
--source include/rpl_connection_master.inc |
| 92 |
DROP TABLE t1; |
| 93 |
--source include/rpl_end.inc |