List:Commits« Previous MessageNext Message »
From:Sergei Golubchik Date:August 18 2008 5:12pm
Subject:Re: bzr commit into mysql-5.1 branch (ramil:2681) Bug#37756
View as plain text  
Hi!

On Jul 31, Ramil Kalimullin wrote:
> #At file:///home/ram/mysql/b37756.5.1/
> 
>  2681 Ramil Kalimullin	2008-07-31
>       Fix for bug #37756: enabling fulltext indexes with 
>         myisam_repair_threads > 1 causes crash
>       
>       Problem: parallel repair (myisam_repair_threads > 1) of a myisam
>       table with two or more fulltext keys that use the same parser may
>       lead to a server crash. ALTER TABLE ENABLE KEYS is affected as well.
>       
>       Fix: properly initialize fulltext structures for parallel repair.
>       
>       Note: 1. there's no deterministic test case.
>       2. now we call parser->init() for each each fulltext key
>       (not for each fulltext parser used).

> === modified file 'storage/myisam/ft_parser.c'
> --- a/storage/myisam/ft_parser.c	2007-11-14 14:32:03 +0000
> +++ b/storage/myisam/ft_parser.c	2008-07-31 04:50:44 +0000
> @@ -324,59 +324,58 @@ int ft_parse(TREE *wtree, uchar *doc, in
>  }
>  
>  #define MAX_PARAM_NR 2
> -MYSQL_FTPARSER_PARAM *ftparser_call_initializer(MI_INFO *info,
> -                                                uint keynr, uint paramnr)
> +
> +
> +MYSQL_FTPARSER_PARAM* ftparser_alloc_param(MI_INFO *info)
>  {
> -  uint32 ftparser_nr;
> -  struct st_mysql_ftparser *parser;
> -  if (! info->ftparser_param)
> +  if (!info->ftparser_param)
>    {
> -    /* info->ftparser_param can not be zero after the initialization,
> -       because it always includes built-in fulltext parser. And built-in
> -       parser can be called even if the table has no fulltext indexes and
> -       no varchar/text fields. */
> -    if (! info->s->ftparsers)
> +    /* 
> +      info->ftparser_param can not be zero after the initialization,
> +      because it always includes built-in fulltext parser. And built-in
> +      parser can be called even if the table has no fulltext indexes and
> +      no varchar/text fields.
> +    */
> +    if (!info->s->ftparsers)
>      {
> -      /* It's ok that modification to shared structure is done w/o mutex
> -         locks, because all threads would set the same variables to the
> -         same values. */
> -      uint i, j, keys= info->s->state.header.keys, ftparsers= 1;
> +      /*
> +        It's ok that modification to shared structure is done w/o mutex
> +        locks, because all threads would set the same variables to the
> +        same values. 
> +      */
> +      uint i, keys= info->s->state.header.keys, ftparsers= 1;
>        for (i= 0; i < keys; i++)
>        {
>          MI_KEYDEF *keyinfo= &info->s->keyinfo[i];
> +
>          if (keyinfo->flag & HA_FULLTEXT)
> -        {
> -          for (j= 0;; j++)
> -          {
> -            if (j == i)
> -            {
> -              keyinfo->ftparser_nr= ftparsers++;
> -              break;
> -            }
> -            if (info->s->keyinfo[j].flag & HA_FULLTEXT &&
> -                keyinfo->parser == info->s->keyinfo[j].parser)
> -            {
> -              keyinfo->ftparser_nr= info->s->keyinfo[j].ftparser_nr;
> -              break;
> -            }
> -          }
> -        }
> +          keyinfo->ftparser_nr= ftparsers++;

may be it shoud be then "ftindex_nr" ? and set in mi_open not here ?

>        }
>        info->s->ftparsers= ftparsers;
>      }
>      /*
>        We have to allocate two MYSQL_FTPARSER_PARAM structures per plugin
>        because in a boolean search a parser is called recursively
> -      ftb_find_relevance* calls ftb_check_phrase*
> -      (MAX_PARAM_NR=2)
> +      ftb_find_relevance* calls ftb_check_phrase * (MAX_PARAM_NR == 2).

this doesn't make any sense. The comment should be

  ftb_find_relevance... parser (ftb_find_relevance_parse,
  ftb_find_relevance_add_word) calls ftb_check_phrase... parser
  (ftb_check_phrase_internal, ftb_phrase_add_word). Thus MAX_PARAM_NR=2.

>      */
>      info->ftparser_param= (MYSQL_FTPARSER_PARAM *)
>        my_malloc(MAX_PARAM_NR * sizeof(MYSQL_FTPARSER_PARAM) *
>                  info->s->ftparsers, MYF(MY_WME|MY_ZEROFILL));
>      init_alloc_root(&info->ft_memroot, FTPARSER_MEMROOT_ALLOC_SIZE, 0);
> -    if (! info->ftparser_param)
> -      return 0;
>    }
> +  return info->ftparser_param;
> +}

Regards / Mit vielen Grüssen,
Sergei

-- 
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /   Sergei Golubchik <serg@stripped>
 / /|_/ / // /\ \/ /_/ / /__  Principal Software Engineer/Server Architect
/_/  /_/\_, /___/\___\_\___/  Sun Microsystems GmbH, HRB München 161028
       <___/                  Sonnenallee 1, 85551 Kirchheim-Heimstetten
Geschäftsführer: Thomas Schroeder, Wolfgang Engels, Dr. Roland Boemer
Vorsitzender des Aufsichtsrates: Martin Häring
Thread
bzr commit into mysql-5.1 branch (ramil:2681) Bug#37756Ramil Kalimullin31 Jul
  • Re: bzr commit into mysql-5.1 branch (ramil:2681) Bug#37756Sergei Golubchik18 Aug