From 31754c57bd388b57c57c68df0c763af6a3bd7216 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 11 Oct 2006 20:34:20 +0500 Subject: 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). --- mysql-test/r/repair.result | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'mysql-test/r/repair.result') diff --git a/mysql-test/r/repair.result b/mysql-test/r/repair.result index c069824e9f0..815305013be 100644 --- a/mysql-test/r/repair.result +++ b/mysql-test/r/repair.result @@ -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 SET myisam_repair_threads=@@global.myisam_repair_threads; 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; -- cgit v1.2.1 From 48cf65c037a870d1ee2bb9c3aeade85d2b36a248 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 18 Oct 2006 17:57:29 +0500 Subject: BUG#23175 - MYISAM crash/repair failed during repair Repair table could crash a server if there is not sufficient memory (myisam_sort_buffer_size) to operate. Affects not only repair, but also all statements that use create index by sort: repair by sort, parallel repair, bulk insert. Return an error if there is not sufficient memory to store at least one key per BUFFPEK. Also fixed memory leak if thr_find_all_keys returns an error. myisam/sort.c: maxbuffer is number of BUFFPEK-s for repair. It is calculated as records / keys. keys is number of keys that can be stored in memory (myisam_sort_buffer_size). There must be sufficient memory to store both BUFFPEK-s and keys. It was checked correctly before this patch. However there is another requirement that wasn't checked: there must be sufficient memory for at least one key per BUFFPEK, otherwise repair by sort/parallel repair cannot operate. Return an error if there is not sufficient memory to store at least one key per BUFFPEK. Also fixed memory leak if thr_find_all_keys returns an error. mysql-test/r/repair.result: A test case for BUG#23175. mysql-test/t/repair.test: A test case for BUG#23175. --- mysql-test/r/repair.result | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'mysql-test/r/repair.result') diff --git a/mysql-test/r/repair.result b/mysql-test/r/repair.result index c069824e9f0..8b3782ec2a4 100644 --- a/mysql-test/r/repair.result +++ b/mysql-test/r/repair.result @@ -48,3 +48,31 @@ 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 SET myisam_repair_threads=@@global.myisam_repair_threads; DROP TABLE t1; +CREATE TABLE t1(a CHAR(255), KEY(a)); +SET myisam_sort_buffer_size=4096; +INSERT INTO t1 VALUES +('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'), +('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'), +('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'), +('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'), +('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'), +('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'), +('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'), +('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'), +('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'), +('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'), +('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'), +('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'), +('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'), +('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'), +('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'), +('0'),('0'),('0'),('0'),('0'),('0'),('0'); +SET myisam_repair_threads=2; +REPAIR TABLE t1; +Table Op Msg_type Msg_text +test.t1 repair error sort_buffer_size is to small +test.t1 repair warning Number of rows changed from 0 to 157 +test.t1 repair status OK +SET myisam_repair_threads=@@global.myisam_repair_threads; +SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size; +DROP TABLE t1; -- cgit v1.2.1