diff options
author | unknown <serg@serg.mylan> | 2005-03-17 08:46:48 +0100 |
---|---|---|
committer | unknown <serg@serg.mylan> | 2005-03-17 08:46:48 +0100 |
commit | 5c1b91f1ee1248f91fb8c886967bb6c510ee854c (patch) | |
tree | 37a5d35e424f7ed118f092a6b045f239969554e3 /sql/sql_table.cc | |
parent | 2bbde22d8485463704a4be3494094a03c1888e21 (diff) | |
parent | 5cb5a11bdd1b85c15d3e0dc42a9cf506c85f86be (diff) | |
download | mariadb-git-5c1b91f1ee1248f91fb8c886967bb6c510ee854c.tar.gz |
Merge bk-internal:/home/bk/mysql-5.0
into serg.mylan:/usr/home/serg/Abk/mysql-5.0
sql/handler.cc:
Auto merged
sql/lock.cc:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/mysqld.cc:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_table.cc:
Auto merged
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r-- | sql/sql_table.cc | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 3cae2484ca2..8295e2f07ab 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -65,7 +65,7 @@ static int copy_data_between_tables(TABLE *from,TABLE *to, bool mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists, my_bool drop_temporary) { - bool error= FALSE; + bool error= FALSE, need_start_waiters= FALSE; DBUG_ENTER("mysql_rm_table"); /* mark for close and remove all cached entries */ @@ -74,23 +74,19 @@ bool mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists, thd->mysys_var->current_cond= &COND_refresh; VOID(pthread_mutex_lock(&LOCK_open)); - if (!drop_temporary && global_read_lock) + if (!drop_temporary) { - if (thd->global_read_lock) + if ((error= wait_if_global_read_lock(thd, 0, 1))) { my_error(ER_TABLE_NOT_LOCKED_FOR_WRITE, MYF(0), tables->table_name); - error= TRUE; goto err; } - while (global_read_lock && ! thd->killed) - { - (void) pthread_cond_wait(&COND_refresh,&LOCK_open); - } - + else + need_start_waiters= TRUE; } error= mysql_rm_table_part2(thd, tables, if_exists, drop_temporary, 0, 0); - err: +err: pthread_mutex_unlock(&LOCK_open); pthread_mutex_lock(&thd->mysys_var->mutex); @@ -98,6 +94,9 @@ bool mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists, thd->mysys_var->current_cond= 0; pthread_mutex_unlock(&thd->mysys_var->mutex); + if (need_start_waiters) + start_waiting_global_read_lock(thd); + if (error) DBUG_RETURN(TRUE); send_ok(thd); @@ -114,7 +113,7 @@ bool mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists, tables List of tables to delete if_exists If 1, don't give error if one table doesn't exists dont_log_query Don't write query to log files. This will also not - generate warnings if the handler files doesn't exists + generate warnings if the handler files doesn't exists NOTES Works like documented in mysql_rm_table(), but don't check |