List:Commits« Previous MessageNext Message »
From:Luis Soares Date:June 9 2011 2:20pm
Subject:[Resend] bzr commit into mysql-5.5 branch (luis.soares:3434) Bug#47103
Bug#12638214
View as plain text  
[This commit e-mail is a repeat.]

#At file:///home/lsoares/Workspace/bzr/work/bugfixing/12638214/mysql-5.5/ based on
revid:marko.makela@stripped

 3434 Luis Soares	2011-06-09
      BUG#12638214: 61450: FIX FOR BUG #47103 HAVE NOT BEEN BACKPORTED 
      INTO 5.5 SERIES 
      
      Backported revision luis.soares@stripped
      form mysql-6.0-codebase. Fixed conflicts and changed test case to use
      more recent test includes.

    added:
      mysql-test/suite/rpl/r/rpl_row_merge_engine.result
      mysql-test/suite/rpl/t/rpl_row_merge_engine.test
    modified:
      sql/log_event.cc
=== added file 'mysql-test/suite/rpl/r/rpl_row_merge_engine.result'
--- a/mysql-test/suite/rpl/r/rpl_row_merge_engine.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_merge_engine.result	2011-06-09 13:56:17 +0000
@@ -0,0 +1,43 @@
+include/master-slave.inc
+[connection master]
+DROP TABLE IF EXISTS t1,t2,t3;
+CREATE TABLE t1 ( f1 integer , f2 int, primary key (f1)) ENGINE = MyISAM;
+CREATE TABLE t2 ( f1 integer , f2 int, primary key (f1)) ENGINE = MyISAM;
+CREATE TABLE t3 ( f1 integer , f2 int, primary key (f1)) ENGINE = MERGE UNION (t1,t2);
+INSERT IGNORE INTO t2 VALUES  (1, 1);
+UPDATE t3  SET `f2` = 7 LIMIT 1;
+SELECT * FROM t3;
+f1	f2
+1	7
+DROP TABLE t1, t2, t3;
+include/rpl_reset.inc
+CREATE TABLE `table0_int_autoinc` ( `int` int, pk integer
+auto_increment, `int_key` int,
+primary key (pk), key (`int_key`));
+CREATE TABLE `table10_int_autoinc` ( `int` int, pk integer
+auto_increment, `int_key` int,
+primary key (pk), key (`int_key`));
+INSERT IGNORE INTO table10_int_autoinc VALUES (NULL, NULL,
+'-474021888') , ('1', NULL, NULL) , ('1141047296', NULL, NULL) ,
+(NULL, NULL, NULL) , (NULL, NULL, '1') , (NULL, NULL, '9') , ('0',
+NULL, '1225785344') , (NULL, NULL, '1574174720') , ('2', NULL, NULL) ,
+('6', NULL, '3');
+CREATE TABLE IF NOT EXISTS t1_merge_1_A LIKE test.table0_int_autoinc;
+ALTER TABLE t1_merge_1_A ENGINE = MERGE UNION ( table10_int_autoinc ,
table0_int_autoinc);
+DELETE FROM t1_merge_1_A;
+DROP TABLE table0_int_autoinc, table10_int_autoinc, t1_merge_1_A;
+include/rpl_reset.inc
+CREATE TABLE t1 (a int);
+CREATE TABLE t2 (a int);
+INSERT INTO t1 VALUES (1), (2), (3);
+INSERT INTO t2 VALUES (4), (5), (6);
+CREATE TABLE IF NOT EXISTS t1_merge LIKE t1;
+ALTER TABLE t1_merge ENGINE=MERGE UNION (t2, t1);
+include/diff_tables.inc [master:test.t1, slave:test.t1]
+include/diff_tables.inc [master:test.t2, slave:test.t2]
+UPDATE t1_merge SET a=10 WHERE a=1;
+DELETE FROM t1_merge WHERE a=10;
+include/diff_tables.inc [master:test.t1, slave:test.t1]
+include/diff_tables.inc [master:test.t2, slave:test.t2]
+DROP TABLE t1_merge, t1, t2;
+include/rpl_end.inc

