summaryrefslogtreecommitdiff
path: root/myisam
diff options
context:
space:
mode:
Diffstat (limited to 'myisam')
-rw-r--r--myisam/ft_boolean_search.c4
-rw-r--r--myisam/mi_check.c34
-rw-r--r--myisam/mi_dynrec.c21
-rw-r--r--myisam/mi_info.c2
-rw-r--r--myisam/mi_key.c23
-rw-r--r--myisam/mi_open.c13
-rw-r--r--myisam/mi_range.c3
-rw-r--r--myisam/mi_rkey.c48
-rw-r--r--myisam/mi_search.c31
-rw-r--r--myisam/mi_test2.c12
-rw-r--r--myisam/myisamchk.c19
-rw-r--r--myisam/myisamdef.h4
-rw-r--r--myisam/sort.c8
13 files changed, 158 insertions, 64 deletions
diff --git a/myisam/ft_boolean_search.c b/myisam/ft_boolean_search.c
index 6fa71348002..c59d140da85 100644
--- a/myisam/ft_boolean_search.c
+++ b/myisam/ft_boolean_search.c
@@ -321,10 +321,10 @@ static void _ftb_init_index_search(FT_INFO *ftb)
else /* 3 */
{
if (!is_tree_inited(& ftb->no_dupes))
- {
init_tree(&ftb->no_dupes,0,0,sizeof(my_off_t),
_ftb_no_dupes_cmp, 0, NULL, NULL);
- }
+ else
+ reset_tree(& ftb->no_dupes);
}
}
diff --git a/myisam/mi_check.c b/myisam/mi_check.c
index 75f2a6c83c4..019222fdf22 100644
--- a/myisam/mi_check.c
+++ b/myisam/mi_check.c
@@ -858,15 +858,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;
}
@@ -2233,7 +2237,17 @@ int mi_repair_parallel(MI_CHECK *param, register MI_INFO *info,
else
rec_length=share->base.pack_reclength;
sort_info.max_records=
- ((param->testflag & T_CREATE_MISSING_KEYS) ? info->state->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));
del=info->state->del;
@@ -3681,12 +3695,14 @@ int update_state_info(MI_CHECK *param, MI_INFO *info,uint update)
}
if (update & UPDATE_STAT)
{
- uint key_parts= mi_uint2korr(share->state.header.key_parts);
+ uint i, key_parts= mi_uint2korr(share->state.header.key_parts);
share->state.rec_per_key_rows=info->state->records;
- memcpy((char*) share->state.rec_per_key_part,
- (char*) param->rec_per_key_part,
- sizeof(*param->rec_per_key_part)*key_parts);
share->state.changed&= ~STATE_NOT_ANALYZED;
+ for (i=0; i<key_parts; i++)
+ {
+ if (!(share->state.rec_per_key_part[i]=param->rec_per_key_part[i]))
+ share->state.changed|= STATE_NOT_ANALYZED;
+ }
}
if (update & (UPDATE_STAT | UPDATE_SORT | UPDATE_TIME | UPDATE_AUTO_INC))
{
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/mi_info.c b/myisam/mi_info.c
index 0be3cc44d80..32767e73bb1 100644
--- a/myisam/mi_info.c
+++ b/myisam/mi_info.c
@@ -14,7 +14,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-/* Ger tillbaka en struct med information om isam-filen */
+/* Return useful base information for an open table */
#include "myisamdef.h"
#ifdef __WIN__
diff --git a/myisam/mi_key.c b/myisam/mi_key.c
index 00a64bca269..37708a399b0 100644
--- a/myisam/mi_key.c
+++ b/myisam/mi_key.c
@@ -145,11 +145,26 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key,
} /* _mi_make_key */
- /* Pack a key to intern format from given format (c_rkey) */
- /* returns length of packed key */
+/*
+ Pack a key to intern format from given format (c_rkey)
+
+ SYNOPSIS
+ _mi_pack_key()
+ info MyISAM handler
+ uint keynr key number
+ key Store packed key here
+ old Not packed key
+ k_length Length of 'old' to use
+ last_used_keyseg out parameter. May be NULL
+
+ RETURN
+ length of packed key
+
+ last_use_keyseg Store pointer to the keyseg after the last used one
+*/
uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old,
- uint k_length)
+ uint k_length, MI_KEYSEG **last_used_keyseg)
{
uint length;
uchar *pos,*end,*start_key=key;
@@ -220,6 +235,8 @@ uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old,
key+= length;
k_length-=length;
}
+ if (last_used_keyseg)
+ *last_used_keyseg= keyseg;
#ifdef NOT_USED
if (keyseg->type)
diff --git a/myisam/mi_open.c b/myisam/mi_open.c
index a1ce135f02f..6da1a0395c0 100644
--- a/myisam/mi_open.c
+++ b/myisam/mi_open.c
@@ -116,8 +116,10 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
errpos=1;
if (my_read(kfile,(char*) share->state.header.file_version,head_length,
MYF(MY_NABP)))
+ {
+ my_errno= HA_ERR_NOT_A_TABLE;
goto err;
-
+ }
if (memcmp((byte*) share->state.header.file_version,
(byte*) myisam_file_magic, 4))
{
@@ -166,7 +168,10 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
}
errpos=3;
if (my_read(kfile,disk_cache,info_length,MYF(MY_NABP)))
+ {
+ my_errno=HA_ERR_CRASHED;
goto err;
+ }
len=mi_uint2korr(share->state.header.state_info_length);
keys= (uint) share->state.header.keys;
uniques= (uint) share->state.header.uniques;
@@ -181,6 +186,12 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
}
share->state_diff_length=len-MI_STATE_INFO_SIZE;
+ if (share->state.header.fulltext_keys)
+ {
+ /* Not supported in this version */
+ my_errno= HA_ERR_UNSUPPORTED;
+ goto err;
+ }
mi_state_info_read(disk_cache, &share->state);
len= mi_uint2korr(share->state.header.base_info_length);
if (len != MI_BASE_INFO_SIZE)
diff --git a/myisam/mi_range.c b/myisam/mi_range.c
index 4b98b48199a..d5a786438cd 100644
--- a/myisam/mi_range.c
+++ b/myisam/mi_range.c
@@ -103,7 +103,8 @@ static ha_rows _mi_record_pos(MI_INFO *info, const byte *key, uint key_len,
if (key_len == 0)
key_len=USE_WHOLE_KEY;
key_buff=info->lastkey+info->s->base.max_key_length;
- key_len=_mi_pack_key(info,inx,key_buff,(uchar*) key,key_len);
+ key_len=_mi_pack_key(info,inx,key_buff,(uchar*) key,key_len,
+ (MI_KEYSEG**) 0);
DBUG_EXECUTE("key",_mi_print_key(DBUG_FILE,keyinfo->seg,
(uchar*) key_buff,key_len););
nextflag=myisam_read_vec[search_flag];
diff --git a/myisam/mi_rkey.c b/myisam/mi_rkey.c
index 4a3c76809e8..a702f78b926 100644
--- a/myisam/mi_rkey.c
+++ b/myisam/mi_rkey.c
@@ -23,10 +23,12 @@
/* Ordinary search_flag is 0 ; Give error if no record with key */
int mi_rkey(MI_INFO *info, byte *buf, int inx, const byte *key, uint key_len,
- enum ha_rkey_function search_flag)
+ enum ha_rkey_function search_flag)
{
uchar *key_buff;
MYISAM_SHARE *share=info->s;
+ MI_KEYDEF *keyinfo;
+ MI_KEYSEG *last_used_keyseg;
uint pack_key_length, use_key_length, nextflag;
DBUG_ENTER("mi_rkey");
DBUG_PRINT("enter",("base: %lx inx: %d search_flag: %d",
@@ -36,25 +38,29 @@ int mi_rkey(MI_INFO *info, byte *buf, int inx, const byte *key, uint key_len,
DBUG_RETURN(my_errno);
info->update&= (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED);
- info->last_key_func=search_flag;
+ info->last_key_func= search_flag;
+ keyinfo= share->keyinfo + inx;
if (info->once_flags & USE_PACKED_KEYS)
{
- /* key is already packed! */
+ info->once_flags&= ~USE_PACKED_KEYS; /* Reset flag */
+ /*
+ key is already packed!; This happens when we are using a MERGE TABLE
+ */
key_buff=info->lastkey+info->s->base.max_key_length;
- info->last_rkey_length=pack_key_length=key_len;
+ pack_key_length= key_len;
bmove(key_buff,key,key_len);
- info->once_flags&= ~USE_PACKED_KEYS;
+ last_used_keyseg= 0;
}
else
{
if (key_len == 0)
key_len=USE_WHOLE_KEY;
key_buff=info->lastkey+info->s->base.max_key_length;
- pack_key_length=_mi_pack_key(info,(uint) inx,key_buff,(uchar*) key,key_len);
- info->last_rkey_length=pack_key_length;
- DBUG_EXECUTE("key",_mi_print_key(DBUG_FILE,share->keyinfo[inx].seg,
- key_buff,pack_key_length););
+ pack_key_length=_mi_pack_key(info,(uint) inx, key_buff, (uchar*) key,
+ key_len, &last_used_keyseg);
+ DBUG_EXECUTE("key",_mi_print_key(DBUG_FILE, keyinfo->seg,
+ key_buff, pack_key_length););
}
if (fast_mi_readinfo(info))
@@ -67,9 +73,9 @@ int mi_rkey(MI_INFO *info, byte *buf, int inx, const byte *key, uint key_len,
if (!(nextflag & (SEARCH_FIND | SEARCH_NO_FIND | SEARCH_LAST)))
use_key_length=USE_WHOLE_KEY;
- switch(info->s->keyinfo[inx].key_alg){
+ switch (info->s->keyinfo[inx].key_alg) {
case HA_KEY_ALG_RTREE:
- if(rtree_find_first(info,inx,key_buff,use_key_length,nextflag)<0)
+ if (rtree_find_first(info,inx,key_buff,use_key_length,nextflag) < 0)
{
my_errno=HA_ERR_CRASHED;
goto err;
@@ -77,8 +83,8 @@ int mi_rkey(MI_INFO *info, byte *buf, int inx, const byte *key, uint key_len,
break;
case HA_KEY_ALG_BTREE:
default:
- if (!_mi_search(info,info->s->keyinfo+inx,key_buff,use_key_length,
- myisam_read_vec[search_flag],info->s->state.key_root[inx]))
+ if (!_mi_search(info, keyinfo, key_buff, use_key_length,
+ myisam_read_vec[search_flag], info->s->state.key_root[inx]))
{
while (info->lastpos >= info->state->data_file_length)
{
@@ -88,7 +94,7 @@ int mi_rkey(MI_INFO *info, byte *buf, int inx, const byte *key, uint key_len,
exact key, because the keys are sorted according to position
*/
- if (_mi_search_next(info,info->s->keyinfo+inx,info->lastkey,
+ if (_mi_search_next(info, keyinfo, info->lastkey,
info->lastkey_length,
myisam_readnext_vec[search_flag],
info->s->state.key_root[inx]))
@@ -99,8 +105,17 @@ int mi_rkey(MI_INFO *info, byte *buf, int inx, const byte *key, uint key_len,
if (share->concurrent_insert)
rw_unlock(&share->key_root_lock[inx]);
+ /* Calculate length of the found key; Used by mi_rnext_same */
+ if ((keyinfo->flag & HA_VAR_LENGTH_KEY) && last_used_keyseg &&
+ info->lastpos != HA_OFFSET_ERROR)
+ info->last_rkey_length= _mi_keylength_part(keyinfo, info->lastkey,
+ last_used_keyseg);
+ else
+ info->last_rkey_length= pack_key_length;
+
+ /* Check if we don't want to have record back, only error message */
if (!buf)
- DBUG_RETURN(info->lastpos==HA_OFFSET_ERROR ? my_errno : 0);
+ DBUG_RETURN(info->lastpos == HA_OFFSET_ERROR ? my_errno : 0);
if (!(*info->read_record)(info,info->lastpos,buf))
{
@@ -110,8 +125,9 @@ int mi_rkey(MI_INFO *info, byte *buf, int inx, const byte *key, uint key_len,
info->lastpos = HA_OFFSET_ERROR; /* Didn't find key */
- /* Store key for read next */
+ /* Store last used key as a base for read next */
memcpy(info->lastkey,key_buff,pack_key_length);
+ info->last_rkey_length= pack_key_length;
bzero((char*) info->lastkey+pack_key_length,info->s->base.rec_reflength);
info->lastkey_length=pack_key_length+info->s->base.rec_reflength;
diff --git a/myisam/mi_search.c b/myisam/mi_search.c
index 04803d7a901..340d8ec2db6 100644
--- a/myisam/mi_search.c
+++ b/myisam/mi_search.c
@@ -1033,6 +1033,37 @@ uint _mi_keylength(MI_KEYDEF *keyinfo, register uchar *key)
} /* _mi_keylength */
+/*
+ Calculate length of part key.
+
+ Used in mi_rkey() to find the key found for the key-part that was used.
+ This is needed in case of multi-byte character sets where we may search
+ after '0xDF' but find 'ss'
+*/
+
+uint _mi_keylength_part(MI_KEYDEF *keyinfo, register uchar *key,
+ MI_KEYSEG *end)
+{
+ reg1 MI_KEYSEG *keyseg;
+ uchar *start= key;
+
+ for (keyseg=keyinfo->seg ; keyseg != end ; keyseg++)
+ {
+ if (keyseg->flag & HA_NULL_PART)
+ if (!*key++)
+ continue;
+ if (keyseg->flag & (HA_SPACE_PACK | HA_BLOB_PART | HA_VAR_LENGTH))
+ {
+ uint length;
+ get_key_length(length,key);
+ key+=length;
+ }
+ else
+ key+= keyseg->length;
+ }
+ return (uint) (key-start);
+}
+
/* Move a key */
uchar *_mi_move_key(MI_KEYDEF *keyinfo, uchar *to, uchar *from)
diff --git a/myisam/mi_test2.c b/myisam/mi_test2.c
index 8c7713c4b4d..75adf74294f 100644
--- a/myisam/mi_test2.c
+++ b/myisam/mi_test2.c
@@ -645,14 +645,14 @@ int main(int argc, char *argv[])
if ((long) range_records < (long) records*7/10-2 ||
(long) range_records > (long) records*14/10+2)
{
- printf("mi_records_range for key: %d returned %ld; Should be about %ld\n",
- i, (long) range_records, (long) records);
+ printf("mi_records_range for key: %d returned %lu; Should be about %lu\n",
+ i, (ulong) range_records, (ulong) records);
goto end;
}
if (verbose && records)
{
- printf("mi_records_range returned %ld; Exact is %ld (diff: %4.2g %%)\n",
- (long) range_records, (long) records,
+ printf("mi_records_range returned %lu; Exact is %lu (diff: %4.2g %%)\n",
+ (ulong) range_records, (ulong) records,
labs((long) range_records-(long) records)*100.0/records);
}
@@ -666,8 +666,8 @@ int main(int argc, char *argv[])
|| info.keys != keys)
{
puts("Wrong info from mi_info");
- printf("Got: records: %ld delete: %ld i_keys: %d\n",
- (long) info.records, (long) info.deleted,info.keys);
+ printf("Got: records: %lu delete: %lu i_keys: %d\n",
+ (ulong) info.records, (ulong) info.deleted, info.keys);
}
if (verbose)
{
diff --git a/myisam/myisamchk.c b/myisam/myisamchk.c
index 104b344a9e2..834ad818972 100644
--- a/myisam/myisamchk.c
+++ b/myisam/myisamchk.c
@@ -44,6 +44,8 @@ static const char *load_default_groups[]= { "myisamchk", 0 };
static const char *set_charset_name, *opt_tmpdir;
static CHARSET_INFO *set_charset;
static long opt_myisam_block_size;
+static const char *my_progname_short;
+static int stopwords_inited= 0;
static MY_TMPDIR myisamchk_tmpdir;
static const char *type_names[]=
@@ -86,6 +88,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);
@@ -332,7 +335,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\
@@ -689,7 +692,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) &&
@@ -699,7 +702,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);
}
@@ -874,7 +877,7 @@ static int myisamchk(MI_CHECK *param, my_string filename)
}
else
{
- if (share->state.header.fulltext_keys)
+ if (share->state.header.fulltext_keys && !stopwords_inited++)
ft_init_stopwords();
if (!(param->testflag & T_READONLY))
@@ -1674,13 +1677,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);
@@ -1700,12 +1703,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);
diff --git a/myisam/myisamdef.h b/myisam/myisamdef.h
index 50320f1ecbd..0d9d7d43438 100644
--- a/myisam/myisamdef.h
+++ b/myisam/myisamdef.h
@@ -537,6 +537,8 @@ extern uchar *_mi_get_last_key(MI_INFO *info,MI_KEYDEF *keyinfo,uchar *keypos,
extern uchar *_mi_get_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *page,
uchar *key, uchar *keypos, uint *return_key_length);
extern uint _mi_keylength(MI_KEYDEF *keyinfo,uchar *key);
+extern uint _mi_keylength_part(MI_KEYDEF *keyinfo, register uchar *key,
+ MI_KEYSEG *end);
extern uchar *_mi_move_key(MI_KEYDEF *keyinfo,uchar *to,uchar *from);
extern int _mi_search_next(MI_INFO *info,MI_KEYDEF *keyinfo,uchar *key,
uint key_length,uint nextflag,my_off_t pos);
@@ -551,7 +553,7 @@ extern my_off_t _mi_new(MI_INFO *info,MI_KEYDEF *keyinfo);
extern uint _mi_make_key(MI_INFO *info,uint keynr,uchar *key,
const byte *record,my_off_t filepos);
extern uint _mi_pack_key(MI_INFO *info,uint keynr,uchar *key,uchar *old,
- uint key_length);
+ uint key_length, MI_KEYSEG **last_used_keyseg);
extern int _mi_read_key_record(MI_INFO *info,my_off_t filepos,byte *buf);
extern int _mi_read_cache(IO_CACHE *info,byte *buff,my_off_t pos,
uint length,int re_read_if_possibly);
diff --git a/myisam/sort.c b/myisam/sort.c
index 09e487e1165..a41713f750f 100644
--- a/myisam/sort.c
+++ b/myisam/sort.c
@@ -185,8 +185,8 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages,
if (maxbuffer == 0)
{
if (!no_messages)
- printf(" - Dumping %lu keys\n",records);
- if (write_index(info,sort_keys,(uint) records))
+ printf(" - Dumping %lu keys\n", (ulong) records);
+ if (write_index(info,sort_keys, (uint) records))
goto err; /* purecov: inspected */
}
else
@@ -195,7 +195,7 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages,
if (maxbuffer >= MERGEBUFF2)
{
if (!no_messages)
- printf(" - Merging %lu keys\n",records); /* purecov: tested */
+ printf(" - Merging %lu keys\n", (ulong) records); /* purecov: tested */
if (merge_many_buff(info,keys,sort_keys,
dynamic_element(&buffpek,0,BUFFPEK *),&maxbuffer,&tempfile))
goto err; /* purecov: inspected */
@@ -308,6 +308,8 @@ pthread_handler_decl(thr_find_all_keys,arg)
uint idx, maxbuffer;
uchar **sort_keys=0;
+ LINT_INIT(keys);
+
error=1;
if (my_thread_init())