1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Merge mysql.com:/opt/local/work/mysql-4.1-7209-new

into  mysql.com:/opt/local/work/mysql-5.0-merge
This commit is contained in:
konstantin@mysql.com
2006-01-04 17:49:45 +03:00
7 changed files with 78 additions and 50 deletions

View File

@ -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 */