~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/myisam/mi_check.cc

  • Committer: Monty Taylor
  • Date: 2010-02-04 08:14:46 UTC
  • mfrom: (1277.2.1 build) (1280.2.1 build)
  • mto: This revision was merged to the branch mainline in revision 1283.
  • Revision ID: mordred@inaugust.com-20100204081446-ldh9m486va30uap6
Put everything in drizzled into drizzled namespace.
Put internal stuff into drizzled::internal namespace.
Removed some cruft.
Now every symbol that is shipped in a header is in the drizzled namespace
and everything in the server that's not shipped is labeled internal. woot. 
Removed a lot of the extra extern "C" stuff that was in there. Less ugliness for
internal callbacks now for Sun Studio.

Show diffs side-by-side

added added

removed removed

Lines of Context:
59
59
#include <algorithm>
60
60
 
61
61
using namespace std;
 
62
using namespace drizzled;
 
63
using namespace drizzled::internal;
62
64
 
63
65
 
64
66
#define my_off_t2double(A)  ((double) (my_off_t) (A))
74
76
static int writekeys(MI_SORT_PARAM *sort_param);
75
77
static int sort_one_index(MI_CHECK *param, MI_INFO *info,MI_KEYDEF *keyinfo,
76
78
                          my_off_t pagepos, int new_file);
77
 
extern "C"
78
 
{
79
 
  int sort_key_read(MI_SORT_PARAM *sort_param,void *key);
80
 
  int sort_get_next_record(MI_SORT_PARAM *sort_param);
81
 
  int sort_key_cmp(MI_SORT_PARAM *sort_param, const void *a,const void *b);
82
 
  int sort_key_write(MI_SORT_PARAM *sort_param, const void *a);
83
 
  my_off_t get_record_for_key(MI_INFO *info,MI_KEYDEF *keyinfo,
84
 
                              unsigned char *key);
85
 
  int sort_insert_key(MI_SORT_PARAM  *sort_param,
86
 
                      register SORT_KEY_BLOCKS *key_block,
87
 
                      unsigned char *key, my_off_t prev_block);
88
 
  int sort_delete_record(MI_SORT_PARAM *sort_param);
89
 
}
 
79
int sort_key_read(MI_SORT_PARAM *sort_param,void *key);
 
80
int sort_get_next_record(MI_SORT_PARAM *sort_param);
 
81
int sort_key_cmp(MI_SORT_PARAM *sort_param, const void *a,const void *b);
 
82
int sort_key_write(MI_SORT_PARAM *sort_param, const void *a);
 
83
my_off_t get_record_for_key(MI_INFO *info,MI_KEYDEF *keyinfo,
 
84
                            unsigned char *key);
 
85
int sort_insert_key(MI_SORT_PARAM  *sort_param,
 
86
                    register SORT_KEY_BLOCKS *key_block,
 
87
                    unsigned char *key, my_off_t prev_block);
 
88
int sort_delete_record(MI_SORT_PARAM *sort_param);
 
89
 
90
90
/*static int flush_pending_blocks(MI_CHECK *param);*/
91
91
static SORT_KEY_BLOCKS  *alloc_key_blocks(MI_CHECK *param, uint32_t blocks,
92
92
                                          uint32_t buffer_length);
1459
1459
  if (!rep_quick)
