summaryrefslogtreecommitdiff
path: root/sql/sql_table.cc
diff options
context:
space:
mode:
authorunknown <monty@hundin.mysql.fi>2001-11-26 02:16:38 +0200
committerunknown <monty@hundin.mysql.fi>2001-11-26 02:16:38 +0200
commit4615e50093d635f07f2940bb9fbe7e1c327b8ebb (patch)
tree1f8e0f608f035ad5906f6ea2dbbb3006ea2703bd /sql/sql_table.cc
parent7ef7d93726929ec678a8b07bed1be7bb56ad4b10 (diff)
downloadmariadb-git-4615e50093d635f07f2940bb9fbe7e1c327b8ebb.tar.gz
Fix race condition in ANALYZE TABLE.
Fixed bug where one got an empty set instead of a DEADLOCK error when using BDB tables. Docs/manual.texi: Cleanup configure.in: Version number change mysql-test/t/backup.test: drop used tables mysql-test/t/bdb-crash.test: cleanup mysys/thr_lock.c: cleanup sql/mysqld.cc: safety fix sql/records.cc: Fixed bug where one got an empty set instead of a DEADLOCK error when using BDB tables. sql/sql_table.cc: Fix race condition in ANALYZE TABLE.
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r--sql/sql_table.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 725aed390be..f4735df5451 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -964,9 +964,11 @@ static int mysql_admin_table(THD* thd, TABLE_LIST* tables,
}
/* Close all instances of the table to allow repair to rename files */
- if (open_for_modify && table->table->version)
+ if (lock_type == TL_WRITE && table->table->version)
{
pthread_mutex_lock(&LOCK_open);
+ const char *old_message=thd->enter_cond(&COND_refresh, &LOCK_open,
+ "Waiting to get writelock");
mysql_lock_abort(thd,table->table);
while (remove_table_from_cache(thd, table->table->table_cache_key,
table->table->real_name) &&
@@ -976,6 +978,7 @@ static int mysql_admin_table(THD* thd, TABLE_LIST* tables,
(void) pthread_cond_wait(&COND_refresh,&LOCK_open);
dropping_tables--;
}
+ thd->exit_cond(old_message);
pthread_mutex_unlock(&LOCK_open);
if (thd->killed)
goto err;