List:Commits« Previous MessageNext Message »
From:Mattias Jonsson Date:December 17 2009 10:08am
Subject:Re: bzr commit into mysql-5.5-trunk branch (mikael:2925) Bug#49591
View as plain text  
Hi,

Please add conversion of the returned version to a string in 
set_show_version_string.

Is there anymore places this new intro_version could be used?


 > +    int output_version= (*input_version, 50500);

do you mean max(*input_version, 50500) ? (I don't know what 
output_version would be set to otherwise).

Approved after fixing these issues.

(Same comments below, just to show where in the patch.)

/Mattias
ps would also be handy to introduce (a bit updated for 50100) for bug#42849.



Mikael Ronstrom wrote:
> #At file:///home/mikael/mysql_clones/mysql-trunk-bug49591/ based on
> revid:build@stripped
> 
>  2925 Mikael Ronstrom	2009-12-16
>       BUG#49591, Fixed proper version number in SHOW CREATE TABLE output
> 
>     modified:
>       mysql-test/r/partition_column.result
>       mysql-test/r/partition_range.result
>       mysql-test/r/partition_utf8.result
>       mysql-test/t/partition_range.test
>       sql/item.h
>       sql/item_timefunc.h
>       sql/partition_info.cc
>       sql/partition_info.h
>       sql/sql_show.cc
> === modified file 'mysql-test/r/partition_column.result'
> --- a/mysql-test/r/partition_column.result	2009-12-02 07:14:22 +0000
> +++ b/mysql-test/r/partition_column.result	2009-12-16 18:14:05 +0000
> @@ -69,7 +69,7 @@ Table	Create Table

<snip>

> === modified file 'sql/item.h'
> --- a/sql/item.h	2009-12-11 09:39:38 +0000
> +++ b/sql/item.h	2009-12-16 18:14:05 +0000
> @@ -894,6 +894,15 @@ public:
>       (*traverser)(this, arg);
>     }
>  
> +  /*
> +    This is used to get the most recent version of any function in
> +    an item tree. The version is the version where a MySQL function
> +    was introduced in. So any function which is added should use
> +    this function and set the int_arg to maximum of the input data
> +    and their own version info.
> +  */
> +  virtual bool intro_version(uchar *int_arg) { return 0; }
> +
>    virtual bool remove_dependence_processor(uchar * arg) { return 0; }
>    virtual bool remove_fixed(uchar * arg) { fixed= 0; return 0; }
>    virtual bool cleanup_processor(uchar *arg);
> 
> === modified file 'sql/item_timefunc.h'
> --- a/sql/item_timefunc.h	2009-11-02 10:09:15 +0000
> +++ b/sql/item_timefunc.h	2009-12-16 18:14:05 +0000
> @@ -91,6 +91,15 @@ public:
>    enum_monotonicity_info get_monotonicity_info() const;
>    longlong val_int_endpoint(bool left_endp, bool *incl_endp);
>    bool check_partition_func_processor(uchar *bool_arg) { return FALSE;}
> +
> +  bool intro_version(uchar *int_arg)
> +  {
> +    int *input_version= (int*)int_arg;
> +    /* This function was introduced in 5.5 */
> +    int output_version= (*input_version, 50500);

mattiasj: do you mean max() or min(*input_version, 50500) ?

> +    *input_version= output_version;
> +    return 0;
> +  }
>  };
>  
>  
> 
> === modified file 'sql/partition_info.cc'
> --- a/sql/partition_info.cc	2009-12-02 07:14:22 +0000
> +++ b/sql/partition_info.cc	2009-12-16 18:14:05 +0000
> @@ -116,6 +116,38 @@ char *partition_info::create_default_par
>  
>  
>  /*
> +  Generate a version string for partition expression
> +  This function must be updated every time there is a possibility for
> +  a new function of a higher version number than 5.5.0.
> +
> +  SYNOPSIS
> +    set_show_version_string()
> +  RETURN VALUES
> +    None
> +*/
> +void partition_info::set_show_version_string(String *packet)
> +{
> +  int version= 0;
> +  if (column_list)
> +    packet->append(STRING_WITH_LEN("\n/*!50500"));
> +  else
> +  {
> +    if (part_expr)
> +      part_expr->walk(&Item::intro_version, 0, (uchar*)&version);
> +    if (subpart_expr)
> +      subpart_expr->walk(&Item::intro_version, 0, (uchar*)&version);
> +    if (version == 0)
> +    {
> +      /* No new functions in partition function */
> +      packet->append(STRING_WITH_LEN("\n/*!50100"));
> +    }
> +    else
> +      packet->append(STRING_WITH_LEN("\n/*!50500"));

mattiasj: Here, add the conversion from the version returned.

> +    DBUG_ASSERT(version <= 50500);

mattiasj: One could use MYSQL_VERSION_ID here instead, then it should be 
safe also for the next versions.

> +  }
> +}
> +
> +/*
>    Create a unique name for the subpartition as part_name'sp''subpart_no'
>    SYNOPSIS
>      create_subpartition_name()
> 
> === modified file 'sql/partition_info.h'
> --- a/sql/partition_info.h	2009-10-28 17:22:36 +0000
> +++ b/sql/partition_info.h	2009-12-16 18:14:05 +0000
> @@ -302,6 +302,7 @@ public:
>    bool check_partition_field_length();
>    bool init_column_part();
>    bool add_column_list_value(THD *thd, Item *item);
> +  void set_show_version_string(String *packet);
>  private:
>    static int list_part_cmp(const void* a, const void* b);
>    bool set_up_default_partitions(handler *file, HA_CREATE_INFO *info,
> 
> === modified file 'sql/sql_show.cc'
> --- a/sql/sql_show.cc	2009-11-10 09:32:29 +0000
> +++ b/sql/sql_show.cc	2009-12-16 18:14:05 +0000
> @@ -1497,7 +1497,7 @@ int store_create_info(THD *thd, TABLE_LI
>                                                    show_table_options,
>                                                    NULL, NULL))))
>      {
> -       packet->append(STRING_WITH_LEN("\n/*!50100"));
> +       table->part_info->set_show_version_string(packet);
>         packet->append(part_syntax, part_syntax_len);
>         packet->append(STRING_WITH_LEN(" */"));
>         my_free(part_syntax, MYF(0));
> 
> 
> 
> ------------------------------------------------------------------------
> 
> 
Thread
bzr commit into mysql-5.5-trunk branch (mikael:2925) Bug#49591Mikael Ronstrom16 Dec
  • Re: bzr commit into mysql-5.5-trunk branch (mikael:2925) Bug#49591Mattias Jonsson17 Dec
    • Re: bzr commit into mysql-5.5-trunk branch (mikael:2925) Bug#49591Vasil Dimov16 Mar
      • Re: bzr commit into mysql-5.5-trunk branch (mikael:2925) Bug#49591Mattias Jonsson16 Mar
      • Re: bzr commit into mysql-5.5-trunk branch (mikael:2925) Bug#49591Mattias Jonsson16 Mar