mirror of
https://github.com/MariaDB/server.git
synced 2025-03-26 08:58:40 +01:00
MDEV-34705: Binlog in Engine
Skip prepare step in InnoDB when it handles the binlog, but re-enable InnoDB fsync at commit. Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
This commit is contained in:
parent
e9b71fb297
commit
0dbccdd299
4 changed files with 15 additions and 1 deletions
|
@ -1964,6 +1964,10 @@ int ha_commit_trans(THD *thd, bool all)
|
|||
*/
|
||||
if (! hi->is_trx_read_write())
|
||||
continue;
|
||||
/* We do not need to 2pc the binlog with the engine that implements it. */
|
||||
/* ToDo: This needs refinement, at least to handle the case when we are not binlogging. And maybe the logic could happen more elegantly in a different place, higher in the call stack? */
|
||||
if (ht == opt_binlog_engine_hton)
|
||||
continue;
|
||||
/*
|
||||
Sic: we know that prepare() is not NULL since otherwise
|
||||
trans->no_2pc would have been set.
|
||||
|
|
|
@ -2810,6 +2810,7 @@ trx_deregister_from_2pc(
|
|||
{
|
||||
trx->is_registered= false;
|
||||
trx->active_commit_ordered= false;
|
||||
trx->active_prepare= false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -17337,7 +17338,10 @@ innobase_xa_prepare(
|
|||
case TRX_STATE_ACTIVE:
|
||||
thd_get_xid(thd, &reinterpret_cast<MYSQL_XID&>(trx->xid));
|
||||
if (prepare_trx)
|
||||
{
|
||||
trx_prepare_for_mysql(trx);
|
||||
trx->active_prepare= true;
|
||||
}
|
||||
else
|
||||
{
|
||||
lock_unlock_table_autoinc(trx);
|
||||
|
|
|
@ -823,7 +823,10 @@ public:
|
|||
is set to false after commit or
|
||||
rollback. */
|
||||
/** whether this is holding the prepare mutex */
|
||||
/* ToDo: This need a better mechanism. It is currently done to know that we did not do a prepare step before commit_ordered, due to binlog being stored in InnoDB; and therefore we need to do an fsync of the log in commit to make the commit durable. */
|
||||
bool active_commit_ordered;
|
||||
/** whether innobase_xa_prepare() was done. */
|
||||
bool active_prepare;
|
||||
/*------------------------------*/
|
||||
bool flush_log_later;/* In 2PC, we hold the
|
||||
prepare_commit mutex across
|
||||
|
|
|
@ -106,6 +106,8 @@ trx_init(
|
|||
|
||||
trx->active_commit_ordered = false;
|
||||
|
||||
trx->active_prepare = false;
|
||||
|
||||
trx->isolation_level = TRX_ISO_REPEATABLE_READ;
|
||||
|
||||
trx->check_foreigns = true;
|
||||
|
@ -407,6 +409,7 @@ void trx_t::free()
|
|||
bulk_insert */);
|
||||
MEM_NOACCESS(&is_registered, sizeof is_registered);
|
||||
MEM_NOACCESS(&active_commit_ordered, sizeof active_commit_ordered);
|
||||
MEM_NOACCESS(&active_prepare, sizeof active_prepare);
|
||||
MEM_NOACCESS(&flush_log_later, sizeof flush_log_later);
|
||||
MEM_NOACCESS(&duplicates, sizeof duplicates);
|
||||
MEM_NOACCESS(&dict_operation, sizeof dict_operation);
|
||||
|
@ -1743,7 +1746,7 @@ void trx_commit_complete_for_mysql(trx_t *trx)
|
|||
case 0:
|
||||
return;
|
||||
case 1:
|
||||
if (trx->active_commit_ordered)
|
||||
if (trx->active_commit_ordered && trx->active_prepare)
|
||||
return;
|
||||
}
|
||||
trx_flush_log_if_needed(lsn, trx);
|
||||
|
|
Loading…
Add table
Reference in a new issue