List:Internals« Previous MessageNext Message »
From:eugene Date:September 13 2005 10:16pm
Subject:bk commit into 5.0 tree (evgen:1.1970) BUG#12291
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of evgen. When evgen 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
  1.1970 05/09/14 00:16:17 evgen@stripped +3 -0
  Fix bug #12291 Table wasn't reinited for index scan after sequential scan
  
  Optimizer did choose "Range checked for each record" for one of the tables.
  For first few loops over that table it choose sequential access, on later
  stage it choose to use index. Because table was previously initialized for 
  sequential access, it skips intitialization for index access, and when
  server tries to retrieve data error occurs.
  
  QUICK_RANGE_SELECT::init() changes so if file already initialized for
  sequential access, it calls ha_rnd_end() and initializes file for index
  access.

  mysql-test/r/select.result
    1.93 05/09/13 23:56:28 evgen@stripped +14 -0
    Test case for bug #12291 Table wasn't reinited for index scan after sequential scan

  mysql-test/t/select.test
    1.78 05/09/13 23:56:04 evgen@stripped +12 -0
    Test case for bug #12291 Table wasn't reinited for index scan after sequential scan

  sql/opt_range.cc
    1.188 05/09/13 23:55:17 evgen@stripped +8 -1
    Fix bug #12291 Table wasn't reinited for index scan after sequential scan

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	evgen
# Host:	moonbone.local
# Root:	/work/12291-bug-5.0-mysql

--- 1.187/sql/opt_range.cc	2005-09-07 17:29:04 +04:00
+++ 1.188/sql/opt_range.cc	2005-09-13 23:55:17 +04:00
@@ -750,8 +750,15 @@
 {
   DBUG_ENTER("QUICK_RANGE_SELECT::init");
 
-  if (file->inited == handler::NONE)
+  switch (file->inited) {
+  case handler::INDEX:
+    break;
+  case handler::RND:
+    file->ha_rnd_end();
+    /* fall through */
+  case handler::NONE:
     DBUG_RETURN(error= file->ha_index_init(index));
+  }
   error= 0;
   DBUG_RETURN(0);
 }

--- 1.92/mysql-test/r/select.result	2005-09-12 20:18:14 +04:00
+++ 1.93/mysql-test/r/select.result	2005-09-13 23:56:28 +04:00
@@ -2943,3 +2943,17 @@
 c	a	b
 1	1	1
 drop table t1, t2, t3, t4;
+create table t1(x int, y int);
+create table t2(x int, y int);
+create table t3(x int, primary key(x));
+insert into t1 values (1, 1), (2, 1), (3, 1), (4, 3), (5, 6);
+insert into t2 values (1, 1), (2, 1), (3, 3);
+insert into t3 values (1), (2), (3);
+select t1.x, t3.x from t1, t2, t3  where t1.x = t2.x and t3.x >= t1.y and t3.x <=
t2.y;
+x	x
+1	1
+2	1
+3	1
+3	2
+3	3
+drop table t1,t2,t3;

--- 1.77/mysql-test/t/select.test	2005-09-12 20:18:14 +04:00
+++ 1.78/mysql-test/t/select.test	2005-09-13 23:56:04 +04:00
@@ -2523,3 +2523,15 @@
 select * from t1 join t2 join t3 join t4 on (t1.a = t4.c and t2.b = t4.c);
 select * from t1 join t2 join t4 using (c);
 drop table t1, t2, t3, t4;
+
+#
+# Bug #12291 Table wasn't reinited for index scan after sequential scan 
+#
+create table t1(x int, y int);
+create table t2(x int, y int);
+create table t3(x int, primary key(x));
+insert into t1 values (1, 1), (2, 1), (3, 1), (4, 3), (5, 6);
+insert into t2 values (1, 1), (2, 1), (3, 3);
+insert into t3 values (1), (2), (3);
+select t1.x, t3.x from t1, t2, t3  where t1.x = t2.x and t3.x >= t1.y and t3.x <=
t2.y;
+drop table t1,t2,t3;
Thread
bk commit into 5.0 tree (evgen:1.1970) BUG#12291eugene13 Sep