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

Commit 5defdc382bbf606b83e556c4f0d29dcd7954ebbc
(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.
This commit is contained in:
Marko Mäkelä 2020-04-22 12:36:11 +03:00
parent 1b81e96593
commit 30c9833751
2 changed files with 3 additions and 2 deletions

View File

@ -614,7 +614,8 @@ private:
#ifdef UNIV_DEBUG
public:
/** @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 */
bool has_committed() const { ut_ad(!m_commit || m_start); return m_commit; }
private:

View File

@ -1984,7 +1984,7 @@ row_merge_read_clustered_index(
os_thread_yield();
scan_next:
ut_ad(!mtr_started);
ut_ad(mtr.is_active());
ut_ad(!mtr.is_active());
mtr.start();
mtr_started = true;
/* Restore position on the record, or its