#At file:///home/lsoares/Workspace/bzr/work/bugfixing/53643/mysql-5.1-rpl-wl5092/ based on revid:luis.soares@stripped
3187 Luis Soares 2010-05-17 [merge]
BUG#53643: assert in Field_new_decimal::store_value on slave server
The table->write_set at the slave was improperly set before
processing a row event. For update events, it was being
calculated from the event's read set instead of the event's
write_set.
In some cases, this would lead to an assertion while unpacking
and resetting decimal fields because the corresponding bit in
the slave's table->write_set was incorrectly set.
We fix this by properly initializing the read_set and write_set
before unpacking takes place.
added:
mysql-test/suite/rpl/r/rpl_row_img_misc.result
mysql-test/suite/rpl/t/rpl_row_img_misc.test
modified:
sql/log_event.cc
=== added file 'mysql-test/suite/rpl/r/rpl_row_img_misc.result'
--- a/mysql-test/suite/rpl/r/rpl_row_img_misc.result 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_img_misc.result 2010-05-14 15:15:09 +0000
@@ -0,0 +1,18 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE t0 ( col1 INT NOT NULL, col2 INT ) ENGINE=InnoDB;
+INSERT INTO t0 (col1,col2) VALUES (4,7),(4,8);
+CREATE TABLE t1 (col3 DECIMAL(35,0) DEFAULT NULL,
+col1 INT NOT NULL,
+col2 INT NOT NULL DEFAULT '0',
+PRIMARY KEY (col1))
+ENGINE=MyISAM DEFAULT CHARSET=latin1 ;
+SET SESSION BINLOG_ROW_IMAGE = minimal;
+REPLACE INTO t1 ( col1,col2) SELECT col1,col2 FROM t0;
+Comparing tables master:test.t0 and slave:test.t0
+Comparing tables master:test.t1 and slave:test.t1
+DROP TABLE t0, t1;
=== added file 'mysql-test/suite/rpl/t/rpl_row_img_misc.test'
--- a/mysql-test/suite/rpl/t/rpl_row_img_misc.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_row_img_misc.test 2010-05-14 15:15:09 +0000
@@ -0,0 +1,38 @@
+-- source include/master-slave.inc
+-- source include/have_binlog_format_row.inc
+-- source include/have_innodb.inc
+
+#
+# BUG#53643: assert in Field_new_decimal::store_value on slave server
+#
+
+CREATE TABLE t0 ( col1 INT NOT NULL, col2 INT ) ENGINE=InnoDB;
+INSERT INTO t0 (col1,col2) VALUES (4,7),(4,8);
+
+-- sync_slave_with_master
+-- connection master
+
+CREATE TABLE t1 (col3 DECIMAL(35,0) DEFAULT NULL,
+ col1 INT NOT NULL,
+ col2 INT NOT NULL DEFAULT '0',
+ PRIMARY KEY (col1))
+ ENGINE=MyISAM DEFAULT CHARSET=latin1 ;
+
+SET SESSION BINLOG_ROW_IMAGE = minimal;
+
+# This statement would lead to an assert on slave
+REPLACE INTO t1 ( col1,col2) SELECT col1,col2 FROM t0;
+
+-- sync_slave_with_master
+-- connection master
+
+-- let $diff_table_1=master:test.t0
+-- let $diff_table_2=slave:test.t0
+-- source include/diff_tables.inc
+
+-- let $diff_table_1=master:test.t1
+-- let $diff_table_2=slave:test.t1
+-- source include/diff_tables.inc
+
+DROP TABLE t0, t1;
+-- sync_slave_with_master
=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc 2010-03-04 17:00:32 +0000
+++ b/sql/log_event.cc 2010-05-14 15:15:09 +0000
@@ -7625,9 +7625,17 @@ int Rows_log_event::do_apply_event(Relay
DBUG_PRINT_BITSET("debug", "Setting table's write_set from: %s", &m_cols);
bitmap_set_all(table->read_set);
+ if (get_type_code() == DELETE_ROWS_EVENT)
+ bitmap_intersect(table->read_set,&m_cols);
+
bitmap_set_all(table->write_set);
if (!get_flags(COMPLETE_ROWS_F))
- bitmap_intersect(table->write_set,&m_cols);
+ {
+ if (get_type_code() == UPDATE_ROWS_EVENT)
+ bitmap_intersect(table->write_set,&m_cols_ai);
+ else /* WRITE ROWS EVENTS store the bitmap in m_cols instead of m_cols_ai */
+ bitmap_intersect(table->write_set,&m_cols);
+ }
this->slave_exec_mode= slave_exec_mode_options; // fix the mode
Attachment: [text/bzr-bundle] bzr/luis.soares@sun.com-20100517151630-0hidznuderzboa4r.bundle
Thread |
---|
• bzr commit into mysql-5.1-rpl-wl5092 branch (luis.soares:3187)Bug#53643 | Luis Soares | 17 May |