--source include/have_debug.inc
--source include/have_binlog_format_row.inc
--source include/master-slave.inc
# MTS can't yet retry temporary failing (timeout, deadlock) transaction
--source include/not_mts_slave_parallel_workers.inc

call mtr.add_suppression("Deadlock found");

--echo **** On Master ****
connection master;
CREATE TABLE t1 (a INT PRIMARY KEY, b INT);
INSERT INTO t1 VALUES (1,1), (2,2), (3,3), (4,4);
--echo **** On Slave ****
--source include/sync_slave_sql_with_master.inc
SHOW STATUS LIKE 'Slave_retried_transactions';
# since bug#31552/31609 idempotency is not default any longer. In order
# the following UPDATE t1 to pass the mode is switched temprorarily
set @@global.slave_exec_mode= 'IDEMPOTENT';
UPDATE t1 SET a = 5, b = 47 WHERE a = 1;
SELECT * FROM t1;
--echo **** On Master ****
connection master;
UPDATE t1 SET a = 5, b = 5 WHERE a = 1;
SELECT * FROM t1;
#SHOW BINLOG EVENTS;
--echo **** On Slave ****
--source include/sync_slave_sql_with_master.inc
set @@global.slave_exec_mode= default;
SHOW STATUS LIKE 'Slave_retried_transactions';
SELECT * FROM t1;
source include/check_slave_is_running.inc;

connection slave;
call mtr.add_suppression("Slave SQL.*Could not execute Update_rows event on table test.t1");

--echo **** On Master ****
connection master;
DROP TABLE t1;

--source include/rpl_end.inc
