diff options
author | unknown <konstantin@mysql.com> | 2006-01-04 17:49:45 +0300 |
---|---|---|
committer | unknown <konstantin@mysql.com> | 2006-01-04 17:49:45 +0300 |
commit | 3456c4be3acf92c2ec54dc2551e4e2a02e95512a (patch) | |
tree | d0ba85a749cfceb9ceb00a014db23734e8656646 /sql/sql_base.cc | |
parent | 314f0fbf32d33baab1d43de180892a274f46992d (diff) | |
parent | f577d864cdac14d9a5cf7714b3506bab7688b1c7 (diff) | |
download | mariadb-git-3456c4be3acf92c2ec54dc2551e4e2a02e95512a.tar.gz |
Merge mysql.com:/opt/local/work/mysql-4.1-7209-new
into mysql.com:/opt/local/work/mysql-5.0-merge
mysys/hash.c:
Auto merged
ndb/src/kernel/blocks/dbtup/DbtupCommit.cpp:
Auto merged
sql/lock.cc:
Auto merged
sql/sql_cache.cc:
Auto merged
sql/sql_acl.cc:
Manual merge.
sql/sql_base.cc:
Manual merge.
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r-- | sql/sql_base.cc | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc index cae77756012..290f16a09d6 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -1085,6 +1085,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; + HASH_SEARCH_STATE state; DBUG_ENTER("open_table"); /* find a unused table in the open table cache */ @@ -1247,9 +1248,11 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root, if (thd->handler_tables) mysql_ha_flush(thd, (TABLE_LIST*) NULL, MYSQL_HA_REOPEN_ON_USAGE, TRUE); - for (table=(TABLE*) hash_search(&open_cache,(byte*) key,key_length) ; + for (table= (TABLE*) hash_first(&open_cache, (byte*) key, key_length, + &state); table && table->in_use ; - table = (TABLE*) hash_next(&open_cache,(byte*) key,key_length)) + table= (TABLE*) hash_next(&open_cache, (byte*) key, key_length, + &state)) { if (table->s->version != refresh_version) { @@ -1621,10 +1624,11 @@ bool table_is_used(TABLE *table, bool wait_for_name_lock) { char *key= table->s->table_cache_key; uint key_length= table->s->key_length; - for (TABLE *search=(TABLE*) hash_search(&open_cache, - (byte*) key,key_length) ; + for (TABLE *search= (TABLE*) hash_search(&open_cache, (byte*) key, + key_length, &state); search ; - search = (TABLE*) hash_next(&open_cache,(byte*) key,key_length)) + search= (TABLE*) hash_next(&open_cache, (byte*) key, + key_length, &state)) { if (search->locked_by_flush || search->locked_by_name && wait_for_name_lock || @@ -5063,11 +5067,14 @@ bool remove_table_from_cache(THD *thd, const char *db, const char *table_name, key_length=(uint) (strmov(strmov(key,db)+1,table_name)-key)+1; for (;;) { + HASH_SEARCH_STATE state; result= signalled= 0; - for (table=(TABLE*) hash_search(&open_cache,(byte*) key,key_length) ; + for (table= (TABLE*) hash_first(&open_cache, (byte*) key, key_length, + &state); table; - table = (TABLE*) hash_next(&open_cache,(byte*) key,key_length)) + table= (TABLE*) hash_next(&open_cache, (byte*) key, key_length, + &state)) { THD *in_use; table->s->version=0L; /* Free when thread is ready */ |