~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/filesort.cc

  • Committer: Mark Atwood
  • Date: 2011-04-29 00:19:38 UTC
  • mto: This revision was merged to the branch mainline in revision 2297.
  • Revision ID: me@mark.atwood.name-20110429001938-ps5i74hzcic7dvr3
Merge in Fixes of Brian's IOCACHE.

Show diffs side-by-side

added added

removed removed

Lines of Context:
120
120
 
121
121
  int write_keys(unsigned char * *sort_keys,
122
122
                 uint32_t count,
123
 
                 internal::IO_CACHE *buffer_file,
124
 
                 internal::IO_CACHE *tempfile);
 
123
                 internal::io_cache_st *buffer_file,
 
124
                 internal::io_cache_st *tempfile);
125
125
 
126
126
  void make_sortkey(unsigned char *to,
127
127
                    unsigned char *ref_pos);
137
137
static char **make_char_array(char **old_pos, uint32_t fields,
138
138
                              uint32_t length);
139
139
 
140
 
static unsigned char *read_buffpek_from_file(internal::IO_CACHE *buffer_file,
 
140
static unsigned char *read_buffpek_from_file(internal::io_cache_st *buffer_file,
141
141
                                             uint32_t count,
142
142
                                             unsigned char *buf);
143
143
 
196
196
  buffpek *buffpek_inst= 0;
197
197
  ha_rows records= HA_POS_ERROR;
198
198
  unsigned char **sort_keys= 0;
199
 
  internal::IO_CACHE tempfile;
200
 
  internal::IO_CACHE buffpek_pointers;
201
 
  internal::IO_CACHE *selected_records_file;
202
 
  internal::IO_CACHE *outfile;
 
199
  internal::io_cache_st tempfile;
 
200
  internal::io_cache_st buffpek_pointers;
 
201
  internal::io_cache_st *selected_records_file;
 
202
  internal::io_cache_st *outfile;
203
203
  SortParam param;
204
204
  bool multi_byte_charset;
205
205
 
475
475
 
476
476
/** Read 'count' number of buffer pointers into memory. */
477
477
 
478
 
static unsigned char *read_buffpek_from_file(internal::IO_CACHE *buffpek_pointers, uint32_t count,
 
478
static unsigned char *read_buffpek_from_file(internal::io_cache_st *buffpek_pointers, uint32_t count,
479
479
                                     unsigned char *buf)
480
480
{
481
481
  uint32_t length= sizeof(buffpek)*count;
537
537
ha_rows FileSort::find_all_keys(SortParam *param, 
538
538
                                optimizer::SqlSelect *select,
539
539
                                unsigned char **sort_keys,
540
 
                                internal::IO_CACHE *buffpek_pointers,
541
 
                                internal::IO_CACHE *tempfile, internal::IO_CACHE *indexfile)
 
540
                                internal::io_cache_st *buffpek_pointers,
 
541
                                internal::io_cache_st *tempfile, internal::io_cache_st *indexfile)
542
542
{
543
543
  int error,flag,quick_select;
544
544
  uint32_t idx,indexpos,ref_length;
724
724
*/
725
725
 
726
726
int SortParam::write_keys(unsigned char **sort_keys, uint32_t count,
727
 
                          internal::IO_CACHE *buffpek_pointers, internal::IO_CACHE *tempfile)
 
727
                          internal::io_cache_st *buffpek_pointers, internal::io_cache_st *tempfile)
728
728
{
729
729
  buffpek buffpek;
730
730
 
1088
1088
/** Merge buffers to make < MERGEBUFF2 buffers. */
1089
1089
 
1090
1090
int FileSort::merge_many_buff(SortParam *param, unsigned char *sort_buffer,
1091
 
                              buffpek *buffpek_inst, uint32_t *maxbuffer, internal::IO_CACHE *t_file)
 
1091
                              buffpek *buffpek_inst, uint32_t *maxbuffer, internal::io_cache_st *t_file)
1092
1092
{
1093
 
  internal::IO_CACHE t_file2,*from_file,*to_file,*temp;
 
1093
  internal::io_cache_st t_file2,*from_file,*to_file,*temp;
1094
1094
  buffpek *lastbuff;
1095
1095
 
1096
1096
  if (*maxbuffer < MERGEBUFF2)
1162
1162
    (uint32_t)-1 if something goes wrong
1163
1163
*/
1164
1164
 
1165
 
uint32_t FileSort::read_to_buffer(internal::IO_CACHE *fromfile, buffpek *buffpek_inst, uint32_t rec_length)
 
1165
uint32_t FileSort::read_to_buffer(internal::io_cache_st *fromfile, buffpek *buffpek_inst, uint32_t rec_length)
1166
1166
{
1167
1167
  uint32_t count;
1168
1168
  uint32_t length;
1219
1219
    other  error
1220
1220
*/
1221
1221
 
1222
 
int FileSort::merge_buffers(SortParam *param, internal::IO_CACHE *from_file,
1223
 
                            internal::IO_CACHE *to_file, unsigned char *sort_buffer,
 
1222
int FileSort::merge_buffers(SortParam *param, internal::io_cache_st *from_file,
 
1223
                            internal::io_cache_st *to_file, unsigned char *sort_buffer,
1224
1224
                            buffpek *lastbuff, buffpek *Fb, buffpek *Tb,
1225
1225
                            int flag)
1226
1226
{
1434
1434
 
1435
1435
int FileSort::merge_index(SortParam *param, unsigned char *sort_buffer,
1436
1436
                          buffpek *buffpek_inst, uint32_t maxbuffer,
1437
 
                          internal::IO_CACHE *tempfile, internal::IO_CACHE *outfile)
 
1437
                          internal::io_cache_st *tempfile, internal::io_cache_st *outfile)
1438
1438
{
1439
1439
  if (merge_buffers(param,tempfile,outfile,sort_buffer,buffpek_inst,buffpek_inst,
1440
1440
                    buffpek_inst+maxbuffer,1))