summaryrefslogtreecommitdiff
path: root/myisam
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2003-11-23 14:36:41 +0200
committerunknown <monty@mysql.com>2003-11-23 14:36:41 +0200
commitce44db9fb1fc20133e05cab5cd99195c814f3b05 (patch)
treedf2c427c1d086dc0727fa8656815cece6df4aeb2 /myisam
parentb1a563c39233b6af3939f23e4b50d89d7b28a74a (diff)
downloadmariadb-git-ce44db9fb1fc20133e05cab5cd99195c814f3b05.tar.gz
Fixed compiler warnings from Intel compiler in Win64
Added option --max-record-length=# to myisamchk Don't try repair twice if doing myisamchk --repair --force Shared memory handler didn't clean up things on errors or shutdown VC++Files/libmysqltest/mytest.c: Fixed compiler warnings from Intel compiler include/myisam.h: Added option --max-record-length=# to myisamchk include/mysql_com.h: Fixed compiler warnings from Intel compiler innobase/btr/btr0btr.c: Fixed compiler warnings from Intel compiler innobase/btr/btr0cur.c: Fixed compiler warnings from Intel compiler innobase/include/btr0btr.ic: Fixed compiler warnings from Intel compiler innobase/include/buf0buf.ic: Fixed compiler warnings from Intel compiler innobase/include/row0sel.ic: Fixed compiler warnings from Intel compiler innobase/include/row0upd.ic: Fixed compiler warnings from Intel compiler innobase/include/trx0rseg.ic: Fixed compiler warnings from Intel compiler innobase/pars/pars0opt.c: Fixed compiler warnings from Intel compiler innobase/que/que0que.c: Fixed compiler warnings from Intel compiler myisam/mi_check.c: Added option --max-record-length=# to myisamchk Better error messages myisam/myisamchk.c: Added option --max-record-length=# to myisamchk Don't try repair twice if doing myisamchk --repair --force mysql-test/r/create.result: Updated test results mysql-test/t/create.test: Better initialization sql/ha_innodb.cc: Fixed compiler warnings from Intel compiler sql/item_func.cc: Fixed compiler warnings from Intel compiler sql/mysqld.cc: Fixed compiler warnings from Intel compiler Cleaned up handle_connections_shared_memory Shared memory handler didn't clean up things on errors or shutdown strings/bmove512.c: Fixed compiler warnings from Intel compiler
Diffstat (limited to 'myisam')
-rw-r--r--myisam/mi_check.c91
-rw-r--r--myisam/myisamchk.c15
2 files changed, 68 insertions, 38 deletions
diff --git a/myisam/mi_check.c b/myisam/mi_check.c
index fd4c897983f..bd8c8c60e33 100644
--- a/myisam/mi_check.c
+++ b/myisam/mi_check.c
@@ -77,6 +77,7 @@ void myisamchk_init(MI_CHECK *param)
param->tmpfile_createflag=O_RDWR | O_TRUNC | O_EXCL;
param->myf_rw=MYF(MY_NABP | MY_WME | MY_WAIT_IF_FULL);
param->start_check_pos=0;
+ param->max_record_length= LONGLONG_MAX;
param->key_cache_block_size= KEY_CACHE_BLOCK_SIZE;
}
@@ -523,7 +524,7 @@ static int chk_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo,
if (!(temp_buff=(uchar*) my_alloca((uint) keyinfo->block_length)))
{
- mi_check_print_error(param,"Not Enough memory");
+ mi_check_print_error(param,"Not enough memory for keyblock");
DBUG_RETURN(-1);
}
@@ -712,7 +713,7 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend)
if (!(record= (byte*) my_malloc(info->s->base.pack_reclength,MYF(0))))
{
- mi_check_print_error(param,"Not Enough memory");
+ mi_check_print_error(param,"Not enough memory for record");
DBUG_RETURN(-1);
}
records=del_blocks=0;
@@ -815,16 +816,17 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend)
goto next;
}
mi_check_print_error(param,"Wrong bytesec: %d-%d-%d at linkstart: %s",
- block_info.header[0],block_info.header[1],
- block_info.header[2],
- llstr(start_block,llbuff));
+ block_info.header[0],block_info.header[1],
+ block_info.header[2],
+ llstr(start_block,llbuff));
goto err2;
}
if (info->state->data_file_length < block_info.filepos+
block_info.block_len)
{
- mi_check_print_error(param,"Recordlink that points outside datafile at %s",
- llstr(pos,llbuff));
+ mi_check_print_error(param,
+ "Recordlink that points outside datafile at %s",
+ llstr(pos,llbuff));
got_error=1;
break;
}
@@ -835,9 +837,9 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend)
pos=block_info.filepos+block_info.block_len;
if (block_info.rec_len > (uint) info->s->base.max_pack_length)
{
- mi_check_print_error(param,"Found too long record (%d) at %s",
- block_info.rec_len,
- llstr(start_recpos,llbuff));
+ mi_check_print_error(param,"Found too long record (%lu) at %s",
+ (ulong) block_info.rec_len,
+ llstr(start_recpos,llbuff));
got_error=1;
break;
}
@@ -846,8 +848,10 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend)
if (!(to= mi_alloc_rec_buff(info, block_info.rec_len,
&info->rec_buff)))
{
- mi_check_print_error(param,"Not enough memory for blob at %s",
- llstr(start_recpos,llbuff));
+ mi_check_print_error(param,
+ "Not enough memory (%lu) for blob at %s",
+ (ulong) block_info.rec_len,
+ llstr(start_recpos,llbuff));
got_error=1;
break;
}
@@ -858,9 +862,11 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend)
}
if (left_length < block_info.data_len)
{
- mi_check_print_error(param,"Found too long record at %s",
- llstr(start_recpos,llbuff));
- got_error=1; break;
+ mi_check_print_error(param,"Found too long record (%lu) at %s",
+ (ulong) block_info.data_len,
+ llstr(start_recpos,llbuff));
+ got_error=1;
+ break;
}
if (_mi_read_cache(&param->read_cache,(byte*) to,block_info.filepos,
(uint) block_info.data_len,
@@ -1167,7 +1173,7 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info,
MYF(0))) ||
!mi_alloc_rec_buff(info, -1, &sort_param.rec_buff))
{
- mi_check_print_error(param,"Not enough memory for extra record");
+ mi_check_print_error(param, "Not enough memory for extra record");
goto err;
}
@@ -1630,7 +1636,7 @@ static int sort_one_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo,
if (!(buff=(uchar*) my_alloca((uint) keyinfo->block_length)))
{
- mi_check_print_error(param,"Not Enough memory");
+ mi_check_print_error(param,"Not enough memory for key block");
DBUG_RETURN(-1);
}
if (!_mi_fetch_keypage(info,keyinfo,pagepos,DFLT_INIT_HITS,buff,0))
@@ -1842,7 +1848,7 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info,
MYF(0))) ||
!mi_alloc_rec_buff(info, -1, &sort_param.rec_buff))
{
- mi_check_print_error(param,"Not enough memory for extra record");
+ mi_check_print_error(param, "Not enough memory for extra record");
goto err;
}
if (!rep_quick)
@@ -2278,17 +2284,19 @@ int mi_repair_parallel(MI_CHECK *param, register MI_INFO *info,
rec_length=share->base.min_block_length;
else
rec_length=share->base.pack_reclength;
+ /*
+ +1 below is required hack for parallel repair mode.
+ The info->state->records value, that is compared later
+ to sort_info.max_records and cannot exceed it, is
+ increased in sort_key_write. In mi_repair_by_sort, sort_key_write
+ is called after sort_key_read, where the comparison is performed,
+ but in parallel mode master thread can call sort_key_write
+ before some other repair thread calls sort_key_read.
+ Furthermore I'm not even sure +1 would be enough.
+ May be sort_info.max_records shold be always set to max value in
+ parallel mode.
+ */
sort_info.max_records=
- /* +1 below is required hack for parallel repair mode.
- The info->state->records value, that is compared later
- to sort_info.max_records and cannot exceed it, is
- increased in sort_key_write. In mi_repair_by_sort, sort_key_write
- is called after sort_key_read, where the comparison is performed,
- but in parallel mode master thread can call sort_key_write
- before some other repair thread calls sort_key_read.
- Furthermore I'm not even sure +1 would be enough.
- May be sort_info.max_records shold be always set to max value in
- parallel mode. */
((param->testflag & T_CREATE_MISSING_KEYS) ? info->state->records + 1:
(ha_rows) (sort_info.filelength/rec_length+1));
@@ -2302,7 +2310,7 @@ int mi_repair_parallel(MI_CHECK *param, register MI_INFO *info,
(sizeof(MI_SORT_PARAM) + share->base.pack_reclength),
MYF(MY_ZEROFILL))))
{
- mi_check_print_error(param,"Not enough memory!");
+ mi_check_print_error(param,"Not enough memory for key!");
goto err;
}
total_key_length=0;
@@ -2858,9 +2866,20 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param)
if (!(to=mi_alloc_rec_buff(info,block_info.rec_len,
&(sort_param->rec_buff))))
{
- mi_check_print_error(param,"Not enough memory for blob at %s (need %lu)",
- llstr(sort_param->start_recpos,llbuff), block_info.rec_len);
- DBUG_RETURN(1);
+ if (param->max_record_length >= block_info.rec_len)
+ {
+ mi_check_print_error(param,"Not enough memory for blob at %s (need %lu)",
+ llstr(sort_param->start_recpos,llbuff),
+ (ulong) block_info.rec_len);
+ DBUG_RETURN(1);
+ }
+ else
+ {
+ mi_check_print_info(param,"Not enough memory for blob at %s (need %lu); Row skipped",
+ llstr(sort_param->start_recpos,llbuff),
+ (ulong) block_info.rec_len);
+ goto try_next;
+ }
}
}
else
@@ -2868,14 +2887,16 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param)
}
if (left_length < block_info.data_len || ! block_info.data_len)
{
- mi_check_print_info(param,"Found block with too small length at %s; Skipped",
+ mi_check_print_info(param,
+ "Found block with too small length at %s; Skipped",
llstr(sort_param->start_recpos,llbuff));
goto try_next;
}
if (block_info.filepos + block_info.data_len >
sort_param->read_cache.end_of_file)
{
- mi_check_print_info(param,"Found block that points outside data file at %s",
+ mi_check_print_info(param,
+ "Found block that points outside data file at %s",
llstr(sort_param->start_recpos,llbuff));
goto try_next;
}
@@ -3510,7 +3531,7 @@ static SORT_KEY_BLOCKS *alloc_key_blocks(MI_CHECK *param, uint blocks,
buffer_length+IO_SIZE)*blocks,
MYF(0))))
{
- mi_check_print_error(param,"Not Enough memory for sort-key-blocks");
+ mi_check_print_error(param,"Not enough memory for sort-key-blocks");
return(0);
}
for (i=0 ; i < blocks ; i++)
diff --git a/myisam/myisamchk.c b/myisam/myisamchk.c
index f034d6ae406..61a1736c521 100644
--- a/myisam/myisamchk.c
+++ b/myisam/myisamchk.c
@@ -110,7 +110,8 @@ int main(int argc, char **argv)
VOID(fflush(stderr));
if ((check_param.error_printed | check_param.warning_printed) &&
(check_param.testflag & T_FORCE_CREATE) &&
- (!(check_param.testflag & (T_REP | T_SORT_RECORDS | T_SORT_INDEX))))
+ (!(check_param.testflag & (T_REP | T_REP_BY_SORT | T_SORT_RECORDS |
+ T_SORT_INDEX))))
{
uint old_testflag=check_param.testflag;
if (!(check_param.testflag & T_REP))
@@ -153,7 +154,7 @@ enum options_mc {
OPT_KEY_CACHE_BLOCK_SIZE, OPT_MYISAM_BLOCK_SIZE,
OPT_READ_BUFFER_SIZE, OPT_WRITE_BUFFER_SIZE, OPT_SORT_BUFFER_SIZE,
OPT_SORT_KEY_BLOCKS, OPT_DECODE_BITS, OPT_FT_MIN_WORD_LEN,
- OPT_FT_MAX_WORD_LEN, OPT_FT_MAX_WORD_LEN_FOR_SORT
+ OPT_FT_MAX_WORD_LEN, OPT_FT_MAX_WORD_LEN_FOR_SORT, OPT_MAX_RECORD_LENGTH
};
static struct my_option my_long_options[] =
@@ -215,6 +216,11 @@ static struct my_option my_long_options[] =
(gptr*) &check_param.keys_in_use,
(gptr*) &check_param.keys_in_use,
0, GET_ULL, REQUIRED_ARG, -1, 0, 0, 0, 0, 0},
+ {"max-record-length", OPT_MAX_RECORD_LENGTH,
+ "Skip rows bigger than this if myisamchk can't allocate memory to hold it",
+ (gptr*) &check_param.max_record_length,
+ (gptr*) &check_param.max_record_length,
+ 0, GET_ULL, REQUIRED_ARG, LONGLONG_MAX, 0, LONGLONG_MAX, 0, 0, 0},
{"medium-check", 'm',
"Faster than extend-check, but only finds 99.99% of all errors. Should be good enough for most cases.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
@@ -327,7 +333,7 @@ static struct my_option my_long_options[] =
static void print_version(void)
{
- printf("%s Ver 2.6 for %s at %s\n", my_progname, SYSTEM_TYPE,
+ printf("%s Ver 2.7 for %s at %s\n", my_progname, SYSTEM_TYPE,
MACHINE_TYPE);
}
@@ -394,6 +400,9 @@ static void usage(void)
-k, --keys-used=# Tell MyISAM to update only some specific keys. # is a\n\
bit mask of which keys to use. This can be used to\n\
get faster inserts.\n\
+ --max-record-length=#\n\
+ Skip rows bigger than this if myisamchk can't allocate\n\
+ memory to hold it.\n\
-r, --recover Can fix almost anything except unique keys that aren't\n\
unique.\n\
-n, --sort-recover Forces recovering with sorting even if the temporary\n\