diff options
author | unknown <kaa@polly.(none)> | 2007-10-16 19:20:00 +0400 |
---|---|---|
committer | unknown <kaa@polly.(none)> | 2007-10-16 19:20:00 +0400 |
commit | 9ef7b5f6f0a71208892ad97c89f5e6aba173b5a3 (patch) | |
tree | 4fc28944e0debe5dbd0863c4a795e6a01cd4896e | |
parent | 13afffd03b80ab73d813158f3d0a1ebf63a5ef31 (diff) | |
parent | 99a7866a93823dad2e22ae9125bc57fa9643e838 (diff) | |
download | mariadb-git-9ef7b5f6f0a71208892ad97c89f5e6aba173b5a3.tar.gz |
Merge polly.(none):/home/kaa/src/maint/mysql-4.1-maint
into polly.(none):/home/kaa/src/maint/mysql-5.0-maint
myisam/sort.c:
Auto merged
mysql-test/r/repair.result:
Auto merged
mysql-test/t/repair.test:
Auto merged
-rw-r--r-- | myisam/sort.c | 6 | ||||
-rw-r--r-- | mysql-test/r/repair.result | 27 | ||||
-rw-r--r-- | mysql-test/t/repair.test | 31 |
3 files changed, 61 insertions, 3 deletions
diff --git a/myisam/sort.c b/myisam/sort.c index f48161b7c8e..a3fab5025a8 100644 --- a/myisam/sort.c +++ b/myisam/sort.c @@ -565,9 +565,10 @@ int thr_write_keys(MI_SORT_PARAM *sort_param) 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) @@ -905,6 +906,7 @@ merge_buffers(MI_SORT_PARAM *info, uint keys, IO_CACHE *from_file, 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 --git a/mysql-test/r/repair.result b/mysql-test/r/repair.result index bd746711f1f..a7b74600c3c 100644 --- a/mysql-test/r/repair.result +++ b/mysql-test/r/repair.result @@ -88,3 +88,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 +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 --git a/mysql-test/t/repair.test b/mysql-test/t/repair.test index f2e4c328218..baaa7316bbe 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 |