diff options
Diffstat (limited to 'storage/innobase/trx/trx0trx.cc')
-rw-r--r-- | storage/innobase/trx/trx0trx.cc | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc index b7d41b23825..56bdac29694 100644 --- a/storage/innobase/trx/trx0trx.cc +++ b/storage/innobase/trx/trx0trx.cc @@ -1152,29 +1152,20 @@ static void trx_flush_log_if_needed_low(lsn_t lsn, const trx_t *trx) if (!srv_flush_log_at_trx_commit) return; - if (log_sys.get_flushed_lsn() > lsn) + if (log_sys.get_flushed_lsn(std::memory_order_relaxed) >= lsn) return; - const bool flush= srv_file_flush_method != SRV_NOSYNC && - (srv_flush_log_at_trx_commit & 1); + completion_callback cb, *callback= nullptr; - if (trx->state == TRX_STATE_PREPARED) + if (trx->state != TRX_STATE_PREPARED && !log_sys.is_pmem() && + (cb.m_param= thd_increment_pending_ops(trx->mysql_thd))) { - /* XA, which is used with binlog as well. - Be conservative, use synchronous wait.*/ -sync: - log_write_up_to(lsn, flush); - return; + cb.m_callback= (void (*)(void *)) thd_decrement_pending_ops; + callback= &cb; } - completion_callback cb; - if ((cb.m_param = thd_increment_pending_ops(trx->mysql_thd))) - { - cb.m_callback = (void (*)(void *)) thd_decrement_pending_ops; - log_write_up_to(lsn, flush, false, &cb); - } - else - goto sync; + log_write_up_to(lsn, srv_file_flush_method != SRV_NOSYNC && + (srv_flush_log_at_trx_commit & 1), callback); } /**********************************************************************//** |