[MDEV-14782] Master allows changing transaction isolation inside trigger, replication fails Created: 2017-12-27  Updated: 2023-04-27

Status: Confirmed
Project: MariaDB Server
Component/s: Server
Affects Version/s: 5.5, 10.0, 10.1, 10.2, 10.3, 10.4, 10.5
Fix Version/s: 10.4, 10.5

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Andrei Elkin
Resolution: Unresolved Votes: 0
Labels: upstream-fixed


 Description   

Test case

--source include/master-slave.inc
--source include/have_binlog_format_mixed.inc
--source include/have_innodb.inc
 
CREATE TABLE IF NOT EXISTS t1 (f1 INTEGER) ENGINE=InnoDB;
CREATE TRIGGER tr BEFORE INSERT ON t1 FOR EACH ROW SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
INSERT INTO t1 VALUES (1);
SELECT * FROM t1;
 
--sync_slave_with_master
SELECT * FROM t1;
 
# Cleanup
--connection master
DROP TABLE t1;
--source include/rpl_end.inc

The master executes its part without complaints and writes everything into the binary log. The slave, however, fails with

2017-12-28  0:20:33 13 [ERROR] Slave SQL: Error 'Transaction characteristics can't be changed while a transaction is in progress' on query. Default database: 'test'. Query: 'INSERT INTO t1 VALUES (1)', Gtid 0-1-3, Internal MariaDB error code: 1568
2017-12-28  0:20:33 13 [Warning] Slave: Transaction characteristics can't be changed while a transaction is in progress Error_code: 1568
2017-12-28  0:20:33 13 [Warning] Slave: At line 1 in test.tr Error_code: 4094

Slave's behavior is documented in MySQL manual:
https://dev.mysql.com/doc/refman/5.5/en/set-transaction.html

SET TRANSACTION ISOLATION LEVEL without GLOBAL or SESSION is not permitted while there is an active transaction

So the problem is apparently on master.
Reproducible also with MySQL 5.5, 5.6, while with MySQL 5.7 INSERT fails on master.


Generated at Thu Feb 08 08:16:14 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.