From c74959c9e072971f0fdd90fcd242458ec8346879 Mon Sep 17 00:00:00 2001 From: "tsmith@ramayana.hindu.god" <> Date: Wed, 30 Jan 2008 19:00:20 -0700 Subject: [PATCH] Bug #32149 Long semaphore wait for adaptive hash latch Fix by calling ha_release_temporary_latches() before ::filesort(). --- sql/filesort.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sql/filesort.cc b/sql/filesort.cc index 43b079e83d5..132e91363f3 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -112,6 +112,13 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length, FILESORT_INFO table_sort; TABLE_LIST *tab= table->pos_in_table_list; Item_subselect *subselect= tab ? tab->containing_subselect() : 0; + + /* + Release InnoDB's adaptive hash index latch (if holding) before + running a sort. + */ + ha_release_temporary_latches(thd); + /* Don't use table->sort in filesort as it is also used by QUICK_INDEX_MERGE_SELECT. Work with a copy and put it back at the end