Commit a533cec7 authored by Luis Soares's avatar Luis Soares

Fix for rpl_bug31076 valgrind failure which popped up after

WL#5151 was pushed.

Problem 1: Some old binlog events do not contain metadata. This
makes checking whether the field can be converted or not rather
impossible because one cannot compare, for instance, field sizes
from original table and target table.

Solution 1: When an event does not contain metadata, we will just
check if field types are equal and assume that original field
definition matched with the one in the target table.

Problem 2: There is a second fix, which involves lack of
information regarding maybe_null. This was causing a conditional
jump warning when creating a conversion table. 

Solution 2: We will just assume that all fields that need to be
in the conversion table may be null.
parent 9e2c9cd2
......@@ -590,6 +590,13 @@ can_convert_field_to(Field *field,
*/
if (field->real_type() == source_type)
{
if (metadata == 0) // Metadata can only be zero if no metadata was provided
{
DBUG_PRINT("debug", ("Base types are identical, but there is no metadata"));
*order_var= 0;
DBUG_RETURN(true);
}
DBUG_PRINT("debug", ("Base types are identical, doing field size comparison"));
if (field->compatible_field_size(metadata, rli, mflags, order_var))
DBUG_RETURN(is_conversion_ok(*order_var, rli));
......@@ -920,7 +927,7 @@ TABLE *table_def::create_conversion_table(THD *thd, Relay_log_info *rli, TABLE *
field_def->init_for_tmp_table(type(col),
max_length,
decimals,
maybe_null(col), // maybe_null
TRUE, // maybe_null
FALSE, // unsigned_flag
pack_length);
field_def->charset= target_table->field[col]->charset();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment