From fbee9f5b6e25e60c7e6785b3125a277426eb78b5 Mon Sep 17 00:00:00 2001 From: Igor Babaev Date: Tue, 14 Aug 2012 14:25:56 -0700 Subject: [PATCH] Corrected the pactch for mdev-449 to fix valgrind failures. --- sql/filesort.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sql/filesort.cc b/sql/filesort.cc index 4d06317447a..46348f91bb4 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -285,7 +285,8 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length, Use also the space previously used by string pointers in sort_buffer for temporary key storage. */ - param.keys= sort_buff_sz / param.rec_length; + param.keys=((param.keys*(param.rec_length+sizeof(char*))) / + param.rec_length-1); maxbuffer--; // Offset from 0 if (merge_many_buff(¶m,(uchar*) sort_keys,buffpek,&maxbuffer, &tempfile)) @@ -1260,8 +1261,7 @@ int merge_buffers(SORTPARAM *param, IO_CACHE *from_file, strpos= sort_buffer; org_max_rows=max_rows= param->max_rows; - /* The following will fire if there is not enough space in sort_buffer */ - DBUG_ASSERT(maxcount!=0); + set_if_bigger(maxcount, 1); if (unique_buff) {