=== added file 'mysql-test/suite/rpl/t/rpl_row_merge_engine.test'
--- a/mysql-test/suite/rpl/t/rpl_row_merge_engine.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_row_merge_engine.test	2011-06-09 13:56:17 +0000
@@ -0,0 +1,110 @@
+#
+# BUG#47103
+# 
+# This test case checks whether the slave crashes or not when there is
+# a merge table in use.
+#
+# Description
+# ===========
+#
+# The test case creates two regular MyISAM tables on the master and
+# one MERGE table. Then it populates the MyISAM tables and deletes
+# their contents through the merge table. Finally, the slave is
+# synchronized with the master and (after the fix) it won't crash.
+# 
+  
+-- source include/master-slave.inc
+-- source include/have_binlog_format_row.inc
+
+#### sanity checks for tests in bug report (first two test cases) 
+
+### Test case #1 ###
+
+--disable_warnings
+DROP TABLE IF EXISTS t1,t2,t3;
+--enable_warnings
+
+CREATE TABLE t1 ( f1 integer , f2 int, primary key (f1)) ENGINE = MyISAM;
+CREATE TABLE t2 ( f1 integer , f2 int, primary key (f1)) ENGINE = MyISAM;
+CREATE TABLE t3 ( f1 integer , f2 int, primary key (f1)) ENGINE = MERGE UNION (t1,t2);
+INSERT IGNORE INTO t2 VALUES  (1, 1);
+# The UPDATE gets a crash with replication format mix and row
+UPDATE t3  SET `f2` = 7 LIMIT 1;
+SELECT * FROM t3;
+-- sync_slave_with_master
+
+-- connection master
+DROP TABLE t1, t2, t3;
+-- sync_slave_with_master
+
+-- connection master
+
+## Test case #2 ##
+
+-- source include/rpl_reset.inc
+
+-- connection master
+CREATE TABLE `table0_int_autoinc` ( `int` int, pk integer
+                                     auto_increment, `int_key` int,
+                                     primary key (pk), key (`int_key`));
+
+CREATE TABLE `table10_int_autoinc` ( `int` int, pk integer
+                                      auto_increment, `int_key` int,
+                                      primary key (pk), key (`int_key`));
+
+INSERT IGNORE INTO table10_int_autoinc VALUES (NULL, NULL,
+'-474021888') , ('1', NULL, NULL) , ('1141047296', NULL, NULL) ,
+(NULL, NULL, NULL) , (NULL, NULL, '1') , (NULL, NULL, '9') , ('0',
+NULL, '1225785344') , (NULL, NULL, '1574174720') , ('2', NULL, NULL) ,
+('6', NULL, '3');
+
+CREATE TABLE IF NOT EXISTS t1_merge_1_A LIKE test.table0_int_autoinc;
+
+ALTER TABLE t1_merge_1_A ENGINE = MERGE UNION ( table10_int_autoinc ,
table0_int_autoinc);
+
+DELETE FROM t1_merge_1_A;
+
+-- sync_slave_with_master
+
+-- connection master
+DROP TABLE table0_int_autoinc, table10_int_autoinc, t1_merge_1_A;
+-- sync_slave_with_master
+
+-- connection master
+-- source include/rpl_reset.inc
+-- connection master
+
+## Test case #3 ##
+
+CREATE TABLE t1 (a int);
+CREATE TABLE t2 (a int);
+INSERT INTO t1 VALUES (1), (2), (3);
+INSERT INTO t2 VALUES (4), (5), (6);
+CREATE TABLE IF NOT EXISTS t1_merge LIKE t1;
+ALTER TABLE t1_merge ENGINE=MERGE UNION (t2, t1);
+
+-- sync_slave_with_master
+
+-- let diff_tables=master:test.t1, slave:test.t1
+-- source include/diff_tables.inc
+
+-- let diff_tables=master:test.t2, slave:test.t2
+-- source include/diff_tables.inc
+
+-- connection master
+UPDATE t1_merge SET a=10 WHERE a=1;
+DELETE FROM t1_merge WHERE a=10;
+
+-- sync_slave_with_master
+
+-- let diff_tables=master:test.t1, slave:test.t1
+-- source include/diff_tables.inc
+
+-- let diff_tables=master:test.t2, slave:test.t2
+-- source include/diff_tables.inc
+
+-- connection master
+DROP TABLE t1_merge, t1, t2;
+-- sync_slave_with_master
+
+--source include/rpl_end.inc

=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc	2011-05-23 22:46:51 +0000
+++ b/sql/log_event.cc	2011-06-09 13:56:17 +0000
@@ -7636,9 +7636,11 @@ int Rows_log_event::do_apply_event(Relay
       DBUG_PRINT("debug", ("Checking compability of tables to lock - tables_to_lock: %p",
                            rli->tables_to_lock));
       RPL_TABLE_LIST *ptr= rli->tables_to_lock;
-      for ( ; ptr ; ptr= static_cast<RPL_TABLE_LIST*>(ptr->next_global))
+      for (uint i= 0 ; ptr && (i < rli->tables_to_lock_count); 
+           ptr= static_cast<RPL_TABLE_LIST*>(ptr->next_global), i++)
       {
         TABLE *conv_table;
+        DBUG_ASSERT(ptr->m_tabledef_valid);
         if (!ptr->m_tabledef.compatible_with(thd,
const_cast<Relay_log_info*>(rli),
                                              ptr->table, &conv_table))
         {


Attachment: [text/bzr-bundle] bzr/luis.soares@oracle.com-20110609135617-geeco6888b9xftfs.bundle
Thread
[Resend] bzr commit into mysql-5.5 branch (luis.soares:3434) Bug#47103Bug#12638214Luis Soares9 Jun