Commit fe26eac2 authored by unknown's avatar unknown

Stopwords (English only); fulltext keys now can be repaired


myisam/fulltext.h:
  stopwords moved to include/ft_global.h
myisam/mi_check.c:
  fulltext keys now can be repaired
include/ft_global.h:
  stopwords declaration
sql/ha_myisam.cc:
  bug in ::repair
sql/mysqld.cc:
  stopwords initialized with PRECOMPILED_STOPWORDS
include/Makefile.am:
  because `bk ci' set permissions to 444, the my_global.h
  should be removed, not overwritten.]
parent e7f6ed65
......@@ -45,6 +45,7 @@ my_config.h: ../config.h
# This should be changed in the source and removed.
my_global.h: global.h
-$(RM) my_global.h
$(CP) global.h my_global.h
# These files should not be included in distributions since they are
......
......@@ -40,6 +40,8 @@ typedef struct st_ft_doclist {
FT_DOC doc[1];
} FT_DOCLIST;
extern const char *ft_precompiled_stopwords[];
int ft_init_stopwords(const char **);
FT_DOCLIST * ft_init_search(void *, uint, byte *, uint, my_bool);
......
......@@ -35,8 +35,6 @@
extern const MI_KEYSEG ft_keysegs[FT_SEGS];
extern const char *ft_precompiled_stopwords[];
int _mi_ft_cmp(MI_INFO *, uint, const byte *, const byte *);
int _mi_ft_add(MI_INFO *, uint, byte *, const byte *, my_off_t);
int _mi_ft_del(MI_INFO *, uint, byte *, const byte *, my_off_t);
......@@ -1083,7 +1083,7 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info,
if (!(sort_info->record=(byte*) my_malloc((uint) share->base.pack_reclength,
MYF(0))))
{
mi_check_print_error(param,"Not Enough memory for extra record");
mi_check_print_error(param,"Not enough memory for extra record");
goto err;
}
......@@ -1141,6 +1141,8 @@ 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 ? */
info->state->key_file_length=share->base.keystart;
lock_memory(param); /* Everything is alloced */
......@@ -1270,11 +1272,18 @@ static int writekeys(register MI_INFO *info,byte *buff,my_off_t filepos)
for (i=0 ; i < info->s->base.keys ; i++)
{
if (((ulonglong) 1 << i) & info->s->state.key_map)
{
if (info->s->keyinfo[i].flag & HA_FULLTEXT )
{
if (_mi_ft_add(info,i,(char*) key,buff,filepos)) goto err;
}
else
{
uint key_length=_mi_make_key(info,i,key,buff,filepos);
if (_mi_ck_write(info,i,key,key_length)) goto err;
}
}
}
DBUG_RETURN(0);
err:
......@@ -1284,12 +1293,19 @@ static int writekeys(register MI_INFO *info,byte *buff,my_off_t filepos)
while ( i-- > 0 )
{
if (((ulonglong) 1 << i) & info->s->state.key_map)
{
if (info->s->keyinfo[i].flag & HA_FULLTEXT)
{
if (_mi_ft_del(info,i,(char*) key,buff,filepos)) break;
}
else
{
uint key_length=_mi_make_key(info,i,key,buff,filepos);
if (_mi_ck_delete(info,i,key,key_length)) break;
}
}
}
}
DBUG_PRINT("error",("errno: %d",my_errno));
DBUG_RETURN(-1);
} /* writekeys */
......@@ -1919,8 +1935,17 @@ static int sort_key_read(SORT_INFO *sort_info, void *key)
"Found too many records; Can`t continue");
DBUG_RETURN(1);
}
if (sort_info->keyinfo->flag & HA_FULLTEXT )
{
mi_check_print_error(sort_info->param,
"Can`t use repair_by_sort with FULLTEXT key");
DBUG_RETURN(1);
}
else
{
VOID(_mi_make_key(info,sort_info->key,key,sort_info->record,
sort_info->filepos));
}
DBUG_RETURN(sort_write_record(sort_info));
} /* sort_key_read */
......@@ -2984,7 +3009,7 @@ 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++)
{
if (mi_too_big_key_for_sort(key,rows))
if (mi_too_big_key_for_sort(key,rows) || (key->flag & HA_FULLTEXT))
return FALSE;
}
return TRUE;
......
......@@ -372,6 +372,7 @@ int ha_myisam::repair(THD *thd, MI_CHECK &param)
param.table_name = table->table_name;
param.tmpfile_createflag = O_RDWR | O_TRUNC;
param.using_global_keycache = 1;
param.thd=thd;
VOID(fn_format(fixed_name,file->filename,"",MI_NAME_IEXT,
4+ (param.opt_follow_links ? 16 : 0)));
......
......@@ -1455,7 +1455,7 @@ int main(int argc, char **argv)
sql_print_error("Can't init databases");
exit(1);
}
ft_init_stopwords(NULL); /* SerG */
ft_init_stopwords(ft_precompiled_stopwords); /* SerG */
#ifdef __WIN__
#define MYSQL_ERR_FILE "mysql.err"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment