summaryrefslogtreecommitdiff
path: root/sql/log.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/log.cc')
-rw-r--r--sql/log.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/sql/log.cc b/sql/log.cc
index 170e976e643..02e34b773ef 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -1321,6 +1321,14 @@ bool MYSQL_LOG::write(THD *thd, IO_CACHE *cache)
*/
{
Query_log_event qinfo(thd, "BEGIN", 5, TRUE);
+ /*
+ 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 master's
+ binlog, which would result in wrong positions being shown to the user,
+ MASTER_POS_WAIT undue waiting etc.
+ */
+ qinfo.set_log_pos(this);
if (qinfo.write(&log_file))
goto err;
}
@@ -1343,6 +1351,7 @@ bool MYSQL_LOG::write(THD *thd, IO_CACHE *cache)
{
Query_log_event qinfo(thd, "COMMIT", 6, TRUE);
+ qinfo.set_log_pos(this);
if (qinfo.write(&log_file) || flush_io_cache(&log_file))
goto err;
}