| 1 |
--source include/not_group_replication_plugin.inc |
| 2 |
--source include/have_debug.inc |
| 3 |
--source include/have_binlog_format_row.inc |
| 4 |
--source include/master-slave.inc |
| 5 |
|
| 6 |
call mtr.add_suppression("Deadlock found"); |
| 7 |
|
| 8 |
--echo **** On Master **** |
| 9 |
connection master; |
| 10 |
CREATE TABLE t1 (a INT PRIMARY KEY, b INT); |
| 11 |
INSERT INTO t1 VALUES (1,1), (2,2), (3,3), (4,4); |
| 12 |
--echo **** On Slave **** |
| 13 |
--source include/sync_slave_sql_with_master.inc |
| 14 |
SELECT count_transactions_retries FROM performance_schema.replication_applier_status; |
| 15 |
# since bug#31552/31609 idempotency is not default any longer. In order |
| 16 |
# the following UPDATE t1 to pass the mode is switched temprorarily |
| 17 |
set @@global.replica_exec_mode= 'IDEMPOTENT'; |
| 18 |
UPDATE t1 SET a = 5, b = 47 WHERE a = 1; |
| 19 |
SELECT * FROM t1 order by a; |
| 20 |
--echo **** On Master **** |
| 21 |
connection master; |
| 22 |
UPDATE t1 SET a = 5, b = 5 WHERE a = 1; |
| 23 |
SELECT * FROM t1 order by a; |
| 24 |
#SHOW BINLOG EVENTS; |
| 25 |
--echo **** On Slave **** |
| 26 |
--source include/sync_slave_sql_with_master.inc |
| 27 |
set @@global.replica_exec_mode= default; |
| 28 |
SELECT count_transactions_retries FROM performance_schema.replication_applier_status; |
| 29 |
SELECT * FROM t1 order by a; |
| 30 |
source include/check_slave_is_running.inc; |
| 31 |
|
| 32 |
connection slave; |
| 33 |
call mtr.add_suppression("Replica SQL.*Could not execute Update_rows event on table test.t1"); |
| 34 |
call mtr.add_suppression("Replica SQL for channel '': worker thread retried transaction"); |
| 35 |
call mtr.add_suppression("The replica coordinator and worker threads are stopped"); |
| 36 |
# |
| 37 |
# Bug#24764800 REPLICATION FAILING ON SLAVE WITH XAER_RMFAIL ERROR |
| 38 |
# |
| 39 |
# Verify that a temporary failing replicated xa transaction completes |
| 40 |
# upon slave applier restart after previous |
| 41 |
# @@global.replica_transaction_retries number of retries in vain. |
| 42 |
# |
| 43 |
connection slave; |
| 44 |
|
| 45 |
set @save_innodb_lock_wait_timeout=@@global.innodb_lock_wait_timeout; |
| 46 |
set @save_replica_transaction_retries=@@global.replica_transaction_retries; |
| 47 |
|
| 48 |
# Slave applier parameters for the failed retry |
| 49 |
set @@global.innodb_lock_wait_timeout=1; |
| 50 |
set @@global.replica_transaction_retries=2; |
| 51 |
--source include/restart_slave_sql.inc |
| 52 |
|
| 53 |
# Temporary error implement: a record is blocked by slave local trx |
| 54 |
connection slave1; |
| 55 |
BEGIN; |
| 56 |
INSERT INTO t1 SET a = 6, b = 7; |
| 57 |
|
| 58 |
connection master; |
| 59 |
INSERT INTO t1 SET a = 99, b = 99; # slave applier warm up trx |
| 60 |
XA START 'xa1'; |
| 61 |
INSERT INTO t1 SET a = 6, b = 6; # this record eventually must be found on slave |
| 62 |
XA END 'xa1'; |
| 63 |
XA PREPARE 'xa1'; |
| 64 |
|
| 65 |
connection slave; |
| 66 |
--let $err_timeout= convert_error(ER_LOCK_WAIT_TIMEOUT) |
| 67 |
--let $err_deadlock= convert_error(ER_LOCK_DEADLOCK) |
| 68 |
--let $slave_sql_errno=$err_deadlock,$err_timeout |
| 69 |
--let $show_slave_sql_error= |
| 70 |
--source include/wait_for_slave_sql_error.inc |
| 71 |
|
| 72 |
# b. Slave applier parameters for successful retry after restart |
| 73 |
set @@global.innodb_lock_wait_timeout=1; |
| 74 |
set @@global.replica_transaction_retries=100; |
| 75 |
SELECT count_transactions_retries FROM performance_schema.replication_applier_status INTO @last_retries; |
| 76 |
--source include/start_slave_sql.inc |
| 77 |
--let $wait_condition=SELECT count_transactions_retries > @last_retries+1 FROM performance_schema.replication_applier_status; |
| 78 |
--source include/wait_condition.inc |
| 79 |
|
| 80 |
# Release the record after just one retry |
| 81 |
connection slave1; |
| 82 |
ROLLBACK; |
| 83 |
|
| 84 |
connection master; |
| 85 |
XA COMMIT 'xa1'; |
| 86 |
|
| 87 |
--source include/sync_slave_sql_with_master.inc |
| 88 |
|
| 89 |
# Proof of correctness: the committed XA is on the slave |
| 90 |
connection slave; |
| 91 |
--let $assert_text=XA transaction record must be in the table |
| 92 |
--let $assert_cond=count(*)=1 FROM t1 WHERE a=6 AND b=6 |
| 93 |
--source include/assert.inc |
| 94 |
|
| 95 |
# Bug#24764800 cleanup: |
| 96 |
set @@global.innodb_lock_wait_timeout=@save_innodb_lock_wait_timeout; |
| 97 |
set @@global.replica_transaction_retries= @save_replica_transaction_retries; |
| 98 |
|
| 99 |
# |
| 100 |
# Total cleanup: |
| 101 |
# |
| 102 |
--echo **** On Master **** |
| 103 |
connection master; |
| 104 |
DROP TABLE t1; |
| 105 |
|
| 106 |
--source include/rpl_end.inc |