summaryrefslogtreecommitdiff
path: root/mysql-test/t/repair.test
diff options
context:
space:
mode:
authorunknown <svoj@mysql.com/april.(none)>2006-10-18 17:57:29 +0500
committerunknown <svoj@mysql.com/april.(none)>2006-10-18 17:57:29 +0500
commit48cf65c037a870d1ee2bb9c3aeade85d2b36a248 (patch)
tree53984d04f062e309c8ffd5e75aa6f749396a3814 /mysql-test/t/repair.test
parent403cc15508e9129db0196e8b98b72a4ff1a4db03 (diff)
downloadmariadb-git-48cf65c037a870d1ee2bb9c3aeade85d2b36a248.tar.gz
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.
Diffstat (limited to 'mysql-test/t/repair.test')
-rw-r--r--mysql-test/t/repair.test28
1 files changed, 28 insertions, 0 deletions
diff --git a/mysql-test/t/repair.test b/mysql-test/t/repair.test
index f086d5b0c2a..b192d5c0a64 100644
--- a/mysql-test/t/repair.test
+++ b/mysql-test/t/repair.test
@@ -45,4 +45,32 @@ SHOW INDEX FROM t1;
SET myisam_repair_threads=@@global.myisam_repair_threads;
DROP TABLE t1;
+#
+# BUG#23175 - MYISAM crash/repair failed during repair
+#
+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;
+SET myisam_repair_threads=@@global.myisam_repair_threads;
+SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
+DROP TABLE t1;
+
# End of 4.1 tests