~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/myisam/myisamchk.cc

  • Committer: Monty Taylor
  • Date: 2009-03-04 02:16:28 UTC
  • mto: (917.1.2 mordred)
  • mto: This revision was merged to the branch mainline in revision 912.
  • Revision ID: mordred@inaugust.com-20090304021628-rfq0b16uoi09g8tx
Fix to make VPATH builds work again.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 
16
16
/* Describe, check and repair of MyISAM tables */
17
17
 
18
 
#include <drizzled/global.h>
 
18
#include "myisamdef.h"
 
19
#include "myisam.h"
19
20
 
20
21
#include <mystrings/m_ctype.h>
21
 
#include <stdarg.h>
22
22
#include <mysys/my_getopt.h>
23
23
#include <mysys/my_bit.h>
24
 
#include <myisam.h>
25
24
#include <mystrings/m_string.h>
 
25
#include <stdio.h>
 
26
#include <stdarg.h>
26
27
#ifdef HAVE_SYS_VADVICE_H
27
28
#include <sys/vadvise.h>
28
29
#endif
29
30
#ifdef HAVE_SYS_MMAN_H
30
31
#include <sys/mman.h>
31
32
#endif
32
 
 
33
 
#define my_raid_create(A,B,C,D,E,F,G) my_create(A,B,C,G)
34
 
#define my_raid_delete(A,B,C) my_delete(A,B)
35
 
 
36
 
#include "myisamdef.h"
 
33
#include <drizzled/util/test.h>
 
34
 
 
35
 
 
36
pthread_mutex_t THR_LOCK_myisam= PTHREAD_MUTEX_INITIALIZER;
37
37
 
38
38
static uint32_t decode_bits;
39
39
static char **default_argv;
43
43
static long opt_myisam_block_size;
44
44
static long opt_key_cache_block_size;
45
45
static const char *my_progname_short;
46
 
static MY_TMPDIR myisamchk_tmpdir;
47
46
 
48
47
static const char *type_names[]=
49
48
{ "impossible","char","binary", "short", "long", "float",
77
76
                             MI_KEYDEF *keyinfo,
78
77
                             my_off_t page,unsigned char *buff,uint32_t sortkey,
79
78
                             File new_file, bool update_index);
 
79
extern "C"
 
80
bool get_one_option(int optid, const struct my_option *, char *argument);
80
81
 
81
82
MI_CHECK check_param;
82
83
 
131
132
    printf("\nTotal of all %d MyISAM-files:\nData records: %9s   Deleted blocks: %9s\n",check_param.total_files,llstr(check_param.total_records,buff),
132
133
           llstr(check_param.total_deleted,buff2));
133
134
  }
 
135
 
 
136
  pthread_mutex_destroy(&THR_LOCK_myisam);
 
137
 
134
138
  free_defaults(default_argv);
135
 
  free_tmpdir(&myisamchk_tmpdir);
136
139
  my_end(check_param.testflag & T_INFO ? MY_CHECK_ERROR | MY_GIVE_INFO : MY_CHECK_ERROR);
137
 
  exit(error);
138
 
#ifndef _lint
139
 
  return 0;                             /* No compiler warning */
140
 
#endif
 
140
  return error;
141
141
} /* main */
142
142
 
