~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/myisam/myisamchk.c

  • Committer: Monty Taylor
  • Date: 2008-07-16 19:10:24 UTC
  • mfrom: (51.1.127 remove-dbug)
  • mto: This revision was merged to the branch mainline in revision 176.
  • Revision ID: monty@inaugust.com-20080716191024-prjgoh7fbri7rx26
MergedĀ fromĀ remove-dbug.

Show diffs side-by-side

added added

removed removed

Lines of Context:
177
177
  {"correct-checksum", OPT_CORRECT_CHECKSUM,
178
178
   "Correct checksum information for table.",
179
179
   0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
180
 
#ifndef DBUG_OFF
181
 
  {"debug", '#',
182
 
   "Output debug log. Often this is 'd:t:o,filename'.",
183
 
   0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
184
 
#endif
185
180
  {"description", 'd',
186
181
   "Prints some information about table.",
187
182
   0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
346
341
  puts("Used without options all tables on the command will be checked for errors");
347
342
  printf("Usage: %s [OPTIONS] tables[.MYI]\n", my_progname_short);
348
343
  printf("\nGlobal options:\n");
349
 
#ifndef DBUG_OFF
350
 
  printf("\
351
 
  -#, --debug=...     Output debug log. Often this is 'd:t:o,filename'.\n");
352
 
#endif
353
344
  printf("\
354
345
  -?, --help          Display this help and exit.\n\
355
346
  -O, --set-variable var=option.\n\
657
648
    else
658
649
      check_param.testflag|= T_UPDATE_STATE;
659
650
    break;
660
 
  case '#':
661
 
    if (argument == disabled_my_option)
662
 
    {
663
 
      DBUG_POP();
664
 
    }
665
 
    else
666
 
    {
667
 
      DBUG_PUSH(argument ? argument : "d:t:o,/tmp/myisamchk.trace");
668
 
    }
669
 
    break;
670
651
  case 'V':
671
652
    print_version();
672
653
    exit(0);
787
768
  char llbuff[22],llbuff2[22];
788
769
  my_bool state_updated=0;
789
770
  MYISAM_SHARE *share;
790
 
  DBUG_ENTER("myisamchk");
791
771
 
792
772
  param->out_flag=error=param->warning_printed=param->error_printed=
793
773
    recreate=0;
837
817
                  my_errno,filename);
838
818
      break;
839
819
    }
840
 
    DBUG_RETURN(1);
 
820
    return(1);
841
821
  }
842
822
  share=info->s;
843
823
  share->options&= ~HA_OPTION_READ_ONLY_DATA; /* We are modifing it */
884
864
      {
885
865
        mi_check_print_error(param,"%d when closing MyISAM-table '%s'",
886
866
                             my_errno,filename);
887
 
        DBUG_RETURN(1);
 
867
        return(1);
888
868
      }
889
 
      DBUG_RETURN(0);
 
869
      return(0);
890
870
    }
891
871
  }
892
872
  if ((param->testflag & (T_REP_ANY | T_STATISTICS |
1116
1096
  if (mi_close(info))
1117
1097
  {
1118
1098
    mi_check_print_error(param,"%d when closing MyISAM-table '%s'",my_errno,filename);
1119
 
    DBUG_RETURN(1);
 
1099
    return(1);
1120
1100
  }
1121
1101
  if (error == 0)
1122
1102
  {
1153
1133
    VOID(fprintf(stderr, "MyISAM-table '%s' is usable but should be fixed\n",
1154
1134
                 filename));
1155
1135
  VOID(fflush(stderr));
1156
 
  DBUG_RETURN(error);
 
1136
  return(error);
1157
1137
} /* myisamchk */
1158
1138
 
1159
1139
 
1169
1149
  enum en_fieldtype type;
1170
1150
  MYISAM_SHARE *share=info->s;
1171
1151
  char llbuff[22],llbuff2[22];
1172
 
  DBUG_ENTER("describe");
1173
1152
 
1174
1153
  printf("\nMyISAM file:         %s\n",name);
1175
1154
  fputs("Record format:       ",stdout);
1240
1219
  printf("Data records:        %13s  Deleted blocks:     %13s\n",
1241
1220
         llstr(info->state->records,llbuff),llstr(info->state->del,llbuff2));
1242
1221
  if (param->testflag & T_SILENT)
1243
 
    DBUG_VOID_RETURN;                           /* This is enough */
 
1222
    return;                             /* This is enough */
1244
1223
 
1245
1224
  if (param->testflag & T_VERBOSE)
1246
1225
  {
1418
1397
      start+=share->rec[field].length;
1419
1398
    }
1420
1399
  }
1421
 
  DBUG_VOID_RETURN;
 
1400
  return;
1422
1401
} /* describe */
1423
1402
 
1424
1403
 
1440
1419
  char llbuff[22],llbuff2[22];
1441
1420
  SORT_INFO sort_info;
1442
1421
  MI_SORT_PARAM sort_param;
1443
 
  DBUG_ENTER("sort_records");
1444
1422
 
1445
1423
  bzero((char*)&sort_info,sizeof(sort_info));
1446
1424
  bzero((char*)&sort_param,sizeof(sort_param));
1457
1435
                           "Can't sort table '%s' on key %d;  No such key",
1458
1436
                name,sort_key+1);
