List:Commits« Previous MessageNext Message »
From:Sergey Petrunia Date:November 16 2007 5:09pm
Subject:bk commit into 6.0 tree (sergefp:1.2636) BUG#32229
View as plain text  
Below is the list of changes that have just been committed into a local
6.0 repository of psergey. When psergey does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-11-16 19:09:45+03:00, sergefp@stripped +3 -0
  BUG#32229: Range optimizer crashes for 'range checked for each record' query
  The problem:
  New code in sel_arg_range_sext() function didn't take into account that 
  SEL_ARG tree may contain objects of type SEL_ARG::MAYBE_KEY which do not
  represent intervals but just signal about possibility to use the "range
  checked for each record" optimization. Attempt to get min/max bounds from
  those objects caused the crash
  Fix:
  Make sel_arg_range_seq_next ignore SEL_ARG objects that have type other 
  than SEL_ARG::KEY_RANGE.
  [re-committing to push into the build clone]

  mysql-test/r/range.result@stripped, 2007-11-16 19:09:37+03:00, sergefp@stripped +8 -0
    BUG#32229: Range optimizer crashes for 'range checked for each record' query
    - testcase

  mysql-test/t/range.test@stripped, 2007-11-16 19:09:37+03:00, sergefp@stripped +11 -0
    BUG#32229: Range optimizer crashes for 'range checked for each record' query
    - testcase

  sql/opt_range.cc@stripped, 2007-11-16 19:09:37+03:00, sergefp@stripped +2 -1
    BUG#32229: Range optimizer crashes for 'range checked for each record' query
    - Make sel_arg_range_seq_next ignore SEL_ARG objects that have type 
      other than KEY_RANGE.

diff -Nrup a/mysql-test/r/range.result b/mysql-test/r/range.result
--- a/mysql-test/r/range.result	2007-11-16 18:59:33 +03:00
+++ b/mysql-test/r/range.result	2007-11-16 19:09:37 +03:00
@@ -1163,3 +1163,11 @@ Warning	1292	Truncated incorrect DOUBLE 
 Warning	1292	Truncated incorrect DOUBLE value: 'A'
 Warning	1292	Truncated incorrect DOUBLE value: 'A'
 DROP TABLE t1;
+create table t1 (a int,b int,key (b),key (a),key (b,a));
+insert into t1(a,b) values (1,2),(3,4),(5,6),(7,8);
+create table t2 (c int);
+insert into t2(c) values (1),(5),(6),(7),(8);
+select 1 from (select c from t1,t2 where b >= 1 and a <=> c group by 1 limit 1)
as d1;
+1
+1
+drop table t1, t2;
diff -Nrup a/mysql-test/t/range.test b/mysql-test/t/range.test
--- a/mysql-test/t/range.test	2007-11-16 18:59:33 +03:00
+++ b/mysql-test/t/range.test	2007-11-16 19:09:37 +03:00
@@ -973,3 +973,14 @@ CREATE TABLE t1 (c1 DECIMAL(10,0),INDEX(
 INSERT INTO t1 VALUES (1),(2),(3);
 SELECT c1 FROM t1 WHERE c1 >= 'A' GROUP BY 1;
 DROP TABLE t1;
+
+#
+# BUG#32229: Range optimizer crashes for 'range checked for each record' query
+#
+create table t1 (a int,b int,key (b),key (a),key (b,a));
+insert into t1(a,b) values (1,2),(3,4),(5,6),(7,8);
+create table t2 (c int);
+insert into t2(c) values (1),(5),(6),(7),(8);
+select 1 from (select c from t1,t2 where b >= 1 and a <=> c group by 1 limit 1)
as d1;
+drop table t1, t2;
+
diff -Nrup a/sql/opt_range.cc b/sql/opt_range.cc
--- a/sql/opt_range.cc	2007-11-16 18:59:33 +03:00
+++ b/sql/opt_range.cc	2007-11-16 19:09:37 +03:00
@@ -7267,7 +7267,8 @@ uint sel_arg_range_seq_next(range_seq_t 
   */
 walk_right_n_up:
   while (key_tree->next_key_part && key_tree->next_key_part !=
&null_element && 
-         key_tree->next_key_part->part == key_tree->part + 1)
+         key_tree->next_key_part->part == key_tree->part + 1 &&
+         key_tree->next_key_part->type == SEL_ARG::KEY_RANGE)
   {
     {
       RANGE_SEQ_ENTRY *cur= &seq->stack[seq->i];
Thread
bk commit into 6.0 tree (sergefp:1.2636) BUG#32229Sergey Petrunia16 Nov