Bug #42977 RBR logs for rows with more than 250 column results in corrupt binlog.
Submitted: 18 Feb 2009 16:29 Modified: 15 Apr 2009 10:24
Reporter: Matthew Montgomery Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Row Based Replication ( RBR ) Severity:S1 (Critical)
Version:6.0.8, 5.1.32 OS:Any
Assigned to: Andrei Elkin CPU Architecture:Any

[18 Feb 2009 16:29] Matthew Montgomery
Description:
This bug is tangentially related to Bug #42914.

Got, "ERROR: Error in Log_event::read_log_event(): 'read error', data_len: 4259840, event_type: -100" from mysqlbinlog when logging updates to table with > 250 columns.

Slave IO thread gets 

[ERROR] Error reading packet from server: error reading log entry ( server_errno=1236)
[ERROR] Got fatal error 1236: 'error reading log entry' from master when reading data from binary log

How to repeat:
BINLOG_FORMAT=ROW or MIXED

create table t1 ( f1 int, f2 int, f3 int, f4 int, f5 int, f6 int, f7 int, f8 int, f9 int, f10 int, f11 int, f12 int, f13 int, f14 int, f15 int, f16 int, f17 int, f18 int, f19 int, f20 int, f21 int, f22 int, f23 int, f24 int, f25 int, f26 int, f27 int, f28 int, f29 int, f30 int, f31 int, f32 int, f33 int, f34 int, f35 int, f36 int, f37 int, f38 int, f39 int, f40 int, f41 int, f42 int, f43 int, f44 int, f45 int, f46 int, f47 int, f48 int, f49 int, f50 int, f51 int, f52 int, f53 int, f54 int, f55 int, f56 int, f57 int, f58 int, f59 int, f60 int, f61 int, f62 int, f63 int, f64 int, f65 int, f66 int, f67 int, f68 int, f69 int, f70 int, f71 int, f72 int, f73 int, f74 int, f75 int, f76 int, f77 int, f78 int, f79 int, f80 int, f81 int, f82 int, f83 int, f84 int, f85 int, f86 int, f87 int, f88 int, f89 int, f90 int, f91 int, f92 int, f93 int, f94 int, f95 int, f96 int, f97 int, f98 int, f99 int, f100 int, f101 int, f102 int, f103 int, f104 int, f105 int, f106 int, f107 int, f108 int, f109 int, f110 int, f111 int, f112 int, f113 int, f114 int, f115 int, f116 int, f117 int, f118 int, f119 int, f120 int, f121 int, f122 int, f123 int, f124 int, f125 int, f126 int, f127 int, f128 int, f129 int, f130 int, f131 int, f132 int, f133 int, f134 int, f135 int, f136 int, f137 int, f138 int, f139 int, f140 int, f141 int, f142 int, f143 int, f144 int, f145 int, f146 int, f147 int, f148 int, f149 int, f150 int, f151 int, f152 int, f153 int, f154 int, f155 int, f156 int, f157 int, f158 int, f159 int, f160 int, f161 int, f162 int, f163 int, f164 int, f165 int, f166 int, f167 int, f168 int, f169 int, f170 int, f171 int, f172 int, f173 int, f174 int, f175 int, f176 int, f177 int, f178 int, f179 int, f180 int, f181 int, f182 int, f183 int, f184 int, f185 int, f186 int, f187 int, f188 int, f189 int, f190 int, f191 int, f192 int, f193 int, f194 int, f195 int, f196 int, f197 int, f198 int, f199 int, f200 int, f201 int, f202 int, f203 int, f204 int, f205 int, f206 int, f207 int, f208 int, f209 int, f210 int, f211 int, f212 int, f213 int, f214 int, f215 int, f216 int, f217 int, f218 int, f219 int, f220 int, f221 int, f222 int, f223 int, f224 int, f225 int, f226 int, f227 int, f228 int, f229 int, f230 int, f231 int, f232 int, f233 int, f234 int, f235 int, f236 int, f237 int, f238 int, f239 int, f240 int, f241 int, f242 int, f243 int, f244 int, f245 int, f246 int, f247 int, f248 int, f249 int, f250 int, f251 int,  primary key (f1)) engine=myisam;
insert into t1 (f1) values(1); 
DROP TABLE t1;

~/mysql/sandbox/60$ ./bin/mysqlbinlog -f -H ./data/host-bin.000001 

Suggested fix:
If this is a known limitation, force failback to SBR for tables with > 250 columns.  Ideally this limitation should be removed.  Any table which could be bin-logged under SBR should be likewise for RBR.
[18 Feb 2009 17:12] MySQL Verification Team
Sorry, BINLOG_FORMAT=MIXED does not reproduce this bug.  Only ROW
[23 Mar 2009 16:31] 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/70089

