From 06ef5509d0be2ed8197a981e2b9ceb8ac2bab0cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 20 Nov 2020 09:18:41 +0200 Subject: MDEV-24167: Replace trx_purge_latch --- storage/innobase/include/sync0types.h | 2 -- storage/innobase/include/trx0purge.h | 14 +++++--------- 2 files changed, 5 insertions(+), 11 deletions(-) (limited to 'storage/innobase/include') diff --git a/storage/innobase/include/sync0types.h b/storage/innobase/include/sync0types.h index ee54b6fffc4..a12fb88ae55 100644 --- a/storage/innobase/include/sync0types.h +++ b/storage/innobase/include/sync0types.h @@ -224,7 +224,6 @@ enum latch_level_t { SYNC_RSEG_HEADER_NEW, SYNC_NOREDO_RSEG, SYNC_REDO_RSEG, - SYNC_PURGE_LATCH, SYNC_TREE_NODE, SYNC_TREE_NODE_FROM_HASH, SYNC_TREE_NODE_NEW, @@ -296,7 +295,6 @@ enum latch_id_t { LATCH_ID_FIL_SPACE, LATCH_ID_FTS_CACHE, LATCH_ID_FTS_CACHE_INIT, - LATCH_ID_TRX_PURGE, LATCH_ID_IBUF_INDEX_TREE, LATCH_ID_INDEX_TREE, LATCH_ID_DICT_TABLE_STATS, diff --git a/storage/innobase/include/trx0purge.h b/storage/innobase/include/trx0purge.h index 38e9e7207a2..0aff65fd7b6 100644 --- a/storage/innobase/include/trx0purge.h +++ b/storage/innobase/include/trx0purge.h @@ -29,6 +29,7 @@ Created 3/26/1996 Heikki Tuuri #include "trx0rseg.h" #include "que0types.h" +#include "srw_lock.h" #include @@ -127,11 +128,9 @@ class purge_sys_t { public: /** latch protecting view, m_enabled */ - MY_ALIGNED(CACHE_LINE_SIZE) - mutable rw_lock_t latch; + MY_ALIGNED(CACHE_LINE_SIZE) mutable srw_lock latch; private: /** The purge will not remove undo logs which are >= this view */ - MY_ALIGNED(CACHE_LINE_SIZE) ReadViewBase view; /** whether purge is enabled; protected by latch and std::atomic */ std::atomic m_enabled; @@ -249,23 +248,20 @@ public: /** A wrapper around ReadView::changes_visible(). */ bool changes_visible(trx_id_t id, const table_name_t &name) const { - ut_ad(rw_lock_own(&latch, RW_LOCK_S)); return view.changes_visible(id, name); } /** A wrapper around ReadView::low_limit_no(). */ trx_id_t low_limit_no() const { -#if 0 /* Unfortunately we don't hold this assertion, see MDEV-22718. */ - ut_ad(rw_lock_own(&latch, RW_LOCK_S)); -#endif + /* MDEV-22718 FIXME: We are not holding latch here! */ return view.low_limit_no(); } /** A wrapper around trx_sys_t::clone_oldest_view(). */ void clone_oldest_view() { - rw_lock_x_lock(&latch); + latch.wr_lock(); trx_sys.clone_oldest_view(&view); - rw_lock_x_unlock(&latch); + latch.wr_unlock(); } }; -- cgit v1.2.1