From 3198ea57f5b2da8c63fc6d8e98872508adb8c134 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 24 Jun 2004 11:38:57 +0200 Subject: Final part of WL#1717 "innodb/binlog consistency". This is to resolve a limitation of yesterday's implementation: if there was an unfinished transaction (COMMIT not typed), and some MyISAM tables were then updated, and then mysqld crashes, then at restart the server would use the too old binlog offset known by InnoDB to cut the binlog, thus cutting the successful MyISAM updates. We fix this by reporting the binlog offset into InnoDB even if InnoDB was not affected at all by the update. But the feature is still disabled until we decide if it can go into 4.1.3. sql/handler.cc: How we report the binlog offset into InnoDB: - if the update affected InnoDB, it will happen naturally - otherwise (for example MyISAM update not in an InnoDB transaction), we explicitely report it. sql/handler.h: removing warning (noticed this) sql/log.cc: clearer messages when truncating binlog. sql/mysql_priv.h: need to see opt_innodb_safe_binlog in handler.cc sql/mysqld.cc: No innodb-safe-binlog if no InnoDB. Updating message as now we work with MyISAM. --- sql/handler.cc | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'sql/handler.cc') diff --git a/sql/handler.cc b/sql/handler.cc index 0e1b2d62a4f..f4cd2901be1 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -385,17 +385,25 @@ int ha_report_binlog_offset_and_commit(THD *thd, #ifdef HAVE_INNOBASE_DB THD_TRANS *trans; trans = &thd->transaction.all; - if (trans->innobase_tid) + if (trans->innobase_tid && trans->innodb_active_trans) { + /* + If we updated some InnoDB tables (innodb_active_trans is true), the + binlog coords will be reported into InnoDB during the InnoDB commit + (innobase_report_binlog_offset_and_commit). But if we updated only + non-InnoDB tables, we need an explicit call to report it. + */ if ((error=innobase_report_binlog_offset_and_commit(thd, - trans->innobase_tid, - log_file_name, - end_offset))) + trans->innobase_tid, + log_file_name, + end_offset))) { my_error(ER_ERROR_DURING_COMMIT, MYF(0), error); error=1; } } + else if (opt_innodb_safe_binlog) // Don't report if not useful + innobase_store_binlog_offset_and_flush_log(log_file_name, end_offset); #endif return error; } -- cgit v1.2.1