diff options
author | unknown <monty@hundin.mysql.fi> | 2002-01-30 16:37:47 +0200 |
---|---|---|
committer | unknown <monty@hundin.mysql.fi> | 2002-01-30 16:37:47 +0200 |
commit | 85278245af45fc301dc7940bec9a3434003285a6 (patch) | |
tree | 3ca7f6fddbb9bdc0b635f243af69c6606924c3c2 /sql/log.cc | |
parent | 9369764f2226e0e8cb9724bcdac256f45330ba67 (diff) | |
parent | 8a56717c4ce14aa7e36e04a8dc880dcc1311ea28 (diff) | |
download | mariadb-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/log.cc')
-rw-r--r-- | sql/log.cc | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/sql/log.cc b/sql/log.cc index 13ebbd9a3e7..892780d3882 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -873,9 +873,12 @@ bool MYSQL_LOG::write(Log_event* event_info) VOID(pthread_mutex_unlock(&LOCK_log)); return 0; } + error=1; - // no check for auto events flag here - this write method should - // never be called if auto-events are enabled + /* + No check for auto events flag here - this write method should + never be called if auto-events are enabled + */ if (thd && thd->last_insert_id_used) { Intvar_log_event e(thd,(uchar)LAST_INSERT_ID_EVENT,thd->last_insert_id); @@ -913,8 +916,24 @@ bool MYSQL_LOG::write(Log_event* event_info) file == &log_file && flush_io_cache(file)) goto err; error=0; - should_rotate = (file == &log_file && - (uint)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); + should_rotate= (my_b_tell(file) >= (my_off_t) max_binlog_size); + } + err: if (error) { @@ -948,7 +967,7 @@ uint MYSQL_LOG::next_file_id() '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; @@ -984,6 +1003,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; |