Commit 1ef8d5fc authored by Marko Mäkelä's avatar Marko Mäkelä

Bug #12329920 ASSERT UT_ERROR IN SYNC_THREAD_LEVELS_NONEMPTY_TRX

SRV_CONC_FORCE_EXIT_INNODB

This is a bogus UNIV_SYNC_DEBUG assertion failure that I introduced
when introducing assertions for checking that InnoDB is not holding
any mutexes or rw-locks when returning control to MySQL.

srv_suspend_mysql_thread(): Release dict_operation_lock before
invoking srv_conc_force_exit_innodb(), which would now check that the
thread is not holding any mutexes or rw-locks.  After resuming, check
sync_thread_levels_nonempty_trx() and do srv_conc_force_enter_innodb()
before reacquiring the dict_operation_lock.

rb:646 approved by Sunny Bains
parent cdba023d
......@@ -1624,17 +1624,6 @@ srv_suspend_mysql_thread(
mutex_exit(&kernel_mutex);
if (trx->declared_to_be_inside_innodb) {
was_declared_inside_innodb = TRUE;
/* We must declare this OS thread to exit InnoDB, since a
possible other thread holding a lock which this thread waits
for must be allowed to enter, sooner or later */
srv_conc_force_exit_innodb(trx);
}
had_dict_lock = trx->dict_operation_lock_mode;
switch (had_dict_lock) {
......@@ -1662,12 +1651,34 @@ srv_suspend_mysql_thread(
ut_a(trx->dict_operation_lock_mode == 0);
if (trx->declared_to_be_inside_innodb) {
was_declared_inside_innodb = TRUE;
/* We must declare this OS thread to exit InnoDB, since a
possible other thread holding a lock which this thread waits
for must be allowed to enter, sooner or later */
srv_conc_force_exit_innodb(trx);
}
/* Suspend this thread and wait for the event. */
thd_wait_begin(trx->mysql_thd, THD_WAIT_ROW_TABLE_LOCK);
os_event_wait(event);
thd_wait_end(trx->mysql_thd);
#ifdef UNIV_SYNC_DEBUG
ut_ad(!sync_thread_levels_nonempty_trx(trx->has_search_latch));
#endif /* UNIV_SYNC_DEBUG */
if (was_declared_inside_innodb) {
/* Return back inside InnoDB */
srv_conc_force_enter_innodb(trx);
}
/* After resuming, reacquire the data dictionary latch if
necessary. */
......@@ -1683,13 +1694,6 @@ srv_suspend_mysql_thread(
break;
}
if (was_declared_inside_innodb) {
/* Return back inside InnoDB */
srv_conc_force_enter_innodb(trx);
}
mutex_enter(&kernel_mutex);
/* Release the slot for others to use */
......@@ -1744,10 +1748,6 @@ srv_suspend_mysql_thread(
trx->error_state = DB_INTERRUPTED;
}
#ifdef UNIV_SYNC_DEBUG
ut_ad(!sync_thread_levels_nonempty_trx(trx->has_search_latch));
#endif /* UNIV_SYNC_DEBUG */
}
/********************************************************************//**
......
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