diff options
author | Sergei Golubchik <serg@mariadb.org> | 2015-06-05 02:06:51 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2015-06-05 02:06:51 +0200 |
commit | f84f577aa15a193f24c3119eafdee554cb9775fb (patch) | |
tree | ee531580839374516db09b2409ec4bd57a847e8a /sql/filesort.cc | |
parent | f07b3463e7a4ff32316e1cc94d553b5009ac51f2 (diff) | |
parent | 31c803e8d0543b330aa8e61ef878da43fe1f68f7 (diff) | |
download | mariadb-git-f84f577aa15a193f24c3119eafdee554cb9775fb.tar.gz |
Merge tag 'mysql-5.5.44' into bb-5.5-serg
Diffstat (limited to 'sql/filesort.cc')
-rw-r--r-- | sql/filesort.cc | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/sql/filesort.cc b/sql/filesort.cc index d6cb22ebe2c..5bb5c64409a 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -1,5 +1,5 @@ -/* Copyright (c) 2000, 2014, Oracle and/or its affiliates. - Copyright (c) 2009, 2014, Monty Program Ab. +/* Copyright (c) 2000, 2015, Oracle and/or its affiliates. + Copyright (c) 2009, 2015, MariaDB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -199,6 +199,13 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length, set_if_bigger(min_sort_memory, sizeof(BUFFPEK*)*MERGEBUFF2); if (!table_sort.sort_keys) { + /* + Cannot depend on num_rows. For external sort, space for upto MERGEBUFF2 + rows is required. + */ + if (num_rows < MERGEBUFF2) + num_rows= MERGEBUFF2; + while (memory_available >= min_sort_memory) { ulonglong keys= memory_available / (param.rec_length + sizeof(char*)); |