Hi!
Kristian Nielsen wrote:
> Hi Igor, Timour, Sergey,
> 
> Can one of you please check this patch from MySQL 5.1.46? It is a commit to
> fix http://bugs.mysql.com/bug.php?id=51494
> 
> This patch introduces a regression:
> 
>     http://bugs.mysql.com/bug.php?id=53334
> 
> If I revert the patch, the regression disappears. And interestingly, the
> included test case does not fail even when the fix is reverted (go figure...)
> 
> So it would be good if one of you could check the patch and check what is
> wrong with it, and if a different fix for Bug#51494 is needed.
> 
> (needed to complete merge of MySQL 5.1.46).

Ok, I will take care of it.

Regards,
Igor.

> 
> Thanks,
> 
>  - Kristian.
> 
> ------------------------------------------------------------
> revno: 3407.1.1
> revision-id: sergey.gluk...@sun.com-20100319060102-57ykzjf4pc93avy1
> parent: o...@mysql.com-20100318064207-l3ap0mpxt510b4n3
> committer: Sergey Glukhov <sergey.gluk...@sun.com>
> branch nick: mysql-5.1-bugteam
> timestamp: Fri 2010-03-19 10:01:02 +0400
> message:
>   Bug#51494 crash with join, explain and 'sounds like' operator
>   The crash happens because of discrepancy between values of
>   conts_tables and join->const_table_map(make_join_statisctics).
>   Calculation of conts_tables used condition with
>   HA_STATS_RECORDS_IS_EXACT flag check. Calculation of
>   join->const_table_map does not use this flag check.
>   In case of MERGE table without union with index
>   the table does not become const table and
>   thus join_read_const_table() is not called
>   for the table. join->const_table_map supposes
>   this table is const and later in make_join_select
>   this table is used for making&calculation const
>   condition. As table record buffer is not populated
>   it leads to crash.
>   The fix is adding a check if an engine supports
>   HA_STATS_RECORDS_IS_EXACT flag before updating
>   join->const_table_map.
> diff:
> === modified file 'sql/sql_select.cc'
> --- sql/sql_select.cc 2010-03-14 16:01:45 +0000
> +++ sql/sql_select.cc 2010-03-19 06:01:02 +0000
> @@ -2943,7 +2943,8 @@
>        s->quick=select->quick;
>        s->needed_reg=select->needed_reg;
>        select->quick=0;
> -      if (records == 0 && s->table->reginfo.impossible_range)
> +      if (records == 0 && s->table->reginfo.impossible_range &&
> +          (s->table->file->ha_table_flags() & HA_STATS_RECORDS_IS_EXACT))
>        {
>       /*
>         Impossible WHERE or ON expression
> === modified file 'mysql-test/r/merge.result'
> --- mysql-test/r/merge.result 2010-03-03 10:49:03 +0000
> +++ mysql-test/r/merge.result 2010-03-19 06:01:02 +0000
> @@ -2286,4 +2286,16 @@
>  DROP TABLE m1;
>  DROP TABLE `t...@1`.`t@1`;
>  DROP DATABASE `t...@1`;
> +#
> +# Bug#51494c rash with join, explain and 'sounds like' operator
> +#
> +CREATE TABLE t1 (a INT) ENGINE=MYISAM;
> +INSERT INTO t1 VALUES(1);
> +CREATE TABLE t2 (b INT NOT NULL,c INT,d INT,e BLOB NOT NULL,
> +KEY idx0 (d, c)) ENGINE=MERGE;
> +EXPLAIN SELECT * FROM t1 NATURAL RIGHT JOIN
> +t2 WHERE b SOUNDS LIKE e AND d = 1;
> +id   select_type     table   type    possible_keys   key     key_len ref     
> rows    Extra
> +1    SIMPLE  NULL    NULL    NULL    NULL    NULL    NULL    NULL    
> Impossible WHERE noticed after reading const tables
> +DROP TABLE t2, t1;
>  End of 5.1 tests
> 
> === modified file 'mysql-test/t/merge.test'
> --- mysql-test/t/merge.test   2010-03-03 10:49:03 +0000
> +++ mysql-test/t/merge.test   2010-03-19 06:01:02 +0000
> @@ -1690,4 +1690,19 @@
>  DROP TABLE `t...@1`.`t@1`;
>  DROP DATABASE `t...@1`;
>  
> +--echo #
> +--echo # Bug#51494c rash with join, explain and 'sounds like' operator
> +--echo #
> +
> +CREATE TABLE t1 (a INT) ENGINE=MYISAM;
> +INSERT INTO t1 VALUES(1);
> +
> +CREATE TABLE t2 (b INT NOT NULL,c INT,d INT,e BLOB NOT NULL,
> +KEY idx0 (d, c)) ENGINE=MERGE;
> +
> +EXPLAIN SELECT * FROM t1 NATURAL RIGHT JOIN
> +t2 WHERE b SOUNDS LIKE e AND d = 1;
> +
> +DROP TABLE t2, t1;
> +
>  --echo End of 5.1 tests
> 


_______________________________________________
Mailing list: https://launchpad.net/~maria-developers
Post to     : maria-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~maria-developers
More help   : https://help.launchpad.net/ListHelp

Reply via email to