~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/myisam/myisamchk.cc

  • Committer: Monty Taylor
  • Date: 2009-01-09 07:02:24 UTC
  • mto: (779.1.2 devel)
  • mto: This revision was merged to the branch mainline in revision 784.
  • Revision ID: mordred@inaugust.com-20090109070224-prwl5p52mfql3zfw
Split out readline.

Show diffs side-by-side

added added

removed removed

Lines of Context:
76
76
                             MI_KEYDEF *keyinfo,
77
77
                             my_off_t page,unsigned char *buff,uint32_t sortkey,
78
78
                             File new_file, bool update_index);
79
 
extern "C"
80
 
bool get_one_option(int optid, const struct my_option *, char *argument);
81
79
 
82
80
MI_CHECK check_param;
83
81
 
137
135
 
138
136
  free_defaults(default_argv);
139
137
  my_end(check_param.testflag & T_INFO ? MY_CHECK_ERROR | MY_GIVE_INFO : MY_CHECK_ERROR);
140
 
  return error;
 
138
  exit(error);
 
139
#ifndef _lint
 
140
  return 0;                             /* No compiler warning */
 
141
#endif
141
142
} /* main */
142
143
 
143
144
enum options_mc {
154
155
  {"analyze", 'a',
155
156
   "Analyze distribution of keys. Will make some joins in MySQL faster. You can check the calculated distribution.",
156
157
   0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
 
158
  {"block-search", 'b',
 
159
   "No help available.",
 
160
   0, 0, 0, GET_ULONG, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
157
161
  {"backup", 'B',
158
162
   "Make a backup of the .MYD file as 'filename-time.BAK'.",
159
163
   0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
 
164
  {"character-sets-dir", OPT_CHARSETS_DIR,
 
165
   "Directory where character sets are.",
 
166
   (char**) &charsets_dir, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
160
167
  {"check", 'c',
161
168
   "Check table for errors.",
162
169
   0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
270
277
   0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
271
278
  { "key_buffer_size", OPT_KEY_BUFFER_SIZE, "",
272
279
    (char**) &check_param.use_buffers, (char**) &check_param.use_buffers, 0,
273
 
    GET_UINT64, REQUIRED_ARG, (long) USE_BUFFER_INIT, (long) MALLOC_OVERHEAD,
 
280
    GET_ULONG, REQUIRED_ARG, (long) USE_BUFFER_INIT, (long) MALLOC_OVERHEAD,
274
281
    INT32_MAX, (long) MALLOC_OVERHEAD, (long) IO_SIZE, 0},
275
282
  { "key_cache_block_size", OPT_KEY_CACHE_BLOCK_SIZE,  "",
276
283
    (char**) &opt_key_cache_block_size,
283
290
    MI_MAX_KEY_BLOCK_LENGTH, 0, MI_MIN_KEY_BLOCK_LENGTH, 0},
284
291
  { "read_buffer_size", OPT_READ_BUFFER_SIZE, "",
285
292
    (char**) &check_param.read_buffer_length,
286
 
    (char**) &check_param.read_buffer_length, 0, GET_SIZE, REQUIRED_ARG,
 
293
    (char**) &check_param.read_buffer_length, 0, GET_ULONG, REQUIRED_ARG,
287
294
    (long) READ_BUFFER_INIT, (long) MALLOC_OVERHEAD,
288
 
    SIZE_MAX, (long) MALLOC_OVERHEAD, (long) 1L, 0},
 
295
    INT32_MAX, (long) MALLOC_OVERHEAD, (long) 1L, 0},
289
296
  { "write_buffer_size", OPT_WRITE_BUFFER_SIZE, "",
290
297
    (char**) &check_param.write_buffer_length,
291
 
    (char**) &check_param.write_buffer_length, 0, GET_SIZE, REQUIRED_ARG,
 
298
    (char**) &check_param.write_buffer_length, 0, GET_ULONG, REQUIRED_ARG,
292
299
    (long) READ_BUFFER_INIT, (long) MALLOC_OVERHEAD,
293
 
    SIZE_MAX, (long) MALLOC_OVERHEAD, (long) 1L, 0},
 
300
    INT32_MAX, (long) MALLOC_OVERHEAD, (long) 1L, 0},
294
301
  { "sort_buffer_size", OPT_SORT_BUFFER_SIZE, "",
295
302
    (char**) &check_param.sort_buffer_length,
296
 
    (char**) &check_param.sort_buffer_length, 0, GET_SIZE, REQUIRED_ARG,
 
303
    (char**) &check_param.sort_buffer_length, 0, GET_ULONG, REQUIRED_ARG,
297
304
    (long) SORT_BUFFER_INIT, (long) (MIN_SORT_BUFFER + MALLOC_OVERHEAD),
298
 
    SIZE_MAX, (long) MALLOC_OVERHEAD, (long) 1L, 0},
 
305
    INT32_MAX, (long) MALLOC_OVERHEAD, (long) 1L, 0},
299
306
  { "sort_key_blocks", OPT_SORT_KEY_BLOCKS, "",
300
307
    (char**) &check_param.sort_key_blocks,
301
 
    (char**) &check_param.sort_key_blocks, 0, GET_SIZE, REQUIRED_ARG,
 
308
    (char**) &check_param.sort_key_blocks, 0, GET_ULONG, REQUIRED_ARG,
302
309
    BUFFERS_WHEN_SORTING, 4L, 100L, 0L, 1L, 0},
303
310
  { "decode_bits", OPT_DECODE_BITS, "", (char**) &decode_bits,
304
311
    (char**) &decode_bits, 0, GET_UINT, REQUIRED_ARG, 9L, 4L, 17L, 0L, 1L, 0},
424
431
  -R, --sort-records=#\n\
425
432
                      Sort records according to an index.  This makes your\n\
426
433
                      data much more localized and may speed up things\n\
427
 
                      (It may be VERY slow to do a sort the first time!).\n");
 
434
                      (It may be VERY slow to do a sort the first time!).\n\
 
435
  -b,  --block-search=#\n\
 
436
                       Find a record, a block at given offset belongs to.");
428
437
 
429
438
  print_defaults("drizzle", load_default_groups);
430
439
  my_print_variables(my_long_options);
438
447
 
439
448
         /* Read options */
440
449
 
441
 
bool get_one_option(int optid, const struct my_option *, char *argument)
 
450
static bool
 
451
get_one_option(int optid,
 
452
               const struct my_option *opt __attribute__((unused)),
 
453
               char *argument)
442
454
{
443
455
  switch (optid) {
444
456
  case 'a':
556
568
    if (argument != disabled_my_option)
557
569
    {
558
570
      check_param.testflag|= T_REP;
559
 
      my_disable_async_io= true;                /* More safety */
 
571
      my_disable_async_io= 1;           /* More safety */
560
572
    }
561
573
    break;
562
574
  case 'n':
725
737
  check_param.key_cache_block_size= opt_key_cache_block_size;
726
738
 
727
739
  if (set_collation_name)
728
 
    if (!(set_collation= get_charset_by_name(set_collation_name)))
 
740
    if (!(set_collation= get_charset_by_name(set_collation_name,
 
741
                                             MYF(MY_WME))))
729
742
      exit(1);
730
743
 
731
744
  myisam_block_size=(uint) 1 << my_bit_log2(opt_myisam_block_size);
1643
1656
 
1644
1657
static int not_killed= 0;
1645
1658
 
1646
 
volatile int *killed_ptr(MI_CHECK *)
 
1659
volatile int *killed_ptr(MI_CHECK *param __attribute__((unused)))
1647
1660
{
1648
1661
  return &not_killed;                   /* always NULL */
1649
1662
}
1651
1664
        /* print warnings and errors */
1652
1665
        /* VARARGS */
1653
1666
 
1654
 
void mi_check_print_info(MI_CHECK *,
 
1667
void mi_check_print_info(MI_CHECK *param __attribute__((unused)),
1655
1668
                         const char *fmt,...)
1656
1669
{
1657
1670
  va_list args;