[MDEV-20478] interupted transactions in mixed mode with transactional and non-transactional tables break replication Created: 2019-09-03  Updated: 2023-12-05

Status: Stalled
Project: MariaDB Server
Component/s: Replication
Affects Version/s: 10.3
Fix Version/s: 10.4

Type: Bug Priority: Major
Reporter: Richard Stracke Assignee: Andrei Elkin
Resolution: Unresolved Votes: 1
Labels: mixed_engine_transaction, non-transactional-event-replication, temporary-table-replication

Issue Links:
Relates
relates to MDEV-20668 Side effect rolled back transaction m... Open

 Description   

To reproduce

Setup a usual async master - server setup

Open 2 sessions on the master

Execute on session 1:

set session binlog_format =  mixed;
 
create temporary table test.t22(a int) engine=MEMORY;
create temporary table test.t23(a int) engine=innodb;
 
begin;
 
 insert into test.t22(a) values(1);
 INSERT INTO test.t23 SELECT * FROM test.t22;
 SELECT SLEEP(30);
 commit;
 

Kill the transaction during select sleep(30) in session 2.

Slave breaks with error:

Error 'Table 'test.t23' doesn't exist' on query. Default database: 'test'. Query: 'INSERT INTO test.t23 SELECT * FROM test.t22'

Reason:
--> tables are not using PKs, so statement logmode will be choosen.
--> The interrupted transaction cause an implicit "drop temporary table"
--> The begin... transaction will be logged into binlog with rollback,
because transaction tables and non-transactional tables are mixed in one transaction.

Binlog:

 
#190903 13:42:58 server id 1  end_log_pos 614 CRC32 0x84f2060c  GTID 0-1-2 ddl
/*!100001 SET @@session.gtid_seq_no=2*//*!*/;
# at 614
#190903 13:42:58 server id 1  end_log_pos 735 CRC32 0xa207f25e  Query   thread_id=15    exec_time=6     error_code=0
SET TIMESTAMP=1567510978/*!*/;
/*!\C utf8 *//*!*/;
SET @@session.character_set_client=33,@@session.collation_connection=45,@@session.collation_server=33/*!*/;
DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `t23`,`t22`
/*!*/;
# at 735
#190903 13:42:58 server id 1  end_log_pos 777 CRC32 0x9d1a52fd  GTID 0-1-3 ddl
/*!100001 SET @@session.gtid_seq_no=3*//*!*/;
BEGIN
/*!*/;
# at 777
#190903 13:42:58 server id 1  end_log_pos 896 CRC32 0xfa6b3120  Query   thread_id=15    exec_time=0     error_code=0
SET TIMESTAMP=1567510978/*!*/;
/*!\C utf8mb4 *//*!*/;
SET @@session.character_set_client=45,@@session.collation_connection=45,@@session.collation_server=33/*!*/;
create temporary table test.t23(a int) engine=innodb
/*!*/;
# at 896
#190903 13:42:58 server id 1  end_log_pos 996 CRC32 0x8e6e177a  Query   thread_id=15    exec_time=0     error_code=0
SET TIMESTAMP=1567510978/*!*/;
insert into test.t22(a) values(1)
/*!*/;
# at 996
#190903 13:42:58 server id 1  end_log_pos 1106 CRC32 0x08d4bda9         Query   thread_id=15    exec_time=0     error_code=0
SET TIMESTAMP=1567510978/*!*/;
INSERT INTO test.t23 SELECT * FROM test.t22
/*!*/;
# at 1106
#190903 13:42:58 server id 1  end_log_pos 1181 CRC32 0x2ef6d902         Query   thread_id=15    exec_time=6     error_code=0
SET TIMESTAMP=1567510978/*!*/;
ROLLBACK
/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;



 Comments   
Comment by Andrei Elkin [ 2019-09-04 ]

Richard, thanks for the report. I feel the description is not precise, seeing DROP in the binlog before CREATE. That must mean

begin;
create temporary table test.t22(a int) engine=MEMORY;
create temporary table test.t23(a int) engine=innodb;
insert into test.t22(a) values(1);
INSERT INTO test.t23 SELECT * FROM test.t22;
SELECT SLEEP(30);

right?

Comment by Julien Fritsch [ 2023-12-05 ]

Automated message:
----------------------------
Since this issue has not been updated since 6 weeks, it's time to move it back to Stalled.

Comment by JiraAutomate [ 2023-12-05 ]

Automated message:
----------------------------
Since this issue has not been updated since 6 weeks, it's time to move it back to Stalled.

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