summaryrefslogtreecommitdiff
path: root/sql/rpl_utility.h
diff options
context:
space:
mode:
authorMats Kindahl <mats@sun.com>2010-03-17 15:28:49 +0100
committerMats Kindahl <mats@sun.com>2010-03-17 15:28:49 +0100
commit2c5f439d651f00f2f13d1f8e94f3701dadf9c7d3 (patch)
tree25da1cce3d83a72ee2d7bce4c40bddb413eb5c19 /sql/rpl_utility.h
parent8799820faf2a10b6ed406bde7df885caf144548a (diff)
downloadmariadb-git-2c5f439d651f00f2f13d1f8e94f3701dadf9c7d3.tar.gz
BUG#49618: Field length stored incorrectly in binary log
for InnoDB The class Field_bit_as_char stores the metadata for the field incorrecly because bytes_in_rec and bit_len are set to (field_length + 7 ) / 8 and 0 respectively, while Field_bit has the correct values field_length / 8 and field_length % 8. Solved the problem by re-computing the values for the metadata based on the field_length instead of using the bytes_in_rec and bit_len variables. To handle compatibility with old server, a table map flag was added to indicate that the bit computation is exact. If the flag is clear, the slave computes the number of bytes required to store the bit field and compares that instead, effectively allowing replication *without conversion* from any field length that require the same number of bytes to store. mysql-test/suite/rpl/t/rpl_typeconv_innodb.test: Adding test to check compatibility for bit field replication when using InnoDB sql/field.cc: Extending compatible_field_size() with flags from table map to allow fields to check master info. sql/field.h: Extending compatible_field_size() with flags from table map to allow fields to check master info. sql/log.cc: Removing table map flags since they are not used outside table map class. sql/log_event.cc: Removing flags parameter from table map constructor since it is not used and does not have to be exposed. sql/log_event.h: Adding flag to denote that bit length for bit field type is exact and not potentially rounded to even bytes. sql/rpl_utility.cc: Adding fields to table_def to store table map flags. sql/rpl_utility.h: Removing obsolete comment and adding flags to store table map flags from master.
Diffstat (limited to 'sql/rpl_utility.h')
-rw-r--r--sql/rpl_utility.h11
1 files changed, 3 insertions, 8 deletions
diff --git a/sql/rpl_utility.h b/sql/rpl_utility.h
index 1f4ca246ff1..9f4a4c9454b 100644
--- a/sql/rpl_utility.h
+++ b/sql/rpl_utility.h
@@ -32,12 +32,6 @@ class Relay_log_info;
- Extract and decode table definition data from the table map event
- Check if table definition in table map is compatible with table
definition on slave
-
- Currently, the only field type data available is an array of the
- type operators that are present in the table map event.
-
- @todo Add type operands to this structure to allow detection of
- difference between, e.g., BIT(5) and BIT(10).
*/
class table_def
@@ -59,9 +53,9 @@ public:
@param null_bitmap The bitmap of fields that can be null
*/
table_def(field_type *types, ulong size, uchar *field_metadata,
- int metadata_size, uchar *null_bitmap)
+ int metadata_size, uchar *null_bitmap, uint16 flags)
: m_size(size), m_type(0), m_field_metadata_size(metadata_size),
- m_field_metadata(0), m_null_bits(0), m_memory(NULL)
+ m_field_metadata(0), m_null_bits(0), m_flags(flags), m_memory(NULL)
{
m_memory= (uchar *)my_multi_malloc(MYF(MY_WME),
&m_type, size,
@@ -246,6 +240,7 @@ private:
uint m_field_metadata_size;
uint16 *m_field_metadata;
uchar *m_null_bits;
+ uint16 m_flags; // Table flags
uchar *m_memory;
};