From 30c9833751529d403927b9832268bef2c36acbd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 22 Apr 2020 12:36:11 +0300 Subject: [PATCH] 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. --- storage/innobase/include/mtr0mtr.h | 3 ++- storage/innobase/row/row0merge.cc | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/storage/innobase/include/mtr0mtr.h b/storage/innobase/include/mtr0mtr.h index 2f71155187c..2664054f5c6 100644 --- a/storage/innobase/include/mtr0mtr.h +++ b/storage/innobase/include/mtr0mtr.h @@ -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: diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc index e4943195fb1..93d86a96067 100644 --- a/storage/innobase/row/row0merge.cc +++ b/storage/innobase/row/row0merge.cc @@ -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