mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
5.5 merge
This commit is contained in:
@ -12,7 +12,7 @@
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
|
||||
|
||||
|
||||
/**
|
||||
@ -55,7 +55,7 @@ static ha_rows find_all_keys(Sort_param *param,SQL_SELECT *select,
|
||||
IO_CACHE *tempfile,
|
||||
Bounded_queue<uchar, uchar> *pq,
|
||||
ha_rows *found_rows);
|
||||
static int write_keys(Sort_param *param, Filesort_info *fs_info,
|
||||
static bool write_keys(Sort_param *param, Filesort_info *fs_info,
|
||||
uint count, IO_CACHE *buffer_file, IO_CACHE *tempfile);
|
||||
static void make_sortkey(Sort_param *param, uchar *to, uchar *ref_pos);
|
||||
static void register_used_fields(Sort_param *param);
|
||||
@ -147,7 +147,7 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length,
|
||||
ha_rows *found_rows)
|
||||
{
|
||||
int error;
|
||||
ulong memory_available= thd->variables.sortbuff_size;
|
||||
size_t memory_available= thd->variables.sortbuff_size;
|
||||
uint maxbuffer;
|
||||
BUFFPEK *buffpek;
|
||||
ha_rows num_rows= HA_POS_ERROR;
|
||||
@ -245,11 +245,11 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length,
|
||||
{
|
||||
DBUG_PRINT("info", ("filesort PQ is not applicable"));
|
||||
|
||||
ulong min_sort_memory= max(MIN_SORT_MEMORY, param.sort_length*MERGEBUFF2);
|
||||
size_t min_sort_memory= max(MIN_SORT_MEMORY, param.sort_length*MERGEBUFF2);
|
||||
set_if_bigger(min_sort_memory, sizeof(BUFFPEK*)*MERGEBUFF2);
|
||||
while (memory_available >= min_sort_memory)
|
||||
{
|
||||
ulong keys= memory_available / (param.rec_length + sizeof(char*));
|
||||
ulonglong keys= memory_available / (param.rec_length + sizeof(char*));
|
||||
param.max_keys_per_buffer= (uint) min(num_rows, keys);
|
||||
if (table_sort.get_sort_keys())
|
||||
{
|
||||
@ -267,7 +267,7 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length,
|
||||
table_sort.alloc_sort_buffer(param.max_keys_per_buffer, param.rec_length);
|
||||
if (table_sort.get_sort_keys())
|
||||
break;
|
||||
ulong old_memory_available= memory_available;
|
||||
size_t old_memory_available= memory_available;
|
||||
memory_available= memory_available/4*3;
|
||||
if (memory_available < min_sort_memory &&
|
||||
old_memory_available > min_sort_memory)
|
||||
@ -449,7 +449,7 @@ void filesort_free_buffers(TABLE *table, bool full)
|
||||
static uchar *read_buffpek_from_file(IO_CACHE *buffpek_pointers, uint count,
|
||||
uchar *buf)
|
||||
{
|
||||
ulong length= sizeof(BUFFPEK)*count;
|
||||
size_t length= sizeof(BUFFPEK)*count;
|
||||
uchar *tmp= buf;
|
||||
DBUG_ENTER("read_buffpek_from_file");
|
||||
if (count > UINT_MAX/sizeof(BUFFPEK))
|
||||
@ -791,7 +791,7 @@ static ha_rows find_all_keys(Sort_param *param, SQL_SELECT *select,
|
||||
1 Error
|
||||
*/
|
||||
|
||||
static int
|
||||
static bool
|
||||
write_keys(Sort_param *param, Filesort_info *fs_info, uint count,
|
||||
IO_CACHE *buffpek_pointers, IO_CACHE *tempfile)
|
||||
{
|
||||
@ -952,7 +952,7 @@ static void make_sortkey(register Sort_param *param,
|
||||
else
|
||||
{
|
||||
MYSQL_TIME buf;
|
||||
if (item->get_date_result(&buf, TIME_FUZZY_DATE | TIME_INVALID_DATES))
|
||||
if (item->get_date_result(&buf, TIME_INVALID_DATES))
|
||||
{
|
||||
DBUG_ASSERT(maybe_null);
|
||||
DBUG_ASSERT(item->null_value);
|
||||
|
Reference in New Issue
Block a user