diff options
author | sasha@mysql.sashanet.com <> | 2000-11-27 23:10:49 -0700 |
---|---|---|
committer | sasha@mysql.sashanet.com <> | 2000-11-27 23:10:49 -0700 |
commit | 25ae951289beacf1f43b36d41181e07af5368eb1 (patch) | |
tree | 39bb69a9d25395c95dbba09f15eba543e26775c8 /sql/sql_base.cc | |
parent | 87ef08f239067f227bae488ab78989c4dae8a857 (diff) | |
parent | 3cdf3f87f3d6fb8f1cfb9cbbcf5283a0c24ae65b (diff) | |
download | mariadb-git-25ae951289beacf1f43b36d41181e07af5368eb1.tar.gz |
Merge work.mysql.com:/home/bk/mysql
into mysql.sashanet.com:/home/sasha/src/bk/mysql
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r-- | sql/sql_base.cc | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 9ec85a9114e..f582b4a85af 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -275,7 +275,7 @@ bool close_cached_tables(THD *thd, bool if_wait_for_refresh, bool found=0; for (TABLE_LIST *table=tables ; table ; table=table->next) { - if (remove_table_from_cache(thd, table->db, table->name)) + if (remove_table_from_cache(thd, table->db, table->name, 1)) found=1; } if (!found) @@ -2029,7 +2029,8 @@ void flush_tables() ** Returns true if the table is in use by another thread */ -bool remove_table_from_cache(THD *thd, const char *db,const char *table_name) +bool remove_table_from_cache(THD *thd, const char *db, const char *table_name, + bool return_if_owned_by_thd) { char key[MAX_DBKEY_LENGTH]; uint key_length; @@ -2042,13 +2043,12 @@ bool remove_table_from_cache(THD *thd, const char *db,const char *table_name) table; table = (TABLE*) hash_next(&open_cache,(byte*) key,key_length)) { + THD *in_use; table->version=0L; /* Free when thread is ready */ - if (!table->in_use) + if (!(in_use=table->in_use)) relink_unused(table); - else if (table->in_use != thd) + else if (in_use != thd) { - THD *in_use=table->in_use; - in_use->some_tables_deleted=1; if (table->db_stat) result=1; @@ -2066,6 +2066,8 @@ bool remove_table_from_cache(THD *thd, const char *db,const char *table_name) pthread_mutex_unlock(&in_use->mysys_var->mutex); } } + else + result= result || return_if_owned_by_thd; } while (unused_tables && !unused_tables->version) VOID(hash_delete(&open_cache,(byte*) unused_tables)); |