Skip to content

Commit 62b2044

Browse files
author
svoj@mysql.com/april.(none)
committed
BUG#22562 - REPAIR TABLE .. USE_FRM causes server crash on Windows and server
hangs on Linux If REPAIR TABLE ... USE_FRM is issued for table that is located in different than default database server crash could happen. In reopen_name_locked_table take database name from table_list (user specified or default database) instead of from thd (default database). Affects 4.1 only.
1 parent b7f016d commit 62b2044

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

mysql-test/r/repair.result

+7
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,10 @@ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_par
4848
t1 1 a 1 a A 5 NULL NULL YES BTREE
4949
SET myisam_repair_threads=@@global.myisam_repair_threads;
5050
DROP TABLE t1;
51+
CREATE TABLE t1(a INT);
52+
USE mysql;
53+
REPAIR TABLE test.t1 USE_FRM;
54+
Table Op Msg_type Msg_text
55+
test.t1 repair status OK
56+
USE test;
57+
DROP TABLE t1;

mysql-test/t/repair.test

+10
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,14 @@ SHOW INDEX FROM t1;
4545
SET myisam_repair_threads=@@global.myisam_repair_threads;
4646
DROP TABLE t1;
4747

48+
#
49+
# BUG#22562 - REPAIR TABLE .. USE_FRM causes server crash on Windows and
50+
# server hangs on Linux
51+
#
52+
CREATE TABLE t1(a INT);
53+
USE mysql;
54+
REPAIR TABLE test.t1 USE_FRM;
55+
USE test;
56+
DROP TABLE t1;
57+
4858
# End of 4.1 tests

sql/sql_base.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -821,7 +821,7 @@ TABLE *reopen_name_locked_table(THD* thd, TABLE_LIST* table_list)
821821
if (!(table = table_list->table))
822822
DBUG_RETURN(0);
823823

824-
char* db = thd->db ? thd->db : table_list->db;
824+
char *db= table_list->db;
825825
char* table_name = table_list->real_name;
826826
char key[MAX_DBKEY_LENGTH];
827827
uint key_length;

0 commit comments

Comments
 (0)