summaryrefslogtreecommitdiff
path: root/myisam
diff options
context:
space:
mode:
authormonty@donna.mysql.com <>2000-09-22 01:46:26 +0300
committermonty@donna.mysql.com <>2000-09-22 01:46:26 +0300
commit50486eeb807aefb8af2e03636544fd167ded7f00 (patch)
tree578e79cb989b0a5458b2f7b7cd27600813a79432 /myisam
parent13b3c3280e6bf25be2b5222022a8e22fd7e774c3 (diff)
downloadmariadb-git-50486eeb807aefb8af2e03636544fd167ded7f00.tar.gz
Fixes for MyISAM and packed keys + AIX
Diffstat (limited to 'myisam')
-rw-r--r--myisam/mi_check.c4
-rw-r--r--myisam/mi_search.c4
-rw-r--r--myisam/myisamchk.c21
3 files changed, 21 insertions, 8 deletions
diff --git a/myisam/mi_check.c b/myisam/mi_check.c
index c556c816590..1d5806486b1 100644
--- a/myisam/mi_check.c
+++ b/myisam/mi_check.c
@@ -94,6 +94,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->sort_info.param=param;
+ param->start_check_pos=0;
}
/* Check delete links */
@@ -668,7 +669,7 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend)
intern_record_checksum=param->glob_crc=0;
LINT_INIT(left_length); LINT_INIT(start_recpos); LINT_INIT(to);
got_error=error=0;
- empty=pos=info->s->pack.header_length;
+ empty=info->s->pack.header_length;
/* Check how to calculate checksum of rows */
static_row_size=1;
@@ -685,6 +686,7 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend)
}
}
+ pos=my_b_tell(&param->read_cache);
bzero((char*) key_checksum, info->s->base.keys * sizeof(key_checksum[0]));
while (pos < info->state->data_file_length)
{
diff --git a/myisam/mi_search.c b/myisam/mi_search.c
index 8fb35f3af65..eead2a84c29 100644
--- a/myisam/mi_search.c
+++ b/myisam/mi_search.c
@@ -1407,7 +1407,7 @@ _mi_calc_var_key_length(MI_KEYDEF *keyinfo,uint nod_flag,
Keys are compressed the following way:
If the max length of first key segment <= 127 characters the prefix is
- 1 byte else its 2 byte
+ 1 byte else it's 2 byte
prefix byte The high bit is set if this is a prefix for the prev key
length Packed length if the previous was a prefix byte
@@ -1492,7 +1492,7 @@ _mi_calc_var_pack_key_length(MI_KEYDEF *keyinfo,uint nod_flag,uchar *next_key,
if (new_key_length && new_key_length == org_key_length)
same_length=1;
else if (new_key_length > org_key_length)
- end=key+ org_key_length+1;
+ end=key + org_key_length;
if (sort_order) /* SerG */
{
diff --git a/myisam/myisamchk.c b/myisam/myisamchk.c
index ed1681c728c..73cd50b4e49 100644
--- a/myisam/myisamchk.c
+++ b/myisam/myisamchk.c
@@ -146,7 +146,7 @@ static CHANGEABLE_VAR changeable_vars[] = {
{ "decode_bits",(long*) &decode_bits,9L,4L,17L,0L,1L },
{ NullS,(long*) 0,0L,0L,0L,0L,0L,} };
-enum options {OPT_CHARSETS_DIR=256, OPT_SET_CHARSET};
+enum options {OPT_CHARSETS_DIR=256, OPT_SET_CHARSET,OPT_START_CHECK_POS};
static struct option long_options[] =
@@ -173,6 +173,7 @@ static struct option long_options[] =
{"read-only", no_argument, 0, 'T'},
{"recover", no_argument, 0, 'r'},
{"safe-recover", no_argument, 0, 'o'},
+ {"start-check-pos", required_argument, 0, OPT_START_CHECK_POS},
{"set-auto-increment",optional_argument, 0, 'A'},
{"set-character-set",required_argument,0,OPT_SET_CHARSET},
{"set-variable", required_argument, 0, 'O'},
@@ -190,7 +191,7 @@ static struct option long_options[] =
static void print_version(void)
{
- printf("%s Ver 1.30 for %s at %s\n",my_progname,SYSTEM_TYPE,
+ printf("%s Ver 1.31 for %s at %s\n",my_progname,SYSTEM_TYPE,
MACHINE_TYPE);
}
@@ -416,6 +417,11 @@ static void get_options(register int *argc,register char ***argv)
case OPT_SET_CHARSET:
set_charset_name=optarg;
break;
+#ifdef DEBUG /* Only useful if debugging */
+ case OPT_START_CHECK_POS:
+ check_param.start_check_pos=strtoull(optarg,NULL,0);
+ break;
+#endif
case '?':
usage();
exit(0);
@@ -732,7 +738,8 @@ static int myisamchk(MI_CHECK *param, my_string filename)
error =chk_size(param,info);
if (!error || !(param->testflag & (T_FAST | T_FORCE_CREATE)))
error|=chk_del(param, info,param->testflag);
- if (!error || !(param->testflag & (T_FAST | T_FORCE_CREATE)))
+ if ((!error || !(param->testflag & (T_FAST | T_FORCE_CREATE)) &&
+ !param->start_check_pos))
{
error|=chk_key(param, info);
if (!error && (param->testflag & (T_STATISTICS | T_AUTO_INC)))
@@ -745,8 +752,12 @@ static int myisamchk(MI_CHECK *param, my_string filename)
VOID(init_key_cache(param->use_buffers,(uint) NEAD_MEM));
VOID(init_io_cache(&param->read_cache,datafile,
(uint) param->read_buffer_length,
- READ_CACHE,share->pack.header_length,1,
- MYF(MY_WME)));
+ READ_CACHE,
+ (param->start_check_pos ?
+ param->start_check_pos :
+ share->pack.header_length),
+ 1,
+ MYF(MY_WME)));
lock_memory(param);
if ((info->s->options & (HA_OPTION_PACK_RECORD |
HA_OPTION_COMPRESS_RECORD)) ||