diff options
author | Sergey Vojtovich <svoj@mariadb.org> | 2018-01-21 14:10:06 +0400 |
---|---|---|
committer | Sergey Vojtovich <svoj@mariadb.org> | 2018-01-21 14:10:06 +0400 |
commit | 8bdec7599e6dd07ed7d3c8c53ae792852d171fc4 (patch) | |
tree | 913fe07fab7960aaf893df851979298aac6775ea | |
parent | 9f72798a8fe27fb06ceeb2f543c186ee8faa987a (diff) | |
download | mariadb-git-bb-10.3-MDEV14638.tar.gz |
Simplified away ReadView::complete()bb-10.3-MDEV14638
It was supposed to be called out of mutex, but nevertheless was called
under trx_sys.mutex for normal threads adding one extra condtion in
critical section.
-rw-r--r-- | storage/innobase/include/read0types.h | 4 | ||||
-rw-r--r-- | storage/innobase/read/read0read.cc | 23 |
2 files changed, 7 insertions, 20 deletions
diff --git a/storage/innobase/include/read0types.h b/storage/innobase/include/read0types.h index e30976da302..1a941f2bde2 100644 --- a/storage/innobase/include/read0types.h +++ b/storage/innobase/include/read0types.h @@ -276,10 +276,6 @@ private: inline void prepare(trx_id_t id); /** - Complete the read view creation */ - inline void complete(); - - /** Copy state from another view. Must call copy_complete() to finish. @param other view to copy from */ inline void copy_prepare(const ReadView& other); diff --git a/storage/innobase/read/read0read.cc b/storage/innobase/read/read0read.cc index 6fa0250e111..d36e48fa790 100644 --- a/storage/innobase/read/read0read.cc +++ b/storage/innobase/read/read0read.cc @@ -399,6 +399,8 @@ ReadView::copy_trx_ids(const trx_ids_t& trx_ids) ::memmove(p, &trx_ids[0], n); } + m_up_limit_id = m_ids.front(); + #ifdef UNIV_DEBUG /* Original assertion was here to make sure that rw_trx_ids and rw_trx_hash are in sync and they hold either ACTIVE or PREPARED @@ -434,7 +436,8 @@ ReadView::prepare(trx_id_t id) m_creator_trx_id = id; - m_low_limit_no = m_low_limit_id = trx_sys.get_max_trx_id(); + m_low_limit_no = m_low_limit_id = m_up_limit_id = + trx_sys.get_max_trx_id(); if (!trx_sys.rw_trx_ids.empty()) { copy_trx_ids(trx_sys.rw_trx_ids); @@ -442,6 +445,8 @@ ReadView::prepare(trx_id_t id) m_ids.clear(); } + ut_ad(m_up_limit_id <= m_low_limit_id); + if (UT_LIST_GET_LEN(trx_sys.serialisation_list) > 0) { const trx_t* trx; @@ -453,19 +458,6 @@ ReadView::prepare(trx_id_t id) } } -/** -Complete the read view creation */ - -void -ReadView::complete() -{ - /* The first active transaction has the smallest id. */ - m_up_limit_id = !m_ids.empty() ? m_ids.front() : m_low_limit_id; - - ut_ad(m_up_limit_id <= m_low_limit_id); - set_open(true); -} - /** Create a view. @@ -538,11 +530,11 @@ void MVCC::view_open(trx_t* trx) mutex_enter(&trx_sys.mutex); trx->read_view.prepare(trx->id); - trx->read_view.complete(); if (trx->read_view.is_registered()) UT_LIST_REMOVE(m_views, &trx->read_view); else trx->read_view.set_registered(true); + trx->read_view.set_open(true); UT_LIST_ADD_FIRST(m_views, &trx->read_view); ut_ad(validate()); mutex_exit(&trx_sys.mutex); @@ -624,7 +616,6 @@ MVCC::clone_oldest_view(ReadView* view) /* No views in the list: snapshot current state. */ view->prepare(0); mutex_exit(&trx_sys.mutex); - view->complete(); } /** |