summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <serg@sergbook.mysql.com>2002-05-16 12:51:46 +0200
committerunknown <serg@sergbook.mysql.com>2002-05-16 12:51:46 +0200
commit64ff30d5b13bd3e2a7059c1c30fbcf8aad53a90c (patch)
tree6bb201e74b4b20bab722665d25c4b8fb7feb6ef1 /sql
parent69664dbf987d217db1918aa493706ccd0f5b739c (diff)
downloadmariadb-git-64ff30d5b13bd3e2a7059c1c30fbcf8aad53a90c.tar.gz
"repair ... use_frm" crash fixed
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_table.cc11
1 files changed, 5 insertions, 6 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index dcbfd709f97..4316acfa47d 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -934,20 +934,19 @@ static int prepare_for_repair(THD* thd, TABLE_LIST* table,
else
{
- char from[FN_REFLEN],to[FN_REFLEN];
+ char from[FN_REFLEN],tmp[FN_REFLEN];
char* db = thd->db ? thd->db : table->db;
sprintf(from, "%s/%s/%s", mysql_real_data_home, db, table->name);
fn_format(from, from, "", MI_NAME_DEXT, 4);
- sprintf(to,"%s-%lx_%lx", from, current_pid, thd->thread_id);
+ sprintf(tmp,"%s-%lx_%lx", from, current_pid, thd->thread_id);
-
- my_rename(to, from, MYF(MY_WME));
+ close_cached_table(thd,table->table);
if (lock_and_wait_for_table_name(thd,table))
DBUG_RETURN(-1);
- if (my_rename(from, to, MYF(MY_WME)))
+ if (my_rename(from, tmp, MYF(MY_WME)))
{
unlock_table_name(thd, table);
DBUG_RETURN(send_check_errmsg(thd, table, "repair",
@@ -959,7 +958,7 @@ static int prepare_for_repair(THD* thd, TABLE_LIST* table,
DBUG_RETURN(send_check_errmsg(thd, table, "repair",
"Failed generating table from .frm file"));
}
- if (my_rename(to, from, MYF(MY_WME)))
+ if (my_rename(tmp, from, MYF(MY_WME)))
{
unlock_table_name(thd, table);
DBUG_RETURN(send_check_errmsg(thd, table, "repair",