summaryrefslogtreecommitdiff
path: root/myisam
diff options
context:
space:
mode:
authorunknown <monty@mashka.mysql.fi>2003-09-11 20:31:40 +0300
committerunknown <monty@mashka.mysql.fi>2003-09-11 20:31:40 +0300
commit41824a35338012ff8196eb975f961d5e0f0e2a22 (patch)
tree1475a169c541e6b7aedb36103dd255fe52fc0517 /myisam
parent07bc35e1d024e5e3b81b131a47878510f0521609 (diff)
parentd32bdcb1bfc274476cdd945e66e00f3ec31253c3 (diff)
downloadmariadb-git-41824a35338012ff8196eb975f961d5e0f0e2a22.tar.gz
merge with 4.1 tree
client/mysqltest.c: Auto merged include/mysql.h: Auto merged libmysql/errmsg.c: Auto merged libmysql/libmysql.c: Auto merged mysql-test/mysql-test-run.sh: Auto merged sql/field.cc: Auto merged sql/item.cc: Auto merged sql/item.h: Auto merged sql/item_cmpfunc.cc: Auto merged sql/item_func.cc: Auto merged sql/item_func.h: Auto merged sql/mysql_priv.h: Auto merged sql/mysqld.cc: Auto merged sql/share/portuguese/errmsg.txt: Auto merged sql/share/spanish/errmsg.txt: Auto merged sql/sql_select.cc: Auto merged sql/sql_table.cc: Auto merged sql/sql_yacc.yy: Auto merged tests/client_test.c: Auto merged
Diffstat (limited to 'myisam')
-rw-r--r--myisam/ft_dump.c4
-rw-r--r--myisam/ft_nlq_search.c14
-rw-r--r--myisam/mi_check.c22
-rw-r--r--myisam/mi_create.c2
-rw-r--r--myisam/mi_dynrec.c14
-rw-r--r--myisam/mi_locking.c37
-rw-r--r--myisam/mi_open.c13
-rw-r--r--myisam/mi_packrec.c10
-rw-r--r--myisam/mi_search.c10
-rwxr-xr-xmyisam/mi_test_all.sh2
-rw-r--r--myisam/mi_update.c32
-rw-r--r--myisam/mi_write.c1
-rw-r--r--myisam/myisamchk.c41
-rw-r--r--myisam/myisamlog.c10
-rw-r--r--myisam/myisampack.c2
15 files changed, 145 insertions, 69 deletions
diff --git a/myisam/ft_dump.c b/myisam/ft_dump.c
index 57ae67c7a02..183068789fe 100644
--- a/myisam/ft_dump.c
+++ b/myisam/ft_dump.c
@@ -130,7 +130,11 @@ int main(int argc,char *argv[])
if (subkeys >= 0)
weight=*(float*)&subkeys;
+#ifdef HAVE_SNPRINTF
snprintf(buf,MAX_LEN,"%.*s",(int) keylen,info->lastkey+1);
+#else
+ sprintf(buf,"%.*s",(int) keylen,info->lastkey+1);
+#endif
my_casedn_str(default_charset_info,buf);
total++;
lengths[keylen]++;
diff --git a/myisam/ft_nlq_search.c b/myisam/ft_nlq_search.c
index b1d7d67ae79..690ad0fc453 100644
--- a/myisam/ft_nlq_search.c
+++ b/myisam/ft_nlq_search.c
@@ -68,6 +68,7 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
uint keylen, r, doc_cnt;
FT_SUPERDOC sdoc, *sptr;
TREE_ELEMENT *selem;
+ double gweight=1;
MI_INFO *info=aio->info;
uchar *keybuff=aio->keybuff;
MI_KEYDEF *keyinfo=info->s->keyinfo+aio->keynr;
@@ -89,7 +90,7 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
r=_mi_search(info, keyinfo, keybuff, keylen, SEARCH_FIND, key_root);
info->update|= HA_STATE_AKTIV; /* for _mi_test_if_changed() */
- while (!r)
+ while (!r && gweight)
{
if (keylen &&
@@ -138,6 +139,10 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
doc_cnt++;
+ gweight=word->weight*GWS_IN_USE;
+ if (gweight < 0 || doc_cnt > 2000000)
+ gweight=0;
+
if (_mi_test_if_changed(info) == 0)
r=_mi_search_next(info, keyinfo, info->lastkey, info->lastkey_length,
SEARCH_BIGGER, key_root);
@@ -145,13 +150,8 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
r=_mi_search(info, keyinfo, info->lastkey, info->lastkey_length,
SEARCH_BIGGER, key_root);
}
- if (doc_cnt)
- {
- word->weight*=GWS_IN_USE;
- if (word->weight < 0)
- word->weight=0;
+ word->weight=gweight;
- }
DBUG_RETURN(0);
}
diff --git a/myisam/mi_check.c b/myisam/mi_check.c
index 60053674647..cb2b56d93de 100644
--- a/myisam/mi_check.c
+++ b/myisam/mi_check.c
@@ -36,7 +36,7 @@
/* Functions defined in this file */
static int check_k_link(MI_CHECK *param, MI_INFO *info,uint nr);
-static int chk_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo,
+static int chk_index(MI_CHECK *param, MI_INFO *info,MI_KEYDEF *keyinfo,
my_off_t page, uchar *buff, ha_rows *keys,
ha_checksum *key_checksum, uint level);
static uint isam_key_length(MI_INFO *info,MI_KEYDEF *keyinfo);
@@ -1498,6 +1498,7 @@ int mi_sort_index(MI_CHECK *param, register MI_INFO *info, my_string name)
File new_file;
my_off_t index_pos[MI_MAX_POSSIBLE_KEY];
uint r_locks,w_locks;
+ int old_lock;
MYISAM_SHARE *share=info->s;
MI_STATE_INFO old_state;
DBUG_ENTER("sort_index");
@@ -1541,8 +1542,11 @@ int mi_sort_index(MI_CHECK *param, register MI_INFO *info, my_string name)
flush_key_blocks(share->kfile, FLUSH_IGNORE_CHANGED);
share->state.version=(ulong) time((time_t*) 0);
- old_state=share->state; /* save state if not stored */
- r_locks=share->r_locks; w_locks=share->w_locks;
+ old_state= share->state; /* save state if not stored */
+ r_locks= share->r_locks;
+ w_locks= share->w_locks;
+ old_lock= info->lock_type;
+
/* Put same locks as old file */
share->r_locks= share->w_locks= share->tot_locks= 0;
(void) _mi_writeinfo(info,WRITEINFO_UPDATE_KEYFILE);
@@ -1553,12 +1557,13 @@ int mi_sort_index(MI_CHECK *param, register MI_INFO *info, my_string name)
MYF(0)) ||
mi_open_keyfile(share))
goto err2;
- info->lock_type=F_UNLCK; /* Force mi_readinfo to lock */
+ info->lock_type= F_UNLCK; /* Force mi_readinfo to lock */
_mi_readinfo(info,F_WRLCK,0); /* Will lock the table */
- info->lock_type=F_WRLCK;
- share->r_locks=r_locks; share->w_locks=w_locks;
+ info->lock_type= old_lock;
+ share->r_locks= r_locks;
+ share->w_locks= w_locks;
share->tot_locks= r_locks+w_locks;
- share->state=old_state; /* Restore old state */
+ share->state= old_state; /* Restore old state */
info->state->key_file_length=param->new_file_pos;
info->update= (short) (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED);
@@ -3818,6 +3823,9 @@ void update_key_parts(MI_KEYDEF *keyinfo, ulong *rec_per_key_part,
tmp=records;
else
tmp= (records + (count+1)/2) / (count+1);
+ /* for some weird keys (e.g. FULLTEXT) tmp can be <1 here.
+ let's ensure it is not */
+ set_if_bigger(tmp,1);
if (tmp >= (ulonglong) ~(ulong) 0)
tmp=(ulonglong) ~(ulong) 0;
*rec_per_key_part=(ulong) tmp;
diff --git a/myisam/mi_create.c b/myisam/mi_create.c
index 26bb23c3a7f..0982e5bdaf6 100644
--- a/myisam/mi_create.c
+++ b/myisam/mi_create.c
@@ -303,7 +303,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
keydef->seg[0].type == (int) HA_KEYTYPE_NUM)
keydef->seg[0].flag&= ~HA_SPACE_PACK;
- /* Only use HA_PACK_KEY if the first segment is a variable length key */
+ /* Only use HA_PACK_KEY when first segment is a variable length key */
if (!(keydef->seg[0].flag & (HA_SPACE_PACK | HA_BLOB_PART |
HA_VAR_LENGTH)))
{
diff --git a/myisam/mi_dynrec.c b/myisam/mi_dynrec.c
index faf86c3ffbd..86d648a5af0 100644
--- a/myisam/mi_dynrec.c
+++ b/myisam/mi_dynrec.c
@@ -17,6 +17,7 @@
/* Functions to handle space-packed-records and blobs */
#include "myisamdef.h"
+#include <assert.h>
/* Enough for comparing if number is zero */
static char zero_string[]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
@@ -58,11 +59,11 @@ int _mi_write_blob_record(MI_INFO *info, const byte *record)
{
byte *rec_buff;
int error;
- ulong reclength,extra;
+ ulong reclength,reclength2,extra;
extra= (ALIGN_SIZE(MI_MAX_DYN_BLOCK_HEADER)+MI_SPLIT_LENGTH+
MI_DYN_DELETE_BLOCK_HEADER+1);
- reclength= (info->s->base.pack_reclength + info->s->base.pack_bits +
+ reclength= (info->s->base.pack_reclength +
_my_calc_total_blob_length(info,record)+ extra);
#ifdef NOT_USED /* We now support big rows */
if (reclength > MI_DYN_MAX_ROW_LENGTH)
@@ -76,10 +77,13 @@ int _mi_write_blob_record(MI_INFO *info, const byte *record)
my_errno=ENOMEM;
return(-1);
}
- reclength=_mi_rec_pack(info,rec_buff+ALIGN_SIZE(MI_MAX_DYN_BLOCK_HEADER),
- record);
+ reclength2= _mi_rec_pack(info,rec_buff+ALIGN_SIZE(MI_MAX_DYN_BLOCK_HEADER),
+ record);
+ DBUG_PRINT("info",("reclength: %lu reclength2: %lu",
+ reclength, reclength2));
+ DBUG_ASSERT(reclength2 <= reclength);
error=write_dynamic_record(info,rec_buff+ALIGN_SIZE(MI_MAX_DYN_BLOCK_HEADER),
- reclength);
+ reclength2);
my_afree(rec_buff);
return(error);
}
diff --git a/myisam/mi_locking.c b/myisam/mi_locking.c
index 22772a3dd2e..a707eb294a9 100644
--- a/myisam/mi_locking.c
+++ b/myisam/mi_locking.c
@@ -35,6 +35,7 @@ int mi_lock_database(MI_INFO *info, int lock_type)
MYISAM_SHARE *share=info->s;
uint flag;
DBUG_ENTER("mi_lock_database");
+ DBUG_PRINT("info",("lock_type: %d", lock_type));
if (share->options & HA_OPTION_READ_ONLY_DATA ||
info->lock_type == lock_type)
@@ -53,6 +54,7 @@ int mi_lock_database(MI_INFO *info, int lock_type)
{
switch (lock_type) {
case F_UNLCK:
+ DBUG_PRINT("info", ("old lock: %d", info->lock_type));
if (info->lock_type == F_RDLCK)
count= --share->r_locks;
else
@@ -74,6 +76,8 @@ int mi_lock_database(MI_INFO *info, int lock_type)
}
if (!count)
{
+ DBUG_PRINT("info",("changed: %u w_locks: %u",
+ (uint) share->changed, share->w_locks));
if (share->changed && !share->w_locks)
{
share->state.process= share->last_process=share->this_process;
@@ -106,19 +110,22 @@ int mi_lock_database(MI_INFO *info, int lock_type)
if (error)
mi_mark_crashed(info);
}
- if (share->r_locks)
- { /* Only read locks left */
- flag=1;
- if (my_lock(share->kfile,F_RDLCK,0L,F_TO_EOF,
- MYF(MY_WME | MY_SEEK_NOT_DONE)) && !error)
- error=my_errno;
- }
- else if (!share->w_locks)
- { /* No more locks */
- flag=1;
- if (my_lock(share->kfile,F_UNLCK,0L,F_TO_EOF,
- MYF(MY_WME | MY_SEEK_NOT_DONE)) && !error)
- error=my_errno;
+ if (info->lock_type != F_EXTRA_LCK)
+ {
+ if (share->r_locks)
+ { /* Only read locks left */
+ flag=1;
+ if (my_lock(share->kfile,F_RDLCK,0L,F_TO_EOF,
+ MYF(MY_WME | MY_SEEK_NOT_DONE)) && !error)
+ error=my_errno;
+ }
+ else if (!share->w_locks)
+ { /* No more locks */
+ flag=1;
+ if (my_lock(share->kfile,F_UNLCK,0L,F_TO_EOF,
+ MYF(MY_WME | MY_SEEK_NOT_DONE)) && !error)
+ error=my_errno;
+ }
}
}
info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED);
@@ -347,6 +354,8 @@ int _mi_writeinfo(register MI_INFO *info, uint operation)
int error,olderror;
MYISAM_SHARE *share=info->s;
DBUG_ENTER("_mi_writeinfo");
+ DBUG_PRINT("info",("operation: %u tot_locks: %u", operation,
+ share->tot_locks));
error=0;
if (share->tot_locks == 0)
@@ -374,9 +383,7 @@ int _mi_writeinfo(register MI_INFO *info, uint operation)
my_errno=olderror;
}
else if (operation)
- {
share->changed= 1; /* Mark keyfile changed */
- }
DBUG_RETURN(error);
} /* _mi_writeinfo */
diff --git a/myisam/mi_open.c b/myisam/mi_open.c
index 5d8f384a5af..c4b24acdb77 100644
--- a/myisam/mi_open.c
+++ b/myisam/mi_open.c
@@ -633,7 +633,7 @@ byte *mi_alloc_rec_buff(MI_INFO *info, ulong length, byte **buf)
/* to simplify initial init of info->rec_buf in mi_open and mi_extra */
if (length == (ulong) -1)
{
- length= max(info->s->base.pack_reclength+info->s->base.pack_bits,
+ length= max(info->s->base.pack_reclength,
info->s->base.max_key_length);
/* Avoid unnecessary realloc */
if (newptr && length == old_length)
@@ -688,6 +688,8 @@ void mi_setup_functions(register MYISAM_SHARE *share)
share->compare_unique=_mi_cmp_dynamic_unique;
share->calc_checksum= mi_checksum;
+ /* add bits used to pack data to pack_reclength for faster allocation */
+ share->base.pack_reclength+= share->base.pack_bits;
if (share->base.blobs)
{
share->update_record=_mi_update_blob_record;
@@ -776,6 +778,7 @@ uint mi_state_info_write(File file, MI_STATE_INFO *state, uint pWrite)
uchar *ptr=buff;
uint i, keys= (uint) state->header.keys,
key_blocks=state->header.max_block_size;
+ DBUG_ENTER("mi_state_info_write");
memcpy_fixed(ptr,&state->header,sizeof(state->header));
ptr+=sizeof(state->header);
@@ -826,10 +829,10 @@ uint mi_state_info_write(File file, MI_STATE_INFO *state, uint pWrite)
}
if (pWrite & 1)
- return my_pwrite(file,(char*) buff, (uint) (ptr-buff), 0L,
- MYF(MY_NABP | MY_THREADSAFE));
- else
- return my_write(file, (char*) buff, (uint) (ptr-buff), MYF(MY_NABP));
+ DBUG_RETURN(my_pwrite(file,(char*) buff, (uint) (ptr-buff), 0L,
+ MYF(MY_NABP | MY_THREADSAFE)));
+ DBUG_RETURN(my_write(file, (char*) buff, (uint) (ptr-buff),
+ MYF(MY_NABP)));
}
diff --git a/myisam/mi_packrec.c b/myisam/mi_packrec.c
index 66cfd169026..1bd39aa900b 100644
--- a/myisam/mi_packrec.c
+++ b/myisam/mi_packrec.c
@@ -165,7 +165,9 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys)
diff_length=(int) rec_reflength - (int) share->base.rec_reflength;
if (fix_keys)
share->rec_reflength=rec_reflength;
- share->base.min_block_length=share->min_pack_length+share->pack.ref_length;
+ share->base.min_block_length=share->min_pack_length+1;
+ if (share->min_pack_length > 254)
+ share->base.min_block_length+=2;
if (!(share->decode_trees=(MI_DECODE_TREE*)
my_malloc((uint) (trees*sizeof(MI_DECODE_TREE)+
@@ -741,6 +743,12 @@ static void uf_blob(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff,
{
ulong length=get_bits(bit_buff,rec->space_length_bits);
uint pack_length=(uint) (end-to)-mi_portable_sizeof_char_ptr;
+ if (bit_buff->blob_pos+length > bit_buff->end)
+ {
+ bit_buff->error=1;
+ bzero((byte*) to,(end-to));
+ return;
+ }
decode_bytes(rec,bit_buff,bit_buff->blob_pos,bit_buff->blob_pos+length);
_my_store_blob_length((byte*) to,pack_length,length);
memcpy_fixed((char*) to+pack_length,(char*) &bit_buff->blob_pos,
diff --git a/myisam/mi_search.c b/myisam/mi_search.c
index 7e8577c0656..7f4c90d1bc1 100644
--- a/myisam/mi_search.c
+++ b/myisam/mi_search.c
@@ -810,9 +810,10 @@ uint _mi_get_binary_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag,
register uchar **page_pos, register uchar *key)
{
reg1 HA_KEYSEG *keyseg;
- uchar *start_key,*page=*page_pos,*page_end,*from,*from_end;
+ uchar *start_key,*page,*page_end,*from,*from_end;
uint length,tmp;
+ page= *page_pos;
page_end=page+MI_MAX_KEY_BUFF+1;
start_key=key;
@@ -868,7 +869,9 @@ uint _mi_get_binary_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag,
length-=tmp;
from=page; from_end=page_end;
}
- memcpy((byte*) key,(byte*) from,(size_t) length);
+ DBUG_PRINT("info",("key: %lx from: %lx length: %u",
+ key, from, length));
+ memcpy_overlap((byte*) key, (byte*) from, (size_t) length);
key+=length;
from+=length;
}
@@ -1590,6 +1593,9 @@ _mi_calc_bin_pack_key_length(MI_KEYDEF *keyinfo,uint nod_flag,uchar *next_key,
uint length,key_length,ref_length;
s_temp->totlength=key_length=_mi_keylength(keyinfo,key)+nod_flag;
+#ifdef HAVE_purify
+ s_temp->n_length= s_temp->n_ref_length=0; /* For valgrind */
+#endif
s_temp->key=key;
s_temp->prev_key=org_key;
if (prev_key) /* If not first key in block */
diff --git a/myisam/mi_test_all.sh b/myisam/mi_test_all.sh
index a2d57ea1a83..07e71d65675 100755
--- a/myisam/mi_test_all.sh
+++ b/myisam/mi_test_all.sh
@@ -3,7 +3,9 @@
# Execute some simple basic test on MyISAM libary to check if things
# works at all.
+valgrind="valgrind --alignment=8 --leak-check=yes"
silent="-s"
+
if test -f mi_test1$MACH ; then suffix=$MACH else suffix=""; fi
mi_test1$suffix $silent
myisamchk$suffix -se test1
diff --git a/myisam/mi_update.c b/myisam/mi_update.c
index 53c09a1d35c..d1d41ac351a 100644
--- a/myisam/mi_update.c
+++ b/myisam/mi_update.c
@@ -96,7 +96,14 @@ int mi_update(register MI_INFO *info, const byte *oldrec, byte *newrec)
if (_mi_ft_cmp(info,i,oldrec, newrec))
{
if ((int) i == info->lastinx)
+ {
+ /*
+ We are changeing the index we are reading on. Mark that
+ the index data has changed and we need to do a full search
+ when doing read-next
+ */
key_changed|=HA_STATE_WRITTEN;
+ }
changed|=((ulonglong) 1 << i);
if (_mi_ft_update(info,i,(char*) old_key,oldrec,newrec,pos))
goto err;
@@ -123,25 +130,36 @@ int mi_update(register MI_INFO *info, const byte *oldrec, byte *newrec)
}
/*
If we are running with external locking, we must update the index file
- that something has changed
+ that something has changed.
*/
if (changed || !my_disable_locking)
- key_changed|= HA_STATE_KEY_CHANGED;
+ key_changed|= HA_STATE_CHANGED;
if (share->calc_checksum)
{
info->checksum=(*share->calc_checksum)(info,newrec);
- key_changed|= HA_STATE_KEY_CHANGED; /* Must update index file */
+ /* Store new checksum in index file header */
+ key_changed|= HA_STATE_CHANGED;
}
{
- /* Don't update index file if data file is not extended */
+ /*
+ Don't update index file if data file is not extended and no status
+ information changed
+ */
MI_STATUS_INFO state;
+ ha_rows org_split;
+ my_off_t org_delete_link;
+
memcpy((char*) &state, (char*) info->state, sizeof(state));
+ org_split= share->state.split;
+ org_delete_link= share->state.dellink;
if ((*share->update_record)(info,pos,newrec))
goto err;
if (!key_changed &&
- memcmp((char*) &state, (char*) info->state, sizeof(state)))
- key_changed|= HA_STATE_KEY_CHANGED; /* Must update index file */
+ (memcmp((char*) &state, (char*) info->state, sizeof(state)) ||
+ org_split != share->state.split ||
+ org_delete_link != share->state.dellink))
+ key_changed|= HA_STATE_CHANGED; /* Must update index file */
}
if (auto_key_changed)
update_auto_increment(info,newrec);
@@ -165,7 +183,7 @@ err:
DBUG_PRINT("error",("key: %d errno: %d",i,my_errno));
save_errno=my_errno;
if (changed)
- key_changed|= HA_STATE_KEY_CHANGED;
+ key_changed|= HA_STATE_CHANGED;
if (my_errno == HA_ERR_FOUND_DUPP_KEY || my_errno == HA_ERR_RECORD_FILE_FULL)
{
info->errkey= (int) i;
diff --git a/myisam/mi_write.c b/myisam/mi_write.c
index 6985dac7832..8e0b7e3530c 100644
--- a/myisam/mi_write.c
+++ b/myisam/mi_write.c
@@ -930,4 +930,3 @@ void mi_end_bulk_insert(MI_INFO *info)
info->bulk_insert=0;
}
}
-
diff --git a/myisam/myisamchk.c b/myisam/myisamchk.c
index 43ade35bfd5..b2fdb2ccf3f 100644
--- a/myisam/myisamchk.c
+++ b/myisam/myisamchk.c
@@ -804,15 +804,18 @@ static int myisamchk(MI_CHECK *param, my_string filename)
!(param->testflag & T_CHECK_ONLY_CHANGED))))
need_to_check=1;
- if ((param->testflag & T_STATISTICS) &&
- (share->state.changed & STATE_NOT_ANALYZED))
- need_to_check=1;
- if ((param->testflag & T_SORT_INDEX) &&
- (share->state.changed & STATE_NOT_SORTED_PAGES))
- need_to_check=1;
- if ((param->testflag & T_REP_BY_SORT) &&
- (share->state.changed & STATE_NOT_OPTIMIZED_KEYS))
- need_to_check=1;
+ if (info->s->base.keys && info->state->records)
+ {
+ if ((param->testflag & T_STATISTICS) &&
+ (share->state.changed & STATE_NOT_ANALYZED))
+ need_to_check=1;
+ if ((param->testflag & T_SORT_INDEX) &&
+ (share->state.changed & STATE_NOT_SORTED_PAGES))
+ need_to_check=1;
+ if ((param->testflag & T_REP_BY_SORT) &&
+ (share->state.changed & STATE_NOT_OPTIMIZED_KEYS))
+ need_to_check=1;
+ }
if ((param->testflag & T_CHECK_ONLY_CHANGED) &&
(share->state.changed & (STATE_CHANGED | STATE_CRASHED |
STATE_CRASHED_ON_REPAIR)))
@@ -892,6 +895,11 @@ static int myisamchk(MI_CHECK *param, my_string filename)
param->error_printed=0;
goto end2;
}
+ /*
+ _mi_readinfo() has locked the table.
+ We mark the table as locked (without doing file locks) to be able to
+ use functions that only works on locked tables (like row caching).
+ */
mi_lock_database(info, F_EXTRA_LCK);
datafile=info->dfile;
@@ -1410,23 +1418,24 @@ static int mi_sort_records(MI_CHECK *param,
if (!(((ulonglong) 1 << sort_key) & share->state.key_map))
{
- mi_check_print_error(param,"Can't sort table '%s' on key %d; No such key",
+ mi_check_print_warning(param,
+ "Can't sort table '%s' on key %d; No such key",
name,sort_key+1);
param->error_printed=0;
- DBUG_RETURN(-1);
+ DBUG_RETURN(0); /* Nothing to do */
}
if (keyinfo->flag & HA_FULLTEXT)
{
- mi_check_print_error(param,"Can't sort table '%s' on FULLTEXT key %d",
- name,sort_key+1);
+ mi_check_print_warning(param,"Can't sort table '%s' on FULLTEXT key %d",
+ name,sort_key+1);
param->error_printed=0;
- DBUG_RETURN(-1);
+ DBUG_RETURN(0); /* Nothing to do */
}
if (share->data_file_type == COMPRESSED_RECORD)
{
- mi_check_print_error(param,"Can't sort read-only table '%s'", name);
+ mi_check_print_warning(param,"Can't sort read-only table '%s'", name);
param->error_printed=0;
- DBUG_RETURN(-1);
+ DBUG_RETURN(0); /* Nothing to do */
}
if (!(param->testflag & T_SILENT))
{
diff --git a/myisam/myisamlog.c b/myisam/myisamlog.c
index 4bb7cc55d30..ca164fcdaca 100644
--- a/myisam/myisamlog.c
+++ b/myisam/myisamlog.c
@@ -414,8 +414,16 @@ static int examine_log(my_string file_name, char **table_names)
VOID(tree_walk(&tree,(tree_walk_action) test_if_open,(void*) &open_param,
left_root_right));
file_info.id=open_param.max_id+1;
+ /*
+ * In the line below +10 is added to accomodate '<' and '>' chars
+ * plus '\0' at the end, so that there is place for 7 digits.
+ * It is improbable that same table can have that many entries in
+ * the table cache.
+ * The additional space is needed for the sprintf commands two lines
+ * below.
+ */
file_info.show_name=my_memdup(isam_file_name,
- (uint) strlen(isam_file_name)+6,
+ (uint) strlen(isam_file_name)+10,
MYF(MY_WME));
if (file_info.id > 1)
sprintf(strend(file_info.show_name),"<%d>",file_info.id);
diff --git a/myisam/myisampack.c b/myisam/myisampack.c
index 21b73ce244d..5ca57248204 100644
--- a/myisam/myisampack.c
+++ b/myisam/myisampack.c
@@ -243,7 +243,7 @@ static struct my_option my_long_options[] =
{"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"force", 'f',
- "Force packing of table even if it gets bigger or if tempfile exists.",
+ "Force packing of table even if it gets bigger or if tempfile exists.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"join", 'j',
"Join all given tables into 'new_table_name'. All tables MUST have identical layouts.",