diff options
author | unknown <guilhem@mysql.com> | 2004-11-10 15:07:55 +0100 |
---|---|---|
committer | unknown <guilhem@mysql.com> | 2004-11-10 15:07:55 +0100 |
commit | 12fbc41f5f76b84cf6b7f174f0b9d27e187d104b (patch) | |
tree | aaa1df2c201233d205d73ccc1ba2e041ddea1b74 /sql/log.cc | |
parent | 442b2d89b1992dd727eae1c59c16499d052ceb54 (diff) | |
download | mariadb-git-12fbc41f5f76b84cf6b7f174f0b9d27e187d104b.tar.gz |
Fix for BUG#6522 "Replication fails due to a rolled back transaction in the binlog"
When we are writing a transaction to the binlog, we log BEGIN/COMMIT with zero error code.
Example: all statements of trans succeeded, connection lost and so implicit rollback:
we don't want ER_NET* errors to be logged in the BEGIN/ROLLBACK events, while statement
events have 0. If there was really a serious error code, it's already in the statement events.
sql/log.cc:
When we write the cached binlog segment to disk binlog at COMMIT/ROLLBACK time:
imagine this is rollback due to net timeout, after all statements of
the transaction succeeded. Then we want a zero-error code in BEGIN.
In other words, if there was a really serious error code it's already
in the transaction's statement events.
sql/sql_table.cc:
out of date comment
Diffstat (limited to 'sql/log.cc')
-rw-r--r-- | sql/log.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sql/log.cc b/sql/log.cc index aa5d9d8753b..b2d015c1a14 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -1371,6 +1371,14 @@ bool MYSQL_LOG::write(THD *thd, IO_CACHE *cache, bool commit_or_rollback) { Query_log_event qinfo(thd, "BEGIN", 5, TRUE); /* + Imagine this is rollback due to net timeout, after all statements of + the transaction succeeded. Then we want a zero-error code in BEGIN. + In other words, if there was a really serious error code it's already + in the statement's events. + This is safer than thd->clear_error() against kills at shutdown. + */ + qinfo.error_code= 0; + /* Now this Query_log_event has artificial log_pos 0. It must be adjusted to reflect the real position in the log. Not doing it would confuse the slave: it would prevent this one from knowing where he is in the @@ -1403,6 +1411,7 @@ bool MYSQL_LOG::write(THD *thd, IO_CACHE *cache, bool commit_or_rollback) commit_or_rollback ? "COMMIT" : "ROLLBACK", commit_or_rollback ? 6 : 8, TRUE); + qinfo.error_code= 0; qinfo.set_log_pos(this); if (qinfo.write(&log_file) || flush_io_cache(&log_file)) goto err; |