Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

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


Below is the list of changes that have just been committed into a local 4.1 repository of kaa. When kaa does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository.
For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

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

@@ -559,9 +559,10 @@ int thr_write_keys(MI_SORT_PARAM *sort_p
if (!mergebuf) { length=param->sort_buffer_length; - while (length >= MIN_SORT_MEMORY && !mergebuf) + while (length >= MIN_SORT_MEMORY) { - mergebuf=my_malloc(length, MYF(0)); + if ((mergebuf= my_malloc(length, MYF(0)))) + break; length=length*3/4; } if (!mergebuf)

@@ -897,6 +898,7 @@ merge_buffers(MI_SORT_PARAM *info, uint
 

   count=error=0;
   maxcount=keys/((uint) (Tb-Fb) +1);
+ DBUG_ASSERT(maxcount > 0);

   LINT_INIT(to_start_filepos);
   if (to_file)
     to_start_filepos=my_b_tell(to_file); diff -Nrup a/mysql-test/r/repair.result b/mysql-test/r/repair.result

--- 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:00

@@ -83,3 +83,30 @@ 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;
+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
Do you need more help?X
+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;
Can we help you?X

+
+--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.com
Received on Wed Oct 10 15:01:47 2007
Do you need help?X

This archive was generated by hypermail 2.1.8 : Thu Jul 03 2008 - 09:40:48 EDT


Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library