diff options
Diffstat (limited to 'myisam')
-rw-r--r-- | myisam/ft_boolean_search.c | 4 | ||||
-rw-r--r-- | myisam/ft_dump.c | 4 | ||||
-rw-r--r-- | myisam/ft_nlq_search.c | 39 | ||||
-rw-r--r-- | myisam/mi_check.c | 9 | ||||
-rw-r--r-- | myisam/mi_create.c | 2 | ||||
-rw-r--r-- | myisam/mi_packrec.c | 4 | ||||
-rw-r--r-- | myisam/mi_search.c | 10 | ||||
-rw-r--r-- | myisam/mi_write.c | 1 | ||||
-rw-r--r-- | myisam/myisamchk.c | 25 |
9 files changed, 47 insertions, 51 deletions
diff --git a/myisam/ft_boolean_search.c b/myisam/ft_boolean_search.c index ed6bf1808a9..6a7b7531d4d 100644 --- a/myisam/ft_boolean_search.c +++ b/myisam/ft_boolean_search.c @@ -299,7 +299,7 @@ FT_INFO * ft_init_boolean_search(MI_INFO *info, uint keynr, byte *query, default_charset_info : info->s->keyinfo[keynr].seg->charset); ftb->with_scan=0; - ftb->lastpos=0; + ftb->lastpos=HA_POS_ERROR; bzero(& ftb->no_dupes, sizeof(TREE)); init_alloc_root(&ftb->mem_root, 1024, 1024); @@ -543,7 +543,7 @@ float ft_boolean_find_relevance(FT_INFO *ftb, byte *record, uint length) if (!ftb->queue.elements) return 0; - if (ftb->state != INDEX_SEARCH && docid < ftb->lastpos) + if (ftb->state != INDEX_SEARCH && docid <= ftb->lastpos) { FTB_EXPR *x; uint i; diff --git a/myisam/ft_dump.c b/myisam/ft_dump.c index d95e719e234..69fef529fa9 100644 --- a/myisam/ft_dump.c +++ b/myisam/ft_dump.c @@ -130,7 +130,11 @@ int main(int argc,char *argv[]) #error #endif +#ifdef HAVE_SNPRINTF snprintf(buf,MAX_LEN,"%.*s",(int) keylen,info->lastkey+1); +#else + sprintf(buf,"%.*s",(int) keylen,info->lastkey+1); +#endif casedn_str(buf); total++; lengths[keylen]++; 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 6caacd95386..0d7d7fae628 100644 --- a/myisam/mi_check.c +++ b/myisam/mi_check.c @@ -3562,10 +3562,13 @@ int update_state_info(MI_CHECK *param, MI_INFO *info,uint update) uint i, key_parts= mi_uint2korr(share->state.header.key_parts); share->state.rec_per_key_rows=info->state->records; share->state.changed&= ~STATE_NOT_ANALYZED; - for (i=0; i<key_parts; i++) + if (info->state->records) { - if (!(share->state.rec_per_key_part[i]=param->rec_per_key_part[i])) - 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_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_packrec.c b/myisam/mi_packrec.c index 66cfd169026..7557bb8749f 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)+ 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_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 882f868e326..a0b4515f1dd 100644 --- a/myisam/myisamchk.c +++ b/myisam/myisamchk.c @@ -357,11 +357,15 @@ static void usage(void) -e, --extend-check Check the table VERY throughly. Only use this in\n\ extreme cases as myisamchk should normally be able to\n\ find out if the table is ok even without this switch\n\ - -F, --fast Check only tables that haven't been closed properly\n\ - -C, --check-only-changed\n\ - Check only tables that have changed since last check\n\ + -F, --fast Check only tables that haven't been closed properly.\n\ + It also applies to other requested actions (e.g. --analyze\n\ + will be ignored if the table is already analyzed).\n\ -f, --force Restart with '-r' if there are any errors in the table.\n\ States will be updated as with '--update-state'\n\ + -C, --check-only-changed\n\ + Check only tables that have changed since last check.\n\ + It also applies to other requested actions (e.g. --analyze\n\ + will be ignored if the table is already analyzed).\n\ -i, --information Print statistics information about table that is checked\n\ -m, --medium-check Faster than extend-check, but only finds 99.99% of\n\ all errors. Should be good enough for most cases\n\ @@ -1396,23 +1400,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)) { |