Commit 6236dfc7 authored by serg@infomag.ape.relarn.ru's avatar serg@infomag.ape.relarn.ru
Browse files

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

parent 9349bf7e
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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
+2 −0
Original line number Diff line number Diff line
@@ -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);
+3 −5
Original line number Diff line number Diff line
@@ -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);
+36 −11
Original line number Diff line number Diff line
@@ -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;
+1 −0
Original line number Diff line number Diff line
@@ -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)));
Loading