diff options
Diffstat (limited to 'myisam')
-rw-r--r-- | myisam/ft_nlq_search.c | 39 | ||||
-rw-r--r-- | myisam/mi_check.c | 22 | ||||
-rw-r--r-- | myisam/mi_create.c | 2 | ||||
-rw-r--r-- | myisam/mi_dynrec.c | 14 | ||||
-rw-r--r-- | myisam/mi_locking.c | 37 | ||||
-rw-r--r-- | myisam/mi_open.c | 13 | ||||
-rw-r--r-- | myisam/mi_packrec.c | 6 | ||||
-rw-r--r-- | myisam/mi_search.c | 10 | ||||
-rwxr-xr-x | myisam/mi_test_all.sh | 2 | ||||
-rw-r--r-- | myisam/mi_update.c | 32 | ||||
-rw-r--r-- | myisam/mi_write.c | 1 | ||||
-rw-r--r-- | myisam/myisamchk.c | 35 | ||||
-rw-r--r-- | myisam/myisamlog.c | 10 | ||||
-rw-r--r-- | myisam/myisampack.c | 2 |
14 files changed, 136 insertions, 89 deletions
diff --git a/myisam/ft_nlq_search.c b/myisam/ft_nlq_search.c index 95ff700f815..f426b88d77d 100644 --- a/myisam/ft_nlq_search.c +++ b/myisam/ft_nlq_search.c @@ -67,12 +67,9 @@ static int FT_SUPERDOC_cmp(void* cmp_arg __attribute__((unused)), static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio) { uint keylen, r, doc_cnt; -#ifdef EVAL_RUN - uint cnt; - double sum, sum2, suml; -#endif /* EVAL_RUN */ FT_SUPERDOC sdoc, *sptr; TREE_ELEMENT *selem; + double gweight=1; #if HA_FT_WTYPE == HA_KEYTYPE_FLOAT float tmp_weight; #else @@ -84,42 +81,27 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio) word->weight=LWS_FOR_QUERY; keylen=_ft_make_key(aio->info,aio->keynr,(char*) aio->keybuff,word,0); -#ifdef EVAL_RUN - keylen-=1+HA_FT_WLEN; -#else /* EVAL_RUN */ keylen-=HA_FT_WLEN; -#endif /* EVAL_RUN */ -#ifdef EVAL_RUN - sum=sum2=suml= -#endif /* EVAL_RUN */ doc_cnt=0; r=_mi_search(aio->info, aio->keyinfo, aio->keybuff, keylen, SEARCH_FIND | SEARCH_PREFIX, aio->key_root); aio->info->update|= HA_STATE_AKTIV; /* for _mi_test_if_changed() */ - while (!r) + while (!r && gweight) { if (_mi_compare_text(aio->charset, aio->info->lastkey,keylen, aio->keybuff,keylen,0)) break; #if HA_FT_WTYPE == HA_KEYTYPE_FLOAT -#ifdef EVAL_RUN - mi_float4get(tmp_weight,aio->info->lastkey+keylen+1); -#else /* EVAL_RUN */ mi_float4get(tmp_weight,aio->info->lastkey+keylen); -#endif /* EVAL_RUN */ #else #error #endif if(tmp_weight==0) DBUG_RETURN(doc_cnt); /* stopword, doc_cnt should be 0 */ -#ifdef EVAL_RUN - cnt=*(byte *)(aio->info->lastkey+keylen); -#endif /* EVAL_RUN */ - sdoc.doc.dpos=aio->info->lastpos; /* saving document matched into dtree */ @@ -137,11 +119,10 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio) sptr->tmp_weight=tmp_weight; doc_cnt++; -#ifdef EVAL_RUN - sum +=cnt; - sum2+=cnt*cnt; - suml+=cnt*log(cnt); -#endif /* EVAL_RUN */ + + gweight=word->weight*GWS_IN_USE; + if (gweight < 0 || doc_cnt > 2000000) + gweight=0; if (_mi_test_if_changed(aio->info) == 0) r=_mi_search_next(aio->info, aio->keyinfo, aio->info->lastkey, @@ -152,13 +133,9 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio) aio->info->lastkey_length, SEARCH_BIGGER, aio->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 0d7d7fae628..f5b0a1aabaa 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); @@ -1513,6 +1513,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"); @@ -1556,8 +1557,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); @@ -1568,12 +1572,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); @@ -3681,6 +3686,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 9082c2b0d95..9f39c6f522e 100644 --- a/myisam/mi_create.c +++ b/myisam/mi_create.c @@ -286,7 +286,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 59fae36ac33..580261d8078 100644 --- a/myisam/mi_open.c +++ b/myisam/mi_open.c @@ -595,7 +595,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) @@ -650,6 +650,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; @@ -728,6 +730,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); @@ -778,10 +781,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 7557bb8749f..1bd39aa900b 100644 --- a/myisam/mi_packrec.c +++ b/myisam/mi_packrec.c @@ -743,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 32db69144d8..423b15ff8f7 100644 --- a/myisam/mi_search.c +++ b/myisam/mi_search.c @@ -1218,9 +1218,10 @@ uint _mi_get_binary_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag, register uchar **page_pos, register uchar *key) { reg1 MI_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; @@ -1276,7 +1277,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; } @@ -1998,6 +2001,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 1614d6ca19d..f9ed969d8b5 100644 --- a/myisam/mi_update.c +++ b/myisam/mi_update.c @@ -94,7 +94,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; @@ -121,25 +128,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); @@ -163,7 +181,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 d39bbbf5fc7..40e2f301fce 100644 --- a/myisam/mi_write.c +++ b/myisam/mi_write.c @@ -887,4 +887,3 @@ void mi_end_bulk_insert(MI_INFO *info) info->bulk_insert=0; } } - diff --git a/myisam/myisamchk.c b/myisam/myisamchk.c index 4fadfd2fc5d..83edadf153f 100644 --- a/myisam/myisamchk.c +++ b/myisam/myisamchk.c @@ -794,15 +794,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))) @@ -882,6 +885,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; @@ -1400,21 +1408,22 @@ 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(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(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(0); /* Nothing to do */ } diff --git a/myisam/myisamlog.c b/myisam/myisamlog.c index ceca8d2a0e3..091f9ad1d7e 100644 --- a/myisam/myisamlog.c +++ b/myisam/myisamlog.c @@ -413,8 +413,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 4fc84ac5657..800203a30e2 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.", |