143
143
enum options_mc {
160
160
  {"backup", 'B',
161
161
   "Make a backup of the .MYD file as 'filename-time.BAK'.",
162
162
   0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
163
 
  {"character-sets-dir", OPT_CHARSETS_DIR,
164
 
   "Directory where character sets are.",
165
 
   (char**) &charsets_dir, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
166
163
  {"check", 'c',
167
164
   "Check table for errors.",
168
165
   0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
291
288
    (char**) &check_param.read_buffer_length,
292
289
    (char**) &check_param.read_buffer_length, 0, GET_ULONG, REQUIRED_ARG,
293
290
    (long) READ_BUFFER_INIT, (long) MALLOC_OVERHEAD,
294
 
    INT32_MAX, (long) MALLOC_OVERHEAD, (long) 1L, 0},
 
291
    SIZE_MAX, (long) MALLOC_OVERHEAD, (long) 1L, 0},
295
292
  { "write_buffer_size", OPT_WRITE_BUFFER_SIZE, "",
296
293
    (char**) &check_param.write_buffer_length,
297
294
    (char**) &check_param.write_buffer_length, 0, GET_ULONG, REQUIRED_ARG,
298
295
    (long) READ_BUFFER_INIT, (long) MALLOC_OVERHEAD,
299
 
    INT32_MAX, (long) MALLOC_OVERHEAD, (long) 1L, 0},
 
296
    SIZE_MAX, (long) MALLOC_OVERHEAD, (long) 1L, 0},
300
297
  { "sort_buffer_size", OPT_SORT_BUFFER_SIZE, "",
301
298
    (char**) &check_param.sort_buffer_length,
302
299
    (char**) &check_param.sort_buffer_length, 0, GET_ULONG, REQUIRED_ARG,
303
300
    (long) SORT_BUFFER_INIT, (long) (MIN_SORT_BUFFER + MALLOC_OVERHEAD),
304
 
    INT32_MAX, (long) MALLOC_OVERHEAD, (long) 1L, 0},
 
301
    SIZE_MAX, (long) MALLOC_OVERHEAD, (long) 1L, 0},
305
302
  { "sort_key_blocks", OPT_SORT_KEY_BLOCKS, "",
306
303
    (char**) &check_param.sort_key_blocks,
307
304
    (char**) &check_param.sort_key_blocks, 0, GET_ULONG, REQUIRED_ARG,
434
431
  -b,  --block-search=#\n\
435
432
                       Find a record, a block at given offset belongs to.");
436
433
 
437
 
  print_defaults("my", load_default_groups);
 
434
  print_defaults("drizzle", load_default_groups);
438
435
  my_print_variables(my_long_options);
439
436
}
440
437
 
446
443
 
447
444
         /* Read options */
448
445
 
449
 
static bool
450
 
get_one_option(int optid,
451
 
               const struct my_option *opt __attribute__((unused)),
452
 
               char *argument)
 
446
bool get_one_option(int optid, const struct my_option *, char *argument)
453
447
{
454
448
  switch (optid) {
455
449
  case 'a':
567
561
    if (argument != disabled_my_option)
568
562
    {
569
563
      check_param.testflag|= T_REP;
570
 
      my_disable_async_io= 1;           /* More safety */
 
564
      my_disable_async_io= true;                /* More safety */
571
565
    }
572
566
    break;
573
567
  case 'n':
659
653
      exit(1);
660
654
    }
661
655
    switch (method-1) {
662
 
    case 0: 
 
656
    case 0:
663
657
      method_conv= MI_STATS_METHOD_NULLS_EQUAL;
664
658
      break;
665
659
    case 1:
669
663
      method_conv= MI_STATS_METHOD_IGNORE_NULLS;
670
664
      break;
671
665
    default: assert(0);                         /* Impossible */
 
666
      fprintf(stderr, "Invalid value of stats_method: %s.\n", argument);
 
667
      exit(1);
672
668
    }
673
669
    check_param.stats_method= method_conv;
674
670
    break;
693
689
{
694
690
  int ho_error;
695
691
 
696
 
  load_defaults("my", load_default_groups, argc, argv);
 
692
  load_defaults("drizzle", load_default_groups, argc, argv);
697
693
  default_argv= *argv;
698
694
  if (isatty(fileno(stdout)))
699
695
    check_param.testflag|=T_WRITE_LOOP;
731
727
    exit(1);
732
728
  }
733
729
 
734
 
  if (init_tmpdir(&myisamchk_tmpdir, opt_tmpdir))
735
 
    exit(1);
736
 
 
737
 
  check_param.tmpdir=&myisamchk_tmpdir;
738
730
  check_param.key_cache_block_size= opt_key_cache_block_size;
739
731
 
740
732
  if (set_collation_name)
741
 
    if (!(set_collation= get_charset_by_name(set_collation_name,
742
 
                                             MYF(MY_WME))))
 
733
    if (!(set_collation= get_charset_by_name(set_collation_name)))
743
734
      exit(1);
744
735
 
745
736
  myisam_block_size=(uint) 1 << my_bit_log2(opt_myisam_block_size);
1150
1141
  else
1151
1142
    puts("Fixed length");
1152
1143
  printf("Character set:       %s (%d)\n",
1153
 
         get_charset_name(share->state.header.language),
1154
 
         share->state.header.language);
 
1144
  get_charset_name(share->state.header.language),
 
1145
  share->state.header.language);
