diff options
author | unknown <kaa@polly.(none)> | 2007-10-11 14:28:12 +0400 |
---|---|---|
committer | unknown <kaa@polly.(none)> | 2007-10-11 14:28:12 +0400 |
commit | 1c7b80dff98a1afdc82981e3466874596a8927d1 (patch) | |
tree | 8dd2eb20a23ac075a6d02358dc9bb587f5940b00 /mysql-test/t/repair.test | |
parent | 7a2bb241bd0a80303385ef251ccb422c99c33a0b (diff) | |
download | mariadb-git-1c7b80dff98a1afdc82981e3466874596a8927d1.tar.gz |
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:
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:
Added a test case for bug #31174.
mysql-test/t/repair.test:
Added a test case for bug #31174.
Diffstat (limited to 'mysql-test/t/repair.test')
-rw-r--r-- | mysql-test/t/repair.test | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/mysql-test/t/repair.test b/mysql-test/t/repair.test index 35e5e485cb9..e391e3e0076 100644 --- a/mysql-test/t/repair.test +++ b/mysql-test/t/repair.test @@ -83,4 +83,33 @@ 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 +# +# 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 |