|
|||||||||||
|
bk commit into 4.1 tree (kaa:1.2685) BUG#31174
From: Alexey Kopytov <alexeyk(at)mysql.com>
Date: Thu Oct 11 2007 - 06:28:18 EDT
ChangeSet@1.2685, 2007-10-11 14:28:12+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. When myisam_sort_buffer_size is small enough, this could result in the number of keys < number of BUFFPEK structures which in turn led to use of uninitialized BUFFPEKs. Fixed by correcting the buffer length calculation. myisam/sort.c@1.52, 2007-10-11 14:28:08+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-11 14:28:09+04:00, kaa@polly.(none) +27 -0 Added a test case for bug #31174. mysql-test/t/repair.test@1.18, 2007-10-11 14:28:09+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-11 14:28:08 +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-11 14:28:09 +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-11 14:28:09 +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 Thu Oct 11 06:28:28 2007 This archive was generated by hypermail 2.1.8 : Thu Jul 03 2008 - 09:42:26 EDT |
||||||||||
|
|||||||||||