~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/myisam/mi_check.cc

  • Committer: Brian Aker
  • Date: 2010-11-07 00:54:27 UTC
  • mfrom: (1909.1.2 merge)
  • Revision ID: brian@tangent.org-20101107005427-a3kcx1lytrm36a97
Rollup merge of iocache work.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1434
1434
  if (!param->using_global_keycache)
1435
1435
    assert(0);
1436
1436
 
1437
 
  if (init_io_cache(&param->read_cache,info->dfile,
1438
 
                    (uint) param->read_buffer_length,
1439
 
                    READ_CACHE,share->pack.header_length,1,MYF(MY_WME)))
 
1437
  if (param->read_cache.init_io_cache(info->dfile, (uint) param->read_buffer_length, READ_CACHE,share->pack.header_length,1,MYF(MY_WME)))
1440
1438
  {
1441
1439
    memset(&info->rec_cache, 0, sizeof(info->rec_cache));
1442
1440
    goto err;
1443
1441
  }
1444
 
  if (!rep_quick)
1445
 
    if (init_io_cache(&info->rec_cache,-1,(uint) param->write_buffer_length,
1446
 
                      WRITE_CACHE, new_header_length, 1,
1447
 
                      MYF(MY_WME | MY_WAIT_IF_FULL)))
 
1442
  if (not rep_quick)
 
1443
  {
 
1444
    if (info->rec_cache.init_io_cache(-1, (uint) param->write_buffer_length, WRITE_CACHE, new_header_length, 1, MYF(MY_WME | MY_WAIT_IF_FULL)))
 
1445
    {
1448
1446
      goto err;
 
1447
    }
 
1448
  }
1449
1449
  info->opt_flag|=WRITE_CACHE_USED;
1450
1450
  if (!mi_alloc_rec_buff(info, SIZE_MAX, &sort_param.record) ||
1451
1451
      !mi_alloc_rec_buff(info, SIZE_MAX, &sort_param.rec_buff))
1641
1641
  rec_buff_ptr= NULL;
1642
1642
 
1643
1643
  free(sort_info.buff);
1644
 
  end_io_cache(&param->read_cache);
 
1644
  param->read_cache.end_io_cache();
1645
1645
  info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED);
1646
 
  end_io_cache(&info->rec_cache);
 
1646
  info->rec_cache.end_io_cache();
1647
1647
  got_error|= flush_blocks(param, share->getKeyCache(), share->kfile);
1648
 
  if (!got_error && param->testflag & T_UNPACK)
 
1648
  if (not got_error && param->testflag & T_UNPACK)
1649
1649
  {
1650
1650
    share->state.header.options[0]&= (unsigned char) ~HA_OPTION_COMPRESS_RECORD;
1651
1651
    share->pack.header_length=0;
2045
2045
  memset(&sort_info, 0, sizeof(sort_info));
2046
2046
  memset(&sort_param, 0, sizeof(sort_param));
2047
2047
  if (!(sort_info.key_block=
2048
 
        alloc_key_blocks(param,
2049
 
                         (uint) param->sort_key_blocks,
2050
 
                         share->base.max_key_block_length))
2051
 
      || init_io_cache(&param->read_cache,info->dfile,
2052
 
                       (uint) param->read_buffer_length,
2053
 
                       READ_CACHE,share->pack.header_length,1,MYF(MY_WME)) ||
2054
 
      (! rep_quick &&
2055
 
       init_io_cache(&info->rec_cache,info->dfile,
2056
 
                     (uint) param->write_buffer_length,
2057
 
                     WRITE_CACHE,new_header_length,1,
2058
 
                     MYF(MY_WME | MY_WAIT_IF_FULL) & param->myf_rw)))
 
2048
        alloc_key_blocks(param, (uint) param->sort_key_blocks, share->base.max_key_block_length))
 
2049
      || param->read_cache.init_io_cache(info->dfile, (uint) param->read_buffer_length, READ_CACHE,share->pack.header_length,1,MYF(MY_WME))
 
2050
      || (! rep_quick && info->rec_cache.init_io_cache(info->dfile, (uint) param->write_buffer_length, WRITE_CACHE,new_header_length,1, MYF(MY_WME | MY_WAIT_IF_FULL) & param->myf_rw)))
 
2051
  {
2059
2052
    goto err;
 
2053
  }
2060
2054
  sort_info.key_block_end=sort_info.key_block+param->sort_key_blocks;
2061
2055
  info->opt_flag|=WRITE_CACHE_USED;
2062
2056
  info->rec_cache.file=info->dfile;             /* for sort_delete_record */
2207
2201
    if (sort_param.fix_datafile)
2208
2202
    {
2209
2203
      param->read_cache.end_of_file=sort_param.filepos;
2210
 
      if (write_data_suffix(&sort_info,1) || end_io_cache(&info->rec_cache))
 
2204
      if (write_data_suffix(&sort_info, 1) || info->rec_cache.end_io_cache())
2211
2205
      {
2212
2206
        goto err;
2213
2207
      }
2234
2228
      info->state->data_file_length=sort_param.max_pos;
2235
2229
 
2236
2230
    param->read_cache.file=info->dfile;         /* re-init read cache */
2237
 
    reinit_io_cache(&param->read_cache,READ_CACHE,share->pack.header_length,
2238
 
                    1,1);
 
2231
    param->read_cache.reinit_io_cache(READ_CACHE,share->pack.header_length, 1,1);
2239
2232
  }
2240
2233
 
2241
2234
  if (param->testflag & T_WRITE_LOOP)
2293
2286
 
2294
2287
err:
2295
2288
  got_error|= flush_blocks(param, share->getKeyCache(), share->kfile);
2296
 
  end_io_cache(&info->rec_cache);
 
2289
  info->rec_cache.end_io_cache();
2297
2290
  if (!got_error)
2298
2291
  {
2299
2292
    /* Replace the actual file with the temporary file */
2337
2330
 
2338
2331
  free((unsigned char*) sort_info.key_block);
2339
2332
  free(sort_info.buff);
2340
 
  end_io_cache(&param->read_cache);
 
2333
  param->read_cache.end_io_cache();
2341
2334
  info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED);
2342
2335
  if (!got_error && (param->testflag & T_UNPACK))
2343
2336
  {