diff options
author | pappa@c-450ae253.1238-1-64736c10.cust.bredbandsbolaget.se <> | 2005-07-21 01:29:57 -0400 |
---|---|---|
committer | pappa@c-450ae253.1238-1-64736c10.cust.bredbandsbolaget.se <> | 2005-07-21 01:29:57 -0400 |
commit | 6026054ead01bb2f733529b1a3aa4382a2ced2c0 (patch) | |
tree | f28d036bdc60c31c38b1d066b2d9e02fa4e980e6 /sql/sql_table.cc | |
parent | 69a3209275369e799588a52b3fa748413932e3dc (diff) | |
parent | ac6623f08fe059e4ee49c4f3eaa73198b8ca9d82 (diff) | |
download | mariadb-git-6026054ead01bb2f733529b1a3aa4382a2ced2c0.tar.gz |
Merge mronstrom@bk-internal.mysql.com:/home/bk/mysql-4.1
into c-450ae253.1238-1-64736c10.cust.bredbandsbolaget.se:/home/pappa/mysql-5.0
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r-- | sql/sql_table.cc | 35 |
1 files changed, 12 insertions, 23 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc index e3f85f05c17..e91142d450a 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -229,6 +229,7 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists, for (table= tables; table; table= table->next_local) { char *db=table->db; + uint flags; mysql_ha_flush(thd, table, MYSQL_HA_CLOSE_FINAL); if (!close_temporary_table(thd, db, table->table_name)) { @@ -240,13 +241,8 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists, if (!drop_temporary) { abort_locked_tables(thd,db,table->table_name); - while (remove_table_from_cache(thd, db, table->table_name, 0) && - !thd->killed) - { - dropping_tables++; - (void) pthread_cond_wait(&COND_refresh,&LOCK_open); - dropping_tables--; - } + flags= RTFC_WAIT_OTHER_THREAD_FLAG | RTFC_CHECK_KILLED_FLAG; + remove_table_from_cache(thd,db,table->table_name,flags); drop_locked_tables(thd,db,table->table_name); if (thd->killed) { @@ -1870,12 +1866,8 @@ static void wait_while_table_is_used(THD *thd,TABLE *table, mysql_lock_abort(thd, table); // end threads waiting on lock /* Wait until all there are no other threads that has this table open */ - while (remove_table_from_cache(thd, table->s->db, table->s->table_name, 0)) - { - dropping_tables++; - (void) pthread_cond_wait(&COND_refresh,&LOCK_open); - dropping_tables--; - } + remove_table_from_cache(thd, table->s->db, + table->s->table_name, RTFC_WAIT_OTHER_THREAD_FLAG); DBUG_VOID_RETURN; } @@ -2258,18 +2250,14 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, /* Close all instances of the table to allow repair to rename files */ if (lock_type == TL_WRITE && table->table->s->version) { + uint flags; 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->s->db, - table->table->s->table_name, 0) && - ! thd->killed) - { - dropping_tables++; - (void) pthread_cond_wait(&COND_refresh,&LOCK_open); - dropping_tables--; - } + flags= RTFC_WAIT_OTHER_THREAD_FLAG | RTFC_CHECK_KILLED_FLAG; + remove_table_from_cache(thd, table->table->s->db, + table->table->s->table_name, flags); thd->exit_cond(old_message); if (thd->killed) goto err; @@ -2414,7 +2402,7 @@ send_result_message: { pthread_mutex_lock(&LOCK_open); remove_table_from_cache(thd, table->table->s->db, - table->table->s->table_name, 0); + table->table->s->table_name, RTFC_NO_FLAG); pthread_mutex_unlock(&LOCK_open); /* May be something modified consequently we have to invalidate cache */ query_cache_invalidate3(thd, table->table, 0); @@ -3741,7 +3729,8 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, if (table) { VOID(table->file->extra(HA_EXTRA_FORCE_REOPEN)); // Use new file - remove_table_from_cache(thd,db,table_name, 0); // Mark in-use copies old + remove_table_from_cache(thd,db,table_name,RTFC_NO_FLAG); + // Mark in-use copies old mysql_lock_abort(thd,table); // end threads waiting on lock } VOID(quick_rm_table(old_db_type,db,old_name)); |