summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sql/filesort.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/sql/filesort.cc b/sql/filesort.cc
index d877ff4a8a4..6f59c505615 100644
--- a/sql/filesort.cc
+++ b/sql/filesort.cc
@@ -1,4 +1,5 @@
-/* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+/*
+ Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
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,7 +200,8 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length,
{
const ulong min_sort_memory=
- max(MIN_SORT_MEMORY, param.sort_length * MERGEBUFF2);
+ max(MIN_SORT_MEMORY,
+ ALIGN_SIZE(MERGEBUFF2 * (param.rec_length + sizeof(uchar*))));
while (memory_available >= min_sort_memory)
{
ulong keys= memory_available / (param.rec_length + sizeof(char*));