• unknown's avatar
    BUG#29549 (Endians: test failures on Solaris): · 38b24c7a
    unknown authored
    Refactoring code to add parameter to pack() and unpack() functions with
    purpose of indicating if data should be packed in little-endian or
    native order. Using new functions to always pack data for binary log
    in little-endian order. The purpose of this refactoring is to allow
    proper implementation of endian-agnostic pack() and unpack() functions.
    
    Eliminating several versions of virtual pack() and unpack() functions
    in favor for one single virtual function which is overridden in
    subclasses.
    
    Implementing pack() and unpack() functions for some field types that
    packed data in native format regardless of the value of the
    st_table_share::db_low_byte_first flag.
    
    The field types that were packed in native format regardless are:
    Field_real, Field_decimal, Field_tiny, Field_short, Field_medium,
    Field_long, Field_longlong, and Field_blob.
    
    Before the patch, row-based logging wrote the rows incorrectly on
    big-endian machines where the storage engine defined its own
    low_byte_first() to be FALSE on big-endian machines (the default
    is TRUE), while little-endian machines wrote the fields in correct
    order. The only known storage engine that does this is NDB. In effect,
    this means that row-based replication from or to a big-endian
    machine where the table was using NDB as storage engine failed if the
    other engine was either non-NDB or on a little-endian machine.
    
    With this patch, row-based logging is now always done in little-endian
    order, while ORDER BY uses the native order if the storage engine
    defines low_byte_first() to return FALSE for big-endian machines.
    
    In addition, the max_data_length() function available in Field_blob
    was generalized to the entire Field hierarchy to give the maximum
    number of bytes that Field::pack() will write.
    
    
    mysql-test/extra/rpl_tests/rpl_extraMaster_Col.test:
      Sorting by columns that produces deterministic order.
    mysql-test/suite/rpl/r/rpl_extraColmaster_innodb.result:
      Result change.
    mysql-test/suite/rpl/r/rpl_extraColmaster_myisam.result:
      Result change.
    mysql-test/suite/rpl/r/rpl_row_extraColmaster_ndb.result:
      Result change.
    mysql-test/suite/rpl/t/disabled.def:
      Enabling tests.
    mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test:
      Adding missing sync_slave_with_master causing slave to keep tables
      after shutdown.
    mysql-test/suite/rpl_ndb/t/disabled.def:
      Enabling tests.
    mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb2ndb-slave.opt:
      Adding --new option
    mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb2ndb.test:
      Adding have_log_bin.
    mysql-test/suite/rpl_ndb/t/rpl_ndb_myisam2ndb-slave.opt:
      Adding --new option
    mysql-test/suite/rpl_ndb/t/rpl_ndb_myisam2ndb.test:
      Adding have_log_bin
    mysql-test/t/partition.test:
      Adding have_archive, since that is used in the test.
    sql/field.cc:
      Eliminating all two-argument pack() and unpack() functions and moving
      functionality into the four-argument version. The four argument version
      is introduced so that it is possible to avoid using the storage engine
      default when writing and reading the packed format (the unpacked format
      still uses the storage engine's default). This is used by row-based
      replication to write the fields in a storage engine- and endian-agnostic
      format.
      
      Packing integral and floating-point numbers in little-endian format
      (if requested).
      
      Using pad_char for the field instead of spaces (0x20) when unpacking.
      
      Adding some Doxygen documentation.
      ---
      Adding max_data_length() to denote the maximum number of bytes that
      pack() will write.
      
      Adding casts to remove warnings for debug printouts.
    sql/field.h:
      Eliminating all virtual pack() and unpack() functions except the four-
      argument version, which now is the function that shall be overridden.
      The two-argument versions are convenience functions, to prevent changes
      to code that uses these.
      
      Adding code to pack integer numbers and floating-point numbers in
      little-endian format, if requested.
      ---
      Adding max_data_length() to denote the maximum number of bytes that
      pack() will write.
    sql/log.cc:
      Removing debug printout causing crash when starting NDB on Solaris.
    sql/log_event.cc:
      Adding missing #ifndef causing compile failure. Adding debug printouts.
    sql/rpl_record.cc:
      Debriding code. Using new pack() and unpack() functions to always pack
      fields little-endian. Adding debug printouts.
      ---
      Using max_data_length() when packing field into row.
      
      Adding casts to debug printouts.
    sql/sql_show.cc:
      Adding code that causes crash on Solaris machines since printf() cannot
      handle NULL values for strings properly.
    mysql-test/suite/rpl_ndb/r/rpl_ndb_innodb2ndb.result:
      New BitKeeper file ``mysql-test/suite/rpl_ndb/r/rpl_ndb_innodb2ndb.result''
    mysql-test/suite/rpl_ndb/r/rpl_ndb_myisam2ndb.result:
      New BitKeeper file ``mysql-test/suite/rpl_ndb/r/rpl_ndb_myisam2ndb.result''
    38b24c7a
rpl_row_mysqlbinlog.test 10.3 KB