Bug #43783 different master/slave table defs cause crash: bigint unsigned null vs not null
Submitted: 22 Mar 2009 7:51 Modified: 3 Apr 2009 18:22
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Row Based Replication ( RBR ) Severity:S1 (Critical)
Version:5.1.32 OS:Any
Assigned to: Assigned Account CPU Architecture:Any
Tags: crash, valgrind

[22 Mar 2009 7:51] Shane Bester
Description:
crash and/or valgrind errors are caused when master and slave have different table definition.  

Invalid read of size 4
   at  Field_longlong::unpack (field.h:571)
   by  unpack_row (rpl_record.cc:242)
   by  Rows_log_event::write_row (log_event.h:3548)
   by  Write_rows_log_event::do_exec_row (log_event.cc:8513)
   by  Rows_log_event::do_apply_event (log_event.cc:7281)
   by  apply_event_and_update_pos (log_event.h:1056)
   by  handle_slave_sql (slave.cc:2130)
   by start_thread (in /lib/libpthread-2.5.so)
   by clone (in /lib/libc-2.5.so)
 Address 0x7979141 is 4 bytes after a block of size 5 alloc'd
   at malloc (vg_replace_malloc.c:149)
   by my_malloc (my_malloc.c:34)
   by Rows_log_event::Rows_log_event (log_event.cc:6961)
   by Write_rows_log_event::Write_rows_log_event (log_event.cc:8131)
   by Log_event::read_log_event (log_event.cc:1183)
   by Log_event::read_log_event (log_event.cc:1032)
   by handle_slave_sql (slave.cc:3834)
   by tart_thread (in /lib/libpthread-2.5.so)
   by lone (in /lib/libc-2.5.so)

How to repeat:
1. on master create a table:
create table `t1` (`a` int(11) not null auto_increment,
  `col001` bigint unsigned default null, primary key (`a`)
) engine=myisam default charset=latin1;

2. on slave create a table:
create table `t1` ( `a` int(11) not null auto_increment,
  `col001` bigint not null, primary key (`a`)
) engine=myisam default charset=latin1;

3. setup replication correctly, using binlog_format=row

4. on master, execute this:
insert ignore into `t1` set `col001`=null;

observe either a crash (perhaps after many inserts, or immediate valgrind errors).

Suggested fix:
do the conversion correctly.
[30 Mar 2009 4:54] Alfranio Tavares Correia Junior
See BUG#43789.