[Commits] Rev 2819: Merge in file:///home/igor/maria/maria-5.3-mwl128/

igor at askmonty.org igor at askmonty.org
Thu Sep 23 01:04:38 EEST 2010


At file:///home/igor/maria/maria-5.3-mwl128/

------------------------------------------------------------
revno: 2819 [merge]
revision-id: igor at askmonty.org-20100922220434-iul7kkymnx9qyfxo
parent: igor at askmonty.org-20100903001603-t6l2k9cjei985zs6
parent: igor at askmonty.org-20100921234153-cvokxpi8wqq5m1dn
committer: Igor Babaev <igor at askmonty.org>
branch nick: maria-5.3-mwl128
timestamp: Wed 2010-09-22 15:04:34 -0700
message:
  Merge
modified:
  mysql-test/r/join_cache.result* join_cache.result-20091221012827-jfu65h0x5bmixhh3-1
  mysql-test/t/join_cache.test   join_cache.test-20091221012705-n3szmbc9blgmmu84-1
  sql/sql_join_cache.cc          sql_join_cache.cc-20091221012625-ipp8zu28iijhjmq2-1
-------------- next part --------------
=== modified file 'mysql-test/r/join_cache.result' (properties changed: +x to -x)
--- a/mysql-test/r/join_cache.result	2010-08-31 16:34:21 +0000
+++ b/mysql-test/r/join_cache.result	2010-09-21 23:41:53 +0000
@@ -5174,3 +5174,31 @@
 set join_cache_level=default;
 drop table t1,t2,t3;
 set @@optimizer_switch=@save_optimizer_switch;
+#
+# Bug #52394:  using join buffer for 3 table join with ref access 
+# LP #623209: and no references to the columns of the middle table
+#
+set join_cache_level=6;
+CREATE TABLE t1 (a int(11), b varchar(1));
+INSERT INTO t1 VALUES (6,'r'),(27,'o');
+CREATE TABLE t2(a int);
+INSERT INTO t2 VALUES(1),(2),(3),(4),(5);
+CREATE TABLE t3 (a int(11) primary key, b varchar(1));
+INSERT INTO t3 VALUES
+(14,'d'),(15,'z'),(16,'e'),(17,'h'),(18,'b'),(19,'s'),(20,'e'),
+(21,'j'),(22,'e'),(23,'f'),(24,'v'),(25,'x'),(26,'m'),(27,'o');
+EXPLAIN
+SELECT t3.a FROM t1,t2,t3 WHERE t1.a = t3.a AND t1.b = t3.b;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	2	
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	5	Using join buffer
+1	SIMPLE	t3	eq_ref	PRIMARY	PRIMARY	4	test.t1.a	1	Using where; Using join buffer
+SELECT t3.a FROM t1,t2,t3 WHERE t1.a = t3.a AND t1.b = t3.b;
+a
+27
+27
+27
+27
+27
+DROP TABLE t1,t2,t3;
+set join_cache_level=default;

=== modified file 'mysql-test/t/join_cache.test'
--- a/mysql-test/t/join_cache.test	2010-08-31 16:34:21 +0000
+++ b/mysql-test/t/join_cache.test	2010-09-21 23:41:53 +0000
@@ -1956,3 +1956,31 @@
 drop table t1,t2,t3;
 
 set @@optimizer_switch=@save_optimizer_switch;
+
+--echo #
+--echo # Bug #52394:  using join buffer for 3 table join with ref access 
+--echo # LP #623209: and no references to the columns of the middle table
+--echo #
+
+
+set join_cache_level=6;
+
+CREATE TABLE t1 (a int(11), b varchar(1));
+INSERT INTO t1 VALUES (6,'r'),(27,'o');
+
+CREATE TABLE t2(a int);
+INSERT INTO t2 VALUES(1),(2),(3),(4),(5);
+
+CREATE TABLE t3 (a int(11) primary key, b varchar(1));
+INSERT INTO t3 VALUES
+(14,'d'),(15,'z'),(16,'e'),(17,'h'),(18,'b'),(19,'s'),(20,'e'),
+(21,'j'),(22,'e'),(23,'f'),(24,'v'),(25,'x'),(26,'m'),(27,'o');
+
+EXPLAIN
+SELECT t3.a FROM t1,t2,t3 WHERE t1.a = t3.a AND t1.b = t3.b;
+SELECT t3.a FROM t1,t2,t3 WHERE t1.a = t3.a AND t1.b = t3.b;
+
+DROP TABLE t1,t2,t3;
+
+set join_cache_level=default;
+

=== modified file 'sql/sql_join_cache.cc'
--- a/sql/sql_join_cache.cc	2010-09-03 00:16:03 +0000
+++ b/sql/sql_join_cache.cc	2010-09-21 23:41:53 +0000
@@ -3391,8 +3391,12 @@
   uint rc= join_tab->table->file->multi_range_read_next(ptr) ? -1 : 0;
   if (!rc)
   {
+    /* 
+      If a record in in an incremental cache contains no fields then the
+      association for the last record in cache will be equal to cache->end_pos
+    */ 
     DBUG_ASSERT(cache->buff <= (uchar *) (*ptr) &&
-                (uchar *) (*ptr) < cache->end_pos);
+                (uchar *) (*ptr) <= cache->end_pos);
     update_virtual_fields(join_tab->table);
   }
   return rc;
@@ -3728,12 +3732,12 @@
   uchar *init_pos;
   JOIN_CACHE *cache;
   
-  if (pos > last_rec_pos || !records)
-    return 0;
-
   /* Any record in a BKA cache is prepended with its length */
   DBUG_ASSERT(with_length);
    
+  if ((pos+size_of_rec_len) > last_rec_pos || !records)
+    return 0;
+
   /* Read the length of the record */
   rec_len= get_rec_length(pos);
   pos+= size_of_rec_len; 



More information about the commits mailing list