Bug #72074 the third cascade slave crash when MRG_MyISAM used
Submitted: 19 Mar 2014 10:35 Modified: 21 Mar 2014 6:34
Reporter: xiaobin lin (OCA) Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Row Based Replication ( RBR ) Severity:S2 (Serious)
Version:5.5+ OS:Any
Assigned to: CPU Architecture:Any
Tags: cascade slave, crash, MRG_MyISAM, Row-based binlog

[19 Mar 2014 10:35] xiaobin lin
Description:
When using MRG_MyISAM , and have the cascade slaves, the third slave may crash.

It means there are 4 servers in the environment. Row-based binlog format are used.
M2 is the slave of M1;
M3 is the slave of M2;
M4 is the slave of M3;

Then we create MRG_MyISAM  table,and insert one row.

It is because the RBR requires record the table_map event before Rows_wirte event.
And the table_map event will list all the related tables , (t, t1, t2) in this case.

In sql_thread of M3, (t, t1, t2) is expanded to be ((t, t1, t2), t1, t2).
In M4, when replays this event, the rli.tables_to_lock will be the link as t->t1->t2->t1->t2
But because the first t1 is in part of  MRG_MyISAM, its m_tabledef is not initialized. This causes the M4 crash when testing compatibility (table_def::compatible_with).

How to repeat:
**Be sure the binlog format of M1 is row (which require M2 M3 M4 be the same)**
mysql> show create table t\G
*************************** 1. row ***************************
       Table: t
Create Table: CREATE TABLE `t` (
  `c` int(11) DEFAULT NULL,
  `d` int(11) NOT NULL
) ENGINE=MRG_MyISAM DEFAULT CHARSET=utf8 INSERT_METHOD=LAST UNION=(`t1`,`t2`)
1 row in set (0.00 sec)

mysql> show create table t1\G
*************************** 1. row ***************************
       Table: t1
Create Table: CREATE TABLE `t1` (
  `c` int(11) DEFAULT NULL,
  `d` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8
1 row in set (0.00 sec)

mysql> show create table t2\G
*************************** 1. row ***************************
       Table: t2
Create Table: CREATE TABLE `t2` (
  `c` int(11) DEFAULT NULL,
  `d` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8
1 row in set (0.00 sec)

Suggested fix:
Do not think of beautiful solution yet.
[19 Mar 2014 10:59] MySQL Verification Team
May be duplicate of http://bugs.mysql.com/bug.php?id=69574 ?
[19 Mar 2014 12:18] xiaobin lin
Hi,Umesh ,yes.
So is there any roadmap for this bug?
[19 Mar 2014 12:57] MySQL Verification Team
Hello Xiaobin,

Thank you for confirming.
>>So is there any roadmap for this bug?

Please be informed that we cannot provide any ETA on bug fixes etc, once the bug is fixed closure note would be added here with details.

Marking this as duplicate of  Bug #69574

Thanks,
Umesh
[21 Mar 2014 5:56] xiaobin lin
based on 5.5.18

(*) I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

Contribution: bug69574.diff (application/octet-stream, text), 2.55 KiB.