summaryrefslogtreecommitdiff
path: root/storage/maria/ma_ft_update.c
diff options
context:
space:
mode:
authorunknown <guilhem@gbichot3.local>2006-08-10 16:36:54 +0200
committerunknown <guilhem@gbichot3.local>2006-08-10 16:36:54 +0200
commit99c431db92f8904bf50f6944e1488a0172c4ebd8 (patch)
tree9132c961bf06ad3ad65fed6b3590b820da877ef8 /storage/maria/ma_ft_update.c
parent381fdf1a67a67a7e9037bbbf385cb67cbaef126e (diff)
downloadmariadb-git-99c431db92f8904bf50f6944e1488a0172c4ebd8.tar.gz
Completion of merge of mysql-5.1 into mysql-maria.
Manually imported changes done to MyISAM (include/myisam.h, storage/myisam/*, sql/ha_myisam.*, mysql-test/t/myisam.test, mysql-test/t/ps_2myisam.test) the last months into Maria (tedious, should do it more frequently in the future), including those not done at the previous 5.1->Maria merge (please in the future don't forget to apply MyISAM changes to Maria when you merge 5.1 into Maria). Note: I didn't try to import anything which could be MyISAM-related in other tests of mysql-test (I didn't want to dig in all csets), but as QA is working to make most tests re-usable for other engines (Falcon), it is likely that we'll benefit from this and just have to set engine=Maria somewhere to run those tests on Maria. func_group and partition tests fail but they already do in main 5.1 on my machine. No Valgrind error in t/*maria*.test. Monty: please see the commit comment of maria.result and check. BitKeeper/deleted/.del-ha_maria.m4: Delete: config/ac-macros/ha_maria.m4 configure.in: fix for the new way of enabling engines include/maria.h: importing changes done to MyISAM the last months into Maria include/my_handler.h: importing changes done to MyISAM the last months into Maria include/myisam.h: importing changes done to MyISAM the last months into Maria mysql-test/r/maria.result: identical to myisam.result, except the engine name in some places AND in the line testing key_block_size=1000000000000000000: Maria gives a key block size of 8192 while MyISAM gives 4096; is it explainable by the difference between MARIA_KEY_BLOCK_LENGTH and the same constant in MyISAM? Monty? mysql-test/r/ps_maria.result: identical to ps_2myisam.result (except the engine name in some places) mysql-test/t/maria.test: instead of engine=maria everywhere, I use @@storage_engine (reduces the diff with myisam.test). importing changes done to MyISAM the last months into Maria mysys/my_handler.c: importing changes done to MyISAM the last months into Maria sql/ha_maria.cc: importing changes done to MyISAM the last months into Maria sql/ha_maria.h: importing changes done to MyISAM the last months into Maria sql/mysqld.cc: unneeded storage/maria/Makefile.am: importing changes done to MyISAM the last months into Maria storage/maria/ma_check.c: importing changes done to MyISAM the last months into Maria storage/maria/ma_create.c: importing changes done to MyISAM the last months into Maria storage/maria/ma_delete_table.c: importing changes done to MyISAM the last months into Maria storage/maria/ma_dynrec.c: importing changes done to MyISAM the last months into Maria storage/maria/ma_extra.c: importing changes done to MyISAM the last months into Maria storage/maria/ma_ft_boolean_search.c: importing changes done to MyISAM the last months into Maria storage/maria/ma_ft_eval.c: importing changes done to MyISAM the last months into Maria storage/maria/ma_ft_nlq_search.c: importing changes done to MyISAM the last months into Maria storage/maria/ma_ft_parser.c: importing changes done to MyISAM the last months into Maria storage/maria/ma_ft_test1.c: importing changes done to MyISAM the last months into Maria storage/maria/ma_ft_update.c: importing changes done to MyISAM the last months into Maria storage/maria/ma_ftdefs.h: importing changes done to MyISAM the last months into Maria storage/maria/ma_key.c: importing changes done to MyISAM the last months into Maria storage/maria/ma_open.c: importing changes done to MyISAM the last months into Maria storage/maria/ma_page.c: importing changes done to MyISAM the last months into Maria storage/maria/ma_rkey.c: importing changes done to MyISAM the last months into Maria storage/maria/ma_rsamepos.c: importing changes done to MyISAM the last months into Maria storage/maria/ma_rt_index.c: importing changes done to MyISAM the last months into Maria storage/maria/ma_rt_mbr.c: importing changes done to MyISAM the last months into Maria storage/maria/ma_search.c: importing changes done to MyISAM the last months into Maria storage/maria/ma_sort.c: importing changes done to MyISAM the last months into Maria storage/maria/ma_test1.c: importing changes done to MyISAM the last months into Maria storage/maria/ma_test2.c: importing changes done to MyISAM the last months into Maria storage/maria/ma_test3.c: importing changes done to MyISAM the last months into Maria storage/maria/ma_update.c: importing changes done to MyISAM the last months into Maria storage/maria/ma_write.c: importing changes done to MyISAM the last months into Maria storage/maria/maria_chk.c: importing changes done to MyISAM the last months into Maria storage/maria/maria_def.h: importing changes done to MyISAM the last months into Maria storage/maria/maria_ftdump.c: importing changes done to MyISAM the last months into Maria storage/maria/maria_pack.c: importing changes done to MyISAM the last months into Maria
Diffstat (limited to 'storage/maria/ma_ft_update.c')
-rw-r--r--storage/maria/ma_ft_update.c57
1 files changed, 25 insertions, 32 deletions
diff --git a/storage/maria/ma_ft_update.c b/storage/maria/ma_ft_update.c
index c9e2112578c..965f9afc91d 100644
--- a/storage/maria/ma_ft_update.c
+++ b/storage/maria/ma_ft_update.c
@@ -95,9 +95,8 @@ uint _ma_ft_segiterator(register FT_SEG_ITERATOR *ftsi)
/* parses a document i.e. calls maria_ft_parse for every keyseg */
-uint _ma_ft_parse(TREE *parsed, MARIA_HA *info, uint keynr,
- const byte *record, my_bool with_alloc,
- MYSQL_FTPARSER_PARAM *param)
+uint _ma_ft_parse(TREE *parsed, MARIA_HA *info, uint keynr, const byte *record,
+ MYSQL_FTPARSER_PARAM *param, MEM_ROOT *mem_root)
{
FT_SEG_ITERATOR ftsi;
struct st_mysql_ftparser *parser;
@@ -110,25 +109,27 @@ uint _ma_ft_parse(TREE *parsed, MARIA_HA *info, uint keynr,
while (_ma_ft_segiterator(&ftsi))
{
if (ftsi.pos)
- if (maria_ft_parse(parsed, (byte *)ftsi.pos, ftsi.len, with_alloc, parser,
- param))
+ if (maria_ft_parse(parsed, (byte *)ftsi.pos, ftsi.len, parser, param,
+ mem_root))
DBUG_RETURN(1);
}
DBUG_RETURN(0);
}
-FT_WORD * _ma_ft_parserecord(MARIA_HA *info, uint keynr, const byte *record)
+FT_WORD * _ma_ft_parserecord(MARIA_HA *info, uint keynr, const byte *record,
+ MEM_ROOT *mem_root)
{
TREE ptree;
MYSQL_FTPARSER_PARAM *param;
DBUG_ENTER("_ma_ft_parserecord");
- if (! (param= maria_ftparser_call_initializer(info, keynr)))
+ if (! (param= maria_ftparser_call_initializer(info, keynr, 0)))
DBUG_RETURN(NULL);
bzero((char*) &ptree, sizeof(ptree));
- if (_ma_ft_parse(&ptree, info, keynr, record, 0, param))
+ param->flags= 0;
+ if (_ma_ft_parse(&ptree, info, keynr, record, param, mem_root))
DBUG_RETURN(NULL);
- DBUG_RETURN(maria_ft_linearize(&ptree));
+ DBUG_RETURN(maria_ft_linearize(&ptree, mem_root));
}
static int _ma_ft_store(MARIA_HA *info, uint keynr, byte *keybuf,
@@ -174,10 +175,6 @@ int _ma_ft_cmp(MARIA_HA *info, uint keynr, const byte *rec1, const byte *rec2)
FT_SEG_ITERATOR ftsi1, ftsi2;
CHARSET_INFO *cs=info->s->keyinfo[keynr].seg->charset;
DBUG_ENTER("_ma_ft_cmp");
-#ifndef MYSQL_HAS_TRUE_CTYPE_IMPLEMENTATION
- if (cs->mbmaxlen > 1)
- DBUG_RETURN(THOSE_TWO_DAMN_KEYS_ARE_REALLY_DIFFERENT);
-#endif
_ma_ft_segiterator_init(info, keynr, rec1, &ftsi1);
_ma_ft_segiterator_init(info, keynr, rec2, &ftsi2);
@@ -206,10 +203,11 @@ int _ma_ft_update(MARIA_HA *info, uint keynr, byte *keybuf,
int cmp, cmp2;
DBUG_ENTER("_ma_ft_update");
- if (!(old_word=oldlist= _ma_ft_parserecord(info, keynr, oldrec)))
- goto err0;
- if (!(new_word=newlist= _ma_ft_parserecord(info, keynr, newrec)))
- goto err1;
+ if (!(old_word=oldlist=_ma_ft_parserecord(info, keynr, oldrec,
+ &info->ft_memroot)) ||
+ !(new_word=newlist=_ma_ft_parserecord(info, keynr, newrec,
+ &info->ft_memroot)))
+ goto err;
error=0;
while(old_word->pos && new_word->pos)
@@ -222,13 +220,13 @@ int _ma_ft_update(MARIA_HA *info, uint keynr, byte *keybuf,
{
key_length= _ma_ft_make_key(info,keynr,keybuf,old_word,pos);
if ((error= _ma_ck_delete(info,keynr,(uchar*) keybuf,key_length)))
- goto err2;
+ goto err;
}
if (cmp > 0 || cmp2)
{
key_length= _ma_ft_make_key(info,keynr,keybuf,new_word,pos);
if ((error= _ma_ck_write(info,keynr,(uchar*) keybuf,key_length)))
- goto err2;
+ goto err;
}
if (cmp<=0) old_word++;
if (cmp>=0) new_word++;
@@ -238,11 +236,8 @@ int _ma_ft_update(MARIA_HA *info, uint keynr, byte *keybuf,
else if (new_word->pos)
error= _ma_ft_store(info,keynr,keybuf,new_word,pos);
-err2:
- my_free((char*) newlist,MYF(0));
-err1:
- my_free((char*) oldlist,MYF(0));
-err0:
+err:
+ free_root(&info->ft_memroot, MYF(MY_MARK_BLOCKS_FREE));
DBUG_RETURN(error);
}
@@ -255,12 +250,12 @@ int _ma_ft_add(MARIA_HA *info, uint keynr, byte *keybuf, const byte *record,
int error= -1;
FT_WORD *wlist;
DBUG_ENTER("_ma_ft_add");
+ DBUG_PRINT("enter",("keynr: %d",keynr));
- if ((wlist= _ma_ft_parserecord(info, keynr, record)))
- {
+ if ((wlist= _ma_ft_parserecord(info, keynr, record, &info->ft_memroot)))
error= _ma_ft_store(info,keynr,keybuf,wlist,pos);
- my_free((char*) wlist,MYF(0));
- }
+ free_root(&info->ft_memroot, MYF(MY_MARK_BLOCKS_FREE));
+ DBUG_PRINT("exit",("Return: %d",error));
DBUG_RETURN(error);
}
@@ -275,11 +270,9 @@ int _ma_ft_del(MARIA_HA *info, uint keynr, byte *keybuf, const byte *record,
DBUG_ENTER("_ma_ft_del");
DBUG_PRINT("enter",("keynr: %d",keynr));
- if ((wlist= _ma_ft_parserecord(info, keynr, record)))
- {
+ if ((wlist= _ma_ft_parserecord(info, keynr, record, &info->ft_memroot)))
error= _ma_ft_erase(info,keynr,keybuf,wlist,pos);
- my_free((char*) wlist,MYF(0));
- }
+ free_root(&info->ft_memroot, MYF(MY_MARK_BLOCKS_FREE));
DBUG_PRINT("exit",("Return: %d",error));
DBUG_RETURN(error);
}