~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/myisam/mi_check.c

  • Committer: Monty
  • Date: 2008-10-02 05:41:33 UTC
  • mfrom: (398.1.10 codestyle)
  • Revision ID: mordred@scylla.inaugust.com-20081002054133-tyxv5bmqpazfaqqi
Merged up to 408 of stdint-includes-fix.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1125
1125
      records++;
1126
1126
      if (param->testflag & T_WRITE_LOOP && records % WRITE_COUNT == 0)
1127
1127
      {
1128
 
        printf("%s\r", llstr(records,llbuff)); VOID(fflush(stdout));
 
1128
        printf("%s\r", llstr(records,llbuff)); fflush(stdout);
1129
1129
      }
1130
1130
 
1131
1131
      /* Check if keys match the record */
1172
1172
  }
1173
1173
  if (param->testflag & T_WRITE_LOOP)
1174
1174
  {
1175
 
    VOID(fputs("          \r",stdout)); VOID(fflush(stdout));
 
1175
    fputs("          \r",stdout); fflush(stdout);
1176
1176
  }
1177
1177
  if (records != info->state->records)
1178
1178
  {
1435
1435
    param->testflag|=T_CALC_CHECKSUM;
1436
1436
 
1437
1437
  if (!param->using_global_keycache)
1438
 
    VOID(init_key_cache(dflt_key_cache, param->key_cache_block_size,
1439
 
                        param->use_buffers, 0, 0));
 
1438
    init_key_cache(dflt_key_cache, param->key_cache_block_size,
 
1439
                   param->use_buffers, 0, 0);
1440
1440
 
1441
1441
  if (init_io_cache(&param->read_cache,info->dfile,
1442
1442
                    (uint) param->read_buffer_length,
1528
1528
                          llstr(info->dupp_key_pos,llbuff2));
1529
1529
      if (param->testflag & T_VERBOSE)
1530
1530
      {
1531
 
        VOID(_mi_make_key(info,(uint) info->errkey,info->lastkey,
1532
 
                          sort_param.record,0L));
 
1531
        _mi_make_key(info,(uint) info->errkey,info->lastkey,
 
1532
                     sort_param.record,0L);
1533
1533
      }
1534
1534
      sort_info.dupp++;
1535
1535
      if ((param->testflag & (T_FORCE_UNIQUENESS|T_QUICK)) == T_QUICK)
1549
1549
 
1550
1550
  if (param->testflag & T_WRITE_LOOP)
1551
1551
  {
1552
 
    VOID(fputs("          \r",stdout)); VOID(fflush(stdout));
 
1552
    fputs("          \r",stdout); fflush(stdout);
1553
1553
  }
1554
1554
  if (ftruncate(share->kfile, info->state->key_file_length))
1555
1555
  {
1631
1631
                  llstr(sort_param.start_recpos,llbuff));
1632
1632
    if (new_file >= 0)
1633
1633
    {
1634
 
      VOID(my_close(new_file,MYF(0)));
1635
 
      VOID(my_raid_delete(param->temp_filename,info->s->base.raid_chunks,
1636
 
                          MYF(MY_WME)));
 
1634
      my_close(new_file,MYF(0));
 
1635
      my_raid_delete(param->temp_filename,info->s->base.raid_chunks,
 
1636
                     MYF(MY_WME));
1637
1637
      info->rec_cache.file=-1; /* don't flush data to new_file, it's closed */
1638
1638
    }
1639
1639
    mi_mark_crashed_on_repair(info);
1643
1643
  my_free(mi_get_rec_buff_ptr(info, sort_param.record),
1644
1644
          MYF(MY_ALLOW_ZERO_PTR));
1645
1645
  my_free(sort_info.buff,MYF(MY_ALLOW_ZERO_PTR));
1646
 
  VOID(end_io_cache(&param->read_cache));
 
1646
  end_io_cache(&param->read_cache);
1647
1647
  info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED);
1648
 
  VOID(end_io_cache(&info->rec_cache));
 
1648
  end_io_cache(&info->rec_cache);
1649
1649
  got_error|=flush_blocks(param, share->key_cache, share->kfile);
1650
1650
  if (!got_error && param->testflag & T_UNPACK)
1651
1651
  {
1846
1846
        /* Put same locks as old file */
1847
1847
  share->r_locks= share->w_locks= share->tot_locks= 0;
1848
1848
  (void) _mi_writeinfo(info,WRITEINFO_UPDATE_KEYFILE);
1849
 
  VOID(my_close(share->kfile,MYF(MY_WME)));
 
1849
  my_close(share->kfile,MYF(MY_WME));
1850
1850
  share->kfile = -1;
1851
 
  VOID(my_close(new_file,MYF(MY_WME)));
 
1851
  my_close(new_file,MYF(MY_WME));
1852
1852
  if (change_to_newfile(share->index_file_name,MI_NAME_IEXT,INDEX_TMP_EXT,0,
1853
1853
                        MYF(0)) ||
1854
1854
      mi_open_keyfile(share))
1872
1872
  return(0);
1873
1873
 
1874
1874
err:
1875
 
  VOID(my_close(new_file,MYF(MY_WME)));
 
1875
  my_close(new_file,MYF(MY_WME));
1876
1876
err2:
1877
 
  VOID(my_delete(param->temp_filename,MYF(MY_WME)));
 
1877
  my_delete(param->temp_filename,MYF(MY_WME));
1878
1878
  return(-1);
1879
1879
} /* mi_sort_index */
1880
1880
 
1982
1982
    buff=tmp_buff; buff_length=IO_SIZE;
1983
1983
  }
