• Mats Kindahl's avatar
    BUG#37426: RBR breaks for CHAR() UTF-8 fields > 85 chars · 2a089557
    Mats Kindahl authored
          
    In order to handle CHAR() fields, 8 bits were reserved for
    the size of the CHAR field. However, instead of denoting the
    number of characters in the field, field_length was used which
    denotes the number of bytes in the field.
    
    Since UTF-8 fields can have three bytes per character (and
    has been extended to have four bytes per character in 6.0),
    an extra two bits have been encoded in the field metadata
    work for fields of type Field_string (i.e., CHAR fields).
    
    Since the metadata word is filled, the extra bits have been
    encoded in the upper 4 bits of the real type (the most 
    significant byte of the metadata word) by computing the
    bitwise xor of the extra two bits. Since the upper 4 bits
    of the real type always is 1111 for Field_string, this 
    means that for fields of length <256, the encoding is
    identical to the encoding used in pre-5.1.26 servers, but
    for lengths of 256 or more, an unrecognized type is formed,
    causing an old slave (that does not handle lengths of 256
    or more) to stop.
    2a089557
sql_insert.cc 122 KB