Commit 30c98337 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-22332: Assertion mtr_started == mtr.is_active() failed

Commit 5defdc38
(which aimed to reduce sizeof(mtr_t) for non-debug builds)
replaced the ternary mtr_t::status with two debug-only bool
data members m_start, m_commit and inadvertently made the
(now debug-only) predicate mtr_t::is_active() wrongly hold
after mtr_t::commit().

mtr_t::is_active(): Evaluate both m_start and m_commit,
to be compatible with the old definition.

row_merge_read_clustered_index(): Correct a debug assertion.
parent 1b81e965
...@@ -614,7 +614,8 @@ struct mtr_t { ...@@ -614,7 +614,8 @@ struct mtr_t {
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
public: public:
/** @return whether the mini-transaction is active */ /** @return whether the mini-transaction is active */
bool is_active() const { ut_ad(!m_commit || m_start); return m_start; } bool is_active() const
{ ut_ad(!m_commit || m_start); return m_start && !m_commit; }
/** @return whether the mini-transaction has been committed */ /** @return whether the mini-transaction has been committed */
bool has_committed() const { ut_ad(!m_commit || m_start); return m_commit; } bool has_committed() const { ut_ad(!m_commit || m_start); return m_commit; }
private: private:
......
...@@ -1984,7 +1984,7 @@ row_merge_read_clustered_index( ...@@ -1984,7 +1984,7 @@ row_merge_read_clustered_index(
os_thread_yield(); os_thread_yield();
scan_next: scan_next:
ut_ad(!mtr_started); ut_ad(!mtr_started);
ut_ad(mtr.is_active()); ut_ad(!mtr.is_active());
mtr.start(); mtr.start();
mtr_started = true; mtr_started = true;
/* Restore position on the record, or its /* Restore position on the record, or its
......
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