summaryrefslogtreecommitdiff
path: root/sql/filesort.cc
diff options
context:
space:
mode:
authorVarun Gupta <varun.gupta@mariadb.com>2019-11-18 11:50:58 +0530
committerVarun Gupta <varun.gupta@mariadb.com>2019-11-18 11:50:58 +0530
commit290972563673a7de32e10bb0e4bdb37295be1371 (patch)
tree998a258da4fc54e82951b721f9108f70ad5a342e /sql/filesort.cc
parent214023aa0e6ec00dcac386167a2b2cf9394b6c7e (diff)
downloadmariadb-git-290972563673a7de32e10bb0e4bdb37295be1371.tar.gz
MDEV-21044: Wrong result when using a smaller size for sort buffer
Make sure that the sort buffers can store atleast one sort key. This is needed to make sure that all merge buffers are read else with no sort keys some merge buffers are skipped because the code makes a conclusion there is no data to be read.
Diffstat (limited to 'sql/filesort.cc')
-rw-r--r--sql/filesort.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/sql/filesort.cc b/sql/filesort.cc
index 4f195f68059..bb3e73343ad 100644
--- a/sql/filesort.cc
+++ b/sql/filesort.cc
@@ -343,6 +343,7 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length,
param.max_keys_per_buffer=((param.max_keys_per_buffer *
(param.rec_length + sizeof(char*))) /
param.rec_length - 1);
+ set_if_bigger(param.max_keys_per_buffer, 1);
maxbuffer--; // Offset from 0
if (merge_many_buff(&param,
(uchar*) table_sort.get_sort_keys(),