summaryrefslogtreecommitdiff
path: root/myisam
diff options
context:
space:
mode:
authorunknown <serg@infomag.ape.relarn.ru>2000-08-28 17:43:58 +0400
committerunknown <serg@infomag.ape.relarn.ru>2000-08-28 17:43:58 +0400
commitca04c0eca770ebc50bb336f3ec3d66eb2fe46b58 (patch)
tree485c3b99b43fae8c2b58b7a5ab72b383265423d2 /myisam
parentfe26eac2198e79de6e23c17c5033a5c7bc8e1d41 (diff)
downloadmariadb-git-ca04c0eca770ebc50bb336f3ec3d66eb2fe46b58.tar.gz
ft_optimization: identical queries merging. collection -> fulltext. Bugs fixed.
**************** !!! NOTE EVERYBODY: SYNTAX CHANGED !!! ******************** There's no COLLECTIONs now, full-text indexes can be created via the word FULLTEXT, which should be used like UNIQUE. myisam/mi_check.c: comments added sql/lex.h: COLLECTION -> FULLTEXT sql/item_func.h: ft-optimization: identical queries merging sql/sql_select.cc: ft-optimization sql/item_func.cc: ft-optimization: identical queries merging sql/sql_base.cc: ft_optimization: identical queries merging sql/sql_yacc.yy: COLLECTION -> FULLTEXT myisam/ft_search.c: info->lastpot dealing Docs/manual.texi: COLLECTION -> FULLTEXT
Diffstat (limited to 'myisam')
-rw-r--r--myisam/ft_search.c7
-rw-r--r--myisam/mi_check.c20
2 files changed, 25 insertions, 2 deletions
diff --git a/myisam/ft_search.c b/myisam/ft_search.c
index 9dfa7f05412..91c63055fef 100644
--- a/myisam/ft_search.c
+++ b/myisam/ft_search.c
@@ -158,6 +158,7 @@ FT_DOCLIST * ft_init_search(void *info, uint keynr, byte *key,
ALL_IN_ONE aio;
FT_DOCLIST *dlist;
FT_DOC *dptr;
+ my_off_t saved_lastpos;
/* black magic ON */
if ((int) (keynr = _mi_check_index((MI_INFO *)info,keynr)) < 0)
@@ -173,6 +174,8 @@ FT_DOCLIST * ft_init_search(void *info, uint keynr, byte *key,
aio.keyinfo=aio.info->s->keyinfo+keynr;
aio.key_root=aio.info->s->state.key_root[keynr];
+ saved_lastpos=aio.info->lastpos;
+
if(!(wtree=ft_parse(NULL,key,key_len))) return NULL;
init_tree(&aio.dtree,0,sizeof(FT_SUPERDOC),(qsort_cmp)&FT_SUPERDOC_cmp,0,
@@ -199,6 +202,7 @@ FT_DOCLIST * ft_init_search(void *info, uint keynr, byte *key,
}
err:
+ aio.info->lastpos=saved_lastpos;
delete_tree(&aio.dtree);
delete_tree(wtree);
free(wtree);
@@ -217,7 +221,8 @@ int ft_read_next(FT_DOCLIST *handler, char *record)
info->update&= (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED);
- if (!(*info->read_record)(info,handler->doc[handler->curdoc].dpos,record))
+ info->lastpos=handler->doc[handler->curdoc].dpos;
+ if (!(*info->read_record)(info,info->lastpos,record))
{
info->update|= HA_STATE_AKTIV; /* Record is read */
return 0;
diff --git a/myisam/mi_check.c b/myisam/mi_check.c
index c6bd9f67c65..2b5a14f1e87 100644
--- a/myisam/mi_check.c
+++ b/myisam/mi_check.c
@@ -1141,7 +1141,13 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info,
for (i=0 ; i < share->state.header.max_block_size ; i++)
share->state.key_del[i]= HA_OFFSET_ERROR;
- share->state.key_map= ((ulonglong)1L << share->base.keys)-1; /* Should I ? */
+ /* I think mi_repair and mi_repair_by_sort should do the same
+ (according, e.g. to ha_myisam::repair), but as mi_repair doesn't
+ touch key_map it cannot be used to T_CREATE_MISSING_KEYS.
+ That is the next line for... (serg)
+ */
+
+ share->state.key_map= ((ulonglong)1L << share->base.keys)-1;
info->state->key_file_length=share->base.keystart;
@@ -1935,6 +1941,11 @@ static int sort_key_read(SORT_INFO *sort_info, void *key)
"Found too many records; Can`t continue");
DBUG_RETURN(1);
}
+ /* Hmm, repair_by_sort uses find_all_keys, and find_all_keys strictly
+ implies "one row - one key per keynr", while for ft_key one row/keynr
+ can produce as many keys as the number of unique words in the text
+ that's why I disabled repair_by_sort for ft-keys. (serg)
+ */
if (sort_info->keyinfo->flag & HA_FULLTEXT )
{
mi_check_print_error(sort_info->param,
@@ -3009,6 +3020,13 @@ my_bool mi_test_if_sort_rep(MI_INFO *info, ha_rows rows)
return FALSE; /* Can't use sort */
for (i=0 ; i < share->base.keys ; i++,key++)
{
+/* It's to disable repair_by_sort for ft-keys.
+ Another solution would be to make ft-keys just too_big_key_for_sort,
+ but then they won't be disabled by dectivate_non_unique_index
+ and so they will be created at the first stage. As ft-key creation
+ is very time-consuming process, it's better to leave it to repair stage
+ but this repair shouldn't be repair_by_sort (serg)
+ */
if (mi_too_big_key_for_sort(key,rows) || (key->flag & HA_FULLTEXT))
return FALSE;
}