From 372901addf38deb86a23cafd1ad9ac3e7fae3b0e Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 7 Apr 2006 23:58:17 +0400 Subject: [PATCH] Fixed BUG#15758: "Holding adaptive search latch in innobase_query_caching_of_table_permitted()". Applied the patch due to Heikki Tuuri. Also removed superfluous #ifdefs. sql/sql_cache.cc: Applied the patch due to Heikki Tuuri. Query_cache::store_query(): Make InnoDB to release the adaptive hash index latch before MySQL acquires the query cache mutex. sql/sql_class.cc: Removing superfluous #ifdefs (suggested by Sanja, also discussed with Serg). sql/sql_cursor.cc: Removing superfluous #ifdefs (suggested by Sanja, also discussed with Serg). --- sql/sql_cache.cc | 5 +++++ sql/sql_class.cc | 4 ---- sql/sql_cursor.cc | 3 +-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index cf3ba9c8c40..31201474c05 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -830,6 +830,11 @@ sql mode: 0x%lx, sort len: %lu, conncat len: %lu", flags.sql_mode, flags.max_sort_length, flags.group_concat_max_len)); + /* + Make InnoDB to release the adaptive hash index latch before + acquiring the query cache mutex. + */ + ha_release_temporary_latches(thd); STRUCT_LOCK(&structure_guard_mutex); if (query_cache_size == 0) diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 59391a333c3..5a6bbe01183 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -919,14 +919,12 @@ bool select_send::send_data(List &items) return 0; } -#ifdef HAVE_INNOBASE_DB /* We may be passing the control from mysqld to the client: release the InnoDB adaptive hash S-latch to avoid thread deadlocks if it was reserved by thd */ ha_release_temporary_latches(thd); -#endif List_iterator_fast li(items); Protocol *protocol= thd->protocol; @@ -956,12 +954,10 @@ bool select_send::send_data(List &items) bool select_send::send_eof() { -#ifdef HAVE_INNOBASE_DB /* We may be passing the control from mysqld to the client: release the InnoDB adaptive hash S-latch to avoid thread deadlocks if it was reserved by thd */ ha_release_temporary_latches(thd); -#endif /* Unlock tables before sending packet to gain some speed */ if (thd->lock) diff --git a/sql/sql_cursor.cc b/sql/sql_cursor.cc index 33ad27b9d14..2784e71ccae 100644 --- a/sql/sql_cursor.cc +++ b/sql/sql_cursor.cc @@ -445,9 +445,8 @@ Sensitive_cursor::fetch(ulong num_rows) if (error == NESTED_LOOP_CURSOR_LIMIT) join->resume_nested_loop= TRUE; -#ifdef USING_TRANSACTIONS ha_release_temporary_latches(thd); -#endif + /* Grab free_list here to correctly free it in close */ thd->restore_active_arena(this, &backup_arena);