Commit e2f51ed8 authored by vasil's avatar vasil

Potential fix for Bug#25645:

"Move innobase_release_stat_resources(trx) outside the 'if' in
ha_innobase::external_lock(). That would add more safety that whatever
MySQL does at a query end, there would be no risk of a hang on the btr
search latch."

Also call innobase_release_temporary_latches() in the beginning of
ha_innobase::close().

Approved by:	Heikki
parent 0a0087ed
...@@ -2570,6 +2570,8 @@ ha_innobase::close(void) ...@@ -2570,6 +2570,8 @@ ha_innobase::close(void)
{ {
DBUG_ENTER("ha_innobase::close"); DBUG_ENTER("ha_innobase::close");
innobase_release_temporary_latches(ht, current_thd);
row_prebuilt_free(prebuilt); row_prebuilt_free(prebuilt);
my_free((gptr) upd_buff, MYF(0)); my_free((gptr) upd_buff, MYF(0));
...@@ -6409,6 +6411,12 @@ ha_innobase::external_lock( ...@@ -6409,6 +6411,12 @@ ha_innobase::external_lock(
trx->n_mysql_tables_in_use--; trx->n_mysql_tables_in_use--;
prebuilt->mysql_has_locked = FALSE; prebuilt->mysql_has_locked = FALSE;
/* Release a possible FIFO ticket and search latch. Since we
may reserve the kernel mutex, we have to release the search
system latch first to obey the latching order. */
innobase_release_stat_resources(trx);
/* If the MySQL lock count drops to zero we know that the current SQL /* If the MySQL lock count drops to zero we know that the current SQL
statement has ended */ statement has ended */
...@@ -6417,12 +6425,6 @@ ha_innobase::external_lock( ...@@ -6417,12 +6425,6 @@ ha_innobase::external_lock(
trx->mysql_n_tables_locked = 0; trx->mysql_n_tables_locked = 0;
prebuilt->used_in_HANDLER = FALSE; prebuilt->used_in_HANDLER = FALSE;
/* Release a possible FIFO ticket and search latch. Since we
may reserve the kernel mutex, we have to release the search
system latch first to obey the latching order. */
innobase_release_stat_resources(trx);
if (!(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))) { if (!(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))) {
if (trx->active_trans != 0) { if (trx->active_trans != 0) {
innobase_commit(ht, thd, TRUE); innobase_commit(ht, thd, TRUE);
......
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