List:Commits« Previous MessageNext Message »
From:Øystein Grøvlen Date:March 16 2011 9:40am
Subject:Re: bzr commit into mysql-trunk branch (epotemkin:3006) Bug#11807437
View as plain text  
Hi Evgeny,

Thanks for the patch.  I have verified that it fixes the valgrind issue, 
and will approve it.  I will just note that I would prefer if the test 
case was cleaned up a bit more.  E.g., remove back-ticks, use less 
cryptic names for some of the aliases etc.

--
Øystein

On 25/02/2011 12:10, Evgeny Potemkin wrote:
> #At file:///work/bzrroot/wl5274-next-mr-bugfixing/ based on
> revid:epotemkin@stripped
>
>   3006 Evgeny Potemkin	2011-02-25
>        Bug#11807437: VALGRIND WARNING IN MYSQL_DERIVED_OPTIMIZE() LINE 293
>        After a merge initialization of JOIN::best_rowcount wasn't added in few
>        cases, thus valgrind was throwing reported warning.
>        Added initialization of JOIN::best_rowcount.
>       @ mysql-test/r/derived.result
>          Added a test case for the bug#11807437.
>       @ mysql-test/t/derived.test
>          Added a test case for the bug#11807437.
>       @ sql/sql_select.cc
>          Bug#11807437: VALGRIND WARNING IN MYSQL_DERIVED_OPTIMIZE() LINE 293
>          Added initialization of JOIN::best_rowcount.
>
>      modified:
>        mysql-test/r/derived.result
>        mysql-test/t/derived.test
>        sql/sql_select.cc
> === modified file 'mysql-test/r/derived.result'
> --- a/mysql-test/r/derived.result	2011-02-23 14:37:35 +0000
> +++ b/mysql-test/r/derived.result	2011-02-25 11:10:05 +0000
> @@ -1558,3 +1558,21 @@ id	select_type	table	type	possible_keys
>   DROP VIEW view1;
>   DROP TABLE t1,t2;
>   #
> +#
> +# Bug#11807437: VALGRIND WARNING IN MYSQL_DERIVED_OPTIMIZE() LINE 293
> +#
> +CREATE TABLE `CC` (
> +`col_int_key` int(11) DEFAULT NULL
> +);
> +SELECT 1 AS field1
> +FROM  (
> +SELECT 1 as 'col_int_key',2 as 'col_varchar_nokey'
> +    FROM DUAL
> +WHERE EXISTS  (
> +SELECT C_SQ1_alias1.col_int_key AS C_SQ1_field1
> +FROM  CC AS C_SQ1_alias1
> +)) AS alias2
> +;
> +field1
> +DROP TABLE CC;
> +#
>
> === modified file 'mysql-test/t/derived.test'
> --- a/mysql-test/t/derived.test	2011-02-23 14:37:35 +0000
> +++ b/mysql-test/t/derived.test	2011-02-25 11:10:05 +0000
> @@ -916,3 +916,23 @@ DROP VIEW view1;
>   DROP TABLE t1,t2;
>   --echo #
>
> +--echo #
> +--echo # Bug#11807437: VALGRIND WARNING IN MYSQL_DERIVED_OPTIMIZE() LINE 293
> +--echo #
> +CREATE TABLE `CC` (
> +  `col_int_key` int(11) DEFAULT NULL
> +);
> +
> +SELECT 1 AS field1
> +FROM  (
> +    SELECT 1 as 'col_int_key',2 as 'col_varchar_nokey'
> +    FROM DUAL
> +    WHERE EXISTS  (
> +      SELECT C_SQ1_alias1.col_int_key AS C_SQ1_field1
> +      FROM  CC AS C_SQ1_alias1
> +      )) AS alias2
> +;
> +
> +DROP TABLE CC;
> +--echo #
> +
>
> === modified file 'sql/sql_select.cc'
> --- a/sql/sql_select.cc	2011-02-23 14:37:35 +0000
> +++ b/sql/sql_select.cc	2011-02-25 11:10:05 +0000
> @@ -1853,6 +1853,7 @@ JOIN::optimize()
>         zero_result_cause=  select_lex->having_value == Item::COND_FALSE ?
>                              "Impossible HAVING" : "Impossible WHERE";
>         tables= 0;
> +      best_rowcount= 0;
>         goto setup_subq_exit;
>       }
>     }
> @@ -1898,6 +1899,7 @@ JOIN::optimize()
>       */
>       if ((res=opt_sum_query(select_lex->leaf_tables, all_fields, conds)))
>       {
> +      best_rowcount= 0;
>         if (res == HA_ERR_KEY_NOT_FOUND)
>         {
>           DBUG_PRINT("info",("No matching min/max row"));
> @@ -1921,6 +1923,7 @@ JOIN::optimize()
>         DBUG_PRINT("info",("Select tables optimized away"));
>         zero_result_cause= "Select tables optimized away";
>         tables_list= 0;				// All tables resolved
> +      best_rowcount= 1;
>         const_tables= tables;
>         /*
>           Extract all table-independent conditions and replace the WHERE
>
>
>
>
>


-- 
Øystein Grøvlen, Principal Software Engineer
MySQL Group, Oracle
Trondheim, Norway
Thread
bzr commit into mysql-trunk branch (epotemkin:3006) Bug#11807437Evgeny Potemkin25 Feb
  • Re: bzr commit into mysql-trunk branch (epotemkin:3006) Bug#11807437Øystein Grøvlen16 Mar