summaryrefslogtreecommitdiff
path: root/storage/innobase/trx/trx0undo.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2018-04-25 10:41:32 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2018-04-26 22:53:33 +0300
commit83bd4dd1ee9e7abe2ee33860b15edf7ec72c6b14 (patch)
tree49c303c047d3cd7fad69cf85520aa2ad9b82b3a4 /storage/innobase/trx/trx0undo.cc
parentf7cac5e26c39a9dca4c4f5213faf81455976218e (diff)
downloadmariadb-git-83bd4dd1ee9e7abe2ee33860b15edf7ec72c6b14.tar.gz
MDEV-15914: Remove trx_t::undo_mutex
The trx_t::undo_mutex covered both some main-memory data structures (trx_undo_t) and access to undo pages. The trx_undo_t is only accessed by the thread that is associated with a running transaction. Likewise, each transaction has its private set of undo pages. The thread that is associated with an active transaction may lock multiple undo pages concurrently, but no other thread may lock multiple pages of a foreign transaction. Concurrent access to the undo logs of an active transaction is possible, but trx_undo_get_undo_rec_low() only locks one undo page at a time, without ever holding any undo_mutex. It seems that the trx_t::undo_mutex would have been necessary if multi-threaded execution or rollback of a single transaction had been implemented in InnoDB.
Diffstat (limited to 'storage/innobase/trx/trx0undo.cc')
-rw-r--r--storage/innobase/trx/trx0undo.cc8
1 files changed, 2 insertions, 6 deletions
diff --git a/storage/innobase/trx/trx0undo.cc b/storage/innobase/trx/trx0undo.cc
index 1b97b09949a..adcc67ae167 100644
--- a/storage/innobase/trx/trx0undo.cc
+++ b/storage/innobase/trx/trx0undo.cc
@@ -81,12 +81,12 @@ The contention of the trx_sys.mutex should be minimized. When a transaction
does its first insert or modify in an index, an undo log is assigned for it.
Then we must have an x-latch to the rollback segment header.
When the transaction performs modifications or rolls back, its
-undo log is protected by undo page latches and trx_t::undo_mutex.
+undo log is protected by undo page latches.
Only the thread that is associated with the transaction may hold multiple
undo page latches at a time. Undo pages are always private to a single
transaction. Other threads that are performing MVCC reads
or checking for implicit locks will lock at most one undo page at a time
-in trx_undo_get_undo_rec_low(), without holding any undo_mutex.
+in trx_undo_get_undo_rec_low().
When the transaction commits, its persistent undo log is added
to the history list. If it is not suitable for reuse, its slot is reset.
In both cases, an x-latch must be acquired on the rollback segment header page.
@@ -769,8 +769,6 @@ trx_undo_parse_page_header(
buf_block_t*
trx_undo_add_page(trx_t* trx, trx_undo_t* undo, mtr_t* mtr)
{
- ut_ad(mutex_own(&trx->undo_mutex));
-
trx_rseg_t* rseg = undo->rseg;
buf_block_t* new_block = NULL;
ulint n_reserved;
@@ -1397,7 +1395,6 @@ A new undo log is created or a cached undo log reused.
buf_block_t*
trx_undo_assign(trx_t* trx, dberr_t* err, mtr_t* mtr)
{
- ut_ad(mutex_own(&trx->undo_mutex));
ut_ad(mtr->get_log_mode() == MTR_LOG_ALL);
trx_undo_t* undo = trx->rsegs.m_redo.undo;
@@ -1450,7 +1447,6 @@ trx_undo_assign_low(trx_t* trx, trx_rseg_t* rseg, trx_undo_t** undo,
{
const bool is_temp = rseg == trx->rsegs.m_noredo.rseg;
- ut_ad(mutex_own(&trx->undo_mutex));
ut_ad(rseg == trx->rsegs.m_redo.rseg
|| rseg == trx->rsegs.m_noredo.rseg);
ut_ad(undo == (is_temp