List:Commits« Previous MessageNext Message »
From:Sergey Petrunia Date:August 15 2006 3:16pm
Subject:bk commit into 4.1 tree (sergefp:1.2536) BUG#21077
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@stripped, 2006-08-15 17:16:44+04:00, sergefp@stripped +3 -0
  BUG#21077: Possible crash caused by invalid sequence of handler::* calls: 
  The crash was caused by invalid sequence of handler::** calls: 
    ha_smth->index_init();
    ha_smth->index_next_same(); (2)
  (2) is an invalid call as it was not preceeded by any 'scan setup' call
  like index_first() or index_read(). The cause was that QUICK_SELECT::reset()
  didn't "fully reset" the quick select- current QUICK_RANGE wasn't forgotten,
  and quick select might attempt to continue reading the range, which would 
  result in the above mentioned invalid sequence of handler calls.
  
  5.x versions are not affected by the bug - they already have the missing
  "range=NULL" clause.

  mysql-test/r/innodb_mysql.result@stripped, 2006-08-15 17:16:42+04:00, sergefp@stripped +21
-0
    Testcase for BUG#21077

  mysql-test/t/innodb_mysql.test@stripped, 2006-08-15 17:16:42+04:00, sergefp@stripped +27 -0
    Testcase for BUG#21077

  sql/opt_range.h@stripped, 2006-08-15 17:16:42+04:00, sergefp@stripped +1 -1
    BUG#21077: Possible crash caused by invalid sequence of handler::* calls: 
     - Make QUICK_SELECT::reset() really reset the quick select 

# 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:	pylon.mylan
# Root:	/home/psergey/mysql-4.1-bug21077

--- 1.40/sql/opt_range.h	2006-08-15 17:16:46 +04:00
+++ 1.41/sql/opt_range.h	2006-08-15 17:16:46 +04:00
@@ -86,7 +86,7 @@
 
   QUICK_SELECT(THD *thd, TABLE *table,uint index_arg,bool no_alloc=0);
   virtual ~QUICK_SELECT();
-  void reset(void) { next=0; it.rewind(); }
+  void reset(void) { next=0; it.rewind(); range= NULL;}
   int init()
   {
     key_part_info= head->key_info[index].key_part;

--- 1.4/mysql-test/r/innodb_mysql.result	2006-08-15 17:16:46 +04:00
+++ 1.5/mysql-test/r/innodb_mysql.result	2006-08-15 17:16:46 +04:00
@@ -83,3 +83,24 @@
 3	3
 3	3
 DROP TABLE t1, t2, t3;
+CREATE TABLE `t1` (`id1` INT) ;
+INSERT INTO `t1` (`id1`) VALUES (1),(5),(2);
+CREATE TABLE `t2` (
+`id1` INT,
+`id2` INT NOT NULL,
+`id3` INT,
+`id4` INT NOT NULL,
+UNIQUE (`id2`,`id4`),
+KEY (`id1`)
+) ENGINE=InnoDB;
+INSERT INTO `t2`(`id1`,`id2`,`id3`,`id4`) VALUES 
+(1,1,1,0),
+(1,1,2,1),
+(5,1,2,2),
+(6,1,2,3),
+(1,2,2,2),
+(1,2,1,1);
+SELECT `id1` FROM `t1` WHERE `id1` NOT IN (SELECT `id1` FROM `t2` WHERE `id2` = 1 AND
`id3` = 2);
+id1
+2
+DROP TABLE t1, t2;

--- 1.4/mysql-test/t/innodb_mysql.test	2006-08-15 17:16:46 +04:00
+++ 1.5/mysql-test/t/innodb_mysql.test	2006-08-15 17:16:46 +04:00
@@ -90,3 +90,30 @@
   t3.a = t2.a AND t2.b = t1.a AND t3.b = 1 AND t3.c IN (1, 2) 
   ORDER BY t1.b LIMIT 5;
 DROP TABLE t1, t2, t3;
+
+
+# BUG#21077 (The testcase is not deterministic so correct execution doesn't
+# prove anything) For proof one should track if sequence of ha_innodb::* func
+# calls is correct.
+CREATE TABLE `t1` (`id1` INT) ;
+INSERT INTO `t1` (`id1`) VALUES (1),(5),(2);
+
+CREATE TABLE `t2` (
+  `id1` INT,
+  `id2` INT NOT NULL,
+  `id3` INT,
+  `id4` INT NOT NULL,
+  UNIQUE (`id2`,`id4`),
+  KEY (`id1`)
+) ENGINE=InnoDB;
+
+INSERT INTO `t2`(`id1`,`id2`,`id3`,`id4`) VALUES 
+(1,1,1,0),
+(1,1,2,1),
+(5,1,2,2),
+(6,1,2,3),
+(1,2,2,2),
+(1,2,1,1);
+
+SELECT `id1` FROM `t1` WHERE `id1` NOT IN (SELECT `id1` FROM `t2` WHERE `id2` = 1 AND
`id3` = 2);
+DROP TABLE t1, t2;
Thread
bk commit into 4.1 tree (sergefp:1.2536) BUG#21077Sergey Petrunia15 Aug