List:Commits« Previous MessageNext Message »
From:antony Date:January 5 2007 11:50pm
Subject:bk commit into 5.0 tree (acurtis:1.2358) BUG#24342
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of antony. When antony 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-01-05 14:50:19-08:00, acurtis@stripped +3 -0
  Bug#24342
    "Incorrect results with query over MERGE table"
    mi_rnext_same uses wrong value when checking keys

  myisammrg/myrg_rkey.c@stripped, 2007-01-05 14:50:16-08:00, acurtis@stripped +11 -0
    Bug24342
      save a copy of the key so that mi_rnext_same can work as desired.

  mysql-test/r/merge.result@stripped, 2007-01-05 14:50:17-08:00, acurtis@stripped +41 -0
    test for bug24342

  mysql-test/t/merge.test@stripped, 2007-01-05 14:50:17-08:00, acurtis@stripped +34 -0
    test for bug24342

# 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:	acurtis
# Host:	ltamd64.xiphis.org
# Root:	/home/antony/work2/p2-bug24342.1

--- 1.55/mysql-test/r/merge.result	2007-01-05 14:50:32 -08:00
+++ 1.56/mysql-test/r/merge.result	2007-01-05 14:50:32 -08:00
@@ -800,4 +800,45 @@
 ERROR HY000: Table 't1' is read only
 drop table t2;
 drop table t1;
+DROP TABLE IF EXISTS t1, t2, t3, t4;
+Warnings:
+Note	1051	Unknown table 't1'
+Note	1051	Unknown table 't2'
+Note	1051	Unknown table 't3'
+Note	1051	Unknown table 't4'
+FLUSH TABLES;
+CREATE TABLE t1 ( a VARCHAR(255), b INT, INDEX (a,b) ) ENGINE=MyISAM;
+CREATE TABLE t2 LIKE t1;
+CREATE TABLE t3 LIKE t2;
+CREATE TABLE t4 ( a VARCHAR(255), b INT, INDEX (a,b) ) ENGINE=MERGE
+UNION=(t1,t2,t3);
+INSERT INTO t1 VALUES ('abcd ',1);
+INSERT INTO t1 VALUES ('abcd',1);
+INSERT INTO t2 VALUES ('abcd ',2);
+INSERT INTO t2 VALUES ('abcd',2);
+INSERT INTO t2 SELECT * FROM t2;
+INSERT INTO t3 VALUES ('abcd ',3);
+INSERT INTO t3 VALUES ('abcd',3);
+INSERT INTO t3 SELECT * FROM t3;
+SELECT COUNT(*) x FROM t1 WHERE a = 'abcd' AND b = 1;
+x
+2
+SELECT COUNT(*) x FROM t4 WHERE a = 'abcd' AND b = 1;
+x
+2
+SELECT COUNT(*) x FROM t2 WHERE a = 'abcd' AND b = 2;
+x
+4
+SELECT COUNT(*) x FROM t4 WHERE a = 'abcd' AND b = 2;
+x
+4
+SELECT COUNT(*) x FROM t3 WHERE a = 'abcd' AND b = 3;
+x
+4
+SELECT COUNT(*) x FROM t4 WHERE a = 'abcd' AND b = 3;
+x
+4
+SELECT COUNT(*) FROM t4 WHERE a = 'abcd' AND b > 1;
+COUNT(*)
+8
 End of 5.0 tests

--- 1.45/mysql-test/t/merge.test	2007-01-05 14:50:32 -08:00
+++ 1.46/mysql-test/t/merge.test	2007-01-05 14:50:32 -08:00
@@ -429,4 +429,38 @@
 drop table t2;
 drop table t1;
 
+#
+# Bug#24342 - Incorrect results with query over MERGE table
+#
+DROP TABLE IF EXISTS t1, t2, t3, t4;
+FLUSH TABLES;
+CREATE TABLE t1 ( a VARCHAR(255), b INT, INDEX (a,b) ) ENGINE=MyISAM;
+CREATE TABLE t2 LIKE t1;
+CREATE TABLE t3 LIKE t2;
+CREATE TABLE t4 ( a VARCHAR(255), b INT, INDEX (a,b) ) ENGINE=MERGE
+UNION=(t1,t2,t3);
+INSERT INTO t1 VALUES ('abcd ',1);
+INSERT INTO t1 VALUES ('abcd',1);
+INSERT INTO t2 VALUES ('abcd ',2);
+INSERT INTO t2 VALUES ('abcd',2);
+INSERT INTO t2 SELECT * FROM t2;
+INSERT INTO t3 VALUES ('abcd ',3);
+INSERT INTO t3 VALUES ('abcd',3);
+INSERT INTO t3 SELECT * FROM t3;
+-- 2, correct
+SELECT COUNT(*) x FROM t1 WHERE a = 'abcd' AND b = 1;
+-- 2, correct
+SELECT COUNT(*) x FROM t4 WHERE a = 'abcd' AND b = 1;
+-- 4, correct
+SELECT COUNT(*) x FROM t2 WHERE a = 'abcd' AND b = 2;
+-- 1, incorrect
+SELECT COUNT(*) x FROM t4 WHERE a = 'abcd' AND b = 2;
+-- 4, correct
+SELECT COUNT(*) x FROM t3 WHERE a = 'abcd' AND b = 3;
+-- 1, incorrect
+SELECT COUNT(*) x FROM t4 WHERE a = 'abcd' AND b = 3;
+-- 2, incorrect
+SELECT COUNT(*) FROM t4 WHERE a = 'abcd' AND b > 1;
+
+
 --echo End of 5.0 tests

--- 1.20/myisammrg/myrg_rkey.c	2007-01-05 14:50:32 -08:00
+++ 1.21/myisammrg/myrg_rkey.c	2007-01-05 14:50:32 -08:00
@@ -40,6 +40,7 @@
 {
   byte *key_buff;
   uint pack_key_length;
+  MI_KEYDEF *keyinfo;
   MYRG_TABLE *table;
   MI_INFO *mi;
   int err;
@@ -60,12 +61,22 @@
       /* Get the saved packed key and packed key length. */
       key_buff=(byte*) mi->lastkey+mi->s->base.max_key_length;
       pack_key_length=mi->pack_key_length;
+      keyinfo= mi->s->keyinfo + inx;
     }
     else
     {
       mi->once_flags|= USE_PACKED_KEYS;
       err=mi_rkey(mi,0,inx,key_buff,pack_key_length,search_flag);
     }
+	
+#ifdef HAVE_RTREE_KEYS
+    if (keyinfo->key_alg != HA_KEY_ALG_RTREE)
+#endif
+    {
+      memcpy(mi->lastkey2, key_buff, pack_key_length);
+      mi->update|= HA_STATE_RNEXT_SAME;
+    }
+	
     info->last_used_table=table+1;
 
     if (err)
Thread
bk commit into 5.0 tree (acurtis:1.2358) BUG#24342antony5 Jan