Commit ca174051 authored by Jacob Mathew's avatar Jacob Mathew

MDEV-14019: Spider + binlog_format = ROW => CRASH

The fix for this bug was automatically merged from 10.2.  However, that fix
was incomplete in 10.3.  This commit is for the additional changes that are
necessary in 10.3.

Author:
  Jacob Mathew.

Reviewer:
  Kentoku Shiba.
parent 57c3dd99
...@@ -69,11 +69,13 @@ inline int spider_write_sys_table_row(TABLE *table, bool do_handle_error = TRUE) ...@@ -69,11 +69,13 @@ inline int spider_write_sys_table_row(TABLE *table, bool do_handle_error = TRUE)
Update a Spider system table row. Update a Spider system table row.
@param table The spider system table. @param table The spider system table.
@param do_handle_error TRUE if an error message should be printed
before returning.
@return Error code returned by the update. @return Error code returned by the update.
*/ */
inline int spider_update_sys_table_row(TABLE *table) inline int spider_update_sys_table_row(TABLE *table, bool do_handle_error = TRUE)
{ {
int error_num; int error_num;
THD *thd = table->in_use; THD *thd = table->in_use;
...@@ -82,7 +84,7 @@ inline int spider_update_sys_table_row(TABLE *table) ...@@ -82,7 +84,7 @@ inline int spider_update_sys_table_row(TABLE *table)
error_num = table->file->ha_update_row(table->record[1], table->record[0]); error_num = table->file->ha_update_row(table->record[1], table->record[0]);
reenable_binlog(thd); reenable_binlog(thd);
if (error_num) if (error_num && do_handle_error)
{ {
if (error_num == HA_ERR_RECORD_IS_THE_SAME) if (error_num == HA_ERR_RECORD_IS_THE_SAME)
error_num = 0; error_num = 0;
...@@ -101,7 +103,7 @@ inline int spider_update_sys_table_row(TABLE *table) ...@@ -101,7 +103,7 @@ inline int spider_update_sys_table_row(TABLE *table)
@param do_handle_error TRUE if an error message should be printed @param do_handle_error TRUE if an error message should be printed
before returning. before returning.
@return Error code returned by the update. @return Error code returned by the delete.
*/ */
inline int spider_delete_sys_table_row(TABLE *table, int record_number = 0, inline int spider_delete_sys_table_row(TABLE *table, int record_number = 0,
...@@ -1333,11 +1335,8 @@ int spider_insert_sys_table( ...@@ -1333,11 +1335,8 @@ int spider_insert_sys_table(
) { ) {
int error_num; int error_num;
DBUG_ENTER("spider_insert_sys_table"); DBUG_ENTER("spider_insert_sys_table");
if ((error_num = table->file->ha_write_row(table->record[0]))) if (error_num = spider_write_sys_table_row(table))
{
table->file->print_error(error_num, MYF(0));
DBUG_RETURN(error_num); DBUG_RETURN(error_num);
}
DBUG_RETURN(0); DBUG_RETURN(0);
} }
...@@ -1378,14 +1377,10 @@ int spider_insert_or_update_table_sts( ...@@ -1378,14 +1377,10 @@ int spider_insert_or_update_table_sts(
table->file->print_error(error_num, MYF(0)); table->file->print_error(error_num, MYF(0));
DBUG_RETURN(error_num); DBUG_RETURN(error_num);
} }
if ((error_num = table->file->ha_write_row(table->record[0]))) if (error_num = spider_write_sys_table_row(table))
{
table->file->print_error(error_num, MYF(0));
DBUG_RETURN(error_num); DBUG_RETURN(error_num);
}
} else { } else {
if ((error_num = table->file->ha_update_row(table->record[1], if (error_num = spider_update_sys_table_row(table, FALSE))
table->record[0])))
{ {
table->file->print_error(error_num, MYF(0)); table->file->print_error(error_num, MYF(0));
DBUG_RETURN(error_num); DBUG_RETURN(error_num);
...@@ -1419,14 +1414,10 @@ int spider_insert_or_update_table_crd( ...@@ -1419,14 +1414,10 @@ int spider_insert_or_update_table_crd(
table->file->print_error(error_num, MYF(0)); table->file->print_error(error_num, MYF(0));
DBUG_RETURN(error_num); DBUG_RETURN(error_num);
} }
if ((error_num = table->file->ha_write_row(table->record[0]))) if (error_num = spider_write_sys_table_row(table))
{
table->file->print_error(error_num, MYF(0));
DBUG_RETURN(error_num); DBUG_RETURN(error_num);
}
} else { } else {
if ((error_num = table->file->ha_update_row(table->record[1], if (error_num = spider_update_sys_table_row(table, FALSE))
table->record[0])))
{ {
table->file->print_error(error_num, MYF(0)); table->file->print_error(error_num, MYF(0));
DBUG_RETURN(error_num); DBUG_RETURN(error_num);
...@@ -1791,12 +1782,9 @@ int spider_delete_table_sts( ...@@ -1791,12 +1782,9 @@ int spider_delete_table_sts(
/* no record is ok */ /* no record is ok */
DBUG_RETURN(0); DBUG_RETURN(0);
} else { } else {
if ((error_num = table->file->ha_delete_row(table->record[0]))) if (error_num = spider_delete_sys_table_row(table))
{
table->file->print_error(error_num, MYF(0));
DBUG_RETURN(error_num); DBUG_RETURN(error_num);
} }
}
DBUG_RETURN(0); DBUG_RETURN(0);
} }
...@@ -1824,10 +1812,9 @@ int spider_delete_table_crd( ...@@ -1824,10 +1812,9 @@ int spider_delete_table_crd(
DBUG_RETURN(0); DBUG_RETURN(0);
} else { } else {
do { do {
if ((error_num = table->file->ha_delete_row(table->record[0]))) if (error_num = spider_delete_sys_table_row(table))
{ {
spider_sys_index_end(table); spider_sys_index_end(table);
table->file->print_error(error_num, MYF(0));
DBUG_RETURN(error_num); DBUG_RETURN(error_num);
} }
error_num = spider_sys_index_next_same(table, table_key); error_num = spider_sys_index_next_same(table, table_key);
......
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