Commit fe4fe4e1 authored by Venkatesh Duggirala's avatar Venkatesh Duggirala

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
parent 37bbffa7
......@@ -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));
......
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