2844 Andrei Elkin	2009-03-23
      Bug#42977 RBR logs for rows with more than 250 column results in corrupt binlog
      
      The issue happened to be two-fold.
      The table map event was recorded into binlog having
      an incorrect size when number of columns exceeded 251. 
      The Row-based event had incorrect recording and restoring m_width member within
      the same as above conditions.
      
      Fixed with correcting m_data_size and m_width.
[24 Mar 2009 10:10] 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/70162

2844 Andrei Elkin	2009-03-24
       Bug#42977 RBR logs for rows with more than 250 column results in corrupt binlog
            
      The issue happened to be two-fold.
      The table map event was recorded into binlog having
      an incorrect size when number of columns exceeded 251. 
      The Row-based event had incorrect recording and restoring m_width member within
      the same as above conditions.
            
      Fixed with correcting m_data_size and m_width.
[24 Mar 2009 13:51] 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/70208

2845 Andrei Elkin	2009-03-24
      Bug #42977   RBR logs for rows with more than 250 column results in corrupt binlog.
      
      correcting the position of the null-terminator in DBUG_PRINT_BITSET()
[24 Mar 2009 14:31] 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/70218

2844 Andrei Elkin	2009-03-24
      Bug#42977 RBR logs for rows with more than 250 column results in corrupt binlog
                  
      The issue happened to be two-fold.
      The table map event was recorded into binlog having
      an incorrect size when number of columns exceeded 251. 
      The Row-based event had incorrect recording and restoring m_width member within
      the same as above conditions.
      
      Fixed with correcting m_data_size and m_width.
[25 Mar 2009 10:54] 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/70337

2841 Andrei Elkin	2009-03-25
      Bug#42977 RBR logs for rows with more than 250 column results in corrupt binlog
                  
      The issue happened to be two-fold.
      The table map event was recorded into binlog having
      an incorrect size when number of columns exceeded 251. 
      The Row-based event had incorrect recording and restoring m_width member within
      the same as above conditions.
      
      Fixed with correcting m_data_size and m_width.
[25 Mar 2009 11:39] 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/70342

3168 Andrei Elkin	2009-03-25 [merge]
      merging bug#42977 from 5.1-pe-stage to 6.0-pe-stage
[25 Mar 2009 11:47] Andrei Elkin
Pushed to 5.1,6.0 -pe-stage.
[26 Mar 2009 9: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/70492

2842 Andrei Elkin	2009-03-26
      bug#42977
      compilation warning fixed
[26 Mar 2009 9:31] 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/70495

3171 Andrei Elkin	2009-03-26 [merge]
      merge from 5.1-pe-stage to 6.0 for bug#42977 compilation warning issue
[27 Mar 2009 14:58] Bugs System
Pushed into 5.1.34 (revid:joro@sun.com-20090327143448-wuuuycetc562ty6o) (version source revid:aelkin@mysql.com-20090326092543-renqntx4o2utp5yx) (merge vers: 5.1.34) (pib:6)
[30 Mar 2009 11:54] Jon Stephens
Documented bugfiuc in the 5.1.34 changelog as follows:

        Binary logging with --binlog_format=ROW failed when a change to
        be logged included more than 251 columns. This issue was not
        known to occur with mixed-format or statement-based logging.

Set NDI status pending merge to 6.0 tree.
[13 Apr 2009 9:22] Bugs System
Pushed into 6.0.11-alpha (revid:alik@sun.com-20090413084402-snnrocwzktcl88ny) (version source revid:aelkin@mysql.com-20090326093021-po37vuupbh22j49l) (merge vers: 6.0.11-alpha) (pib:6)
[15 Apr 2009 10:24] Jon Stephens
Fix now also documented in the 6.0.11 changelog; closed.
[9 May 2009 16:41] Bugs System
Pushed into 5.1.34-ndb-6.2.18 (revid:jonas@mysql.com-20090508185236-p9b3as7qyauybefl) (version source revid:jonas@mysql.com-20090508185236-p9b3as7qyauybefl) (merge vers: 5.1.34-ndb-6.2.18) (pib:6)
[9 May 2009 17:38] Bugs System
Pushed into 5.1.34-ndb-6.3.25 (revid:jonas@mysql.com-20090509063138-1u3q3v09wnn2txyt) (version source revid:jonas@mysql.com-20090509063138-1u3q3v09wnn2txyt) (merge vers: 5.1.34-ndb-6.3.25) (pib:6)
[9 May 2009 18:35] Bugs System
Pushed into 5.1.34-ndb-7.0.6 (revid:jonas@mysql.com-20090509154927-im9a7g846c6u1hzc) (version source revid:jonas@mysql.com-20090509154927-im9a7g846c6u1hzc) (merge vers: 5.1.34-ndb-7.0.6) (pib:6)