diff options
author | monty@donna.mysql.com <> | 2000-10-17 16:19:24 +0300 |
---|---|---|
committer | monty@donna.mysql.com <> | 2000-10-17 16:19:24 +0300 |
commit | 828bff9195ac194a10752a009f24a4e7e56f5d36 (patch) | |
tree | 27d0e6155df4adf8bc2ba4032977ecad637026a2 /sql/sql_table.cc | |
parent | 2620ca4cf5ab344947a889311efabd582a8e3f4d (diff) | |
download | mariadb-git-828bff9195ac194a10752a009f24a4e7e56f5d36.tar.gz |
Fixes for automatic recover of MyISAM tables
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r-- | sql/sql_table.cc | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 87c94c22169..e4257f84459 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -889,6 +889,24 @@ static int mysql_admin_table(THD* thd, TABLE_LIST* tables, continue; } + /* Close all instances of the table to allow repair to rename files */ + if (open_for_modify && table->table->version) + { + pthread_mutex_lock(&LOCK_open); + 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--; + } + pthread_mutex_unlock(&LOCK_open); + if (thd->killed) + goto err; + } + int result_code = (table->table->file->*operator_func)(thd, check_opt); packet->length(0); net_store_data(packet, table_name); @@ -933,7 +951,7 @@ static int mysql_admin_table(THD* thd, TABLE_LIST* tables, break; } if (fatal_error) - table->table->flush_version=0; // Force close of table + table->table->version=0; // Force close of table close_thread_tables(thd); if (my_net_write(&thd->net, (char*) packet->ptr(), packet->length())) |