summaryrefslogtreecommitdiff
path: root/myisam
diff options
context:
space:
mode:
authorunknown <serg@serg.mysql.com>2002-10-25 22:07:04 +0000
committerunknown <serg@serg.mysql.com>2002-10-25 22:07:04 +0000
commit7962de4cf303e71600f7ff2beebcb5900ef41f71 (patch)
treea265b1027bdd9f187cbc41ed6c5c709d6793109e /myisam
parentd51b72cac30e5d02fde6e9c98c3e91716b19ed04 (diff)
parentf5563ddad40e8ab84d457b0e9960ddfdc7faec99 (diff)
downloadmariadb-git-7962de4cf303e71600f7ff2beebcb5900ef41f71.tar.gz
merged
BitKeeper/etc/gone: auto-union BitKeeper/etc/logging_ok: auto-union BitKeeper/deleted/.del-skipkeys~888e38cf95239a33: 'Auto converge rename' Docs/manual.texi: Auto merged libmysqld/lib_sql.cc: Auto merged myisam/ft_boolean_search.c: Auto merged myisam/ft_nlq_search.c: Auto merged myisam/ft_parser.c: Auto merged myisam/ftdefs.h: Auto merged myisam/mi_create.c: Auto merged mysys/my_init.c: Auto merged sql/log.cc: Auto merged sql/log_event.h: Auto merged sql/sql_base.cc: Auto merged sql/sql_table.cc: Auto merged sql/sql_update.cc: Auto merged
Diffstat (limited to 'myisam')
-rw-r--r--myisam/ft_boolean_search.c3
-rw-r--r--myisam/ft_nlq_search.c22
-rw-r--r--myisam/ft_parser.c12
-rw-r--r--myisam/ftdefs.h2
-rw-r--r--myisam/mi_create.c2
-rw-r--r--myisam/mi_delete_all.c9
6 files changed, 30 insertions, 20 deletions
diff --git a/myisam/ft_boolean_search.c b/myisam/ft_boolean_search.c
index fadffc0535e..2b9b6cedcf6 100644
--- a/myisam/ft_boolean_search.c
+++ b/myisam/ft_boolean_search.c
@@ -202,7 +202,8 @@ static void _ftb_init_index_search(FT_INFO *ftb)
MI_KEYDEF *keyinfo;
my_off_t keyroot;
- if (ftb->state != READY || ftb->keynr == NO_SUCH_KEY)
+ if ((ftb->state != READY && ftb->state !=INDEX_DONE) ||
+ ftb->keynr == NO_SUCH_KEY)
return;
ftb->state=INDEX_SEARCH;
diff --git a/myisam/ft_nlq_search.c b/myisam/ft_nlq_search.c
index f3fa8865bc6..7225896c69e 100644
--- a/myisam/ft_nlq_search.c
+++ b/myisam/ft_nlq_search.c
@@ -79,6 +79,8 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
#error
#endif
+ DBUG_ENTER("walk_and_match");
+
word->weight=LWS_FOR_QUERY;
keylen=_ft_make_key(aio->info,aio->keynr,(char*) aio->keybuff,word,0);
@@ -112,7 +114,7 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
#else
#error
#endif
- if(tmp_weight==0) return doc_cnt; /* stopword, doc_cnt should be 0 */
+ if(tmp_weight==0) DBUG_RETURN(doc_cnt); /* stopword, doc_cnt should be 0 */
#ifdef EVAL_RUN
cnt=*(byte *)(aio->info->lastkey+keylen);
@@ -122,7 +124,7 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
/* saving document matched into dtree */
if (!(selem=tree_insert(&aio->dtree, &sdoc, 0, aio->dtree.custom_arg)))
- return 1;
+ DBUG_RETURN(1);
sptr=(FT_SUPERDOC *)ELEMENT_KEY((&aio->dtree), selem);
@@ -153,21 +155,22 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
if (doc_cnt)
{
word->weight*=GWS_IN_USE;
- if (word->weight < 0)
- word->weight=0;
+ if (word->weight < 0) word->weight=0;
+
}
- return 0;
+ DBUG_RETURN(0);
}
static int walk_and_copy(FT_SUPERDOC *from,
uint32 count __attribute__((unused)), FT_DOC **to)
{
+ DBUG_ENTER("walk_and_copy");
from->doc.weight+=from->tmp_weight*from->word_ptr->weight;
(*to)->dpos=from->doc.dpos;
(*to)->weight=from->doc.weight;
(*to)++;
- return 0;
+ DBUG_RETURN(0);
}
@@ -185,12 +188,13 @@ FT_INFO *ft_init_nlq_search(MI_INFO *info, uint keynr, byte *query,
FT_DOC *dptr;
FT_INFO *dlist=NULL;
my_off_t saved_lastpos=info->lastpos;
+ DBUG_ENTER("ft_init_nlq_search");
/* black magic ON */
if ((int) (keynr = _mi_check_index(info,keynr)) < 0)
- return NULL;
+ DBUG_RETURN(NULL);
if (_mi_readinfo(info,F_RDLCK,1))
- return NULL;
+ DBUG_RETURN(NULL);
/* black magic OFF */
aio.info=info;
@@ -237,7 +241,7 @@ err2:
err:
info->lastpos=saved_lastpos;
- return dlist;
+ DBUG_RETURN(dlist);
}
diff --git a/myisam/ft_parser.c b/myisam/ft_parser.c
index 583518089ba..29a48352cd6 100644
--- a/myisam/ft_parser.c
+++ b/myisam/ft_parser.c
@@ -190,6 +190,7 @@ byte ft_simple_get_word(byte **start, byte *end, FT_WORD *word)
{
byte *doc=*start;
int mwc;
+ DBUG_ENTER("ft_simple_get_word");
while (doc<end)
{
@@ -211,32 +212,35 @@ byte ft_simple_get_word(byte **start, byte *end, FT_WORD *word)
!is_stopword(word->pos, word->len))
{
*start=doc;
- return 1;
+ DBUG_RETURN(1);
}
}
- return 0;
+ DBUG_RETURN(0);
}
void ft_parse_init(TREE *wtree, CHARSET_INFO *cs)
{
+ DBUG_ENTER("ft_parse_init");
if (!is_tree_inited(wtree))
init_tree(wtree,0,0,sizeof(FT_WORD),(qsort_cmp2)&FT_WORD_cmp,0,NULL, cs);
+ DBUG_VOID_RETURN;
}
int ft_parse(TREE *wtree, byte *doc, int doclen)
{
byte *end=doc+doclen;
FT_WORD w;
+ DBUG_ENTER("ft_parse");
while (ft_simple_get_word(&doc,end,&w))
{
if (!tree_insert(wtree, &w, 0, wtree->custom_arg))
goto err;
}
- return 0;
+ DBUG_RETURN(0);
err:
delete_tree(wtree);
- return 1;
+ DBUG_RETURN(1);
}
diff --git a/myisam/ftdefs.h b/myisam/ftdefs.h
index 22a81ca4f9c..592b60a0133 100644
--- a/myisam/ftdefs.h
+++ b/myisam/ftdefs.h
@@ -78,7 +78,7 @@ extern ulong collstat;
/* Mysterious, but w/o (double) GWS_IDF performs better :-o */
#define GWS_IDF log(aio->info->state->records/doc_cnt)
#define GWS_IDF1 log((double)aio->info->state->records/doc_cnt)
-#define GWS_PROB log(((double)(aio->info->state->records-doc_cnt))/doc_cnt)
+#define GWS_PROB ((aio->info->state->records > doc_cnt) ? log(((double)(aio->info->state->records-doc_cnt))/doc_cnt) : 0 )
#define GWS_FREQ (1.0/doc_cnt)
#define GWS_SQUARED pow(log((double)aio->info->state->records/doc_cnt),2)
#define GWS_CUBIC pow(log((double)aio->info->state->records/doc_cnt),3)
diff --git a/myisam/mi_create.c b/myisam/mi_create.c
index 0fe983bf115..8087d17904a 100644
--- a/myisam/mi_create.c
+++ b/myisam/mi_create.c
@@ -404,7 +404,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
length+=key_length;
keydef->block_length= MI_BLOCK_SIZE(length,pointer,MI_MAX_KEYPTR_SIZE);
if (keydef->block_length > MI_MAX_KEY_BLOCK_LENGTH ||
- length > MI_MAX_KEY_LENGTH)
+ length >= MI_MAX_KEY_BUFF)
{
my_errno=HA_WRONG_CREATE_OPTION;
goto err;
diff --git a/myisam/mi_delete_all.c b/myisam/mi_delete_all.c
index 7e4239bc7d1..45e56626d59 100644
--- a/myisam/mi_delete_all.c
+++ b/myisam/mi_delete_all.c
@@ -15,7 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* Remove all rows from a MyISAM table */
-/* This only clears the status information and truncates the data file */
+/* This clears the status information and truncates files */
#include "myisamdef.h"
@@ -49,14 +49,15 @@ int mi_delete_all_rows(MI_INFO *info)
state->key_root[i]= HA_OFFSET_ERROR;
myisam_log_command(MI_LOG_DELETE_ALL,info,(byte*) 0,0,0);
- VOID(_mi_writeinfo(info,WRITEINFO_UPDATE_KEYFILE));
- if (my_chsize(info->dfile, 0, 0, MYF(MY_WME)))
- goto err;
/*
If we are using delayed keys or if the user has done changes to the tables
since it was locked then there may be key blocks in the key cache
*/
flush_key_blocks(share->kfile, FLUSH_IGNORE_CHANGED);
+ if (my_chsize(info->dfile, 0, 0, MYF(MY_WME)) ||
+ my_chsize(share->kfile, share->base.keystart, 0, MYF(MY_WME)) )
+ goto err;
+ VOID(_mi_writeinfo(info,WRITEINFO_UPDATE_KEYFILE));
allow_break(); /* Allow SIGHUP & SIGINT */
DBUG_RETURN(0);