Bug #97780 Two different type engines in Mysql cause error (assert in debug) in Binlog Xa
Submitted: 26 Nov 2019 6:05 Modified: 28 Nov 2019 4:03
Reporter: Haixing Weng (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Replication Severity:S3 (Non-critical)
Version:MySQL5.7, 5.7.28 OS:Any
Assigned to: CPU Architecture:Any
Tags: binlog XA, DDL

[26 Nov 2019 6:05] Haixing Weng
Description:
When use a DDL SQL which relates two types engine (One is Innodb and other is not surpport transaction), binlog XA will report an error that trx not regists for 2PC. In debug mode, it will crash by debug_assert()..

You can find error in log in release mode:

2019-11-26T13:53:55.366504+08:00 119 [ERROR] Transaction not registered for MySQL 2PC, but transaction is active

How to repeat:

drop table if exists t1,t2,t3;
drop function if exists f1;

delimiter |
create function f1() returns int
begin
  declare res int;
  create temporary table t3 select 1 i;
  set res:= (select count(*) from t1);
  drop temporary table t3;
  return res;
end|
delimiter ;
create table t1 engine=myisam  as select 1 ;
create table t2 engine=myisam  as select f1() from t1 ;
drop table t1,t2;
drop function f1;

You can Find error in log
[26 Nov 2019 6:09] Haixing Weng
add Tags
[26 Nov 2019 6:36] MySQL Verification Team
Hello Haixing Weng,

Thank you for the report and feedback.
Observed the issue with 5.7.28 build.

regards,
Umesh
[28 Nov 2019 4:03] Haixing Weng
Hi Umesh Shastry:

    Would you please tell me that the reason which cause this issue.
    Is it possible happened when a DML contains different engines?

Thanks
[14 Apr 2020 14:27] Vinicius Malvestio Grippa
The same issue is *not* reproducible on MySQL 5.6.

I checked the binary log on MySQL 5.7 and the data seems to be consistent.