16
16
/* Describe, check and repair of MyISAM tables */
18
#include <drizzled/global.h>
18
#include <my_global.h>
20
#include <mystrings/m_ctype.h>
21
21
#include <stdarg.h>
22
#include <mysys/my_getopt.h>
23
#include <mysys/my_bit.h>
22
#include <my_getopt.h>
24
24
#include <myisam.h>
25
#include <mystrings/m_string.h>
26
26
#ifdef HAVE_SYS_VADVICE_H
27
27
#include <sys/vadvise.h>
29
29
#ifdef HAVE_SYS_MMAN_H
30
30
#include <sys/mman.h>
32
SET_STACK_SIZE(9000) /* Minimum stack size for program */
33
34
#define my_raid_create(A,B,C,D,E,F,G) my_create(A,B,C,G)
34
35
#define my_raid_delete(A,B,C) my_delete(A,B)
36
37
#include "myisamdef.h"
38
static uint32_t decode_bits;
39
static uint decode_bits;
39
40
static char **default_argv;
40
41
static const char *load_default_groups[]= { "myisamchk", 0 };
41
42
static const char *set_collation_name, *opt_tmpdir;
42
static const CHARSET_INFO *set_collation;
43
static CHARSET_INFO *set_collation;
43
44
static long opt_myisam_block_size;
44
45
static long opt_key_cache_block_size;
45
46
static const char *my_progname_short;
71
72
static int myisamchk(MI_CHECK *param, char *filename);
72
73
static void descript(MI_CHECK *param, register MI_INFO *info, char * name);
73
74
static int mi_sort_records(MI_CHECK *param, register MI_INFO *info,
74
char * name, uint32_t sort_key,
75
bool write_info, bool update_index);
75
char * name, uint sort_key,
76
my_bool write_info, my_bool update_index);
76
77
static int sort_record_index(MI_SORT_PARAM *sort_param, MI_INFO *info,
77
78
MI_KEYDEF *keyinfo,
78
my_off_t page,unsigned char *buff,uint32_t sortkey,
79
File new_file, bool update_index);
79
my_off_t page,uchar *buff,uint sortkey,
80
File new_file, my_bool update_index);
81
82
MI_CHECK check_param;
99
100
int new_error=myisamchk(&check_param, *(argv++));
100
101
if ((check_param.testflag & T_REP_ANY) != T_REP)
101
102
check_param.testflag&= ~T_REP;
103
VOID(fflush(stdout));
104
VOID(fflush(stderr));
104
105
if ((check_param.error_printed | check_param.warning_printed) &&
105
106
(check_param.testflag & T_FORCE_CREATE) &&
106
107
(!(check_param.testflag & (T_REP | T_REP_BY_SORT | T_SORT_RECORDS |
109
uint32_t old_testflag=check_param.testflag;
110
uint old_testflag=check_param.testflag;
110
111
if (!(check_param.testflag & T_REP))
111
112
check_param.testflag|= T_REP_BY_SORT;
112
113
check_param.testflag&= ~T_EXTEND; /* Don't needed */
113
114
error|=myisamchk(&check_param, argv[-1]);
114
115
check_param.testflag= old_testflag;
116
VOID(fflush(stdout));
117
VOID(fflush(stderr));
119
120
error|=new_error;
120
121
if (argc && (!(check_param.testflag & T_SILENT) || check_param.testflag & T_INFO))
122
123
puts("\n---------\n");
124
VOID(fflush(stdout));
126
127
if (check_param.total_files > 1)
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},
159
{"autoclose", OPT_AUTO_CLOSE, "Auto close the screen on exit for Netware.",
160
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
157
162
{"block-search", 'b',
158
163
"No help available.",
159
164
0, 0, 0, GET_ULONG, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
172
177
{"correct-checksum", OPT_CORRECT_CHECKSUM,
173
178
"Correct checksum information for table.",
174
179
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
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},
175
185
{"description", 'd',
176
186
"Prints some information about table.",
177
187
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
277
287
{ "key_buffer_size", OPT_KEY_BUFFER_SIZE, "",
278
288
(char**) &check_param.use_buffers, (char**) &check_param.use_buffers, 0,
279
289
GET_ULONG, REQUIRED_ARG, (long) USE_BUFFER_INIT, (long) MALLOC_OVERHEAD,
280
INT32_MAX, (long) MALLOC_OVERHEAD, (long) IO_SIZE, 0},
290
(long) ~0L, (long) MALLOC_OVERHEAD, (long) IO_SIZE, 0},
281
291
{ "key_cache_block_size", OPT_KEY_CACHE_BLOCK_SIZE, "",
282
292
(char**) &opt_key_cache_block_size,
283
293
(char**) &opt_key_cache_block_size, 0,
291
301
(char**) &check_param.read_buffer_length,
292
302
(char**) &check_param.read_buffer_length, 0, GET_ULONG, REQUIRED_ARG,
293
303
(long) READ_BUFFER_INIT, (long) MALLOC_OVERHEAD,
294
INT32_MAX, (long) MALLOC_OVERHEAD, (long) 1L, 0},
304
(long) ~0L, (long) MALLOC_OVERHEAD, (long) 1L, 0},
295
305
{ "write_buffer_size", OPT_WRITE_BUFFER_SIZE, "",
296
306
(char**) &check_param.write_buffer_length,
297
307
(char**) &check_param.write_buffer_length, 0, GET_ULONG, REQUIRED_ARG,
298
308
(long) READ_BUFFER_INIT, (long) MALLOC_OVERHEAD,
299
INT32_MAX, (long) MALLOC_OVERHEAD, (long) 1L, 0},
309
(long) ~0L, (long) MALLOC_OVERHEAD, (long) 1L, 0},
300
310
{ "sort_buffer_size", OPT_SORT_BUFFER_SIZE, "",
301
311
(char**) &check_param.sort_buffer_length,
302
312
(char**) &check_param.sort_buffer_length, 0, GET_ULONG, REQUIRED_ARG,
303
313
(long) SORT_BUFFER_INIT, (long) (MIN_SORT_BUFFER + MALLOC_OVERHEAD),
304
INT32_MAX, (long) MALLOC_OVERHEAD, (long) 1L, 0},
314
(long) ~0L, (long) MALLOC_OVERHEAD, (long) 1L, 0},
305
315
{ "sort_key_blocks", OPT_SORT_KEY_BLOCKS, "",
306
316
(char**) &check_param.sort_key_blocks,
307
317
(char**) &check_param.sort_key_blocks, 0, GET_ULONG, REQUIRED_ARG,
334
346
puts("Used without options all tables on the command will be checked for errors");
335
347
printf("Usage: %s [OPTIONS] tables[.MYI]\n", my_progname_short);
336
348
printf("\nGlobal options:\n");
351
-#, --debug=... Output debug log. Often this is 'd:t:o,filename'.\n");
338
354
-?, --help Display this help and exit.\n\
339
355
-O, --set-variable var=option.\n\
438
454
my_print_variables(my_long_options);
457
#include <help_end.h>
441
459
const char *myisam_stats_method_names[] = {"nulls_unequal", "nulls_equal",
442
"nulls_ignored", NULL};
460
"nulls_ignored", NullS};
443
461
TYPELIB myisam_stats_method_typelib= {
444
462
array_elements(myisam_stats_method_names) - 1, "",
445
463
myisam_stats_method_names, NULL};
715
743
if ((check_param.testflag & T_UNPACK) &&
716
744
(check_param.testflag & (T_QUICK | T_SORT_RECORDS)))
719
"%s: --unpack can't be used with --quick or --sort-records\n",
747
"%s: --unpack can't be used with --quick or --sort-records\n",
723
751
if ((check_param.testflag & T_READONLY) &&
974
1003
if (!error && param->testflag & T_SORT_RECORDS)
978
1007
We can't update the index in mi_sort_records if we have a
979
1008
prefix compressed or fulltext index
1010
my_bool update_index=1;
982
1011
for (key=0 ; key < share->base.keys; key++)
983
if (share->keyinfo[key].flag & (HA_BINARY_PACK_KEY))
1012
if (share->keyinfo[key].flag & (HA_BINARY_PACK_KEY|HA_FULLTEXT))
986
1015
error=mi_sort_records(param,info,filename,param->opt_sort_key,
987
1016
/* what is the following parameter for ? */
988
(bool) !(param->testflag & T_REP),
1017
(my_bool) !(param->testflag & T_REP),
990
1019
datafile=info->dfile; /* This is now locked */
991
1020
if (!error && !update_index)
1031
1060
!(param->testflag & (T_FAST | T_FORCE_CREATE)))
1033
1062
if (param->testflag & (T_EXTEND | T_MEDIUM))
1034
init_key_cache(dflt_key_cache,opt_key_cache_block_size,
1035
param->use_buffers, 0, 0);
1036
init_io_cache(¶m->read_cache,datafile,
1037
(uint) param->read_buffer_length,
1039
(param->start_check_pos ?
1040
param->start_check_pos :
1041
share->pack.header_length),
1063
VOID(init_key_cache(dflt_key_cache,opt_key_cache_block_size,
1064
param->use_buffers, 0, 0));
1065
VOID(init_io_cache(¶m->read_cache,datafile,
1066
(uint) param->read_buffer_length,
1068
(param->start_check_pos ?
1069
param->start_check_pos :
1070
share->pack.header_length),
1044
1073
lock_memory(param);
1045
1074
if ((info->s->options & (HA_OPTION_PACK_RECORD |
1046
1075
HA_OPTION_COMPRESS_RECORD)) ||
1047
1076
(param->testflag & (T_EXTEND | T_MEDIUM)))
1048
1077
error|=chk_data_link(param, info, param->testflag & T_EXTEND);
1049
1078
error|=flush_blocks(param, share->key_cache, share->kfile);
1050
end_io_cache(¶m->read_cache);
1079
VOID(end_io_cache(¶m->read_cache));
1068
1097
if ((param->testflag & T_AUTO_INC) ||
1069
1098
((param->testflag & T_REP_ANY) && info->s->base.auto_key))
1070
1099
update_auto_increment_key(param, info,
1071
(bool) !test(param->testflag & T_AUTO_INC));
1100
(my_bool) !test(param->testflag & T_AUTO_INC));
1073
1102
if (!(param->testflag & T_DESCRIPT))
1100
1129
error|=change_to_newfile(filename,MI_NAME_IEXT,INDEX_TMP_EXT,0,
1103
fflush(stdout); fflush(stderr);
1132
VOID(fflush(stdout)); VOID(fflush(stderr));
1104
1133
if (param->error_printed)
1106
1135
if (param->testflag & (T_REP_ANY | T_SORT_RECORDS | T_SORT_INDEX))
1109
"MyISAM-table '%s' is not fixed because of errors\n",
1137
VOID(fprintf(stderr,
1138
"MyISAM-table '%s' is not fixed because of errors\n",
1111
1140
if (param->testflag & T_REP_ANY)
1113
"Try fixing it by using the --safe-recover (-o), the --force (-f) option or by not using the --quick (-q) flag\n");
1141
VOID(fprintf(stderr,
1142
"Try fixing it by using the --safe-recover (-o), the --force (-f) option or by not using the --quick (-q) flag\n"));
1115
1144
else if (!(param->error_printed & 2) &&
1116
1145
!(param->testflag & T_FORCE_CREATE))
1118
"MyISAM-table '%s' is corrupted\nFix it using switch \"-r\" or \"-o\"\n",
1146
VOID(fprintf(stderr,
1147
"MyISAM-table '%s' is corrupted\nFix it using switch \"-r\" or \"-o\"\n",
1121
1150
else if (param->warning_printed &&
1122
1151
! (param->testflag & (T_REP_ANY | T_SORT_RECORDS | T_SORT_INDEX |
1123
1152
T_FORCE_CREATE)))
1124
fprintf(stderr, "MyISAM-table '%s' is usable but should be fixed\n",
1153
VOID(fprintf(stderr, "MyISAM-table '%s' is usable but should be fixed\n",
1155
VOID(fflush(stderr));
1128
1157
} /* myisamchk */
1133
1162
static void descript(MI_CHECK *param, register MI_INFO *info, char * name)
1135
uint32_t key,keyseg_nr,field,start;
1164
uint key,keyseg_nr,field,start;
1136
1165
register MI_KEYDEF *keyinfo;
1137
1166
register HA_KEYSEG *keyseg;
1138
1167
register const char *text;
1171
1201
if (share->state.changed & STATE_CRASHED)
1172
my_stpcpy(buff,"crashed");
1202
strmov(buff,"crashed");
1175
1205
if (share->state.open_count)
1176
pos=my_stpcpy(pos,"open,");
1206
pos=strmov(pos,"open,");
1177
1207
if (share->state.changed & STATE_CHANGED)
1178
pos=my_stpcpy(pos,"changed,");
1208
pos=strmov(pos,"changed,");
1180
pos=my_stpcpy(pos,"checked,");
1210
pos=strmov(pos,"checked,");
1181
1211
if (!(share->state.changed & STATE_NOT_ANALYZED))
1182
pos=my_stpcpy(pos,"analyzed,");
1212
pos=strmov(pos,"analyzed,");
1183
1213
if (!(share->state.changed & STATE_NOT_OPTIMIZED_KEYS))
1184
pos=my_stpcpy(pos,"optimized keys,");
1214
pos=strmov(pos,"optimized keys,");
1185
1215
if (!(share->state.changed & STATE_NOT_SORTED_PAGES))
1186
pos=my_stpcpy(pos,"sorted index pages,");
1216
pos=strmov(pos,"sorted index pages,");
1187
1217
pos[-1]=0; /* Remove extra ',' */
1189
1219
printf("Status: %s\n",buff);
1210
1240
printf("Data records: %13s Deleted blocks: %13s\n",
1211
1241
llstr(info->state->records,llbuff),llstr(info->state->del,llbuff2));
1212
1242
if (param->testflag & T_SILENT)
1213
return; /* This is enough */
1243
DBUG_VOID_RETURN; /* This is enough */
1215
1245
if (param->testflag & T_VERBOSE)
1258
1288
keyseg=keyinfo->seg;
1259
1289
if (keyinfo->flag & HA_NOSAME) text="unique ";
1290
else if (keyinfo->flag & HA_FULLTEXT) text="fulltext ";
1260
1291
else text="multip.";
1263
1294
if (keyseg->flag & HA_REVERSE_SORT)
1265
pos=my_stpcpy(pos,type_names[keyseg->type]);
1296
pos=strmov(pos,type_names[keyseg->type]);
1268
1299
if (keyinfo->flag & HA_PACK_KEY)
1269
pos=my_stpcpy(pos,prefix_packed_txt);
1300
pos=strmov(pos,prefix_packed_txt);
1270
1301
if (keyinfo->flag & HA_BINARY_PACK_KEY)
1271
pos=my_stpcpy(pos,bin_packed_txt);
1302
pos=strmov(pos,bin_packed_txt);
1272
1303
if (keyseg->flag & HA_SPACE_PACK)
1273
pos=my_stpcpy(pos,diff_txt);
1304
pos=strmov(pos,diff_txt);
1274
1305
if (keyseg->flag & HA_BLOB_PART)
1275
pos=my_stpcpy(pos,blob_txt);
1306
pos=strmov(pos,blob_txt);
1276
1307
if (keyseg->flag & HA_NULL_PART)
1277
pos=my_stpcpy(pos,null_txt);
1308
pos=strmov(pos,null_txt);
1280
1311
printf("%-4d%-6ld%-3d %-8s%-21s",
1287
1318
printf("%11lu %12s %10d",
1288
1319
share->state.rec_per_key_part[keyseg_nr++],
1289
1320
buff,keyinfo->block_length);
1321
VOID(putchar('\n'));
1291
1322
while ((++keyseg)->type != HA_KEYTYPE_END)
1294
1325
if (keyseg->flag & HA_REVERSE_SORT)
1296
pos=my_stpcpy(pos,type_names[keyseg->type]);
1327
pos=strmov(pos,type_names[keyseg->type]);
1298
1329
if (keyseg->flag & HA_SPACE_PACK)
1299
pos=my_stpcpy(pos,diff_txt);
1330
pos=strmov(pos,diff_txt);
1300
1331
if (keyseg->flag & HA_BLOB_PART)
1301
pos=my_stpcpy(pos,blob_txt);
1332
pos=strmov(pos,blob_txt);
1302
1333
if (keyseg->flag & HA_NULL_PART)
1303
pos=my_stpcpy(pos,null_txt);
1334
pos=strmov(pos,null_txt);
1305
1336
printf(" %-6ld%-3d %-21s",
1306
1337
(long) keyseg->start+1,keyseg->length,buff);
1307
1338
if (param->testflag & T_VERBOSE)
1308
1339
printf("%11lu", share->state.rec_per_key_part[keyseg_nr++]);
1340
VOID(putchar('\n'));
1317
1348
for (key=0,uniqueinfo= &share->uniqueinfo[0] ;
1318
1349
key < share->state.header.uniques; key++, uniqueinfo++)
1321
1352
char null_bit[8],null_pos[8];
1322
1353
printf("%-8d%-5d",key+1,uniqueinfo->key+1);
1323
1354
for (keyseg=uniqueinfo->seg ; keyseg->type != HA_KEYTYPE_END ; keyseg++)
1352
1383
type=share->rec[field].base_type;
1354
1385
type=(enum en_fieldtype) share->rec[field].type;
1355
end=my_stpcpy(buff,field_pack[type]);
1386
end=strmov(buff,field_pack[type]);
1356
1387
if (share->options & HA_OPTION_COMPRESS_RECORD)
1358
1389
if (share->rec[field].pack_type & PACK_TYPE_SELECTED)
1359
end=my_stpcpy(end,", not_always");
1390
end=strmov(end,", not_always");
1360
1391
if (share->rec[field].pack_type & PACK_TYPE_SPACE_FIELDS)
1361
end=my_stpcpy(end,", no empty");
1392
end=strmov(end,", no empty");
1362
1393
if (share->rec[field].pack_type & PACK_TYPE_ZERO_FILL)
1364
1395
sprintf(end,", zerofill(%d)",share->rec[field].space_length_bits);
1365
end= strchr(end, '\0');
1368
1399
if (buff[0] == ',')
1369
my_stpcpy(buff,buff+2);
1400
strmov(buff,buff+2);
1370
1401
int10_to_str((long) share->rec[field].length,length,10);
1371
1402
null_bit[0]=null_pos[0]=0;
1372
1403
if (share->rec[field].null_bit)
1396
1427
static int mi_sort_records(MI_CHECK *param,
1397
1428
register MI_INFO *info, char * name,
1431
my_bool update_index)
1404
1435
MI_KEYDEF *keyinfo;
1406
unsigned char *temp_buff;
1407
1438
ha_rows old_record_count;
1408
1439
MYISAM_SHARE *share=info->s;
1409
1440
char llbuff[22],llbuff2[22];
1410
1441
SORT_INFO sort_info;
1411
1442
MI_SORT_PARAM sort_param;
1443
DBUG_ENTER("sort_records");
1413
memset(&sort_info, 0, sizeof(sort_info));
1414
memset(&sort_param, 0, sizeof(sort_param));
1445
bzero((char*)&sort_info,sizeof(sort_info));
1446
bzero((char*)&sort_param,sizeof(sort_param));
1415
1447
sort_param.sort_info=&sort_info;
1416
1448
sort_info.param=param;
1417
1449
keyinfo= &share->keyinfo[sort_key];
1425
1457
"Can't sort table '%s' on key %d; No such key",
1426
1458
name,sort_key+1);
1427
1459
param->error_printed=0;
1428
return(0); /* Nothing to do */
1460
DBUG_RETURN(0); /* Nothing to do */
1462
if (keyinfo->flag & HA_FULLTEXT)
1464
mi_check_print_warning(param,"Can't sort table '%s' on FULLTEXT key %d",
1466
param->error_printed=0;
1467
DBUG_RETURN(0); /* Nothing to do */
1430
1469
if (share->data_file_type == COMPRESSED_RECORD)
1432
1471
mi_check_print_warning(param,"Can't sort read-only table '%s'", name);
1433
1472
param->error_printed=0;
1434
return(0); /* Nothing to do */
1473
DBUG_RETURN(0); /* Nothing to do */
1436
1475
if (!(param->testflag & T_SILENT))
1442
1481
llstr(info->state->del,llbuff2));
1444
1483
if (share->state.key_root[sort_key] == HA_OFFSET_ERROR)
1445
return(0); /* Nothing to do */
1484
DBUG_RETURN(0); /* Nothing to do */
1447
1486
init_key_cache(dflt_key_cache, opt_key_cache_block_size, param->use_buffers,
1488
1527
for (key=0 ; key < share->base.keys ; key++)
1489
1528
share->keyinfo[key].flag|= HA_SORT_ALLOWS_SAME;
1491
if (my_pread(share->kfile,(unsigned char*) temp_buff,
1530
if (my_pread(share->kfile,(uchar*) temp_buff,
1492
1531
(uint) keyinfo->block_length,
1493
1532
share->state.key_root[sort_key],
1494
1533
MYF(MY_NABP+MY_WME)))
1538
1577
if (param->testflag & T_WRITE_LOOP)
1540
fputs(" \r",stdout); fflush(stdout);
1579
VOID(fputs(" \r",stdout)); VOID(fflush(stdout));
1545
1584
if (got_error && new_file >= 0)
1547
end_io_cache(&info->rec_cache);
1586
VOID(end_io_cache(&info->rec_cache));
1548
1587
(void) my_close(new_file,MYF(MY_WME));
1549
1588
(void) my_raid_delete(param->temp_filename, share->base.raid_chunks,
1554
my_afree((unsigned char*) temp_buff);
1593
my_afree((uchar*) temp_buff);
1556
void * rec_buff_ptr= mi_get_rec_buff_ptr(info, sort_param.record);
1557
if (rec_buff_ptr != NULL)
1595
my_free(mi_get_rec_buff_ptr(info, sort_param.record),
1596
MYF(MY_ALLOW_ZERO_PTR));
1560
1597
info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED);
1561
end_io_cache(&info->rec_cache);
1562
free(sort_info.buff);
1598
VOID(end_io_cache(&info->rec_cache));
1599
my_free(sort_info.buff,MYF(MY_ALLOW_ZERO_PTR));
1563
1600
sort_info.buff=0;
1564
1601
share->state.sortkey=sort_key;
1565
return(flush_blocks(param, share->key_cache, share->kfile) |
1602
DBUG_RETURN(flush_blocks(param, share->key_cache, share->kfile) |
1567
1604
} /* sort_records */
1572
1609
static int sort_record_index(MI_SORT_PARAM *sort_param,MI_INFO *info,
1573
1610
MI_KEYDEF *keyinfo,
1574
my_off_t page, unsigned char *buff, uint32_t sort_key,
1575
File new_file,bool update_index)
1611
my_off_t page, uchar *buff, uint sort_key,
1612
File new_file,my_bool update_index)
1577
1614
uint nod_flag,used_length,key_length;
1578
unsigned char *temp_buff,*keypos,*endpos;
1615
uchar *temp_buff,*keypos,*endpos;
1579
1616
my_off_t next_page,rec_pos;
1580
unsigned char lastkey[MI_MAX_KEY_BUFF];
1617
uchar lastkey[MI_MAX_KEY_BUFF];
1581
1618
char llbuff[22];
1582
1619
SORT_INFO *sort_info= sort_param->sort_info;
1583
1620
MI_CHECK *param=sort_info->param;
1621
DBUG_ENTER("sort_record_index");
1585
1623
nod_flag=mi_test_if_nod(buff);
1590
if (!(temp_buff=(unsigned char*) my_alloca((uint) keyinfo->block_length)))
1628
if (!(temp_buff=(uchar*) my_alloca((uint) keyinfo->block_length)))
1592
1630
mi_check_print_error(param,"Not Enough memory");
1596
1634
used_length=mi_getint(buff);
1603
1641
next_page=_mi_kpos(nod_flag,keypos);
1604
if (my_pread(info->s->kfile,(unsigned char*) temp_buff,
1642
if (my_pread(info->s->kfile,(uchar*) temp_buff,
1605
1643
(uint) keyinfo->block_length, next_page,
1606
1644
MYF(MY_NABP+MY_WME)))
1641
1679
/* Clear end of block to get better compression if the table is backuped */
1642
memset(buff+used_length, 0, keyinfo->block_length-used_length);
1643
if (my_pwrite(info->s->kfile,(unsigned char*) buff,(uint) keyinfo->block_length,
1680
bzero((uchar*) buff+used_length,keyinfo->block_length-used_length);
1681
if (my_pwrite(info->s->kfile,(uchar*) buff,(uint) keyinfo->block_length,
1644
1682
page,param->myf_rw))
1646
1684
mi_check_print_error(param,"%d when updating keyblock",my_errno);
1650
my_afree((unsigned char*) temp_buff);
1688
my_afree((uchar*) temp_buff);
1654
my_afree((unsigned char*) temp_buff);
1692
my_afree((uchar*) temp_buff);
1656
1694
} /* sort_record_index */
1701
1740
param->warning_printed=1;
1702
1741
va_start(args,fmt);
1703
1742
fprintf(stderr,"%s: warning: ",my_progname_short);
1704
vfprintf(stderr, fmt, args);
1743
VOID(vfprintf(stderr, fmt, args));
1744
VOID(fputc('\n',stderr));
1706
1745
fflush(stderr);
1713
1752
void mi_check_print_error(MI_CHECK *param, const char *fmt,...)
1755
DBUG_ENTER("mi_check_print_error");
1756
DBUG_PRINT("enter",("format: %s",fmt));
1717
1758
fflush(stdout);
1718
1759
if (!param->warning_printed && !param->error_printed)
1724
1765
param->error_printed|=1;
1725
1766
va_start(args,fmt);
1726
1767
fprintf(stderr,"%s: error: ",my_progname_short);
1727
vfprintf(stderr, fmt, args);
1768
VOID(vfprintf(stderr, fmt, args));
1769
VOID(fputc('\n',stderr));
1729
1770
fflush(stderr);