Bug #43785 different master/slave table defs cause crash: date null vs not null
Submitted: 22 Mar 2009 10:03 Modified: 30 Mar 2009 4:50
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Duplicate Impact on me:
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 10:03] Shane Bester
similar to bug #43783

when a 'not null' and 'null' column exist on master/slave for a date column, valgrind errors and/or crashes can happen on the slave.

1 errors in context 1 of 2:
Invalid read of size 1
at  memcpy (mc_replace_strmem.c:406)
by  Field::unpack (field.cc:1498)
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  _ZL20exec_relay_log_eventP3THDP14Relay_log_info (slave.cc:2130)
by  handle_slave_sql (slave.cc:2801)
by start_thread 
by clone 
 Address 0x7A64BFD is 0 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 _ZL10next_eventP14Relay_log_info (slave.cc:3834)
by _ZL20exec_relay_log_eventP3THDP14Relay_log_info (slave.cc:2095)
by handle_slave_sql (slave.cc:2801)
by start_thread 
by clone

How to repeat:
1. create table on master:

create table t1(`a` int, `b` date DEFAULT NULL,
primary key(`a`))engine=myisam DEFAULT CHARSET=latin1;

2. create table on slave:

create table t1(`a` int, `b` date NOT NULL DEFAULT '0000-00-00',
primary key(`a`))engine=myisam DEFAULT CHARSET=latin1;

3. start replication using --binlog-format=row

4. on master, insert a row and see slave crash or have valgrind errors:

insert into t1 values (1,null);

Suggested fix:
do conversion properly
[30 Mar 2009 4:49] Alfranio Junior
See BUG#43789.