Commit 8e1adff9 authored by Sergey Vojtovich's avatar Sergey Vojtovich

Simplified away ReadView::complete()

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.
parent 4dc30f3c
......@@ -275,10 +275,6 @@ class ReadView {
@param id Creator transaction id */
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 */
......
......@@ -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();
}
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment