Bug #31502 5.1.20 -> 5.1.22 Slave crashes if it gets an event w/ data for non-exist column
Submitted: 10 Oct 2007 11:35 Modified: 26 Jan 2010 13:02
Reporter: Serge Kozlov Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: Row Based Replication ( RBR ) Severity:S1 (Critical)
Version:5.1.22 OS:Linux
Assigned to: Mats Kindahl CPU Architecture:Any

[10 Oct 2007 11:35] Serge Kozlov
Description:
New slave 5.1.22 and old master 5.1.20 have same table with same columns.
Remove last column from table on slave, switch master and insert a new row. Slave crashes when the one received event with data for removed column.

How to repeat:
1. Install mysql 5.1.22 
2. Install mysql 5.1.20
3. Copy  m4r22.pl (patched mtr) into 5.1.22/mysql-test 
4. Copy  attached test case into 5.1.22/mysql-test/suite/bug/t/
5. Try to create result file for test case:
./m4r22.pl --master-basedir=/path/to/5.1.20 --suite=bugs --record
--mysqld=--binlog-format=row <test case>
[10 Oct 2007 11:37] Serge Kozlov
testcase and patched mtr

Attachment: bug31502.zip (application/zip, text), 35.18 KiB.

[12 Dec 2007 19:49] 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/39813

ChangeSet@1.2651, 2007-12-12 20:48:06+01:00, mats@kindahl-laptop.dnsalias.net +8 -0
  Bug #31502: 5.1.20 -> 5.1.22 Slave crashes if it gets an event
              w/ data for non-exist column
  
  5.1.20 table map event does not contain metadata for fields,
  i.e., there is no information about the parameters for the
  types. When replicating to a 5.1.22 server that expects
  metadata, it turns out to incorrectly be zero in many cases,
  leading to misaligned rows.
  
  This patch does a decent job of providing length of fields
  where the length can be computed without the metadata, and
  throws an error otherwise, stopping the slave.
[13 Dec 2007 20:28] 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/39937

ChangeSet@1.2651, 2007-12-13 21:27:35+01:00, mats@kindahl-laptop.dnsalias.net +10 -0
  Bug #31502: 5.1.20 -> 5.1.22 Slave crashes if it gets an event
              w/ data for non-exist column
  
  5.1.16 to 5.1.20 table map event does not contain metadata for
  fields, i.e., there is no information about the parameters for
  the types. When replicating to a 5.1.22 server that expects
  metadata, it turns out to incorrectly be zero in many cases,
  leading to misaligned rows.
  
  This patch does a decent job of providing length of fields
  where the length can be computed without the metadata, and
  throws an error otherwise, stopping the slave.
[22 Feb 2008 12:00] Andrei Elkin
Setting back to in-progress as I expect another cset covering notes of our 
discussion with the developer back ago in Dec.
[22 Feb 2008 14:26] 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/42832

ChangeSet@1.2652, 2008-02-22 15:25:56+01:00, mats@kindahl-laptop.dnsalias.net +8 -0
  BUG#31502 (5.1.20 -> 5.1.22 Slave crashes if it gets an event w/ data 
             for non-exist column):
  
  Complimentary patch to fix the fact that type() instead of real_type()
  was sent in the table map event. This cause a crash when using ENUM
  extra columns since type() is MYSQL_TYPE_STRING and real_type() is
  MYSQL_TYPE_ENUM. The packed format for MYSQL_TYPE_STRING is (len,
  byte, ...) while the pack format for MYSQL_TYPE_ENUM is just the
  integer value as a single byte (which will then be interpreted as the
  length of a string by the slave).
[17 Jun 2008 13:56] 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/48000

2612 Mats Kindahl	2008-06-17
      Bug #31502: 5.1.20 -> 5.1.22 Slave crashes if it gets an event
                  w/ data for non-exist column
      
      5.1.16 to 5.1.20 table map event does not contain metadata for
      fields, i.e., there is no information about the parameters for
      the types. When replicating to a 5.1.22 server that expects
      metadata, it turns out to incorrectly be zero in many cases,
      leading to misaligned rows.
      
      This patch does a decent job of providing length of fields
      where the length can be computed without the metadata, and
      throws an error otherwise, stopping the slave.
[26 Jan 2010 12:56] 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/98185

367 Serge Kozlov	2010-01-26
      Cumulative patch:
      1. Added test case for Bug#31502
      2. Fix version detecting for MySQL server.
      3. Sorting of combinations for data types test cases.
      added:
        suites/bugs/bug31502.pm
      modified:
        lib/My/Nuts/util/mysql.pm
        suites/rep/data_types/data_types_eq.pm
        suites/rep/data_types/data_types_main.pm