summaryrefslogtreecommitdiff
path: root/sql/handler.cc
diff options
context:
space:
mode:
authorunknown <monty@hundin.mysql.fi>2002-01-30 16:37:47 +0200
committerunknown <monty@hundin.mysql.fi>2002-01-30 16:37:47 +0200
commit85278245af45fc301dc7940bec9a3434003285a6 (patch)
tree3ca7f6fddbb9bdc0b635f243af69c6606924c3c2 /sql/handler.cc
parent9369764f2226e0e8cb9724bcdac256f45330ba67 (diff)
parent8a56717c4ce14aa7e36e04a8dc880dcc1311ea28 (diff)
downloadmariadb-git-85278245af45fc301dc7940bec9a3434003285a6.tar.gz
Merge from 3.23.48 tree
BitKeeper/etc/logging_ok: auto-union Docs/manual.texi: Auto merged innobase/dict/dict0dict.c: Auto merged innobase/include/srv0srv.h: Auto merged innobase/mem/mem0dbg.c: Auto merged innobase/os/os0file.c: Auto merged innobase/que/que0que.c: Auto merged innobase/rem/rem0rec.c: Auto merged innobase/row/row0sel.c: Auto merged innobase/srv/srv0srv.c: Auto merged innobase/srv/srv0start.c: Auto merged innobase/sync/sync0arr.c: Auto merged innobase/trx/trx0trx.c: Auto merged innobase/trx/trx0undo.c: Auto merged myisam/mi_check.c: Auto merged mysql-test/t/join.test: Auto merged mysys/hash.c: Auto merged scripts/mysql_config.sh: Auto merged sql/ha_innodb.h: Auto merged sql/handler.cc: Auto merged sql/handler.h: Auto merged sql/sql_acl.cc: Auto merged
Diffstat (limited to 'sql/handler.cc')
-rw-r--r--sql/handler.cc40
1 files changed, 39 insertions, 1 deletions
diff --git a/sql/handler.cc b/sql/handler.cc
index 58f8192cf22..1e879c55b5e 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -221,6 +221,44 @@ int ha_autocommit_or_rollback(THD *thd, int error)
DBUG_RETURN(error);
}
+/* This function is called when MySQL writes the log segment of a transaction
+to the binlog. It is called when the LOCK_log mutex is reserved. Here we
+communicate to transactional table handlers whta binlog position corresponds
+to the current transaction. The handler can store it and in recovery print
+to the user, so that the user knows from what position in the binlog to
+start possible roll-forward, for example, if the crashed server was a slave
+in replication. This function also calls the commit of the table handler,
+because the order of trasnactions in the log of the table handler must be
+the same as in the binlog. */
+
+int ha_report_binlog_offset_and_commit(
+ THD *thd, /* in: user thread */
+ char *log_file_name, /* in: latest binlog file name */
+ my_off_t end_offset) /* in: the offset in the binlog file
+ up to which we wrote */
+{
+ THD_TRANS *trans;
+ int error = 0;
+
+ trans = &thd->transaction.all;
+
+#ifdef HAVE_INNOBASE_DB
+ if (trans->innobase_tid)
+ {
+ if ((error=innobase_report_binlog_offset_and_commit(thd,
+ trans->innobase_tid,
+ log_file_name,
+ end_offset)))
+ {
+ my_error(ER_ERROR_DURING_COMMIT, MYF(0), error);
+ error=1;
+ }
+ trans->innodb_active_trans=0;
+ }
+#endif
+
+ return error;
+}
int ha_commit_trans(THD *thd, THD_TRANS* trans)
{
@@ -233,7 +271,7 @@ int ha_commit_trans(THD *thd, THD_TRANS* trans)
if (trans == &thd->transaction.all && mysql_bin_log.is_open() &&
my_b_tell(&thd->transaction.trans_log))
{
- mysql_bin_log.write(&thd->transaction.trans_log);
+ mysql_bin_log.write(thd, &thd->transaction.trans_log);
reinit_io_cache(&thd->transaction.trans_log,
WRITE_CACHE, (my_off_t) 0, 0, 1);
thd->transaction.trans_log.end_of_file= max_binlog_cache_size;