~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/filesort.cc

  • Committer: Andrew Hutchings
  • Date: 2010-10-22 13:52:10 UTC
  • mto: This revision was merged to the branch mainline in revision 1907.
  • Revision ID: andrew@linuxjedi.co.uk-20101022135210-puqqk8yg94cshbg4
Change default setting
Don't allow it to be less than sort-buffer-size
Move to pre-alloc for sort buffer

Show diffs side-by-side

added added

removed removed

Lines of Context:
251
251
    uint32_t old_memavl;
252
252
    uint32_t keys= memavl/(param.rec_length+sizeof(char*));
253
253
    param.keys= (uint32_t) min(records+1, (ha_rows)keys);
 
254
 
 
255
    allocated_sort_memory= param.keys * param.rec_length;
 
256
    if (not global_sort_buffer.add(allocated_sort_memory))
 
257
    {
 
258
      my_error(ER_OUT_OF_GLOBAL_SORTMEMORY, MYF(ME_ERROR+ME_WAITTANG));
 
259
      goto err;
 
260
    }
 
261
 
254
262
    if ((table_sort.sort_keys=
255
263
         (unsigned char **) make_char_array((char **) table_sort.sort_keys,
256
264
                                            param.keys, param.rec_length)))
257
265
      break;
 
266
 
 
267
    global_sort_buffer.sub(allocated_sort_memory);
258
268
    old_memavl= memavl;
259
269
    if ((memavl= memavl/4*3) < min_sort_memory && old_memavl > min_sort_memory)
260
270
      memavl= min_sort_memory;
265
275
    my_error(ER_OUT_OF_SORTMEMORY,MYF(ME_ERROR+ME_WAITTANG));
266
276
    goto err;
267
277
  }
268
 
  allocated_sort_memory= param.keys * param.rec_length;
269
 
  if (not global_sort_buffer.add(allocated_sort_memory))
270
 
  {
271
 
    my_error(ER_OUT_OF_GLOBAL_SORTMEMORY, MYF(ME_ERROR+ME_WAITTANG));
272
 
    goto err;
273
 
  }
274
278
 
275
279
  if (open_cached_file(&buffpek_pointers,drizzle_tmpdir.c_str(),TEMP_PREFIX,
276
280
                       DISK_BUFFER_SIZE, MYF(MY_WME)))