Commit f4df8c00 authored by Jan Lindström's avatar Jan Lindström

MDEV-11197: TrxInInnoDB::is_aborted(const trx_t*): Assertion...

MDEV-11197: TrxInInnoDB::is_aborted(const trx_t*): Assertion `srv_read_only_mode || trx->in_depth > 0' failed

TrxInInnoDB should be constructed to track if a transaction is executing
inside InnoDB code i.e. it is like a gate between Server and InnoDB
::rnd_next() is called from Server and thus construct TrxInInnoDB
also there.

Applied suggested clean-up to TrxInInnoDB class functions enter()
and exit(). Note that exactly original did not work for enter().
parent 00821c38
...@@ -10574,6 +10574,8 @@ ha_innobase::rnd_next( ...@@ -10574,6 +10574,8 @@ ha_innobase::rnd_next(
DBUG_ENTER("rnd_next"); DBUG_ENTER("rnd_next");
TrxInInnoDB trx_in_innodb(m_prebuilt->trx);
if (m_start_of_scan) { if (m_start_of_scan) {
error = index_first(buf); error = index_first(buf);
......
...@@ -1508,17 +1508,15 @@ class TrxInInnoDB { ...@@ -1508,17 +1508,15 @@ class TrxInInnoDB {
} }
/* Avoid excessive mutex acquire/release */ /* Avoid excessive mutex acquire/release */
++trx->in_depth; if (++trx->in_depth > 1) {
/* The transaction is already inside InnoDB. */
/* If trx->in_depth is greater than 1 then ut_ad(trx->in_depth > 1);
transaction is already in InnoDB. */
if (trx->in_depth > 1) {
return; return;
} }
/* Only the owning thread should release the latch. */ /* Only the owning thread should release the latch. */
ut_ad(trx->in_depth == 1);
trx_assert_no_search_latch(trx); trx_assert_no_search_latch(trx);
trx_mutex_enter(trx); trx_mutex_enter(trx);
...@@ -1545,15 +1543,14 @@ class TrxInInnoDB { ...@@ -1545,15 +1543,14 @@ class TrxInInnoDB {
ut_ad(trx->in_depth > 0); ut_ad(trx->in_depth > 0);
--trx->in_depth; if (--trx->in_depth > 0) {
ut_ad(trx->in_depth);
if (trx->in_depth > 0) {
return; return;
} }
/* Only the owning thread should release the latch. */ /* Only the owning thread should release the latch. */
ut_ad(trx->in_depth == 0);
trx_assert_no_search_latch(trx); trx_assert_no_search_latch(trx);
trx_mutex_enter(trx); trx_mutex_enter(trx);
......
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