summaryrefslogtreecommitdiff
path: root/sql/sql_table.cc
diff options
context:
space:
mode:
authorunknown <pappa@c-450ae253.1238-1-64736c10.cust.bredbandsbolaget.se>2005-07-20 21:58:33 -0400
committerunknown <pappa@c-450ae253.1238-1-64736c10.cust.bredbandsbolaget.se>2005-07-20 21:58:33 -0400
commita3fe765249cd6b23dcd59a9bda3f310606877dc8 (patch)
tree67806b9ee022b7209440238f0cf7228d9e910a58 /sql/sql_table.cc
parentbf4dfde9fc729894eb745b58ced160133ecde510 (diff)
parentaf1dfb613b7ce6343f461d6f4c3def6af9354814 (diff)
downloadmariadb-git-a3fe765249cd6b23dcd59a9bda3f310606877dc8.tar.gz
Merge mronstrom@bk-internal.mysql.com:/home/bk/mysql-4.0
into c-450ae253.1238-1-64736c10.cust.bredbandsbolaget.se:/home/pappa/mysql-4.1 include/thr_lock.h: Auto merged mysys/thr_lock.c: Auto merged sql/lock.cc: Auto merged sql/mysql_priv.h: Auto merged sql/sql_base.cc: Auto merged sql/sql_table.cc: Manual merge after 4.0 fix
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r--sql/sql_table.cc37
1 files changed, 20 insertions, 17 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 204a8df6e9a..b0e8319fbb7 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -220,6 +220,7 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
for (table=tables ; table ; table=table->next)
{
char *db=table->db;
+ uint flags;
mysql_ha_flush(thd, table, MYSQL_HA_CLOSE_FINAL);
if (!close_temporary_table(thd, db, table->real_name))
{
@@ -227,6 +228,16 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
continue; // removed temporary table
}
+ abort_locked_tables(thd,db,table->real_name);
+ flags= RTFC_WAIT_OTHER_THREAD_FLAG | RTFC_CHECK_KILLED_FLAG;
+ remove_table_from_cache(thd,db,table->real_name,flags);
+ drop_locked_tables(thd,db,table->real_name);
+ if (thd->killed)
+ DBUG_RETURN(-1);
+ alias= (lower_case_table_names == 2) ? table->alias : table->real_name;
+ /* remove form file and isam files */
+ strxmov(path, mysql_data_home, "/", db, "/", alias, reg_ext, NullS);
+ (void) unpack_filename(path,path);
error=0;
if (!drop_temporary)
{
@@ -1661,13 +1672,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->table_cache_key,
- table->real_name))
- {
- dropping_tables++;
- (void) pthread_cond_wait(&COND_refresh,&LOCK_open);
- dropping_tables--;
- }
+ remove_table_from_cache(thd,table->table_cache_key,
+ table->real_name, RTFC_WAIT_OTHER_THREAD_FLAG);
DBUG_VOID_RETURN;
}
@@ -1989,18 +1995,14 @@ static int 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->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->table_cache_key,
- table->table->real_name) &&
- ! 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->table_cache_key,
+ table->table->real_name, flags);
thd->exit_cond(old_message);
if (thd->killed)
goto err;
@@ -2123,7 +2125,7 @@ send_result_message:
{
pthread_mutex_lock(&LOCK_open);
remove_table_from_cache(thd, table->table->table_cache_key,
- table->table->real_name);
+ table->table->real_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);
@@ -3418,7 +3420,8 @@ int 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); // Mark all 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));