summaryrefslogtreecommitdiff
path: root/sql/log.cc
diff options
context:
space:
mode:
authormonty@mysql.com <>2004-11-12 19:58:24 +0200
committermonty@mysql.com <>2004-11-12 19:58:24 +0200
commitaddd1a0da882615330368c8815b0c13d17bf0232 (patch)
treee0dd750287073966f1595d8099b4cc23faa803f7 /sql/log.cc
parent16c1b9f44e36de0867afb15ba6e6baa4fb9a857d (diff)
parent08c5b245b88eda61c95febea3d02394b76605d79 (diff)
downloadmariadb-git-addd1a0da882615330368c8815b0c13d17bf0232.tar.gz
Merge with 4.1
Diffstat (limited to 'sql/log.cc')
-rw-r--r--sql/log.cc12
1 files changed, 11 insertions, 1 deletions
diff --git a/sql/log.cc b/sql/log.cc
index 86b76ed883e..24dafc39b66 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -1464,7 +1464,8 @@ COLLATION_CONNECTION=%u,COLLATION_DATABASE=%u,COLLATION_SERVER=%u",
if (flush_io_cache(file) || sync_binlog(file))
goto err;
- if (opt_using_transactions && !my_b_tell(&thd->transaction.trans_log))
+ if (opt_using_transactions &&
+ !(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)))
{
/*
LOAD DATA INFILE in AUTOCOMMIT=1 mode writes to the binlog
@@ -1612,6 +1613,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
@@ -1643,6 +1652,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;
if (qinfo.write(&log_file) || flush_io_cache(&log_file) ||
sync_binlog(&log_file))
goto err;