Commit a498ce55 authored by unknown's avatar unknown

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.


mysql-test/r/repair.result:
  A test case for BUG#22562.
mysql-test/t/repair.test:
  A test case for BUG#22562.
sql/sql_base.cc:
  In reopen_name_locked_table take database name from table_list (user specified
  or default database) instead of from thd (default database).
parent 96ca77d4
...@@ -48,3 +48,10 @@ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_par ...@@ -48,3 +48,10 @@ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_par
t1 1 a 1 a A 5 NULL NULL YES BTREE t1 1 a 1 a A 5 NULL NULL YES BTREE
SET myisam_repair_threads=@@global.myisam_repair_threads; SET myisam_repair_threads=@@global.myisam_repair_threads;
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1(a INT);
USE mysql;
REPAIR TABLE test.t1 USE_FRM;
Table Op Msg_type Msg_text
test.t1 repair status OK
USE test;
DROP TABLE t1;
...@@ -45,4 +45,14 @@ SHOW INDEX FROM t1; ...@@ -45,4 +45,14 @@ SHOW INDEX FROM t1;
SET myisam_repair_threads=@@global.myisam_repair_threads; SET myisam_repair_threads=@@global.myisam_repair_threads;
DROP TABLE t1; DROP TABLE t1;
#
# BUG#22562 - REPAIR TABLE .. USE_FRM causes server crash on Windows and
# server hangs on Linux
#
CREATE TABLE t1(a INT);
USE mysql;
REPAIR TABLE test.t1 USE_FRM;
USE test;
DROP TABLE t1;
# End of 4.1 tests # End of 4.1 tests
...@@ -821,7 +821,7 @@ TABLE *reopen_name_locked_table(THD* thd, TABLE_LIST* table_list) ...@@ -821,7 +821,7 @@ TABLE *reopen_name_locked_table(THD* thd, TABLE_LIST* table_list)
if (!(table = table_list->table)) if (!(table = table_list->table))
DBUG_RETURN(0); DBUG_RETURN(0);
char* db = thd->db ? thd->db : table_list->db; char *db= table_list->db;
char* table_name = table_list->real_name; char* table_name = table_list->real_name;
char key[MAX_DBKEY_LENGTH]; char key[MAX_DBKEY_LENGTH];
uint key_length; uint key_length;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment