List:Commits« Previous MessageNext Message »
From:Sergey Petrunia Date:January 25 2006 8:25pm
Subject:bk commit into 4.1 tree (sergefp:1.2455) BUG#15935
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 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
  1.2455 06/01/25 23:25:23 sergefp@stripped +3 -0
  BUG#15935: In mysql_update, don't use full index scan when we could have used quick select scan.

  sql/sql_update.cc
    1.152 06/01/25 23:25:19 sergefp@stripped +1 -2
    BUG#15935: 
    - Do account for the fact that used_index!=MAX_KEY is also true for cases
      when quick select is used, and use quick select then (and not full index scan).
    - Also removed the redundant "used_index= MAX_KEY" statement

  mysql-test/t/update.test
    1.27 06/01/25 23:25:19 sergefp@stripped +12 -0
    Testcase for BUG#15935

  mysql-test/r/update.result
    1.29 06/01/25 23:25:19 sergefp@stripped +15 -0
    Testcase for BUG#15935

# 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:	sergefp
# Host:	newbox.mylan
# Root:	/home/psergey/mysql-4.1-bug15935

--- 1.151/sql/sql_update.cc	2005-12-27 12:36:11 +03:00
+++ 1.152/sql/sql_update.cc	2006-01-25 23:25:19 +03:00
@@ -212,7 +212,6 @@
       SORT_FIELD  *sortorder;
       ha_rows examined_rows;
 
-      used_index= MAX_KEY;                   // For call to init_read_record()
       table->sort.io_cache = (IO_CACHE *) my_malloc(sizeof(IO_CACHE),
 						    MYF(MY_FAE | MY_ZEROFILL));
       if (!(sortorder=make_unireg_sortorder(order, &length)) ||
@@ -244,7 +243,7 @@
 			   DISK_BUFFER_SIZE, MYF(MY_WME)))
 	goto err;
 
-      if (used_index == MAX_KEY)
+      if (used_index == MAX_KEY || (select && select->quick))
         init_read_record(&info,thd,table,select,0,1);
       else
         init_read_record_idx(&info, thd, table, 1, used_index);

--- 1.28/mysql-test/r/update.result	2005-12-01 23:20:44 +03:00
+++ 1.29/mysql-test/r/update.result	2006-01-25 23:25:19 +03:00
@@ -358,3 +358,18 @@
 affected rows: 3
 info: Rows matched: 3  Changed: 3  Warnings: 0
 drop table t1,t2;
+create table t1 (a int);
+insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+create table t2 (a int, filler1 char(200), filler2 char(200), key(a));
+insert into t2 select A.a + 10*B.a, 'filler','filler' from t1 A, t1 B;
+flush status;
+update t2 set a=3 where a=2;
+show status like 'handler_read%';
+Variable_name	Value
+Handler_read_first	0
+Handler_read_key	1
+Handler_read_next	1
+Handler_read_prev	0
+Handler_read_rnd	1
+Handler_read_rnd_next	0
+drop table t1, t2;

--- 1.26/mysql-test/t/update.test	2005-12-01 23:20:10 +03:00
+++ 1.27/mysql-test/t/update.test	2006-01-25 23:25:19 +03:00
@@ -287,4 +287,16 @@
 update t2,t1 set f1=3,f2=3 where f1=f2 and f1=1;
 --disable_info
 drop table t1,t2;
+
+
+# BUG#15935
+create table t1 (a int);
+insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+create table t2 (a int, filler1 char(200), filler2 char(200), key(a));
+insert into t2 select A.a + 10*B.a, 'filler','filler' from t1 A, t1 B;
+flush status;
+update t2 set a=3 where a=2;
+show status like 'handler_read%';
+drop table t1, t2;
+
 # End of 4.1 tests
Thread
bk commit into 4.1 tree (sergefp:1.2455) BUG#15935Sergey Petrunia25 Jan