diff options
author | He Zhenxing <zhenxing.he@sun.com> | 2009-11-21 12:28:01 +0800 |
---|---|---|
committer | He Zhenxing <zhenxing.he@sun.com> | 2009-11-21 12:28:01 +0800 |
commit | 9b65f5782e110bed71cc3ed782029d73b1faa297 (patch) | |
tree | 33edb6115f37aa26c592dd1aa99a17b195511f5e /sql/log_event_old.cc | |
parent | 408dd52a6ad1698619fb933b62966fa8b843f859 (diff) | |
download | mariadb-git-9b65f5782e110bed71cc3ed782029d73b1faa297.tar.gz |
BUG#37148 Most callers of mysql_bin_log.write ignore the return result
This is the non-ndb part of the patch.
The return value of mysql_bin_log.write was ignored by most callers,
which may lead to inconsistent on master and slave if the transaction
was committed while the binlog was not correctly written. If
my_error() is call in mysql_bin_log.write, this could also lead to
assertion issue if my_ok() or my_error() is called after.
This fixed the problem by let the caller to check and handle the
return value of mysql_bin_log.write. This patch only adresses the
simple cases.
Diffstat (limited to 'sql/log_event_old.cc')
-rw-r--r-- | sql/log_event_old.cc | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/sql/log_event_old.cc b/sql/log_event_old.cc index fbcbb388236..72affd2bee9 100644 --- a/sql/log_event_old.cc +++ b/sql/log_event_old.cc @@ -1513,7 +1513,15 @@ int Old_rows_log_event::do_apply_event(Relay_log_info const *rli) NOTE: For this new scheme there should be no pending event: need to add code to assert that is the case. */ - thd->binlog_flush_pending_rows_event(false); + error= thd->binlog_flush_pending_rows_event(false); + if (error) + { + rli->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR, + ER(ER_SLAVE_FATAL_ERROR), + "call to binlog_flush_pending_rows_event() failed"); + thd->is_slave_error= 1; + DBUG_RETURN(error); + } TABLE_LIST *tables= rli->tables_to_lock; close_tables_for_reopen(thd, &tables); @@ -1803,7 +1811,7 @@ int Old_rows_log_event::do_apply_event(Relay_log_info const *rli) (assume the last master's transaction is ignored by the slave because of replicate-ignore rules). */ - thd->binlog_flush_pending_rows_event(true); + int binlog_error= thd->binlog_flush_pending_rows_event(true); /* If this event is not in a transaction, the call below will, if some @@ -1814,12 +1822,13 @@ int Old_rows_log_event::do_apply_event(Relay_log_info const *rli) are involved, commit the transaction and flush the pending event to the binlog. */ - if ((error= ha_autocommit_or_rollback(thd, 0))) + if ((error= ha_autocommit_or_rollback(thd, binlog_error))) rli->report(ERROR_LEVEL, error, "Error in %s event: commit of row events failed, " "table `%s`.`%s`", get_type_str(), m_table->s->db.str, m_table->s->table_name.str); + error|= binlog_error; /* Now what if this is not a transactional engine? we still need to |