1984
1984
 
1985
 
  VOID(my_seek(from,start,MY_SEEK_SET,MYF(0)));
 
1985
  my_seek(from,start,MY_SEEK_SET,MYF(0));
1986
1986
  while (length > buff_length)
1987
1987
  {
1988
1988
    if (my_read(from,(uchar*) buff,buff_length,MYF(MY_NABP)) ||
2252
2252
 
2253
2253
  if (param->testflag & T_WRITE_LOOP)
2254
2254
  {
2255
 
    VOID(fputs("          \r",stdout)); VOID(fflush(stdout));
 
2255
    fputs("          \r",stdout); fflush(stdout);
2256
2256
  }
2257
2257
 
2258
2258
  if (rep_quick && del+sort_info.dupp != info->state->del)
2305
2305
 
2306
2306
err:
2307
2307
  got_error|= flush_blocks(param, share->key_cache, share->kfile);
2308
 
  VOID(end_io_cache(&info->rec_cache));
 
2308
  end_io_cache(&info->rec_cache);
2309
2309
  if (!got_error)
2310
2310
  {
2311
2311
    /* Replace the actual file with the temporary file */
2327
2327
      mi_check_print_error(param,"%d when fixing table",my_errno);
2328
2328
    if (new_file >= 0)
2329
2329
    {
2330
 
      VOID(my_close(new_file,MYF(0)));
2331
 
      VOID(my_raid_delete(param->temp_filename,share->base.raid_chunks,
2332
 
                          MYF(MY_WME)));
 
2330
      my_close(new_file,MYF(0));
 
2331
      my_raid_delete(param->temp_filename,share->base.raid_chunks,
 
2332
                     MYF(MY_WME));
2333
2333
      if (info->dfile == new_file)
2334
2334
        info->dfile= -1;
2335
2335
    }
2345
2345
          MYF(MY_ALLOW_ZERO_PTR));
2346
2346
  my_free((uchar*) sort_info.key_block,MYF(MY_ALLOW_ZERO_PTR));
2347
2347
  my_free(sort_info.buff,MYF(MY_ALLOW_ZERO_PTR));
2348
 
  VOID(end_io_cache(&param->read_cache));
 
2348
  end_io_cache(&param->read_cache);
2349
2349
  info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED);
2350
2350
  if (!got_error && (param->testflag & T_UNPACK))
2351
2351
  {
2806
2806
    the share by remove_io_thread() or it was not yet started (if the
2807
2807
    error happend before creating the thread).
2808
2808
  */
2809
 
  VOID(end_io_cache(&info->rec_cache));
 
2809
  end_io_cache(&info->rec_cache);
2810
2810
  /*
2811
2811
    Destroy the new data cache in case of non-quick repair. All slave
2812
2812
    threads did either detach from the share by remove_io_thread()
2814
2814
    creating the threads).
2815
2815
  */
2816
2816
  if (!rep_quick)
2817
 
    VOID(end_io_cache(&new_data_cache));
 
2817
    end_io_cache(&new_data_cache);
2818
2818
  if (!got_error)
2819
2819
  {
2820
2820
    /* Replace the actual file with the temporary file */
2836
2836
      mi_check_print_error(param,"%d when fixing table",my_errno);
2837
2837
    if (new_file >= 0)
2838
2838
    {
2839
 
      VOID(my_close(new_file,MYF(0)));
2840
 
      VOID(my_raid_delete(param->temp_filename,share->base.raid_chunks,
2841
 
                          MYF(MY_WME)));
 
2839
      my_close(new_file,MYF(0));
 
2840
      my_raid_delete(param->temp_filename,share->base.raid_chunks,
 
2841
                     MYF(MY_WME));
2842
2842
      if (info->dfile == new_file)
2843
2843
        info->dfile= -1;
2844
2844
    }
2854
2854
  my_free((uchar*) sort_info.key_block,MYF(MY_ALLOW_ZERO_PTR));
2855
2855
  my_free((uchar*) sort_param,MYF(MY_ALLOW_ZERO_PTR));
2856
2856
  my_free(sort_info.buff,MYF(MY_ALLOW_ZERO_PTR));
2857
 
  VOID(end_io_cache(&param->read_cache));
 
2857
  end_io_cache(&param->read_cache);
2858
2858
  info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED);
2859
2859
  if (!got_error && (param->testflag & T_UNPACK))
2860
2860
  {
3374
3374
    {
3375
3375
      char llbuff[22];
3376
3376
      printf("%s\r", llstr(info->state->records,llbuff));
3377
 
      VOID(fflush(stdout));
 
3377
      fflush(stdout);
3378
3378
    }
3379
3379
  }
3380
3380
  return(0);
3505
3505
  key_block->end_pos+=t_length;
3506
3506
  if (a_length <= keyinfo->block_length)
3507
3507
  {
3508
 
    VOID(_mi_move_key(keyinfo,key_block->lastkey,key));
 
3508
    _mi_move_key(keyinfo,key_block->lastkey,key);
3509
3509
    key_block->last_length=a_length-t_length;
3510
3510
    return(0);
3511
3511
  }
3776
3776
  set_if_bigger(file_length,tmp_length);
3777
3777
  set_if_bigger(file_length,(uint64_t) share.base.max_data_file_length);
3778
3778
 
3779
 
  VOID(mi_close(*org_info));
 
3779
  mi_close(*org_info);
3780
3780
  memset(&create_info, 0, sizeof(create_info));
3781
3781
  create_info.max_rows=cmax(max_records,share.base.records);
3782
3782
  create_info.reloc_rows=share.base.reloc;
3817
3817
  }
3818
3818
  /* We are modifing */
3819
3819
  (*org_info)->s->options&= ~HA_OPTION_READ_ONLY_DATA;
3820
 
  VOID(_mi_readinfo(*org_info,F_WRLCK,0));
 
3820
  _mi_readinfo(*org_info,F_WRLCK,0);
3821
3821
  (*org_info)->state->records=info.state->records;
3822
3822
  if (share.state.create_time)
3823
3823
    (*org_info)->s->state.create_time=share.state.create_time;