Bug #48845 Slave crash during update of char column if size of column less than on master
Submitted: 17 Nov 2009 18:21 Modified: 7 Nov 2015 8:10
Reporter: Serge Kozlov Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: Row Based Replication ( RBR ) Severity:S2 (Serious)
Version:5.1-rep+3 OS:Any
Assigned to: Assigned Account CPU Architecture:Any
Tags: char, crash, slave, table definition
Triage: Triaged: D3 (Medium)

[17 Nov 2009 18:21] Serge Kozlov
Description:
There is master and slave. The both have the table with same name but different definitions:
MASTER: CREATE TABLE t1 (a CHAR(2));
SLAVE: CREATE TABLE t1 (a CHAR(1));

If size of inserted data for column 'a' is greater than size of column on slave then slave is crashed:

MASTER: INSERT INTO t1 VALUES('ab');
SLAVE: crash

Expected behavior is data should be truncated with warnings or proper error (depends SQL mode)

=========cut from slave log============

CURRENT_TEST: rpl.rpl0-3
091117 20:38:23 [Warning] The syntax 'for replication startup options' is deprecated and will be removed in MySQL 6.0. Please use 'CHANGE MASTER' instead.
091117 20:38:23 [Note] Plugin 'FEDERATED' is disabled.
091117 20:38:23 [Note] Plugin 'InnoDB' is disabled.
091117 20:38:23 [Note] Plugin 'ndbcluster' is disabled.
091117 20:38:23 [Warning] /home/ksm/sun/repo/build-5.1-rep+3/sql/mysqld: unknown variable 'loose-debug-sync-timeout=300'
091117 20:38:23 [Note] Event Scheduler: Loaded 0 events
091117 20:38:23 [Note] /home/ksm/sun/repo/build-5.1-rep+3/sql/mysqld: ready for connections.
Version: '5.1.41-log'  socket: '/home/ksm/sun/repo/build-5.1-rep+3/mysql-test/var/tmp/mysqld.2.sock'  port: 13001  Source distribution
091117 20:38:25 [Note] Slave I/O thread: connected to master 'root@127.0.0.1:13000',replication started in log 'FIRST' at position 4
091117 20:38:25 [Note] Slave SQL thread initialized, starting replication in log 'FIRST' at position 0, relay log './slave-relay-bin.000001' position: 4
091117 20:38:25 - mysqld got signal 11 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help diagnose
the problem, but since we have already crashed, something is definitely wrong
and this may fail.

key_buffer_size=1048576
read_buffer_size=131072
max_used_connections=2
max_threads=151
threads_connected=2
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 59972 K
bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

thd: 0xa590b50
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 0x20202020 thread_stack 0x30000
/home/ksm/sun/repo/build-5.1-rep+3/sql/mysqld(my_print_stacktrace+0x21)[0x85a6171]
/home/ksm/sun/repo/build-5.1-rep+3/sql/mysqld(handle_segfault+0x38a)[0x822ebb0]
[0xc72420]
/home/ksm/sun/repo/build-5.1-rep+3/sql/mysqld(_Z10unpack_rowPK14Relay_log_infoP8st_tablejPKhPK9st_bitmapPS5_Pmbb+0x191)[0x830081b]
/home/ksm/sun/repo/build-5.1-rep+3/sql/mysqld(_ZN14Rows_log_event9write_rowEPK14Relay_log_infob+0xf5)[0x82f8941]
/home/ksm/sun/repo/build-5.1-rep+3/sql/mysqld(_ZN20Write_rows_log_event11do_exec_rowEPK14Relay_log_info+0x2c)[0x82f8d42]
/home/ksm/sun/repo/build-5.1-rep+3/sql/mysqld(_ZN14Rows_log_event14do_apply_eventEPK14Relay_log_info+0x187)[0x82f6517]
/home/ksm/sun/repo/build-5.1-rep+3/sql/mysqld(_Z26apply_event_and_update_posP9Log_eventP3THDP14Relay_log_info+0x135)[0x836a933]
/home/ksm/sun/repo/build-5.1-rep+3/sql/mysqld[0x837076f]
/home/ksm/sun/repo/build-5.1-rep+3/sql/mysqld(handle_slave_sql+0x582)[0x837119c]
/lib/libpthread.so.0[0x51546b]
/lib/libc.so.6(clone+0x5e)[0x46cdbe]
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort...
thd->query at 0x20202020 is an invalid pointer
thd->thread_id=538976288
thd->killed=UNKNOWN
The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.
Writing a core file

How to repeat:
Use attached test case.
[17 Nov 2009 18:27] Serge Kozlov
test case

Attachment: bug48845.tgz (application/x-gzip, text), 373 bytes.

[17 Nov 2009 18:32] Serge Kozlov
data, core, log files

Virus scan engine found a threat. This file might be infected. Attachment: bug-data-48845.tgz (application/x-gzip, text), 321.27 KiB.

[29 Nov 2009 19:57] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/92012

364 Serge Kozlov	2009-11-29
      1. Test cases for bugs: bug#48815, bug#48819, bug#48845, bug#48903, bug#48908
      2. Added sorting test cases by their file names.
      3. Added test template Replication.pm
      added:
        lib/My/Nuts/Library/Tests/Replication.pm
        suites/bugs/
        suites/bugs/bug48815.pm
        suites/bugs/bug48819.pm
        suites/bugs/bug48845.pm
        suites/bugs/bug48903.pm
        suites/bugs/bug48908.pm
      modified:
        bin/Driver.pm
[28 Dec 2009 21:07] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/95765

365 Serge Kozlov	2009-12-29
      1. Test cases for bugs: bug#48815, bug#48819, bug#48845, bug#48903, bug#48908
      2. Added sorting test cases by their file names.
      3. Added test template Replication.pm
      added:
        lib/My/Nuts/Library/Tests/Replication.pm
        suites/bugs/
        suites/bugs/bug48815.pm
        suites/bugs/bug48819.pm
        suites/bugs/bug48845.pm
        suites/bugs/bug48903.pm
        suites/bugs/bug48908.pm
      modified:
        bin/Driver.pm