summaryrefslogtreecommitdiff
path: root/sql/rpl_utility.cc
diff options
context:
space:
mode:
authorVenkatesh Duggirala <venkatesh.duggirala@oracle.com>2012-11-29 17:33:06 +0530
committerVenkatesh Duggirala <venkatesh.duggirala@oracle.com>2012-11-29 17:33:06 +0530
commitfe4fe4e1cc8c65ace419764fc07594456b900510 (patch)
treee25ed4f83cf228c542f12b51eadda12c0f89332a /sql/rpl_utility.cc
parent37bbffa7751a89fdd1598bf2b6f50c70406dce3f (diff)
downloadmariadb-git-fe4fe4e1cc8c65ace419764fc07594456b900510.tar.gz
BUG#15888454: SLAVE CRASHES WHEN DML REQUIRES CONVERSION & TABLE HAS
LESS COLUMNS THAN MASTER Problem: ======== If DML operation requires a converstion at slave and if slave contains less number of columns than master, slave is crashing. Fix: ==== When Slave applies any DML operation, it sees if any of the columns requires conversion. If yes, it creates conversion table. While creating the coversion table, it should look into the actual number of columns required to create the table instead of getting the number of columns from Master (size()). Columns would have dropped or added at Slave. So the value should be min(columns@master, columns@slave) sql/rpl_utility.cc: loop through only correct number of columns
Diffstat (limited to 'sql/rpl_utility.cc')
-rw-r--r--sql/rpl_utility.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/sql/rpl_utility.cc b/sql/rpl_utility.cc
index 627bad741e8..8efb376b5b6 100644
--- a/sql/rpl_utility.cc
+++ b/sql/rpl_utility.cc
@@ -878,8 +878,13 @@ 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;
-
- for (uint col= 0 ; col < size() ; ++col)
+ /*
+ At slave, columns may differ. So we should create
+ min(columns@master, columns@slave) columns in the
+ conversion table.
+ */
+ uint const cols_to_create= min(target_table->s->fields, size());
+ for (uint col= 0 ; col < cols_to_create; ++col)
{
Create_field *field_def=
(Create_field*) alloc_root(thd->mem_root, sizeof(Create_field));