mirror of
https://github.com/MariaDB/server.git
synced 2025-08-05 13:16:09 +03:00
"repair ... use_frm" crash fixed
This commit is contained in:
@@ -934,20 +934,19 @@ static int prepare_for_repair(THD* thd, TABLE_LIST* table,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
char from[FN_REFLEN],to[FN_REFLEN];
|
char from[FN_REFLEN],tmp[FN_REFLEN];
|
||||||
char* db = thd->db ? thd->db : table->db;
|
char* db = thd->db ? thd->db : table->db;
|
||||||
|
|
||||||
sprintf(from, "%s/%s/%s", mysql_real_data_home, db, table->name);
|
sprintf(from, "%s/%s/%s", mysql_real_data_home, db, table->name);
|
||||||
fn_format(from, from, "", MI_NAME_DEXT, 4);
|
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);
|
||||||
|
|
||||||
|
close_cached_table(thd,table->table);
|
||||||
my_rename(to, from, MYF(MY_WME));
|
|
||||||
|
|
||||||
if (lock_and_wait_for_table_name(thd,table))
|
if (lock_and_wait_for_table_name(thd,table))
|
||||||
DBUG_RETURN(-1);
|
DBUG_RETURN(-1);
|
||||||
|
|
||||||
if (my_rename(from, to, MYF(MY_WME)))
|
if (my_rename(from, tmp, MYF(MY_WME)))
|
||||||
{
|
{
|
||||||
unlock_table_name(thd, table);
|
unlock_table_name(thd, table);
|
||||||
DBUG_RETURN(send_check_errmsg(thd, table, "repair",
|
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",
|
DBUG_RETURN(send_check_errmsg(thd, table, "repair",
|
||||||
"Failed generating table from .frm file"));
|
"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);
|
unlock_table_name(thd, table);
|
||||||
DBUG_RETURN(send_check_errmsg(thd, table, "repair",
|
DBUG_RETURN(send_check_errmsg(thd, table, "repair",
|
||||||
|
Reference in New Issue
Block a user