Bug #40638 Replication failure with Innodb + RBR + decimal + no PK
Submitted: 11 Nov 2008 14:40 Modified: 4 Mar 2009 7:01
Reporter: Philip Stoev Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Row Based Replication ( RBR ) Severity:S2 (Serious)
Version:5.1.26,5.1.30 OS:Any
Assigned to: Assigned Account CPU Architecture:Any

[11 Nov 2008 14:40] Philip Stoev
Description:
Row-based replication fails with Innodb when decimal columns are being updated with the following error:

1032; handler error HA_ERR_END_OF_FILE; the event's master log master-bin.000001, end_log_pos 780

How to repeat:
--source include/master-slave.inc
--source include/have_innodb.inc

SET BINLOG_FORMAT = 'row';
CREATE TABLE `t1` (
        `decimal_key` decimal,
        `decimal` decimal,
        key (`decimal_key` )
) ENGINE=innodb;
INSERT IGNORE INTO t1 VALUES (4, NULL);
INSERT IGNORE INTO t1 VALUES (NULL, 4);
UPDATE `t1` SET `decimal_key` = 4 WHERE `decimal` = 4;

--save_master_pos
--connection slave
--sync_with_master

Please execute this test with --mysqld=--innodb in order to have Innodb on both the master and the slave.
[11 Nov 2008 18:38] Valeriy Kravchuk
Verified just as described with recent 5.1.30 from bzr:

openxs@suse:/home2/openxs/dbs/5.1/mysql-test> ./mysql-test-run.pl --mysqld=--innodb --suite=rpl
Logging: ./mysql-test-run.pl --mysqld=--innodb --suite=rpl
MySQL Version 5.1.30
Using dynamic switching of binlog format
Using ndbcluster when necessary, mysqld supports it
Setting mysqld to support SSL connections
Binaries are debug compiled
Using MTR_BUILD_THREAD      = 0
Using MASTER_MYPORT         = 9306
Using MASTER_MYPORT1        = 9307
Using SLAVE_MYPORT          = 9308
Using SLAVE_MYPORT1         = 9309
Using SLAVE_MYPORT2         = 9310
Using NDBCLUSTER_PORT       = 9311
Using NDBCLUSTER_PORT_SLAVE = 9312
Using IM_PORT               = 9313
Using IM_MYSQLD1_PORT       = 9314
Using IM_MYSQLD2_PORT       = 9315
 - adding combinations
Killing Possible Leftover Processes
Removing Stale Files
Creating Directories
Installing Master Database
Installing Slave1 Database
=======================================================

TEST                           RESULT         TIME (ms)
-------------------------------------------------------

rpl.rpl000010 'row'            [ pass ]            703
rpl.rpl000011 'row'            [ pass ]            350
rpl.rpl000013 'row'            [ skipped ]   Doesn't support --binlog-format='row'
rpl.rpl000017 'row'            [ pass ]            378
rpl.rpl_000015 'row'           [ pass ]            134
rpl.rpl_40638 'row'            [ fail ]

=== SHOW MASTER STATUS ===
---- 1. ----
File    slave-bin.000001
Position        711
Binlog_Do_DB
Binlog_Ignore_DB
==========================

=== SHOW SLAVE STATUS ===
---- 1. ----
Slave_IO_State  Waiting for master to send event
Master_Host     127.0.0.1
Master_User     root
Master_Port     9306
Connect_Retry   1
Master_Log_File master-bin.000001
Read_Master_Log_Pos     807
Relay_Log_File  slave-relay-bin.000003
Relay_Log_Pos   765
Relay_Master_Log_File   master-bin.000001
Slave_IO_Running        Yes
Slave_SQL_Running       No
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno      1032
Last_Error      Could not execute Update_rows event on table test.t1; Can't find record in 't1', Error_code: 1032; handler error HA_ERR_END_OF_FILE; the event's master log master-bin.000001, end_log_pos 780
Skip_Counter    0
Exec_Master_Log_Pos     619
Relay_Log_Space 1108
Until_Condition None
Until_Log_File
Until_Log_Pos   0
Master_SSL_Allowed      No
Master_SSL_CA_File
Master_SSL_CA_Path
Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master
Master_SSL_Verify_Server_Cert   No
Last_IO_Errno   0
Last_IO_Error
Last_SQL_Errno  1032
Last_SQL_Error  Could not execute Update_rows event on table test.t1; Can't find record in 't1', Error_code: 1032; handler error HA_ERR_END_OF_FILE; the event's master log master-bin.000001, end_log_pos 780
=========================

mysqltest: At line 16: could not sync with master ('select master_pos_wait('master-bin.000001', 807)' returned NULL)

The result from queries just before the failure was:
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;
SET BINLOG_FORMAT = 'row';
CREATE TABLE `t1` (
`decimal_key` decimal,
`decimal` decimal,
key (`decimal_key` )
) ENGINE=innodb;
INSERT IGNORE INTO t1 VALUES (4, NULL);
INSERT IGNORE INTO t1 VALUES (NULL, 4);
UPDATE `t1` SET `decimal_key` = 4 WHERE `decimal` = 4;

More results from queries before failure can be found in /home2/openxs/dbs/5.1/mysql-test/var/log/rpl_40638.log
[4 Mar 2009 7:01] Zhenxing He
Duplicate of BUG#39648, and the fix is already in the code.
[18 Jun 2010 21:39] Roel Van de Paar
Bug #46597 was marked as a duplicate of this one