1155
1146
 
1156
1147
  if (param->testflag & T_VERBOSE)
1157
1148
  {
1169
1160
    }
1170
1161
    pos=buff;
1171
1162
    if (share->state.changed & STATE_CRASHED)
1172
 
      my_stpcpy(buff,"crashed");
 
1163
      strcpy(buff,"crashed");
1173
1164
    else
1174
1165
    {
1175
1166
      if (share->state.open_count)
1176
 
        pos=my_stpcpy(pos,"open,");
 
1167
        pos= strcpy(pos,"open,")+5;
1177
1168
      if (share->state.changed & STATE_CHANGED)
1178
 
        pos=my_stpcpy(pos,"changed,");
 
1169
        pos= strcpy(pos,"changed,")+8;
1179
1170
      else
1180
 
        pos=my_stpcpy(pos,"checked,");
 
1171
        pos= strcpy(pos,"checked,")+8;
1181
1172
      if (!(share->state.changed & STATE_NOT_ANALYZED))
1182
 
        pos=my_stpcpy(pos,"analyzed,");
 
1173
        pos= strcpy(pos,"analyzed,")+9;
1183
1174
      if (!(share->state.changed & STATE_NOT_OPTIMIZED_KEYS))
1184
 
        pos=my_stpcpy(pos,"optimized keys,");
 
1175
        pos= strcpy(pos,"optimized keys,")+15;
1185
1176
      if (!(share->state.changed & STATE_NOT_SORTED_PAGES))
1186
 
        pos=my_stpcpy(pos,"sorted index pages,");
 
1177
        pos= strcpy(pos,"sorted index pages,")+19;
1187
1178
      pos[-1]=0;                                /* Remove extra ',' */
1188
 
    }      
 
1179
    }
1189
1180
    printf("Status:              %s\n",buff);
1190
1181
    if (share->base.auto_key)
1191
1182
    {
1193
1184
             share->base.auto_key,
1194
1185
             llstr(share->state.auto_increment,llbuff));
1195
1186
    }
1196
 
    if (share->base.raid_type)
1197
 
    {
1198
 
      printf("RAID:                Type:  %u   Chunks: %u  Chunksize: %lu\n",
1199
 
             share->base.raid_type,
1200
 
             share->base.raid_chunks,
1201
 
             share->base.raid_chunksize);
1202
 
    }
1203
1187
    if (share->options & (HA_OPTION_CHECKSUM | HA_OPTION_COMPRESS_RECORD))
1204
1188
      printf("Checksum:  %23s\n",llstr(info->state->checksum,llbuff));
1205
1189
;
1208
1192
 
1209
1193
  }
1210
1194
  printf("Data records:        %13s  Deleted blocks:     %13s\n",
1211
 
         llstr(info->state->records,llbuff),llstr(info->state->del,llbuff2));
 
1195
  llstr(info->state->records,llbuff),llstr(info->state->del,llbuff2));
1212
1196
  if (param->testflag & T_SILENT)
1213
1197
    return;                             /* This is enough */
1214
1198
 
1218
1202
    printf("Init-relocation:     %13s\n",llstr(share->base.reloc,llbuff));
1219
1203
#endif
1220
1204
    printf("Datafile parts:      %13s  Deleted data:       %13s\n",
1221
 
           llstr(share->state.split,llbuff),
1222
 
           llstr(info->state->empty,llbuff2));
 
