diff --git a/mysql-test/r/bug69574.result b/mysql-test/r/bug69574.result new file mode 100644 index 0000000..adea0b1 --- /dev/null +++ b/mysql-test/r/bug69574.result @@ -0,0 +1,28 @@ +include/master-slave.inc +[connection master] +CREATE TABLE `t1` ( +`c` int(11) DEFAULT NULL, +`d` int(11) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +CREATE TABLE `t2` ( +`c` int(11) DEFAULT NULL, +`d` int(11) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +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`); + +flush to 000002 + +flush logs; +insert into t values(1,1); +flush logs; + +flush to 000003 so 02 only contain one transaction + +select count(*) from t; +count(*) +2 +drop table t,t1,t2; +include/rpl_end.inc diff --git a/mysql-test/t/bug69574.test b/mysql-test/t/bug69574.test new file mode 100644 index 0000000..e949dac --- /dev/null +++ b/mysql-test/t/bug69574.test @@ -0,0 +1,38 @@ +--source include/master-slave.inc +CREATE TABLE `t1` ( + `c` int(11) DEFAULT NULL, + `d` int(11) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +CREATE TABLE `t2` ( + `c` int(11) DEFAULT NULL, + `d` int(11) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +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`); + +--echo +--echo flush to 000002 +--echo + +flush logs; +insert into t values(1,1); +flush logs; + +--echo +--echo flush to 000003 so 02 only contain one transaction +--echo + +let $port= query_get_value("select @@port", @@port, 1); +let $MYSQLD_DATADIR= `select @@datadir`; +--exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000002 | mysql -h127.0.0.1 -P$port -uroot test +--sleep 1 +connection slave; +select count(*) from t; +connection master; +drop table t,t1,t2; + + +--source include/rpl_end.inc diff --git a/sql/log_event.cc b/sql/log_event.cc index efd5b3d..327c737 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -7906,6 +7906,13 @@ int Rows_log_event::do_apply_event(Relay_log_info const *rli) for (uint i= 0 ; ptr && (i < rli->tables_to_lock_count); ptr= static_cast(ptr->next_global), i++) { + /* Bug #69574 */ + if (ptr->parent_l && (ptr->parent_l->table->s->db_type()->db_type == DB_TYPE_MRG_MYISAM)) + { + i--; + continue; + } + DBUG_ASSERT(ptr->m_tabledef_valid); TABLE *conv_table; if (!ptr->m_tabledef.compatible_with(thd, const_cast(rli),