From: Jorgen Loland Date: January 7 2011 2:06pm Subject: bzr commit into mysql-trunk-bugfixing branch (jorgen.loland:3475) Bug#58837 List-Archive: http://lists.mysql.com/commits/128172 X-Bug: 58837 Message-Id: <20110107140641.7818410DC@atum21.norway.sun.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============4039732502642679938==" --===============4039732502642679938== MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline #At file:///export/home/jl208045/mysql/mysql-trunk-bugfixing/ based on revid:dao-gang.qu@stripped 3475 Jorgen Loland 2011-01-07 BUG#58837: ICP crash or valgrind error due to uninitialized value in innobase_index_cond The problem was that ICP pushed a condition to an InnoDB table accessed through the primary key, and handler::end_range was not initialized in this case. This problem emerged now because ICP on InnoDB primary index has recently been enabled. @ mysql-test/include/icp_tests.inc Added test case for BUG#58837 @ mysql-test/r/innodb_icp.result Added test case for BUG#58837 @ mysql-test/r/innodb_icp_none.result Added test case for BUG#58837 @ mysql-test/r/myisam_icp.result Added test case for BUG#58837 @ mysql-test/r/myisam_icp_none.result Added test case for BUG#58837 @ sql/handler.h Initialize handler::end_range in ha_rnd_init() and ha_rnd_end() modified: mysql-test/include/icp_tests.inc mysql-test/r/innodb_icp.result mysql-test/r/innodb_icp_none.result mysql-test/r/myisam_icp.result mysql-test/r/myisam_icp_none.result sql/handler.h === modified file 'mysql-test/include/icp_tests.inc' --- a/mysql-test/include/icp_tests.inc 2010-12-13 15:22:45 +0000 +++ b/mysql-test/include/icp_tests.inc 2011-01-07 14:06:38 +0000 @@ -653,3 +653,47 @@ create table t1 (a char(2) charset utf8, insert into t1 values ('',1); select 1 from t1 where b <= 1 and a <> ''; drop table t1; + +--echo # +--echo # Bug#58837: ICP crash or valgrind error due to uninitialized +--echo # value in innobase_index_cond +--echo # + +CREATE TABLE t1 ( + t1_int INT, + t1_time TIME +); + +CREATE TABLE t2 ( + t2_int int PRIMARY KEY, + t2_int2 INT +); + +--disable_warnings +INSERT INTO t2 VALUES (); +INSERT INTO t1 VALUES (); +--enable_warnings + +let $query= +SELECT * +FROM t1 AS t1a +WHERE NOT EXISTS + (SELECT * + FROM t1 AS t1b + WHERE t1b.t1_int NOT IN + (SELECT t2.t2_int + FROM t2 + WHERE t1b.t1_time LIKE t1b.t1_int + OR t1b.t1_time <> t2.t2_int2 + AND 6=7 + ) +) +; + +--echo +--eval $query; +--echo +--eval EXPLAIN $query; +--echo + +DROP TABLE t1,t2; === modified file 'mysql-test/r/innodb_icp.result' --- a/mysql-test/r/innodb_icp.result 2010-12-13 15:22:45 +0000 +++ b/mysql-test/r/innodb_icp.result 2011-01-07 14:06:38 +0000 @@ -598,5 +598,56 @@ insert into t1 values ('',1); select 1 from t1 where b <= 1 and a <> ''; 1 drop table t1; +# +# Bug#58837: ICP crash or valgrind error due to uninitialized +# value in innobase_index_cond +# +CREATE TABLE t1 ( +t1_int INT, +t1_time TIME +); +CREATE TABLE t2 ( +t2_int int PRIMARY KEY, +t2_int2 INT +); +INSERT INTO t2 VALUES (); +INSERT INTO t1 VALUES (); + +SELECT * +FROM t1 AS t1a +WHERE NOT EXISTS +(SELECT * +FROM t1 AS t1b +WHERE t1b.t1_int NOT IN +(SELECT t2.t2_int +FROM t2 +WHERE t1b.t1_time LIKE t1b.t1_int +OR t1b.t1_time <> t2.t2_int2 +AND 6=7 +) +) +;; +t1_int t1_time + +EXPLAIN SELECT * +FROM t1 AS t1a +WHERE NOT EXISTS +(SELECT * +FROM t1 AS t1b +WHERE t1b.t1_int NOT IN +(SELECT t2.t2_int +FROM t2 +WHERE t1b.t1_time LIKE t1b.t1_int +OR t1b.t1_time <> t2.t2_int2 +AND 6=7 +) +) +;; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY t1b ALL NULL NULL NULL NULL 1 Using where +3 DEPENDENT SUBQUERY t2 unique_subquery PRIMARY PRIMARY 4 func 1 Using where; Full scan on NULL key + +DROP TABLE t1,t2; set default_storage_engine= @save_storage_engine; set optimizer_switch=default; === modified file 'mysql-test/r/innodb_icp_none.result' --- a/mysql-test/r/innodb_icp_none.result 2010-12-13 15:22:45 +0000 +++ b/mysql-test/r/innodb_icp_none.result 2011-01-07 14:06:38 +0000 @@ -597,5 +597,56 @@ insert into t1 values ('',1); select 1 from t1 where b <= 1 and a <> ''; 1 drop table t1; +# +# Bug#58837: ICP crash or valgrind error due to uninitialized +# value in innobase_index_cond +# +CREATE TABLE t1 ( +t1_int INT, +t1_time TIME +); +CREATE TABLE t2 ( +t2_int int PRIMARY KEY, +t2_int2 INT +); +INSERT INTO t2 VALUES (); +INSERT INTO t1 VALUES (); + +SELECT * +FROM t1 AS t1a +WHERE NOT EXISTS +(SELECT * +FROM t1 AS t1b +WHERE t1b.t1_int NOT IN +(SELECT t2.t2_int +FROM t2 +WHERE t1b.t1_time LIKE t1b.t1_int +OR t1b.t1_time <> t2.t2_int2 +AND 6=7 +) +) +;; +t1_int t1_time + +EXPLAIN SELECT * +FROM t1 AS t1a +WHERE NOT EXISTS +(SELECT * +FROM t1 AS t1b +WHERE t1b.t1_int NOT IN +(SELECT t2.t2_int +FROM t2 +WHERE t1b.t1_time LIKE t1b.t1_int +OR t1b.t1_time <> t2.t2_int2 +AND 6=7 +) +) +;; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY t1b ALL NULL NULL NULL NULL 1 Using where +3 DEPENDENT SUBQUERY t2 unique_subquery PRIMARY PRIMARY 4 func 1 Using where; Full scan on NULL key + +DROP TABLE t1,t2; set default_storage_engine= @save_storage_engine; set optimizer_switch=default; === modified file 'mysql-test/r/myisam_icp.result' --- a/mysql-test/r/myisam_icp.result 2010-12-13 15:22:45 +0000 +++ b/mysql-test/r/myisam_icp.result 2011-01-07 14:06:38 +0000 @@ -596,4 +596,55 @@ insert into t1 values ('',1); select 1 from t1 where b <= 1 and a <> ''; 1 drop table t1; +# +# Bug#58837: ICP crash or valgrind error due to uninitialized +# value in innobase_index_cond +# +CREATE TABLE t1 ( +t1_int INT, +t1_time TIME +); +CREATE TABLE t2 ( +t2_int int PRIMARY KEY, +t2_int2 INT +); +INSERT INTO t2 VALUES (); +INSERT INTO t1 VALUES (); + +SELECT * +FROM t1 AS t1a +WHERE NOT EXISTS +(SELECT * +FROM t1 AS t1b +WHERE t1b.t1_int NOT IN +(SELECT t2.t2_int +FROM t2 +WHERE t1b.t1_time LIKE t1b.t1_int +OR t1b.t1_time <> t2.t2_int2 +AND 6=7 +) +) +;; +t1_int t1_time + +EXPLAIN SELECT * +FROM t1 AS t1a +WHERE NOT EXISTS +(SELECT * +FROM t1 AS t1b +WHERE t1b.t1_int NOT IN +(SELECT t2.t2_int +FROM t2 +WHERE t1b.t1_time LIKE t1b.t1_int +OR t1b.t1_time <> t2.t2_int2 +AND 6=7 +) +) +;; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY t1b system NULL NULL NULL NULL 1 +3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE + +DROP TABLE t1,t2; set optimizer_switch=default; === modified file 'mysql-test/r/myisam_icp_none.result' --- a/mysql-test/r/myisam_icp_none.result 2010-12-13 15:22:45 +0000 +++ b/mysql-test/r/myisam_icp_none.result 2011-01-07 14:06:38 +0000 @@ -595,4 +595,55 @@ insert into t1 values ('',1); select 1 from t1 where b <= 1 and a <> ''; 1 drop table t1; +# +# Bug#58837: ICP crash or valgrind error due to uninitialized +# value in innobase_index_cond +# +CREATE TABLE t1 ( +t1_int INT, +t1_time TIME +); +CREATE TABLE t2 ( +t2_int int PRIMARY KEY, +t2_int2 INT +); +INSERT INTO t2 VALUES (); +INSERT INTO t1 VALUES (); + +SELECT * +FROM t1 AS t1a +WHERE NOT EXISTS +(SELECT * +FROM t1 AS t1b +WHERE t1b.t1_int NOT IN +(SELECT t2.t2_int +FROM t2 +WHERE t1b.t1_time LIKE t1b.t1_int +OR t1b.t1_time <> t2.t2_int2 +AND 6=7 +) +) +;; +t1_int t1_time + +EXPLAIN SELECT * +FROM t1 AS t1a +WHERE NOT EXISTS +(SELECT * +FROM t1 AS t1b +WHERE t1b.t1_int NOT IN +(SELECT t2.t2_int +FROM t2 +WHERE t1b.t1_time LIKE t1b.t1_int +OR t1b.t1_time <> t2.t2_int2 +AND 6=7 +) +) +;; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY t1b system NULL NULL NULL NULL 1 +3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE + +DROP TABLE t1,t2; set optimizer_switch=default; === modified file 'sql/handler.h' --- a/sql/handler.h 2010-11-18 16:34:56 +0000 +++ b/sql/handler.h 2011-01-07 14:06:38 +0000 @@ -1556,6 +1556,7 @@ public: DBUG_ENTER("ha_rnd_init"); DBUG_ASSERT(inited==NONE || (inited==RND && scan)); inited= (result= rnd_init(scan)) ? NONE: RND; + end_range= NULL; DBUG_RETURN(result); } int ha_rnd_end() @@ -1563,6 +1564,7 @@ public: DBUG_ENTER("ha_rnd_end"); DBUG_ASSERT(inited==RND); inited=NONE; + end_range= NULL; DBUG_RETURN(rnd_end()); } int ha_rnd_next(uchar *buf); --===============4039732502642679938== MIME-Version: 1.0 Content-Type: text/bzr-bundle; charset="us-ascii"; name="bzr/jorgen.loland@stripped" Content-Transfer-Encoding: 7bit Content-Disposition: inline # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: jorgen.loland@stripped\ # wu2agbp7a1p4nso3 # target_branch: file:///export/home/jl208045/mysql/mysql-trunk-\ # bugfixing/ # testament_sha1: 8815a4e8b2e0e7605a3ba44585f74b1ca9ebfe33 # timestamp: 2011-01-07 15:06:41 +0100 # source_branch: file:///export/home/jl208045/mysql/mysql-5.5-bugteam/ # base_revision_id: d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