Commit 98075012 authored by serg@serg.mysql.com's avatar serg@serg.mysql.com
Browse files

protected close_cached_table() call in REPAIR ... USE_FRM with a mutex

test for REPAIR ... USE_FRM added
parent 7c4e5bd9
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
drop table if exists t1;
create table t1 SELECT 1,"table 1";
repair table t1 use_frm;
Table	Op	Msg_type	Msg_text
test.t1	repair	warning	Number of rows changed from 0 to 1
test.t1	repair	status	OK
drop table if exists t1;
+8 −0
Original line number Diff line number Diff line
#
# Test of repair table
#

drop table if exists t1;
create table t1 SELECT 1,"table 1";
repair table t1 use_frm;
drop table if exists t1;
+2 −0
Original line number Diff line number Diff line
@@ -972,7 +972,9 @@ static int prepare_for_repair(THD* thd, TABLE_LIST* table,
    fn_format(from, from, "", MI_NAME_DEXT, 4);
    sprintf(tmp,"%s-%lx_%lx", from, current_pid, thd->thread_id);

    pthread_mutex_lock(&LOCK_open);
    close_cached_table(thd,table->table);
    pthread_mutex_unlock(&LOCK_open);

    if (lock_and_wait_for_table_name(thd,table))
      DBUG_RETURN(-1);