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 | dd383cadec0fbfba626bba72051f2dc548171015 (patch) | |
tree | 33edb6115f37aa26c592dd1aa99a17b195511f5e /sql/sql_delete.cc | |
parent | 27fca0ab1775a8c1dfe699c978b6448a7aa8f47b (diff) | |
download | mariadb-git-dd383cadec0fbfba626bba72051f2dc548171015.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.
mysql-test/include/binlog_inject_error.inc:
inject binlog write error when doing a query
mysql-test/suite/binlog/t/binlog_write_error.test:
Simple test case to check if proper error is reported when injecting binlog write errors.
sql/events.cc:
check return value of mysql_bin_log.write
sql/log.cc:
check return value of mysql_bin_log.write
sql/log_event.cc:
check return value of mysql_bin_log.write
sql/log_event_old.cc:
check return value of mysql_bin_log.write
sql/mysql_priv.h:
Change write_bin_log to return int instead of void
sql/rpl_injector.cc:
check return value of writing binlog
sql/sp.cc:
check return value of writing binlog
sql/sp_head.cc:
return 1 if writing binlog failed
sql/sql_acl.cc:
check return value of writing binlog
sql/sql_base.cc:
check return value of writing binlog
sql/sql_class.h:
Change binlog_show_create_table to return int
sql/sql_db.cc:
Change write_to_binlog to return int
check return value of writing binlog
sql/sql_delete.cc:
check return value of writing binlog
sql/sql_insert.cc:
check return value of writing binlog
sql/sql_load.cc:
check return value of writing binlog
sql/sql_parse.cc:
check return value of writing binlog
sql/sql_partition.cc:
check return value of writing binlog
sql/sql_rename.cc:
check return value of writing binlog
sql/sql_repl.cc:
check return value of writing binlog
sql/sql_table.cc:
Change write_bin_log to return int, and return 1 if there was error writing binlog
sql/sql_tablespace.cc:
check return value of writing binlog
sql/sql_trigger.cc:
check return value of writing binlog
sql/sql_udf.cc:
check return value of writing binlog
sql/sql_update.cc:
check return value of writing binlog
sql/sql_view.cc:
check return value of writing binlog
Diffstat (limited to 'sql/sql_delete.cc')
-rw-r--r-- | sql/sql_delete.cc | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index 6b59cbc14c1..23470b4abc9 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -849,9 +849,10 @@ void multi_delete::abort() if (mysql_bin_log.is_open()) { int errcode= query_error_code(thd, thd->killed == THD::NOT_KILLED); - thd->binlog_query(THD::ROW_QUERY_TYPE, - thd->query(), thd->query_length(), - transactional_tables, FALSE, errcode); + /* possible error of writing binary log is ignored deliberately */ + (void) thd->binlog_query(THD::ROW_QUERY_TYPE, + thd->query(), thd->query_length(), + transactional_tables, FALSE, errcode); } thd->transaction.all.modified_non_trans_table= true; } @@ -1181,8 +1182,9 @@ end: TRUNCATE must always be statement-based binlogged (not row-based) so we don't test current_stmt_binlog_row_based. */ - write_bin_log(thd, TRUE, thd->query(), thd->query_length()); - my_ok(thd); // This should return record count + error= write_bin_log(thd, TRUE, thd->query(), thd->query_length()); + if (!error) + my_ok(thd); // This should return record count } VOID(pthread_mutex_lock(&LOCK_open)); unlock_table_name(thd, table_list); |