summaryrefslogtreecommitdiff
path: root/myisam
diff options
context:
space:
mode:
authorunknown <monty@mashka.mysql.fi>2003-05-13 10:54:07 +0300
committerunknown <monty@mashka.mysql.fi>2003-05-13 10:54:07 +0300
commit10c790eff016ff0fc779baeb7ebf94940d3544e7 (patch)
tree911f869319dc53526bc2bb909aa87944db9d2696 /myisam
parent504fd4d43990e507b685eb336ee672c637ecf4cb (diff)
downloadmariadb-git-10c790eff016ff0fc779baeb7ebf94940d3544e7.tar.gz
Safety fix to enable RAID in max binaries
Better fix for format('nan') Fix for HAVING COUNT(DISTINCT...) myisam/mi_check.c: Better error message myisam/mi_dynrec.c: Simple code cleanup myisam/myisamchk.c: Better error messages mysql-test/r/func_misc.result: Added back test for format('nan') mysql-test/r/having.result: New test mysql-test/t/func_misc.test: Added back test for format('nan') mysql-test/t/having.test: Added test for count(distinct) in having mysys/raid.cc: Safety fix to enable RAID in max binaries scripts/mysql_install_db.sh: Create data directories even if --in-rpm is used (for MaxOSX) sql/item_strfunc.cc: Better fix for format('nan') sql/mysqld.cc: Give stacktrace on assert() sql/sql_yacc.yy: Fix for HAVING COUNT(DISTINCT...) tests/big_record.pl: Extend test to abuse packed MyISAM tables tests/table_types.pl: Fixed wrong merge
Diffstat (limited to 'myisam')
-rw-r--r--myisam/mi_check.c12
-rw-r--r--myisam/mi_dynrec.c21
-rw-r--r--myisam/myisamchk.c16
3 files changed, 25 insertions, 24 deletions
diff --git a/myisam/mi_check.c b/myisam/mi_check.c
index a64130cf6e0..92641cce13a 100644
--- a/myisam/mi_check.c
+++ b/myisam/mi_check.c
@@ -873,15 +873,19 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend)
{
if (b_type & BLOCK_LAST)
{
- mi_check_print_error(param,"Record link to short for record at %s",
- llstr(start_recpos,llbuff));
+ mi_check_print_error(param,
+ "Wrong record length %s of %s at %s",
+ llstr(block_info.rec_len-left_length,llbuff),
+ llstr(block_info.rec_len, llbuff2),
+ llstr(start_recpos,llbuff3));
got_error=1;
break;
}
if (info->state->data_file_length < block_info.next_filepos)
{
- mi_check_print_error(param,"Found next-recordlink that points outside datafile at %s",
- llstr(block_info.filepos,llbuff));
+ mi_check_print_error(param,
+ "Found next-recordlink that points outside datafile at %s",
+ llstr(block_info.filepos,llbuff));
got_error=1;
break;
}
diff --git a/myisam/mi_dynrec.c b/myisam/mi_dynrec.c
index dc51269ac35..faf86c3ffbd 100644
--- a/myisam/mi_dynrec.c
+++ b/myisam/mi_dynrec.c
@@ -485,7 +485,7 @@ int _mi_write_part_record(MI_INFO *info,
{
info->update&= ~HA_STATE_EXTEND_BLOCK;
if (my_block_write(&info->rec_cache,(byte*) *record-head_length,
- length+extra_length+del_length,filepos))
+ length+extra_length+del_length,filepos))
goto err;
}
else if (my_b_write(&info->rec_cache,(byte*) *record-head_length,
@@ -1412,10 +1412,7 @@ uint _mi_get_block_info(MI_BLOCK_INFO *info, File file, my_off_t filepos)
VOID(my_seek(file,filepos,MY_SEEK_SET,MYF(0)));
if (my_read(file,(char*) header,sizeof(info->header),MYF(0)) !=
sizeof(info->header))
- {
- my_errno=HA_ERR_WRONG_IN_RECORD;
- return BLOCK_FATAL_ERROR;
- }
+ goto err;
}
DBUG_DUMP("header",(byte*) header,MI_BLOCK_INFO_HEADER_LENGTH);
if (info->second_read)
@@ -1435,10 +1432,7 @@ uint _mi_get_block_info(MI_BLOCK_INFO *info, File file, my_off_t filepos)
if ((info->block_len=(uint) mi_uint3korr(header+1)) <
MI_MIN_BLOCK_LENGTH ||
(info->block_len & (MI_DYN_ALIGN_SIZE -1)))
- {
- my_errno=HA_ERR_WRONG_IN_RECORD;
- return BLOCK_ERROR;
- }
+ goto err;
info->filepos=filepos;
info->next_filepos=mi_sizekorr(header+4);
info->prev_filepos=mi_sizekorr(header+12);
@@ -1449,7 +1443,7 @@ uint _mi_get_block_info(MI_BLOCK_INFO *info, File file, my_off_t filepos)
(mi_uint4korr(header+12) != 0 &&
(mi_uint4korr(header+12) != (ulong) ~0 ||
info->prev_filepos != (ulong) ~0)))
- return BLOCK_FATAL_ERROR;
+ goto err;
#endif
return return_val | BLOCK_DELETED; /* Deleted block */
@@ -1529,8 +1523,9 @@ uint _mi_get_block_info(MI_BLOCK_INFO *info, File file, my_off_t filepos)
info->second_read=1;
info->filepos=filepos+12;
return return_val;
- default:
- my_errno=HA_ERR_WRONG_IN_RECORD; /* Garbage */
- return BLOCK_ERROR;
}
+
+err:
+ my_errno=HA_ERR_WRONG_IN_RECORD; /* Garbage */
+ return BLOCK_ERROR;
}
diff --git a/myisam/myisamchk.c b/myisam/myisamchk.c
index ac1d0fbfc4a..a3970d65fdf 100644
--- a/myisam/myisamchk.c
+++ b/myisam/myisamchk.c
@@ -44,6 +44,7 @@ static const char *load_default_groups[]= { "myisamchk", 0 };
static const char *set_charset_name;
static CHARSET_INFO *set_charset;
static long opt_myisam_block_size;
+static const char *my_progname_short;
static const char *type_names[]=
{ "?","char","binary", "short", "long", "float",
@@ -85,6 +86,7 @@ int main(int argc, char **argv)
{
int error;
MY_INIT(argv[0]);
+ my_progname_short= my_progname+dirname_length(my_progname);
#ifdef __EMX__
_wildcard (&argc, &argv);
@@ -330,7 +332,7 @@ static void usage(void)
puts("This software comes with NO WARRANTY: see the PUBLIC for details.\n");
puts("Description, check and repair of MyISAM tables.");
puts("Used without options all tables on the command will be checked for errors");
- printf("Usage: %s [OPTIONS] tables[.MYI]\n", my_progname);
+ printf("Usage: %s [OPTIONS] tables[.MYI]\n", my_progname_short);
puts("\nGlobal options:\n\
-#, --debug=... Output debug log. Often this is 'd:t:o,filename'\n\
-?, --help Display this help and exit.\n\
@@ -679,7 +681,7 @@ static void get_options(register int *argc,register char ***argv)
{
VOID(fprintf(stderr,
"%s: --unpack can't be used with --quick or --sort-records\n",
- my_progname));
+ my_progname_short));
exit(1);
}
if ((check_param.testflag & T_READONLY) &&
@@ -689,7 +691,7 @@ static void get_options(register int *argc,register char ***argv)
{
VOID(fprintf(stderr,
"%s: Can't use --readonly when repairing or sorting\n",
- my_progname));
+ my_progname_short));
exit(1);
}
@@ -1655,13 +1657,13 @@ void mi_check_print_warning(MI_CHECK *param, const char *fmt,...)
if (!param->warning_printed && !param->error_printed)
{
if (param->testflag & T_SILENT)
- fprintf(stderr,"%s: MyISAM file %s\n",my_progname,
+ fprintf(stderr,"%s: MyISAM file %s\n",my_progname_short,
param->isam_file_name);
param->out_flag|= O_DATA_LOST;
}
param->warning_printed=1;
va_start(args,fmt);
- fprintf(stderr,"%s: warning: ",my_progname);
+ fprintf(stderr,"%s: warning: ",my_progname_short);
VOID(vfprintf(stderr, fmt, args));
VOID(fputc('\n',stderr));
fflush(stderr);
@@ -1681,12 +1683,12 @@ void mi_check_print_error(MI_CHECK *param, const char *fmt,...)
if (!param->warning_printed && !param->error_printed)
{
if (param->testflag & T_SILENT)
- fprintf(stderr,"%s: MyISAM file %s\n",my_progname,param->isam_file_name);
+ fprintf(stderr,"%s: MyISAM file %s\n",my_progname_short,param->isam_file_name);
param->out_flag|= O_DATA_LOST;
}
param->error_printed|=1;
va_start(args,fmt);
- fprintf(stderr,"%s: error: ",my_progname);
+ fprintf(stderr,"%s: error: ",my_progname_short);
VOID(vfprintf(stderr, fmt, args));
VOID(fputc('\n',stderr));
fflush(stderr);