summaryrefslogtreecommitdiff
path: root/mysql-test/t/myisam.test
diff options
context:
space:
mode:
authorSergey Vojtovich <svoj@sun.com>2009-10-09 21:16:29 +0500
committerSergey Vojtovich <svoj@sun.com>2009-10-09 21:16:29 +0500
commit11c2da53ac14c8aceea38e65169fc40c1a08eb99 (patch)
tree12dae5d03212639ae5c30aa8df421e3a7feef318 /mysql-test/t/myisam.test
parent88abcc64383d10356379f7f4575982f42113b45d (diff)
downloadmariadb-git-11c2da53ac14c8aceea38e65169fc40c1a08eb99.tar.gz
BUG#47073 - valgrind errs, corruption,failed repair of partition,
low myisam_sort_buffer_size Repair by sort (default) or parallel repair of a MyISAM table (doesn't matter partitioned or not) as well as bulk inserts and enable indexes some times didn't failover to repair with key cache. The problem was that after unsuccessful attempt, data file was closed. Whereas repair with key cache requires open data file. Fixed by reopening data file. Also fixed a valgrind warning, which may appear during repair by sort or parallel repair with certain myisam_sort_buffer_size number of rows and length of an index entry (very dependent). mysql-test/r/myisam.result: A test case for BUG#47073. mysql-test/t/myisam.test: A test case for BUG#47073. storage/myisam/ha_myisam.cc: Reverted fix for BUG25289. Not needed anymore. storage/myisam/mi_check.c: Reopen data file, when repair by sort or parallel repair fails. When repair by sort is requested to rebuild data file, data file gets rebuilt while fixing first index. When rebuild is completed, info->dfile is pointing to temporary data file, original data file is closed. It may happen that repair has successfully fixed first index and rebuilt data file, but failed to fix second index. E.g. myisam_sort_buffer_size was big enough to fix first shorter index, but not enough to fix subsequent longer index. In this case we end up with info->dfile pointing to temporary file, which is removed and info->dfile is set to -1. Though repair by sort failed, the upper layer may still want to try repair with key cache. But it needs info->dfile pointing to valid data file. storage/myisam/sort.c: When performing a copy of IO_CACHE structure, current_pos and current_end must be updated separatly to point to memory we're copying to (not to memory we're copying from). As t_file2 is always WRITE cache, proper members are write_pos and write_end accordingly.
Diffstat (limited to 'mysql-test/t/myisam.test')
-rw-r--r--mysql-test/t/myisam.test28
1 files changed, 28 insertions, 0 deletions
diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test
index 5de7c997a24..faeb5ee686a 100644
--- a/mysql-test/t/myisam.test
+++ b/mysql-test/t/myisam.test
@@ -1518,5 +1518,33 @@ CREATE TABLE t3 select * from t1;
checksum table t3;
drop table t1,t2,t3;
+
+#
+# BUG#47073 - valgrind errs, corruption,failed repair of partition,
+# low myisam_sort_buffer_size
+#
+CREATE TABLE t1(a INT, b CHAR(10), KEY(a), KEY(b));
+INSERT INTO t1 VALUES(1,'0'),(2,'0'),(3,'0'),(4,'0'),(5,'0'),
+ (6,'0'),(7,'0');
+INSERT INTO t1 SELECT a+10,b FROM t1;
+INSERT INTO t1 SELECT a+20,b FROM t1;
+INSERT INTO t1 SELECT a+40,b FROM t1;
+INSERT INTO t1 SELECT a+80,b FROM t1;
+INSERT INTO t1 SELECT a+160,b FROM t1;
+INSERT INTO t1 SELECT a+320,b FROM t1;
+INSERT INTO t1 SELECT a+640,b FROM t1;
+INSERT INTO t1 SELECT a+1280,b FROM t1;
+INSERT INTO t1 SELECT a+2560,b FROM t1;
+INSERT INTO t1 SELECT a+5120,b FROM t1;
+SET myisam_sort_buffer_size=4;
+REPAIR TABLE t1;
+SET myisam_repair_threads=2;
+# May report different values depending on threads activity.
+--replace_regex /changed from [0-9]+/changed from #/
+REPAIR TABLE t1;
+SET myisam_repair_threads=@@global.myisam_repair_threads;
+SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
+DROP TABLE t1;
+
--echo End of 5.1 tests