1459
1437
    param->error_printed=0;
1460
 
    DBUG_RETURN(0);                             /* Nothing to do */
 
1438
    return(0);                          /* Nothing to do */
1461
1439
  }
1462
1440
  if (keyinfo->flag & HA_FULLTEXT)
1463
1441
  {
1464
1442
    mi_check_print_warning(param,"Can't sort table '%s' on FULLTEXT key %d",
1465
1443
                           name,sort_key+1);
1466
1444
    param->error_printed=0;
1467
 
    DBUG_RETURN(0);                             /* Nothing to do */
 
1445
    return(0);                          /* Nothing to do */
1468
1446
  }
1469
1447
  if (share->data_file_type == COMPRESSED_RECORD)
1470
1448
  {
1471
1449
    mi_check_print_warning(param,"Can't sort read-only table '%s'", name);
1472
1450
    param->error_printed=0;
1473
 
    DBUG_RETURN(0);                             /* Nothing to do */
 
1451
    return(0);                          /* Nothing to do */
1474
1452
  }
1475
1453
  if (!(param->testflag & T_SILENT))
1476
1454
  {
1481
1459
             llstr(info->state->del,llbuff2));
1482
1460
  }
1483
1461
  if (share->state.key_root[sort_key] == HA_OFFSET_ERROR)
1484
 
    DBUG_RETURN(0);                             /* Nothing to do */
 
1462
    return(0);                          /* Nothing to do */
1485
1463
 
1486
1464
  init_key_cache(dflt_key_cache, opt_key_cache_block_size, param->use_buffers,
1487
1465
                 0, 0);
1599
1577
  my_free(sort_info.buff,MYF(MY_ALLOW_ZERO_PTR));
1600
1578
  sort_info.buff=0;
1601
1579
  share->state.sortkey=sort_key;
1602
 
  DBUG_RETURN(flush_blocks(param, share->key_cache, share->kfile) |
 
1580
  return(flush_blocks(param, share->key_cache, share->kfile) |
1603
1581
              got_error);
1604
1582
} /* sort_records */
1605
1583
 
1618
1596
  char llbuff[22];
1619
1597
  SORT_INFO *sort_info= sort_param->sort_info;
1620
1598
  MI_CHECK *param=sort_info->param;
1621
 
  DBUG_ENTER("sort_record_index");
1622
1599
 
1623
1600
  nod_flag=mi_test_if_nod(buff);
1624
1601
  temp_buff=0;
1628
1605
    if (!(temp_buff=(uchar*) my_alloca((uint) keyinfo->block_length)))
1629
1606
    {
1630
1607
      mi_check_print_error(param,"Not Enough memory");
1631
 
      DBUG_RETURN(-1);
 
1608
      return(-1);
1632
1609
    }
1633
1610
  }
1634
1611
  used_length=mi_getint(buff);
1686
1663
  }
1687
1664
  if (temp_buff)
1688
1665
    my_afree((uchar*) temp_buff);
1689
 
  DBUG_RETURN(0);
 
1666
  return(0);
1690
1667
err:
1691
1668
  if (temp_buff)
1692
1669
    my_afree((uchar*) temp_buff);
1693
 
  DBUG_RETURN(1);
 
1670
  return(1);
1694
1671
} /* sort_record_index */
1695
1672
 
1696
1673
 
1727
1704
void mi_check_print_warning(MI_CHECK *param, const char *fmt,...)
1728
1705
{
1729
1706
  va_list args;
1730
 
  DBUG_ENTER("mi_check_print_warning");
1731
1707
 
1732
1708
  fflush(stdout);
1733
1709
  if (!param->warning_printed && !param->error_printed)
1744
1720
  VOID(fputc('\n',stderr));
1745
1721
  fflush(stderr);
1746
1722
  va_end(args);
1747
 
  DBUG_VOID_RETURN;
 
1723
  return;
1748
1724
}
1749
1725
 
1750
1726
/* VARARGS */
1752
1728
void mi_check_print_error(MI_CHECK *param, const char *fmt,...)
1753
1729
{
1754
1730
  va_list args;
1755
 
  DBUG_ENTER("mi_check_print_error");
1756
 
  DBUG_PRINT("enter",("format: %s",fmt));
1757
1731
 
1758
1732
  fflush(stdout);
1759
1733
  if (!param->warning_printed && !param->error_printed)
1769
1743
  VOID(fputc('\n',stderr));
1770
1744
  fflush(stderr);
1771
1745
  va_end(args);
1772
 
  DBUG_VOID_RETURN;
 
1746
  return;
1773
1747
}
1774
1748