mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge work.mysql.com:/home/bk/mysql
into mysql.sashanet.com:/home/sasha/src/bk/mysql sql/mysql_priv.h: Auto merged sql/mysqld.cc: Auto merged sql/sql_base.cc: Auto merged sql/sql_class.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_parse.cc: Auto merged sql/sql_table.cc: Auto merged
This commit is contained in:
@ -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));
|
||||
|
Reference in New Issue
Block a user