Bug #38849 Crash on mismatched create table (NOT NULL)
Submitted: 18 Aug 2008 11:36 Modified: 3 Apr 2009 13:46
Reporter: Jan Kneschke Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Row Based Replication ( RBR ) Severity:S3 (Non-critical)
Version:5.1.26, 5.1, 6.0 bzr OS:Any
Assigned to: Luis Soares CPU Architecture:Any

[18 Aug 2008 11:36] Jan Kneschke
Description:
Slave crashes if RBR is used and the definition of "NOT NULL" columns doesn't match on master and slave:

0x000000000062b18d in unpack_row (rli=0x120c468, table=0x12261a0, colcnt=2, row_data=0x12539d0 "\220\235\034\001", cols=0x1223370, row_end=0x1223408, master_reclength=0x12233b8)
    at field.h:262
262         { if (null_ptr) null_ptr[row_offset]&= (uchar) ~null_bit; }
(gdb) bt
#0  0x000000000062b18d in unpack_row (rli=0x120c468, table=0x12261a0, colcnt=2, row_data=0x12539d0 "\220\235\034\001", cols=0x1223370, row_end=0x1223408, master_reclength=0x12233b8)
    at field.h:262
#1  0x000000000062aa5d in Rows_log_event::unpack_current_row (this=0x1223310, rli=0x11c9d90) at log_event.h:3465
#2  0x000000000062868c in Rows_log_event::write_row (this=0x1223310, rli=0x120c468, overwrite=false) at log_event.cc:7611
#3  0x0000000000628872 in Write_rows_log_event::do_exec_row (this=0x1223310, rli=0x122333f) at log_event.cc:7782
#4  0x0000000000626afd in Rows_log_event::do_apply_event (this=0x1223310, rli=0x120c468) at log_event.cc:6603
#5  0x0000000000680cfe in apply_event_and_update_pos (ev=0x1223310, thd=0x0, rli=0x120c468, skip=true) at log_event.h:1010
#6  0x0000000000680e53 in exec_relay_log_event (thd=0x1229050, rli=0x120c468) at slave.cc:2058
#7  0x0000000000681d06 in handle_slave_sql (arg=0x120d570) at slave.cc:2717
#8  0x00002ac6681f2020 in start_thread () from /lib64/libpthread.so.0
#9  0x00002ac668d73f8d in clone () from /lib64/libc.so.6
#10 0x0000000000000000 in ?? ()

How to repeat:
Using mysqltest the crash can be triggered:

--connect (master,127.0.0.1,root,,test,3306)
--connect (slave,127.0.0.1,root,,test,3307)
--connection master
use test;
set SQL_LOG_BIN=0;
set session binlog_format=row;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 ( i1 INT, c1 VARCHAR(16) character set latin1 not null, i2 int NOT NULL);

--connection slave
use test;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 ( i1 INT NOT NULL, c1 VARCHAR(16) character set latin1 not null, i2 int);

--connection master
use test;
set SQL_LOG_BIN=1;
INSERT INTO t1 VALUES ( NULL, 'string', 1);
SELECT * FROM t1;
--sync_slave_with_master
SELECT * FROM t1;

Suggested fix:
deny mismatched NULL columns definitions.
[18 Aug 2008 15:56] Sveta Smirnova
Thank you for the report.

Verified as described.
[3 Apr 2009 13:46] Luis Soares
After discussing with Alfranio we agreed that this is duplicates of BUG#43789.