summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Mathew <jacob.mathew@mariadb.com>2018-05-03 09:49:03 -0700
committerJacob Mathew <jacob.mathew@mariadb.com>2018-05-03 09:49:03 -0700
commitca174051d85e93369c0567781c7c8a890cc2a75d (patch)
tree57eab201b6dc495d2e69b700b73f96c52772e2c8
parent57c3dd991b2e9dfd1159e889f9ea7ab7ceebd40c (diff)
downloadmariadb-git-ca174051d85e93369c0567781c7c8a890cc2a75d.tar.gz
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.
-rw-r--r--storage/spider/spd_sys_table.cc37
1 files changed, 12 insertions, 25 deletions
diff --git a/storage/spider/spd_sys_table.cc b/storage/spider/spd_sys_table.cc
index 9f1a9850083..9df470e978f 100644
--- a/storage/spider/spd_sys_table.cc
+++ b/storage/spider/spd_sys_table.cc
@@ -69,11 +69,13 @@ inline int spider_write_sys_table_row(TABLE *table, bool do_handle_error = TRUE)
Update a Spider system table row.
@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.
*/
-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;
THD *thd = table->in_use;
@@ -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]);
reenable_binlog(thd);
- if (error_num)
+ if (error_num && do_handle_error)
{
if (error_num == HA_ERR_RECORD_IS_THE_SAME)
error_num = 0;
@@ -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
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,
@@ -1333,11 +1335,8 @@ int spider_insert_sys_table(
) {
int error_num;
DBUG_ENTER("spider_insert_sys_table");
- if ((error_num = table->file->ha_write_row(table->record[0])))
- {
- table->file->print_error(error_num, MYF(0));
+ if (error_num = spider_write_sys_table_row(table))
DBUG_RETURN(error_num);
- }
DBUG_RETURN(0);
}
@@ -1378,14 +1377,10 @@ int spider_insert_or_update_table_sts(
table->file->print_error(error_num, MYF(0));
DBUG_RETURN(error_num);
}
- if ((error_num = table->file->ha_write_row(table->record[0])))
- {
- table->file->print_error(error_num, MYF(0));
+ if (error_num = spider_write_sys_table_row(table))
DBUG_RETURN(error_num);
- }
} else {
- if ((error_num = table->file->ha_update_row(table->record[1],
- table->record[0])))
+ if (error_num = spider_update_sys_table_row(table, FALSE))
{
table->file->print_error(error_num, MYF(0));
DBUG_RETURN(error_num);
@@ -1419,14 +1414,10 @@ int spider_insert_or_update_table_crd(
table->file->print_error(error_num, MYF(0));
DBUG_RETURN(error_num);
}
- if ((error_num = table->file->ha_write_row(table->record[0])))
- {
- table->file->print_error(error_num, MYF(0));
+ if (error_num = spider_write_sys_table_row(table))
DBUG_RETURN(error_num);
- }
} else {
- if ((error_num = table->file->ha_update_row(table->record[1],
- table->record[0])))
+ if (error_num = spider_update_sys_table_row(table, FALSE))
{
table->file->print_error(error_num, MYF(0));
DBUG_RETURN(error_num);
@@ -1791,11 +1782,8 @@ int spider_delete_table_sts(
/* no record is ok */
DBUG_RETURN(0);
} else {
- if ((error_num = table->file->ha_delete_row(table->record[0])))
- {
- table->file->print_error(error_num, MYF(0));
+ if (error_num = spider_delete_sys_table_row(table))
DBUG_RETURN(error_num);
- }
}
DBUG_RETURN(0);
@@ -1824,10 +1812,9 @@ int spider_delete_table_crd(
DBUG_RETURN(0);
} else {
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);
- table->file->print_error(error_num, MYF(0));
DBUG_RETURN(error_num);
}
error_num = spider_sys_index_next_same(table, table_key);