Commit b91db971 authored by Marko Mäkelä's avatar Marko Mäkelä

squash! 5fea8ffc

trx_t::commit_in_memory(): Set commit_lsn=0 if the log was written.

trx_commit_complete_for_mysql(): Remove some conditions.
We will rely on trx->commit_lsn.

innobase_commit_ordered_2(): Simplify some conditions.
A read-write transaction will always carry nonzero trx_t::id.
Let us unconditionally reset mysql_log_file_name, flush_log_later
after trx_t::commit() was invoked.
parent f4c1784c
......@@ -4467,9 +4467,7 @@ innobase_commit_ordered_2(
{
DBUG_ENTER("innobase_commit_ordered_2");
const bool read_only = trx->read_only || trx->id == 0;
if (!read_only) {
if (trx->id) {
/* The following call reads the binary log position of
the transaction being committed.
......@@ -4500,6 +4498,7 @@ innobase_commit_ordered_2(
innobase_commit_low(trx);
trx->mysql_log_file_name = NULL;
trx->flush_log_later = false;
DBUG_VOID_RETURN;
}
......
......@@ -181,13 +181,9 @@ note that the trx may have been committed before the caller acquires
trx_t::mutex
@retval NULL if no match */
trx_t* trx_get_trx_by_xid(const XID* xid);
/**********************************************************************//**
If required, flushes the log to disk if we called trx_commit_for_mysql()
with trx->flush_log_later == TRUE. */
void
trx_commit_complete_for_mysql(
/*==========================*/
trx_t* trx); /*!< in/out: transaction */
/** Durably write log until trx->commit_lsn
(if trx_t::commit_in_memory() was invoked with flush_log_later=true). */
void trx_commit_complete_for_mysql(trx_t *trx);
/**********************************************************************//**
Marks the latest SQL statement ended. */
void
......
......@@ -1442,11 +1442,11 @@ TRANSACTIONAL_INLINE inline void trx_t::commit_in_memory(const mtr_t *mtr)
gathering. */
commit_lsn= undo_no || !xid.is_null() ? mtr->commit_lsn() : 0;
if (!commit_lsn)
flush_log_later= false;
else if (flush_log_later);
else if (!(flush_log_later= !srv_flush_log_at_trx_commit))
if (commit_lsn && !flush_log_later && srv_flush_log_at_trx_commit)
{
trx_flush_log_if_needed(commit_lsn, this);
commit_lsn= 0;
}
}
savepoints_discard();
......@@ -1693,18 +1693,13 @@ trx_commit_for_mysql(
return(DB_CORRUPTION);
}
/**********************************************************************//**
If required, flushes the log to disk if we called trx_commit_for_mysql()
with trx->flush_log_later == TRUE. */
void
trx_commit_complete_for_mysql(
/*==========================*/
trx_t* trx) /*!< in/out: transaction */
/** Durably write log until trx->commit_lsn
(if trx_t::commit_in_memory() was invoked with flush_log_later=true). */
void trx_commit_complete_for_mysql(trx_t *trx)
{
if (!trx->flush_log_later)
const lsn_t lsn= trx->commit_lsn;
if (!lsn)
return;
trx->flush_log_later= false;
switch (srv_flush_log_at_trx_commit) {
case 0:
return;
......@@ -1712,7 +1707,7 @@ trx_commit_complete_for_mysql(
if (trx->active_commit_ordered)
return;
}
trx_flush_log_if_needed(trx->commit_lsn, trx);
trx_flush_log_if_needed(lsn, trx);
}
/**********************************************************************//**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment