Commit 959ad2f3 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-29612 ReadViewBase::snapshot() misses an optimization

ReadViewBase::snapshot(): In case m_low_limit_no==m_low_limit_id
and m_ids would include everything between that and m_up_limit_id,
set all fields to m_up_limit_id and clear m_ids, to speed up
changes_visible() and append().

rw_trx_hash_t::debug_iterator(): Add an assertion.
parent 3e9e377b
......@@ -523,6 +523,7 @@ class rw_trx_hash_t
if (element->trx)
validate_element(element->trx);
element->mutex.wr_unlock();
ut_ad(element->id < element->no);
return arg->action(element, arg->argument);
}
#endif
......
......@@ -173,9 +173,22 @@ For details see: row_vers_old_has_index_entry() and row_purge_poss_sec()
inline void ReadViewBase::snapshot(trx_t *trx)
{
trx_sys.snapshot_ids(trx, &m_ids, &m_low_limit_id, &m_low_limit_no);
if (m_ids.empty())
{
m_up_limit_id= m_low_limit_id;
return;
}
std::sort(m_ids.begin(), m_ids.end());
m_up_limit_id= m_ids.empty() ? m_low_limit_id : m_ids.front();
m_up_limit_id= m_ids.front();
ut_ad(m_up_limit_id <= m_low_limit_id);
if (m_low_limit_no == m_low_limit_id &&
m_low_limit_id == m_up_limit_id + m_ids.size())
{
m_ids.clear();
m_low_limit_id= m_low_limit_no= m_up_limit_id;
}
}
......
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