|
|||||||||||
|
bk commit into 4.1 tree (kaa:1.2685) BUG#31174
From: Alexey Kopytov <alexeyk(at)mysql.com>
Date: Wed Oct 10 2007 - 15:01:23 EDT
ChangeSet@1.2685, 2007-10-10 23:01:21+04:00, kaa@polly.(none) +3 -0 Fix for bug #31174: "Repair" command on MyISAM crashes with small myisam_sort_buffer_size. An incorrect length of the sort buffer was used when calculating the maximum number of keys. This resulted in the number of keys < number of BUFFPEK structures, which in turn led to use of uninitialized BUFFPEK structures. myisam/sort.c@1.52, 2007-10-10 23:01:18+04:00, kaa@polly.(none) +4 -2 Use a correct buffer length when calculating the maximum number of keys. Assert that for each BUFFPEK structure there is at least one corresponding key. Otherwise we would fail earlier and not reach merge_buffers(). mysql-test/r/repair.result@1.22, 2007-10-10 23:01:18+04:00, kaa@polly.(none) +27 -0 Added a test case for bug #31174. mysql-test/t/repair.test@1.18, 2007-10-10 23:01:18+04:00, kaa@polly.(none) +30 -1 Added a test case for bug #31174. diff -Nrup a/myisam/sort.c b/myisam/sort.c --- a/myisam/sort.c 2007-05-05 01:38:28 +04:00 +++ b/myisam/sort.c 2007-10-10 23:01:18 +04:00 @@ -897,6 +898,7 @@ merge_buffers(MI_SORT_PARAM *info, uint
count=error=0;
LINT_INIT(to_start_filepos);
--- a/mysql-test/r/repair.result 2007-05-05 01:38:28 +04:00 +++ b/mysql-test/r/repair.result 2007-10-10 23:01:18 +04:00SET myisam_repair_threads=@@global.myisam_repair_threads; SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size; DROP TABLE t1;
+CREATE TABLE t1(a CHAR(255), KEY(a));
+SET myisam_sort_buffer_size=4196;
+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 status OK
+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
diff -Nrup a/mysql-test/t/repair.test b/mysql-test/t/repair.test
--- a/mysql-test/t/repair.test 2006-10-19 16:35:04 +04:00
+++ b/mysql-test/t/repair.test 2007-10-10 23:01:18 +04:00
@@ -83,4 +83,33 @@ SET myisam_repair_threads=@@global.myisa SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size; DROP TABLE t1;
-# End of 4.1 tests
+#
+# BUG#31174 - "Repair" command on MyISAM crashes with small
+# myisam_sort_buffer_size
+#
+CREATE TABLE t1(a CHAR(255), KEY(a));
+SET myisam_sort_buffer_size=4196;
+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;
+ +--echo End of 4.1 tests -- MySQL Code Commits Mailing List For list archives: http://lists.mysql.com/commits To unsubscribe: http://lists.mysql.com/commits?unsub=lists@pantek.comReceived on Wed Oct 10 15:01:47 2007 This archive was generated by hypermail 2.1.8 : Thu Jul 03 2008 - 09:40:48 EDT |
||||||||||
|
|||||||||||