[MDEV-31830] Standalone XA COMMIT Binlogged on Replica if its Body Hits a Skipped Error Created: 2023-08-02  Updated: 2023-11-28

Status: Open
Project: MariaDB Server
Component/s: Replication, XA
Affects Version/s: 10.5, 10.6, 10.7, 10.8, 10.9, 10.10, 10.11, 11.0, 11.1
Fix Version/s: 10.5, 10.6, 10.11, 11.0, 11.1

Type: Bug Priority: Major
Reporter: Brandon Nesterenko Assignee: Brandon Nesterenko
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-25616 Binlog event for XA COMMIT is generat... Closed

 Description   

When replicating an XA transaction, if the body of the transaction (XA START through XA PREPARE) runs into an error, but that error is in skip-slave-errors, it won't be be binlogged. The corresponding XA COMMIT, however, will be binlogged without error, leading to an invalid binary log. The following MTR test snippet highlights this:

config file: rpl_bug.cnf

!include ../my.cnf
 
[mysqld.2]
slave-skip-errors=1032
innodb
log-slave-updates
 
[mysqld.3]
innodb
 
[ENV]
SERVER_MYPORT_1= @mysqld.1.port
SERVER_MYPORT_2= @mysqld.2.port
SERVER_MYPORT_3= @mysqld.3.port

mtr file: rpl_bug.test

--source include/have_innodb.inc
--source include/have_binlog_format_row.inc
--let $rpl_server_count= 3
--let $rpl_topology= 1->2->3
--source include/rpl_init.inc
 
--echo #
--echo # Initialize test data
--connection server_1
create table t1 (a int) engine=innodb;
insert into t1 values (1);
insert into t1 values (2);
--source include/save_master_gtid.inc
 
--connection server_2
--source include/sync_with_master_gtid.inc
 
--connection server_2
set statement SQL_LOG_BIN=0 FOR delete from t1 where a=1;
 
--connection server_1
xa start '1';
update t1 set a=3 where a=1;
xa end '1';
xa prepare '1';
xa commit '1';
--source include/save_master_gtid.inc
 
--connection server_3
--let $slave_sql_errno=1397
--source include/wait_for_slave_sql_error.inc
--die Hit Error 'XAER_NOTA: Unknown XID' on query
 
--echo #
--echo # Cleanup
--connection server_1
DROP TABLE t1;
--source include/save_master_gtid.inc
 
--connection server_2
--source include/sync_with_master_gtid.inc
 
--source include/rpl_end.inc
 
--echo # End of tests


Generated at Thu Feb 08 10:26:47 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.