summaryrefslogtreecommitdiff
path: root/sql/sql_base.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r--sql/sql_base.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 2c0ba87262a..156bcaedaf6 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -2529,6 +2529,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
char key[MAX_DBKEY_LENGTH];
uint key_length;
char *alias= table_list->alias;
+ my_hash_value_type hash_value;
HASH_SEARCH_STATE state;
DBUG_ENTER("open_table");
@@ -2718,6 +2719,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
on disk.
*/
+ hash_value= my_calc_hash(&open_cache, (uchar*) key, key_length);
VOID(pthread_mutex_lock(&LOCK_open));
/*
@@ -2760,8 +2762,11 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
an implicit "pending locks queue" - see
wait_for_locked_table_names for details.
*/
- for (table= (TABLE*) my_hash_first(&open_cache, (uchar*) key, key_length,
- &state);
+ for (table= (TABLE*) my_hash_first_from_hash_value(&open_cache,
+ hash_value,
+ (uchar*) key,
+ key_length,
+ &state);
table && table->in_use ;
table= (TABLE*) my_hash_next(&open_cache, (uchar*) key, key_length,
&state))