summaryrefslogtreecommitdiff
path: root/storage/innobase/lock
diff options
context:
space:
mode:
authorSergey Vojtovich <svoj@mariadb.org>2020-05-16 01:13:02 +0400
committerSergey Vojtovich <svoj@mariadb.org>2020-05-26 17:11:20 +0400
commit50b0ce44a2d5c1827aa8483855316c8deaff2c7d (patch)
tree844ffc99f13ed06ef652b1a47c5b9fb83ee87e32 /storage/innobase/lock
parent8569dac1ec9f6853a0b2f3ea9bcbda67644ead24 (diff)
downloadmariadb-git-50b0ce44a2d5c1827aa8483855316c8deaff2c7d.tar.gz
MDEV-22593 - InnoDB: don't take trx_sys.mutex in ReadView::open()
This was the last abuse of trx_sys.mutex, which is now exclusively protecting trx_sys.trx_list. This global acquisition was also potential scalability bottleneck for oltp_read_write benchmark. Although it didn't expose itself as such due to larger scalability issues. Replaced trx_sys.mutex based synchronisation between ReadView creator thread and purge coordinator thread performing latest view clone with ReadView::m_mutex. It also allowed to simplify tri-state view m_state down to boolean m_open flag. For performance reasons trx->read_view.close() is left as atomic relaxed store, so that we don't have to waste resources for otherwise meaningless mutex acquisition.
Diffstat (limited to 'storage/innobase/lock')
-rw-r--r--storage/innobase/lock/lock0lock.cc14
1 files changed, 3 insertions, 11 deletions
diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc
index 622e5ba7515..82bfdff3917 100644
--- a/storage/innobase/lock/lock0lock.cc
+++ b/storage/innobase/lock/lock0lock.cc
@@ -4595,15 +4595,7 @@ lock_trx_print_wait_and_mvcc_state(FILE* file, const trx_t* trx, time_t now)
fprintf(file, "---");
trx_print_latched(file, trx, 600);
-
- /* Note: read_view->get_state() check is race condition. But it
- should "kind of work" because read_view is freed only at shutdown.
- Worst thing that may happen is that it'll get transferred to
- another thread and print wrong values. */
-
- if (trx->read_view.get_state() == READ_VIEW_STATE_OPEN) {
- trx->read_view.print_limits(file);
- }
+ trx->read_view.print_limits(file);
if (trx->lock.que_state == TRX_QUE_LOCK_WAIT) {
@@ -5169,8 +5161,8 @@ lock_validate()
(lock_validate_table_locks), 0);
/* Iterate over all the record locks and validate the locks. We
- don't want to hog the lock_sys_t::mutex and the trx_sys_t::mutex.
- Release both mutexes during the validation check. */
+ don't want to hog the lock_sys_t::mutex. Release it during the
+ validation check. */
for (ulint i = 0; i < hash_get_n_cells(lock_sys.rec_hash); i++) {
ib_uint64_t limit = 0;