1205
    llstr(share->state.split,llbuff),
 
1206
    llstr(info->state->empty,llbuff2));
1223
1207
    printf("Datafile pointer (bytes):%9d  Keyfile pointer (bytes):%9d\n",
1224
 
           share->rec_reflength,share->base.key_reflength);
 
1208
    share->rec_reflength,share->base.key_reflength);
1225
1209
    printf("Datafile length:     %13s  Keyfile length:     %13s\n",
1226
 
           llstr(info->state->data_file_length,llbuff),
1227
 
           llstr(info->state->key_file_length,llbuff2));
 
1210
    llstr(info->state->data_file_length,llbuff),
 
1211
    llstr(info->state->key_file_length,llbuff2));
1228
1212
 
1229
1213
    if (info->s->base.reloc == 1L && info->s->base.records == 1L)
1230
1214
      puts("This is a one-record table");
1231
1215
    else
1232
1216
    {
1233
1217
      if (share->base.max_data_file_length != HA_OFFSET_ERROR ||
1234
 
          share->base.max_key_file_length != HA_OFFSET_ERROR)
1235
 
        printf("Max datafile length: %13s  Max keyfile length: %13s\n",
1236
 
               llstr(share->base.max_data_file_length-1,llbuff),
1237
 
               llstr(share->base.max_key_file_length-1,llbuff2));
 
1218
          share->base.max_key_file_length != HA_OFFSET_ERROR)
 
1219
        printf("Max datafile length: %13s  Max keyfile length: %13s\n",
 
1220
                     llstr(share->base.max_data_file_length-1,llbuff),
 
1221
                     llstr(share->base.max_key_file_length-1,llbuff2));
1238
1222
    }
1239
1223
  }
1240
1224
 
1243
1227
  {
1244
1228
    int64_t2str(share->state.key_map,buff,2);
1245
1229
    printf("Using only keys '%s' of %d possibly keys\n",
1246
 
           buff, share->base.keys);
 
1230
    buff, share->base.keys);
1247
1231
  }
1248
1232
  puts("\ntable description:");
1249
1233
  printf("Key Start Len Index   Type");
1262
1246
    pos=buff;
1263
1247
    if (keyseg->flag & HA_REVERSE_SORT)
1264
1248
      *pos++ = '-';
1265
 
    pos=my_stpcpy(pos,type_names[keyseg->type]);
 
1249
    pos= strcpy(pos,type_names[keyseg->type]);
 
1250
    pos+= strlen(type_names[keyseg->type]);
1266
1251
    *pos++ = ' ';
1267
1252
    *pos=0;
1268
1253
    if (keyinfo->flag & HA_PACK_KEY)
1269
 
      pos=my_stpcpy(pos,prefix_packed_txt);
 
1254
      pos= strcpy(pos,prefix_packed_txt) + strlen(prefix_packed_txt);
1270
1255
    if (keyinfo->flag & HA_BINARY_PACK_KEY)
1271
 
      pos=my_stpcpy(pos,bin_packed_txt);
 
1256
      pos= strcpy(pos,bin_packed_txt) + strlen(bin_packed_txt);
1272
1257
    if (keyseg->flag & HA_SPACE_PACK)
1273
 
      pos=my_stpcpy(pos,diff_txt);
 
1258
      pos= strcpy(pos,diff_txt) + strlen(diff_txt);
1274
1259
    if (keyseg->flag & HA_BLOB_PART)
1275
 
      pos=my_stpcpy(pos,blob_txt);
 
1260
      pos= strcpy(pos,blob_txt) + strlen(blob_txt);
1276
1261
    if (keyseg->flag & HA_NULL_PART)
1277
 
      pos=my_stpcpy(pos,null_txt);
 
1262
      pos= strcpy(pos,null_txt) + strlen(null_txt);
1278
1263
    *pos=0;
1279
1264
 
