summaryrefslogtreecommitdiff
path: root/sql/log.cc
diff options
context:
space:
mode:
authorunknown <heikki@donna.mysql.fi>2002-01-22 22:57:56 +0200
committerunknown <heikki@donna.mysql.fi>2002-01-22 22:57:56 +0200
commit2aa572433b9ce47a511958ce263c8400c2e81ac3 (patch)
treeb54919432865c005c199b95f91277693e1c3c9ba /sql/log.cc
parent0c57c750a84abb0f822a6fe8ed4ef051ce6105af (diff)
downloadmariadb-git-2aa572433b9ce47a511958ce263c8400c2e81ac3.tar.gz
ha_innobase.cc, ha_innobase.h, handler.h, handler.cc, sql_class.h, log.cc:
Tell table handlers where a binlog segment for a trx ends sql/log.cc: Tell table handlers where a binlog segment for a trx ends sql/sql_class.h: Tell table handlers where a binlog segment for a trx ends sql/handler.cc: Tell table handlers where a binlog segment for a trx ends sql/handler.h: Tell table handlers where a binlog segment for a trx ends sql/ha_innobase.h: Tell table handlers where a binlog segment for a trx ends sql/ha_innobase.cc: Tell table handlers where a binlog segment for a trx ends
Diffstat (limited to 'sql/log.cc')
-rw-r--r--sql/log.cc21
1 files changed, 20 insertions, 1 deletions
diff --git a/sql/log.cc b/sql/log.cc
index 1b236d342f5..bc2b19d921f 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -658,6 +658,7 @@ bool MYSQL_LOG::write(Query_log_event* event_info)
VOID(pthread_mutex_unlock(&LOCK_log));
return 0;
}
+
error=1;
if (thd->last_insert_id_used)
@@ -694,6 +695,20 @@ bool MYSQL_LOG::write(Query_log_event* event_info)
goto err;
error=0;
should_rotate = (file == &log_file && my_b_tell(file) >= max_binlog_size);
+
+ /* Tell for transactional table handlers up to which position in the
+ binlog file we wrote. The table handler can store this info, and
+ after crash recovery print for the user the offset of the last
+ transactions which were recovered. Actually, we must also call
+ the table handler commit here, protected by the LOCK_log mutex,
+ because otherwise the transactions may end up in a different order
+ in the table handler log! */
+
+ if (file == &log_file) {
+ error = ha_report_binlog_offset_and_commit(thd, log_file_name,
+ file->pos_in_file);
+ }
+
err:
if (error)
{
@@ -718,7 +733,7 @@ err:
'cache' needs to be reinitialized after this functions returns.
*/
-bool MYSQL_LOG::write(IO_CACHE *cache)
+bool MYSQL_LOG::write(THD *thd, IO_CACHE *cache)
{
VOID(pthread_mutex_lock(&LOCK_log));
bool error=1;
@@ -754,6 +769,10 @@ bool MYSQL_LOG::write(IO_CACHE *cache)
sql_print_error(ER(ER_ERROR_ON_READ), cache->file_name, errno);
goto err;
}
+ error = ha_report_binlog_offset_and_commit(thd, log_file_name,
+ log_file.pos_in_file);
+ if (error)
+ goto err;
}
error=0;