Commit e55d4a88 authored by Venkatesh Duggirala's avatar Venkatesh Duggirala

Bug#16416302 - CRASH WITH LOSSY RBR REPLICATION

OF OLD STYLE DECIMALS

Problem: In RBR, Slave is unable to read row buffer
properly when the row event contains MYSQL_TYPE_DECIMAL
(old style decimals) data type column.

Analysis: In RBR, Slave assumes that Master sends
meta data information for all column types like
text,blob,varchar,old decimal,new decimal,float,
and few  other types along with row buffer event.
But Master is not sending this meta data information
for old style decimal columns. Hence Slave is crashing
due to unknown precision value for these column types.
Master cannot send this precision value to Slave which
will break replication cross-version compatibility.

Fix: To fix the crash, Slave will now throw error if it
receives old-style decimal datatype. User should
consider changing the old-style decimal to new style
decimal data type by executing "ALTER table modify column"
query as mentioned in http://dev.mysql.com/
doc/refman/5.0/en/upgrading-from-previous-series.html.
parent a5aa74c3
/* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -878,6 +878,7 @@ TABLE *table_def::create_conversion_table(THD *thd, Relay_log_info *rli, TABLE *
DBUG_ENTER("table_def::create_conversion_table");
List<Create_field> field_list;
TABLE *conv_table= NULL;
/*
At slave, columns may differ. So we should create
min(columns@master, columns@slave) columns in the
......@@ -919,10 +920,15 @@ TABLE *table_def::create_conversion_table(THD *thd, Relay_log_info *rli, TABLE *
break;
case MYSQL_TYPE_DECIMAL:
precision= field_metadata(col);
decimals= static_cast<Field_num*>(target_table->field[col])->dec;
max_length= field_metadata(col);
break;
sql_print_error("In RBR mode, Slave received incompatible DECIMAL field "
"(old-style decimal field) from Master while creating "
"conversion table. Please consider changing datatype on "
"Master to new style decimal by executing ALTER command for"
" column Name: %s.%s.%s.",
target_table->s->db.str,
target_table->s->table_name.str,
target_table->field[col]->field_name);
goto err;
case MYSQL_TYPE_TINY_BLOB:
case MYSQL_TYPE_MEDIUM_BLOB:
......@@ -950,7 +956,9 @@ TABLE *table_def::create_conversion_table(THD *thd, Relay_log_info *rli, TABLE *
field_def->interval= interval;
}
TABLE *conv_table= create_virtual_tmp_table(thd, field_list);
conv_table= create_virtual_tmp_table(thd, field_list);
err:
if (conv_table == NULL)
rli->report(ERROR_LEVEL, ER_SLAVE_CANT_CREATE_CONVERSION,
ER(ER_SLAVE_CANT_CREATE_CONVERSION),
......
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