~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/filesort.cc

  • Committer: Olaf van der Spek
  • Date: 2011-08-13 15:57:32 UTC
  • mto: This revision was merged to the branch mainline in revision 2407.
  • Revision ID: olafvdspek@gmail.com-20110813155732-jrr1aq3gyeyxl9qv
Move flush() into iocache

Show diffs side-by-side

added added

removed removed

Lines of Context:
381
381
      goto err;
382
382
    }
383
383
 
384
 
    if (flush_io_cache(&tempfile) || tempfile.reinit_io_cache(internal::READ_CACHE,0L,0,0))
 
384
    if (tempfile.flush() || tempfile.reinit_io_cache(internal::READ_CACHE,0L,0,0))
385
385
    {
386
386
      goto err;
387
387
    }
413
413
 
414
414
  if (my_b_inited(outfile))
415
415
  {
416
 
    if (flush_io_cache(outfile))
 
416
    if (outfile->flush())
417
417
    {
418
418
      error=1;
419
419
    }
1075
1075
 
1076
1076
  if (*maxbuffer < MERGEBUFF2)
1077
1077
    return 0;
1078
 
  if (flush_io_cache(t_file) ||
 
1078
  if (t_file->flush() ||
1079
1079
      t_file2.open_cached_file(drizzle_tmpdir.c_str(),TEMP_PREFIX,DISK_BUFFER_SIZE, MYF(MY_WME)))
1080
1080
  {
1081
1081
    return 1;
1084
1084
  from_file= t_file ; to_file= &t_file2;
1085
1085
  while (*maxbuffer >= MERGEBUFF2)
1086
1086
  {
1087
 
    uint32_t i;
1088
 
 
1089
 
    if (from_file->reinit_io_cache(internal::READ_CACHE,0L,0,0))
1090
 
    {
1091
 
      break;
1092
 
    }
1093
 
 
1094
 
    if (to_file->reinit_io_cache(internal::WRITE_CACHE,0L,0,0))
1095
 
    {
1096
 
      break;
1097
 
    }
1098
 
 
1099
 
    lastbuff=buffpek_inst;
1100
 
    for (i=0 ; i <= *maxbuffer-MERGEBUFF*3/2 ; i+=MERGEBUFF)
1101
 
    {
1102
 
      if (merge_buffers(param,from_file,to_file,sort_buffer,lastbuff++,
1103
 
                        buffpek_inst+i,buffpek_inst+i+MERGEBUFF-1,0))
 
1087
    if (from_file->reinit_io_cache(internal::READ_CACHE, 0, 0, 0)
 
1088
      || to_file->reinit_io_cache(internal::WRITE_CACHE, 0, 0, 0))
 
1089
      break;
 
1090
 
 
1091
    uint32_t i= 0;
 
1092
    lastbuff= buffpek_inst;
 
1093
    for (; i <= *maxbuffer - MERGEBUFF * 3 / 2; i += MERGEBUFF)
 
1094
    {
 
1095
      if (merge_buffers(param, from_file, to_file, sort_buffer, lastbuff++, buffpek_inst + i, buffpek_inst + i + MERGEBUFF - 1, 0))
1104
1096
      {
1105
1097
        goto cleanup;
1106
1098
      }
1107
1099
    }
1108
1100
 
1109
 
    if (merge_buffers(param,from_file,to_file,sort_buffer,lastbuff++,
1110
 
                      buffpek_inst+i,buffpek_inst+ *maxbuffer,0))
1111
 
    {
1112
 
      break;
1113
 
    }
1114
 
 
1115
 
    if (flush_io_cache(to_file))
1116
 
    {
1117
 
      break;
1118
 
    }
 
1101
    if (merge_buffers(param, from_file, to_file, sort_buffer, lastbuff++, buffpek_inst + i, buffpek_inst + *maxbuffer, 0)
 
1102
      || to_file->flush())
 
1103
      break;
1119
1104
 
1120
1105
    temp=from_file; from_file=to_file; to_file=temp;
1121
1106
    from_file->setup_io_cache();