summaryrefslogtreecommitdiff
path: root/sql/log.cc
diff options
context:
space:
mode:
authorunknown <guilhem@mysql.com>2003-03-06 16:22:31 +0100
committerunknown <guilhem@mysql.com>2003-03-06 16:22:31 +0100
commit92e6a9fcf23a192c925d9e78a2551f16c20d85d2 (patch)
tree0ed83b9d6c24effccaa2d7be0b83a13c8b64f5a3 /sql/log.cc
parentb2ded34fbce979c10d340f64841f60adebab3648 (diff)
downloadmariadb-git-92e6a9fcf23a192c925d9e78a2551f16c20d85d2.tar.gz
Make log_pos be non-zero in the binary log, for BEGIN and COMMIT Query_log_events.
Now log_pos is the real position of the event. For events that are between BEGIN and COMMIT, log_pos is still the BEGIN's log_pos. This fixes bug #52 (If only transactions are run on the master then t
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 073b7f691e8..27864e19c03 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -1211,6 +1211,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;
}
@@ -1233,6 +1241,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;
}