1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +03:00

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.
This commit is contained in:
Mats Kindahl
2009-12-15 16:11:44 +01:00
parent c701fe6a06
commit f43ca0254e
10 changed files with 104 additions and 35 deletions

View File

@@ -33,12 +33,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
@@ -54,7 +48,7 @@ public:
@param null_bitmap The bitmap of fields that can be null
*/
table_def(unsigned char *types, ulong size, uchar *field_metadata,
int metadata_size, uchar *null_bitmap);
int metadata_size, uchar *null_bitmap, uint16 flags);
~table_def();
@@ -215,6 +209,7 @@ private:
uint m_field_metadata_size;
uint16 *m_field_metadata;
uchar *m_null_bits;
uint16 m_flags; // Table flags
uchar *m_memory;
};