1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +03:00

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.
This commit is contained in:
unknown
2004-06-24 11:38:57 +02:00
parent ff392bbeef
commit 3198ea57f5
5 changed files with 33 additions and 13 deletions

View File

@@ -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;
}