From 339434317ede2a9b9fa1719e2885a014b3a0e512 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 2 Aug 2007 16:15:52 -0400 Subject: WL#3228 (NDB) : RBR using different table defs on slave/master This patch corrects a problem found during testing on Solaris. The code changes how length values are retrieved on big endian machines. The patch allows the rpl_extraColmaster tests to run on these machines. mysql-test/suite/rpl/r/rpl_row_create_table.result: WL#3228 (NDB) : RBR using different table defs on slave/master New result file with changes from merge of 5.1 main. mysql-test/suite/rpl/t/disabled.def: WL#3228 (NDB) : RBR using different table defs on slave/master Disable the rpl_rwo_extraColmaster_ndb test (WL#3915) because the code fails on Big Endian machines. See BUG#29549 for more details. sql/field.cc: WL#3228 (NDB) : RBR using different table defs on slave/master This patch corrects a problem found during testing on Solaris. The code changes how the store_length method processes requests for values on big endian machines. sql/field.h: WL#3228 (NDB) : RBR using different table defs on slave/master This patch corrects a problem found during testing on Solaris. The code changes how the store_length method processes requests for values on big endian machines. It also changes the get_packed_length() method to use the endian-ness of the host in getting the length + packlength. sql/rpl_record.cc: WL#3228 (NDB) : RBR using different table defs on slave/master This patch turns on the little endian switch (db_low_byte_first) in order to ensure the values are unpack correctly from binlog as they are stored in little endian format in binlog. sql/rpl_utility.cc: WL#3228 (NDB) : RBR using different table defs on slave/master This patch corrects a problem found during testing on Solaris. The code changes how the calculated field size method processes requests for values on big endian machines. --- sql/rpl_utility.cc | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) (limited to 'sql/rpl_utility.cc') diff --git a/sql/rpl_utility.cc b/sql/rpl_utility.cc index 40937e98b27..9c0eb9891a0 100644 --- a/sql/rpl_utility.cc +++ b/sql/rpl_utility.cc @@ -114,8 +114,43 @@ uint32 table_def::calc_field_size(uint col, uchar *master_data) case MYSQL_TYPE_BLOB: case MYSQL_TYPE_GEOMETRY: { +#if 1 + /* + BUG#29549: + This is currently broken for NDB, which is using big-endian + order when packing length of BLOB. Once they have decided how to + fix the issue, we can enable the code below to make sure to + always read the length in little-endian order. + */ Field_blob fb(m_field_metadata[col]); - length= fb.get_packed_size(master_data); + length= fb.get_packed_size(master_data, TRUE); +#else + /* + Compute the length of the data. We cannot use get_length() here + since it is dependent on the specific table (and also checks the + packlength using the internal 'table' pointer) and replication + is using a fixed format for storing data in the binlog. + */ + switch (m_field_metadata[col]) { + case 1: + length= *master_data; + break; + case 2: + length= sint2korr(master_data); + break; + case 3: + length= uint3korr(master_data); + break; + case 4: + length= uint4korr(master_data); + break; + default: + DBUG_ASSERT(0); // Should not come here + break; + } + + length+= m_field_metadata[col]; +#endif break; } default: -- cgit v1.2.1