summaryrefslogtreecommitdiff
path: root/sql/sql_base.cc
diff options
context:
space:
mode:
authormonty@donna.mysql.com <>2000-11-28 04:47:47 +0200
committermonty@donna.mysql.com <>2000-11-28 04:47:47 +0200
commit74e7ffe9872e74f3ac1ae4e93a2ef1b0d2c97c03 (patch)
treee3d40dd7c6a7e86bd2388da19d59d5a372bf7bb8 /sql/sql_base.cc
parentad2e43c7d6f4b7bbe5b92830ef11856c7d18b6b5 (diff)
downloadmariadb-git-74e7ffe9872e74f3ac1ae4e93a2ef1b0d2c97c03.tar.gz
New thr_alarm struct for better integration with OS2
Run bootstrap in separate thread Fix bug in FLUSH TABLES table_name
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r--sql/sql_base.cc14
1 files changed, 8 insertions, 6 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 3560fc42d49..66c4a22ad67 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)
@@ -1972,7 +1972,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;
@@ -1985,13 +1986,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;
@@ -2009,6 +2009,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));