1280
1265
    printf("%-4d%-6ld%-3d %-8s%-21s",
1281
 
           key+1,(long) keyseg->start+1,keyseg->length,text,buff);
 
1266
           key+1,(long) keyseg->start+1,keyseg->length,text,buff);
1282
1267
    if (share->state.key_root[key] != HA_OFFSET_ERROR)
1283
1268
      llstr(share->state.key_root[key],buff);
1284
1269
    else
1285
1270
      buff[0]=0;
1286
1271
    if (param->testflag & T_VERBOSE)
1287
1272
      printf("%11lu %12s %10d",
1288
 
             share->state.rec_per_key_part[keyseg_nr++],
1289
 
             buff,keyinfo->block_length);
 
1273
    share->state.rec_per_key_part[keyseg_nr++],
 
1274
    buff,keyinfo->block_length);
1290
1275
    putchar('\n');
1291
1276
    while ((++keyseg)->type != HA_KEYTYPE_END)
1292
1277
    {
1293
1278
      pos=buff;
1294
1279
      if (keyseg->flag & HA_REVERSE_SORT)
1295
 
        *pos++ = '-';
1296
 
      pos=my_stpcpy(pos,type_names[keyseg->type]);
 
1280
        *pos++ = '-';
 
1281
      pos= strcpy(pos,type_names[keyseg->type]);
 
1282
      pos+= strlen(type_names[keyseg->type]);
1297
1283
      *pos++= ' ';
1298
1284
      if (keyseg->flag & HA_SPACE_PACK)
1299
 
        pos=my_stpcpy(pos,diff_txt);
 
1285
        pos= strcpy(pos,diff_txt) + strlen(diff_txt);
1300
1286
      if (keyseg->flag & HA_BLOB_PART)
1301
 
        pos=my_stpcpy(pos,blob_txt);
 
1287
        pos= strcpy(pos,blob_txt) + strlen(blob_txt);
1302
1288
      if (keyseg->flag & HA_NULL_PART)
1303
 
        pos=my_stpcpy(pos,null_txt);
 
1289
        pos= strcpy(pos,null_txt) + strlen(null_txt);
1304
1290
      *pos=0;
1305
1291
      printf("    %-6ld%-3d         %-21s",
1306
1292
             (long) keyseg->start+1,keyseg->length,buff);
1307
1293
      if (param->testflag & T_VERBOSE)
1308
 
        printf("%11lu", share->state.rec_per_key_part[keyseg_nr++]);
 
1294
        printf("%11lu", share->state.rec_per_key_part[keyseg_nr++]);
1309
1295
      putchar('\n');
1310
1296
    }
1311
1297
    keyseg++;
1315
1301
    MI_UNIQUEDEF *uniqueinfo;
1316
1302
    puts("\nUnique  Key  Start  Len  Nullpos  Nullbit  Type");
1317
1303
    for (key=0,uniqueinfo= &share->uniqueinfo[0] ;
1318
 
         key < share->state.header.uniques; key++, uniqueinfo++)
 
1304
         key < share->state.header.uniques; key++, uniqueinfo++)
1319
1305
    {
1320
1306
      bool new_row=0;
1321
1307
      char null_bit[8],null_pos[8];
1322
1308
      printf("%-8d%-5d",key+1,uniqueinfo->key+1);
1323
1309
      for (keyseg=uniqueinfo->seg ; keyseg->type != HA_KEYTYPE_END ; keyseg++)
1324
1310
      {
1325
 
        if (new_row)
1326
 
          fputs("             ",stdout);
1327
 
        null_bit[0]=null_pos[0]=0;
1328
 
        if (keyseg->null_bit)
1329
 
        {
1330
 
          sprintf(null_bit,"%d",keyseg->null_bit);
1331
 
          sprintf(null_pos,"%ld",(long) keyseg->null_pos+1);
1332
 
        }
1333
 
        printf("%-7ld%-5d%-9s%-10s%-30s\n",
1334
 
               (long) keyseg->start+1,keyseg->length,
1335
 
               null_pos,null_bit,
1336
 
               type_names[keyseg->type]);
1337
 
        new_row=1;
 
1311
        if (new_row)
 
1312
          fputs("             ",stdout);
 
1313
        null_bit[0]=null_pos[0]=0;
 
1314
        if (keyseg->null_bit)
 
1315
        {
 
1316
          sprintf(null_bit,"%d",keyseg->null_bit);
 
1317
          sprintf(null_pos,"%ld",(long) keyseg->null_pos+1);
 
1318
        }
 
1319
        printf("%-7ld%-5d%-9s%-10s%-30s\n",
 
1320
               (long) keyseg->start+1,keyseg->length,
 
1321
               null_pos,null_bit,
 
1322
               type_names[keyseg->type]);
 
1323
        new_row=1;
1338
1324
      }
1339
1325
    }
