List:Commits« Previous MessageNext Message »
From:Sergey Vojtovich Date:August 26 2009 12:13pm
Subject:Re: bzr commit into mysql-5.1-bugteam branch (mattias.jonsson:3059)
Bug#32430
View as plain text  
Hi!

Ok to push.

Regards,
Sergey

On Fri, Aug 07, 2009 at 01:08:38PM +0000, Mattias Jonsson wrote:
> #At file:///Users/mattiasj/clones/bzrroot/test-51-bugteam_innodb_plugin/ based on
> revid:iggy@stripped
> 
>  3059 Mattias Jonsson	2009-08-07
>       Bug#32430: 'show innodb status' causes errors
>       Invalid (old?) table or database name in logs
>       
>       Post push patch.
>       
>       Bug was that a non partitioned table file was not
>       converted to system_charset, (due to table_name_len was not set).
>       
>       Also missing DBUG_RETURN.
>       
>       And Innodb adds quotes after calling the function,
>       so I added one more mode where explain_filename does not
>       add quotes. But it still appends the [sub]partition name
>       as a comment.
>       
>       Also caught a minor quoting bug, the character '`' was
>       not quoted in the identifier. (so 'a`b' was quoted as `a`b`
>       and not `a``b`, this is mulitbyte characters aware.)
>      @ sql/mysql_priv.h
>         Bug#32430: 'show innodb status' causes errors
>         Invalid (old?) table or database name in logs
>         
>         Added an unquoted mode
>      @ sql/share/errmsg.txt
>         Bug#32430: 'show innodb status' causes errors
>         Invalid (old?) table or database name in logs
>         
>         Removed the quoting of identifier, only leaving the translated word.
>      @ sql/sql_table.cc
>         Bug#32430: 'show innodb status' causes errors
>         Invalid (old?) table or database name in logs
>         
>         Fixed quoting of '`'
>         Added DBUG_RETURN.
>         Corrected table_name_len.
>         Added unquoted mode.
> 
>     modified:
>       sql/mysql_priv.h
>       sql/share/errmsg.txt
>       sql/sql_table.cc
> === modified file 'sql/mysql_priv.h'
> --- a/sql/mysql_priv.h	2009-07-24 16:20:46 +0000
> +++ b/sql/mysql_priv.h	2009-08-07 13:08:32 +0000
> @@ -2261,7 +2261,8 @@ enum enum_explain_filename_mode
>  {
>    EXPLAIN_ALL_VERBOSE= 0,
>    EXPLAIN_PARTITIONS_VERBOSE,
> -  EXPLAIN_PARTITIONS_AS_COMMENT
> +  EXPLAIN_PARTITIONS_AS_COMMENT,
> +  EXPLAIN_PARTITIONS_AS_COMMENT_NO_QUOTING
>  };
>  uint explain_filename(const char *from, char *to, uint to_length,
>                        enum_explain_filename_mode explain_mode);
> 
> === modified file 'sql/share/errmsg.txt'
> --- a/sql/share/errmsg.txt	2009-07-31 17:14:52 +0000
> +++ b/sql/share/errmsg.txt	2009-08-07 13:08:32 +0000
> @@ -6184,17 +6184,17 @@ ER_FUNC_INEXISTENT_NAME_COLLISION 42000 
>  # When updating these, please update EXPLAIN_FILENAME_MAX_EXTRA_LENGTH in
>  # mysql_priv.h with the new maximal additional length for explain_filename.
>  ER_DATABASE_NAME
> -  eng "Database `%s`"
> -  swe "Databas `%s`"
> +  eng "Database"
> +  swe "Databas"
>  ER_TABLE_NAME
> -  eng "Table `%s`"
> -  swe "Tabell `%s`"
> +  eng "Table"
> +  swe "Tabell"
>  ER_PARTITION_NAME
> -  eng "Partition `%s`"
> -  swe "Partition `%s`"
> +  eng "Partition"
> +  swe "Partition"
>  ER_SUBPARTITION_NAME
> -  eng "Subpartition `%s`"
> -  swe "Subpartition `%s`"
> +  eng "Subpartition"
> +  swe "Subpartition"
>  ER_TEMPORARY_NAME
>    eng "Temporary"
>    swe "Tempor�
> 
> === modified file 'sql/sql_table.cc'
> --- a/sql/sql_table.cc	2009-07-29 08:54:20 +0000
> +++ b/sql/sql_table.cc	2009-08-07 13:08:32 +0000
> @@ -72,7 +72,7 @@ static void wait_for_kill_signal(THD *th
>    @brief Helper function for explain_filename
>  */
>  static char* add_identifier(char *to_p, const char * end_p,
> -                           const char* name, uint name_len, int errcode)
> +                           const char* name, uint name_len, bool add_quotes)
>  {
>    uint res;
>    uint errors;
> @@ -92,18 +92,44 @@ static char* add_identifier(char *to_p, 
>    res= strconvert(&my_charset_filename, conv_name, system_charset_info,
>                    conv_string, FN_REFLEN, &errors);
>    if (!res || errors)
> +  {
> +    DBUG_PRINT("error", ("strconvert of '%s' failed with %u (errors: %u)",
> conv_name, res, errors));
>      conv_name= name;
> +  }
>    else
>    {
>      DBUG_PRINT("info", ("conv '%s' -> '%s'", conv_name, conv_string));
>      conv_name= conv_string;
>    }
>  
> -  if (errcode)
> -    to_p+= my_snprintf(to_p, end_p - to_p, ER(errcode), conv_name);
> +  if (add_quotes && (end_p - to_p > 2))
> +  {
> +    *(to_p++)= '`';
> +    while (*conv_name && (end_p - to_p - 1) > 0)
> +    {
> +      uint length= my_mbcharlen(system_charset_info, *conv_name);
> +      if (!length)
> +        length= 1;
> +      if (length == 1 && *conv_name == '`')
> +      { 
> +        if ((end_p - to_p) < 3)
> +          break;
> +        *(to_p++)= '`';
> +        *(to_p++)= *(conv_name++);
> +      }
> +      else if (length < (end_p - to_p))
> +      {
> +        to_p= strnmov(to_p, conv_name, length);
> +        conv_name+= length;
> +      }
> +      else
> +        break;                               /* string already filled */
> +    }
> +    to_p= strnmov(to_p, "`", end_p - to_p);
> +  }
>    else
> -    to_p+= my_snprintf(to_p, end_p - to_p, "`%s`", conv_name);
> -  return to_p;
> +    to_p= strnmov(to_p, conv_name, end_p - to_p);
> +  DBUG_RETURN(to_p);
>  }
>  
>  
> @@ -135,6 +161,8 @@ static char* add_identifier(char *to_p, 
>                              [,[ Temporary| Renamed] Partition `p`
>                              [, Subpartition `sp`]] *|
>                              (| is really a /, and it is all in one line)
> +                            EXPLAIN_PARTITIONS_AS_COMMENT_NO_QUOTING ->
> +                            same as above but no quotes are added.
>  
>     @retval     Length of returned string
>  */
> @@ -245,28 +273,39 @@ uint explain_filename(const char *from,
>          part_name_len-= 5;
>      }
>    }
> +  else
> +    table_name_len= strlen(table_name);
>    if (db_name)
>    {
>      if (explain_mode == EXPLAIN_ALL_VERBOSE)
>      {
> -      to_p= add_identifier(to_p, end_p, db_name, db_name_len,
> -                           ER_DATABASE_NAME);
> +      to_p= strnmov(to_p, ER(ER_DATABASE_NAME), end_p - to_p);
> +      *(to_p++)= ' ';
> +      to_p= add_identifier(to_p, end_p, db_name, db_name_len, 1);
>        to_p= strnmov(to_p, ", ", end_p - to_p);
>      }
>      else
>      {
> -      to_p= add_identifier(to_p, end_p, db_name, db_name_len, 0);
> +      to_p= add_identifier(to_p, end_p, db_name, db_name_len,
> +                           (explain_mode !=
> +                            EXPLAIN_PARTITIONS_AS_COMMENT_NO_QUOTING));
>        to_p= strnmov(to_p, ".", end_p - to_p);
>      }
>    }
>    if (explain_mode == EXPLAIN_ALL_VERBOSE)
> -    to_p= add_identifier(to_p, end_p, table_name, table_name_len,
> -                         ER_TABLE_NAME);
> +  {
> +    to_p= strnmov(to_p, ER(ER_TABLE_NAME), end_p - to_p);
> +    *(to_p++)= ' ';
> +    to_p= add_identifier(to_p, end_p, table_name, table_name_len, 1);
> +  }
>    else
> -    to_p= add_identifier(to_p, end_p, table_name, table_name_len, 0);
> +    to_p= add_identifier(to_p, end_p, table_name, table_name_len,
> +                         (explain_mode !=
> +                          EXPLAIN_PARTITIONS_AS_COMMENT_NO_QUOTING));
>    if (part_name)
>    {
> -    if (explain_mode == EXPLAIN_PARTITIONS_AS_COMMENT)
> +    if (explain_mode == EXPLAIN_PARTITIONS_AS_COMMENT ||
> +        explain_mode == EXPLAIN_PARTITIONS_AS_COMMENT_NO_QUOTING)
>        to_p= strnmov(to_p, " /* ", end_p - to_p);
>      else if (explain_mode == EXPLAIN_PARTITIONS_VERBOSE)
>        to_p= strnmov(to_p, " ", end_p - to_p);
> @@ -280,15 +319,22 @@ uint explain_filename(const char *from,
>          to_p= strnmov(to_p, ER(ER_RENAMED_NAME), end_p - to_p);
>        to_p= strnmov(to_p, " ", end_p - to_p);
>      }
> +    to_p= strnmov(to_p, ER(ER_PARTITION_NAME), end_p - to_p);
> +    *(to_p++)= ' ';
>      to_p= add_identifier(to_p, end_p, part_name, part_name_len,
> -                         ER_PARTITION_NAME);
> +                         (explain_mode !=
> +                          EXPLAIN_PARTITIONS_AS_COMMENT_NO_QUOTING));
>      if (subpart_name)
>      {
>        to_p= strnmov(to_p, ", ", end_p - to_p);
> +      to_p= strnmov(to_p, ER(ER_SUBPARTITION_NAME), end_p - to_p);
> +      *(to_p++)= ' ';
>        to_p= add_identifier(to_p, end_p, subpart_name, subpart_name_len,
> -                           ER_SUBPARTITION_NAME);
> +                           (explain_mode !=
> +                            EXPLAIN_PARTITIONS_AS_COMMENT_NO_QUOTING));
>      }
> -    if (explain_mode == EXPLAIN_PARTITIONS_AS_COMMENT)
> +    if (explain_mode == EXPLAIN_PARTITIONS_AS_COMMENT ||
> +        explain_mode == EXPLAIN_PARTITIONS_AS_COMMENT_NO_QUOTING)
>        to_p= strnmov(to_p, " */", end_p - to_p);
>    }
>    DBUG_PRINT("exit", ("to '%s'", to));
> 


> 
> -- 
> MySQL Code Commits Mailing List
> For list archives: http://lists.mysql.com/commits
> To unsubscribe:    http://lists.mysql.com/commits?unsub=1


-- 
Sergey Vojtovich <svoj@stripped>
MySQL AB, Software Engineer
Izhevsk, Russia, www.mysql.com
Thread
bzr commit into mysql-5.1-bugteam branch (mattias.jonsson:3059)Bug#32430Mattias Jonsson7 Aug
  • Re: bzr commit into mysql-5.1-bugteam branch (mattias.jonsson:3059)Bug#32430Sergey Vojtovich26 Aug