1460
1460
  {
1461
1461
    /* Get real path for data file */
1462
 
    if ((new_file=my_create(fn_format(param->temp_filename,
 
1462
    if ((new_file=my_create(internal::fn_format(param->temp_filename,
1463
1463
                                      share->data_file_name, "",
1464
1464
                                      DATA_TMP_EXT, 2+4),
1465
1465
                            0,param->tmpfile_createflag,
1576
1576
 
1577
1577
  if (!rep_quick)
1578
1578
  {
1579
 
    my_close(info->dfile,MYF(0));
 
1579
    internal::my_close(info->dfile,MYF(0));
1580
1580
    info->dfile=new_file;
1581
1581
    info->state->data_file_length=sort_param.filepos;
1582
1582
    share->state.version=(ulong) time((time_t*) 0);     /* Force reopen */
1609
1609
    /* Replace the actual file with the temporary file */
1610
1610
    if (new_file >= 0)
1611
1611
    {
1612
 
      my_close(new_file,MYF(0));
 
1612
      internal::my_close(new_file,MYF(0));
1613
1613
      info->dfile=new_file= -1;
1614
1614
      if (change_to_newfile(share->data_file_name,MI_NAME_DEXT,
1615
1615
                            DATA_TMP_EXT, share->base.raid_chunks,
1626
1626
                  llstr(sort_param.start_recpos,llbuff));
1627
1627
    if (new_file >= 0)
1628
1628
    {
1629
 
      my_close(new_file,MYF(0));
 
1629
      internal::my_close(new_file,MYF(0));
1630
1630
      my_delete(param->temp_filename, MYF(MY_WME));
1631
1631
      info->rec_cache.file=-1; /* don't flush data to new_file, it's closed */
1632
1632
    }
1794
1794
    printf("- Sorting index for MyISAM-table '%s'\n",name);
1795
1795
 
1796
1796
  /* Get real path for index file */
1797
 
  fn_format(param->temp_filename,name,"", MI_NAME_IEXT,2+4+32);
1798
 
  if ((new_file=my_create(fn_format(param->temp_filename,param->temp_filename,
 
1797
  internal::fn_format(param->temp_filename,name,"", MI_NAME_IEXT,2+4+32);
 
1798
  if ((new_file=my_create(internal::fn_format(param->temp_filename,param->temp_filename,
1799
1799
                                    "", INDEX_TMP_EXT,2+4),
1800
1800
                          0,param->tmpfile_createflag,MYF(0))) <= 0)
1801
1801
  {
1837
1837
        /* Put same locks as old file */
1838
1838
  share->r_locks= share->w_locks= share->tot_locks= 0;
1839
1839
  (void) _mi_writeinfo(info,WRITEINFO_UPDATE_KEYFILE);
1840
 
  my_close(share->kfile,MYF(MY_WME));
 
1840
  internal::my_close(share->kfile,MYF(MY_WME));
1841
1841
  share->kfile = -1;
1842
 
  my_close(new_file,MYF(MY_WME));
 
1842
  internal::my_close(new_file,MYF(MY_WME));
1843
1843
  if (change_to_newfile(share->index_file_name,MI_NAME_IEXT,INDEX_TMP_EXT,0,
1844
1844
                        MYF(0)) ||
1845
1845
      mi_open_keyfile(share))
1863
1863
  return(0);
1864
1864
 
1865
1865
err:
1866
 
  my_close(new_file,MYF(MY_WME));
 
1866
  internal::my_close(new_file,MYF(MY_WME));
1867
1867
err2:
1868
1868
  my_delete(param->temp_filename,MYF(MY_WME));
1869
1869
  return(-1);
1952
1952
  (void)raid_chunks;
1953
1953
  char old_filename[FN_REFLEN],new_filename[FN_REFLEN];
1954
1954
  /* Get real path to filename */
1955
 
  (void) fn_format(old_filename,filename,"",old_ext,2+4+32);
 
1955
  (void) internal::fn_format(old_filename,filename,"",old_ext,2+4+32);
1956
1956
  return my_redel(old_filename,
1957
 
                  fn_format(new_filename,old_filename,"",new_ext,2+4),
 
1957
                  internal::fn_format(new_filename,old_filename,"",new_ext,2+4),
1958
1958
                  MYF(MY_WME | MY_LINK_WARNING | MyFlags));
1959
1959
} /* change_to_newfile */
1960
1960
 
2072
2072
  if (!rep_quick)
2073
2073
  {
2074
2074
    /* Get real path for data file */
2075
 
    if ((new_file=my_create(fn_format(param->temp_filename,
 
2075
    if ((new_file=my_create(internal::fn_format(param->temp_filename,
2076
2076
                                      share->data_file_name, "",
2077
2077
                                      DATA_TMP_EXT, 2+4),
2078
2078
                            0,param->tmpfile_createflag,
2224
2224
        sort_param.filepos;
2225
2225
      /* Only whole records */
2226
2226
      share->state.version=(ulong) time((time_t*) 0);
2227
 
      my_close(info->dfile,MYF(0));
 
2227
      internal::my_close(info->dfile,MYF(0));
2228
2228
      info->dfile=new_file;
2229
2229
      share->data_file_type=sort_info.new_data_file_type;
2230
2230
      share->pack.header_length=(ulong) new_header_length;
2299
2299
    /* Replace the actual file with the temporary file */
2300
2300
    if (new_file >= 0)
2301
2301
    {
2302
 
      my_close(new_file,MYF(0));
 
2302
      internal::my_close(new_file,MYF(0));
2303
2303
      info->dfile=new_file= -1;
2304
2304
      if (change_to_newfile(share->data_file_name,MI_NAME_DEXT,
2305
2305
                            DATA_TMP_EXT, share->base.raid_chunks,
2315
2315
      mi_check_print_error(param,"%d when fixing table",errno);
2316
2316
    if (new_file >= 0)
2317
2317
    {
2318
 
      my_close(new_file,MYF(0));
 
2318
      internal::my_close(new_file,MYF(0));
2319
2319
      my_delete(param->temp_filename, MYF(MY_WME));
2320
2320
      if (info->dfile == new_file)
2321
2321
        info->dfile= -1;
2481
2481
  if (!rep_quick)
2482
2482
  {
2483
2483
    /* Get real path for data file */
2484
 
    if ((new_file=my_create(fn_format(param->temp_filename,
 
2484
    if ((new_file=my_create(internal::fn_format(param->temp_filename,
2485
2485
                                      share->data_file_name, "",
2486
2486
                                      DATA_TMP_EXT,
2487
2487
                                      2+4),
2733
2733
      Exchange the data file descriptor of the table, so that we use the
2734
2734
      new file from now on.
2735
2735
     */
2736
 
    my_close(info->dfile,MYF(0));
 
2736
    internal::my_close(info->dfile,MYF(0));
2737
2737
    info->dfile=new_file;
2738
2738
 
2739
2739
    share->data_file_type=sort_info.new_data_file_type;
2809
2809
    /* Replace the actual file with the temporary file */
2810
2810
    if (new_file >= 0)
2811
2811
    {
2812
 
      my_close(new_file,MYF(0));
 
2812
      internal::my_close(new_file,MYF(0));
2813
2813
      info->dfile=new_file= -1;
2814
2814
      if (change_to_newfile(share->data_file_name,MI_NAME_DEXT,
2815
2815
                            DATA_TMP_EXT, share->base.raid_chunks,
2825
2825
      mi_check_print_error(param,"%d when fixing table",errno);
2826
2826
    if (new_file >= 0)
2827
2827
    {
2828
 
      my_close(new_file,MYF(0));
 
2828
      internal::my_close(new_file,MYF(0));
2829
2829
      my_delete(param->temp_filename, MYF(MY_WME));
2830
2830
      if (info->dfile == new_file)
2831
2831
        info->dfile= -1;