1340
1326
  }
1349
1335
    for (field=0 ; field < share->base.fields ; field++)
1350
1336
    {
1351
1337
      if (share->options & HA_OPTION_COMPRESS_RECORD)
1352
 
        type=share->rec[field].base_type;
 
1338
        type=share->rec[field].base_type;
1353
1339
      else
1354
 
        type=(enum en_fieldtype) share->rec[field].type;
1355
 
      end=my_stpcpy(buff,field_pack[type]);
 
1340
        type=(enum en_fieldtype) share->rec[field].type;
 
1341
      end= strcpy(buff, field_pack[type]);
 
1342
      end+= strlen(field_pack[type]);
1356
1343
      if (share->options & HA_OPTION_COMPRESS_RECORD)
1357
1344
      {
1358
 
        if (share->rec[field].pack_type & PACK_TYPE_SELECTED)
1359
 
          end=my_stpcpy(end,", not_always");
1360
 
        if (share->rec[field].pack_type & PACK_TYPE_SPACE_FIELDS)
1361
 
          end=my_stpcpy(end,", no empty");
1362
 
        if (share->rec[field].pack_type & PACK_TYPE_ZERO_FILL)
1363
 
        {
1364
 
          sprintf(end,", zerofill(%d)",share->rec[field].space_length_bits);
1365
 
          end= strchr(end, '\0');
1366
 
        }
 
1345
        if (share->rec[field].pack_type & PACK_TYPE_SELECTED)
 
1346
          end= strcpy(end,", not_always")+12;
 
1347
        if (share->rec[field].pack_type & PACK_TYPE_SPACE_FIELDS)
 
1348
          end= strcpy(end,", no empty")+10;
 
1349
        if (share->rec[field].pack_type & PACK_TYPE_ZERO_FILL)
 
1350
        {
 
1351
          sprintf(end,", zerofill(%d)",share->rec[field].space_length_bits);
 
1352
          end= strchr(end, '\0');
 
1353
        }
1367
1354
      }
1368
1355
      if (buff[0] == ',')
1369
 
        my_stpcpy(buff,buff+2);
 
1356
        strcpy(buff,buff+2);
1370
1357
      int10_to_str((long) share->rec[field].length,length,10);
1371
1358
      null_bit[0]=null_pos[0]=0;
1372
1359
      if (share->rec[field].null_bit)
1373
1360
      {
1374
 
        sprintf(null_bit,"%d",share->rec[field].null_bit);
1375
 
        sprintf(null_pos,"%d",share->rec[field].null_pos+1);
 
1361
        sprintf(null_bit,"%d",share->rec[field].null_bit);
 
1362
        sprintf(null_pos,"%d",share->rec[field].null_pos+1);
1376
1363
      }
1377
1364
      printf("%-6d%-6d%-7s%-8s%-8s%-35s",field+1,start,length,
1378
1365
             null_pos, null_bit, buff);
1452
1439
    goto err;
1453
1440
  info->opt_flag|=WRITE_CACHE_USED;
1454
1441
 
1455
 
  if (!(temp_buff=(unsigned char*) my_alloca((uint) keyinfo->block_length)))
 
1442
  if (!(temp_buff=(unsigned char*) malloc(keyinfo->block_length)))
1456
1443
  {
1457
1444
    mi_check_print_error(param,"Not enough memory for key block");
1458
1445
    goto err;
1459
1446
  }
1460
1447
 
1461
 
  if (!mi_alloc_rec_buff(info, -1, &sort_param.record))
 
1448
  if (!mi_alloc_rec_buff(info, (ulong)-1, &sort_param.record))
1462
1449
  {
1463
1450
    mi_check_print_error(param,"Not enough memory for record");
1464
1451
    goto err;
1465
1452
  }
1466
1453
  fn_format(param->temp_filename,name,"", MI_NAME_DEXT,2+4+32);
1467
 
  new_file=my_raid_create(fn_format(param->temp_filename,
1468
 
                                    param->temp_filename,"",
1469
 
                                    DATA_TMP_EXT,2+4),
1470
 
                          0,param->tmpfile_createflag,
1471
 
                          share->base.raid_type,
1472
 
                          share->base.raid_chunks,
1473
 
                          share->base.raid_chunksize,
1474
 
                          MYF(0));
 
1454
  new_file=my_create(fn_format(param->temp_filename,
 
1455
                               param->temp_filename,"",
 
1456
                               DATA_TMP_EXT,2+4),
 
1457
                     0,param->tmpfile_createflag,
 
1458
                     MYF(0));
1475
1459
  if (new_file < 0)
1476
1460
  {
1477
1461
    mi_check_print_error(param,"Can't create new tempfile: '%s'",
1546
1530
  {
1547
1531
    end_io_cache(&info->rec_cache);
1548
1532
    (void) my_close(new_file,MYF(MY_WME));
1549
 
    (void) my_raid_delete(param->temp_filename, share->base.raid_chunks,
1550
 
                          MYF(MY_WME));
 
1533
    (void) my_delete(param->temp_filename, MYF(MY_WME));
1551
1534
  }
1552
1535
  if (temp_buff)
1553
1536
  {
1554
 
    my_afree((unsigned char*) temp_buff);
 
1537
    free((unsigned char*) temp_buff);
1555
1538
  }
1556
1539
  void * rec_buff_ptr= mi_get_rec_buff_ptr(info, sort_param.record);
1557
1540
  if (rec_buff_ptr != NULL)
1587
1570
 
1588
1571
  if (nod_flag)
1589
1572
  {
1590
 
    if (!(temp_buff=(unsigned char*) my_alloca((uint) keyinfo->block_length)))
 
1573
    if (!(temp_buff=(unsigned char*) malloc(keyinfo->block_length)))
1591
1574
    {
1592
1575
      mi_check_print_error(param,"Not Enough memory");
1593
1576
      return(-1);
1647
1630
    goto err;
1648
1631
  }
1649
1632
  if (temp_buff)
1650
 
    my_afree((unsigned char*) temp_buff);
 
1633
    free((unsigned char*) temp_buff);
1651
1634
  return(0);
1652
1635
err:
1653
1636
  if (temp_buff)
1654
 
    my_afree((unsigned char*) temp_buff);
 
1637
    free((unsigned char*) temp_buff);
1655
1638
  return(1);
1656
1639
} /* sort_record_index */
1657
1640
 
1665
1648
 
1666
1649
static int not_killed= 0;
1667
1650
 
1668
 
volatile int *killed_ptr(MI_CHECK *param __attribute__((unused)))
 
1651
volatile int *killed_ptr(MI_CHECK *)
1669
1652
{
1670
1653
  return &not_killed;                   /* always NULL */
1671
1654
}
1673
1656
        /* print warnings and errors */
1674
1657
        /* VARARGS */
1675
1658
 
1676
 
void mi_check_print_info(MI_CHECK *param __attribute__((unused)),
 
1659
void mi_check_print_info(MI_CHECK *,
1677
1660
                         const char *fmt,...)
1678
1661
{
1679
1662
  va_list args;