1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-15833 Row format replication between LONGBLOB and MEDIUMBLOB does not work for long values

The code in Type_handler_blob****::make_conversion_table_field()
erroneously assumed that row format replication uses
MYSQL_TYPE_TINYBLOB, MYSQL_TYPE_BLOB, MYSQL_TYPE_MEDIUMBLOB,
MYSQL_TYPE_LONGBLOB type codes to tranfer BLOB variations.

In fact, all BLOB variations use MYSQL_TYPE_BLOB as the type
code, while the BLOB packlength (1,2,3 or 4) it tranferred
in metadata.

The bug was introduced by  aee068085d
(MDEV-9238 Wrap create_virtual_tmp_table() into a class, split into different steps)
This commit is contained in:
Alexander Barkov
2018-04-10 13:15:57 +04:00
parent 141592cedb
commit 4d9c5844b8
6 changed files with 305 additions and 59 deletions

View File

@ -548,47 +548,17 @@ Field *Type_handler_varchar::make_conversion_table_field(TABLE *table,
}
Field *Type_handler_tiny_blob::make_conversion_table_field(TABLE *table,
uint metadata,
const Field *target)
const
Field *Type_handler_blob_common::make_conversion_table_field(TABLE *table,
uint metadata,
const Field *target)
const
{
uint pack_length= metadata & 0x00ff;
if (pack_length < 1 || pack_length > 4)
return NULL; // Broken binary log?
return new(table->in_use->mem_root)
Field_blob(NULL, (uchar *) "", 1, Field::NONE, TMPNAME,
table->s, 1, target->charset());
}
Field *Type_handler_blob::make_conversion_table_field(TABLE *table,
uint metadata,
const Field *target)
const
{
return new(table->in_use->mem_root)
Field_blob(NULL, (uchar *) "", 1, Field::NONE, TMPNAME,
table->s, 2, target->charset());
}
Field *Type_handler_medium_blob::make_conversion_table_field(TABLE *table,
uint metadata,
const Field *target)
const
{
return new(table->in_use->mem_root)
Field_blob(NULL, (uchar *) "", 1, Field::NONE, TMPNAME,
table->s, 3, target->charset());
}
Field *Type_handler_long_blob::make_conversion_table_field(TABLE *table,
uint metadata,
const Field *target)
const
{
return new(table->in_use->mem_root)
Field_blob(NULL, (uchar *) "", 1, Field::NONE, TMPNAME,
table->s, 4, target->charset());
table->s, pack_length, target->charset());
}