From e55d4a88a80bc4a64625d95bce8bffc974cac795 Mon Sep 17 00:00:00 2001 From: Venkatesh Duggirala Date: Wed, 7 Aug 2013 07:56:07 +0530 Subject: 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. --- sql/rpl_utility.cc | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'sql/rpl_utility.cc') diff --git a/sql/rpl_utility.cc b/sql/rpl_utility.cc index 2643f2d6059..1527676ee58 100644 --- a/sql/rpl_utility.cc +++ b/sql/rpl_utility.cc @@ -1,4 +1,4 @@ -/* 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 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(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), -- cgit v1.2.1