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

Igor Babaev igor at askmonty.org
Sat Jan 15 09:53:28 EET 2011


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

------------------------------------------------------------
revno: 2878 [merge]
revision-id: igor at askmonty.org-20110115075327-ka4s1tvi10dliyd5
parent: psergey at askmonty.org-20110114100750-lrg1cs0qyfp3ybyq
parent: igor at askmonty.org-20110115065556-d8vk6pzf1iira8kz
committer: Igor Babaev <igor at askmonty.org>
branch nick: maria-5.3
timestamp: Fri 2011-01-14 23:53:27 -0800
message:
  Merge
modified:
  mysql-test/r/select.result     sp1f-select.result-20010103001548-znkoalxem6wchsbxizfosjhpfmhfyxuk
  mysql-test/r/select_jcl6.result select_jcl6.result-20091221012908-0kl039gl68crw8rz-1
  mysql-test/r/select_pkeycache.result select_pkeycache.res-20100216163255-sd54514jjhw0yi81-3
  mysql-test/t/select.test       sp1f-select.test-20010103001548-tbl2ff7qehzh43qnsmf4ejhjqe66f46n
  sql/sql_join_cache.cc          sql_join_cache.cc-20091221012625-ipp8zu28iijhjmq2-1
-------------- next part --------------
=== modified file 'mysql-test/r/select.result'
--- a/mysql-test/r/select.result	2010-11-01 17:43:02 +0000
+++ b/mysql-test/r/select.result	2011-01-15 06:55:56 +0000
@@ -4796,4 +4796,83 @@
 1
 1
 DROP TABLE t1;
+#
+# Bug #702310: usage of 2 join buffers after ref access to an empty table 
+#
+CREATE TABLE t1 (f1 int) ;
+INSERT INTO t1 VALUES (9);
+CREATE TABLE t2 (f1 int);
+INSERT INTO t2 VALUES (3),(7),(18);
+INSERT INTO t2 VALUES (3),(7),(18);
+INSERT INTO t2 VALUES (3),(7),(18);
+INSERT INTO t2 VALUES (3),(7),(18);
+CREATE TABLE t3 (f1 int);
+INSERT INTO t3 VALUES (17);
+CREATE TABLE t4  (f1 int PRIMARY KEY, f2 varchar(1024)) ;
+CREATE TABLE t5 (f1 int) ;
+INSERT INTO t5 VALUES (20),(5);
+CREATE TABLE t6(f1 int);
+INSERT INTO t6 VALUES (9),(7);
+SET SESSION join_buffer_size = 2048;
+EXPLAIN
+SELECT STRAIGHT_JOIN * FROM t2, (t1 LEFT JOIN (t3,t4) ON t1.f1 = t4.f1), t5, t6;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	system	NULL	NULL	NULL	NULL	1	
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	12	
+1	SIMPLE	t3	ALL	NULL	NULL	NULL	NULL	1	Using where
+1	SIMPLE	t4	eq_ref	PRIMARY	PRIMARY	4	const	1	
+1	SIMPLE	t5	ALL	NULL	NULL	NULL	NULL	2	Using join buffer (flat, BNL join)
+1	SIMPLE	t6	ALL	NULL	NULL	NULL	NULL	2	Using join buffer (flat, BNL join)
+SELECT STRAIGHT_JOIN * FROM t2, (t1 LEFT JOIN (t3,t4) ON t1.f1 = t4.f1), t5, t6;
+f1	f1	f1	f1	f2	f1	f1
+3	9	NULL	NULL	NULL	20	9
+7	9	NULL	NULL	NULL	20	9
+3	9	NULL	NULL	NULL	20	7
+7	9	NULL	NULL	NULL	20	7
+3	9	NULL	NULL	NULL	5	9
+7	9	NULL	NULL	NULL	5	9
+3	9	NULL	NULL	NULL	5	7
+7	9	NULL	NULL	NULL	5	7
+18	9	NULL	NULL	NULL	20	9
+3	9	NULL	NULL	NULL	20	9
+18	9	NULL	NULL	NULL	20	7
+3	9	NULL	NULL	NULL	20	7
+18	9	NULL	NULL	NULL	5	9
+3	9	NULL	NULL	NULL	5	9
+18	9	NULL	NULL	NULL	5	7
+3	9	NULL	NULL	NULL	5	7
+7	9	NULL	NULL	NULL	20	9
+18	9	NULL	NULL	NULL	20	9
+7	9	NULL	NULL	NULL	20	7
+18	9	NULL	NULL	NULL	20	7
+7	9	NULL	NULL	NULL	5	9
+18	9	NULL	NULL	NULL	5	9
+7	9	NULL	NULL	NULL	5	7
+18	9	NULL	NULL	NULL	5	7
+3	9	NULL	NULL	NULL	20	9
+7	9	NULL	NULL	NULL	20	9
+3	9	NULL	NULL	NULL	20	7
+7	9	NULL	NULL	NULL	20	7
+3	9	NULL	NULL	NULL	5	9
+7	9	NULL	NULL	NULL	5	9
+3	9	NULL	NULL	NULL	5	7
+7	9	NULL	NULL	NULL	5	7
+18	9	NULL	NULL	NULL	20	9
+3	9	NULL	NULL	NULL	20	9
+18	9	NULL	NULL	NULL	20	7
+3	9	NULL	NULL	NULL	20	7
+18	9	NULL	NULL	NULL	5	9
+3	9	NULL	NULL	NULL	5	9
+18	9	NULL	NULL	NULL	5	7
+3	9	NULL	NULL	NULL	5	7
+7	9	NULL	NULL	NULL	20	9
+18	9	NULL	NULL	NULL	20	9
+7	9	NULL	NULL	NULL	20	7
+18	9	NULL	NULL	NULL	20	7
+7	9	NULL	NULL	NULL	5	9
+18	9	NULL	NULL	NULL	5	9
+7	9	NULL	NULL	NULL	5	7
+18	9	NULL	NULL	NULL	5	7
+SET SESSION join_buffer_size = DEFAULT;
+DROP TABLE t1,t2,t3,t4,t5,t6;
 End of 5.1 tests

=== modified file 'mysql-test/r/select_jcl6.result'
--- a/mysql-test/r/select_jcl6.result	2010-11-01 17:43:02 +0000
+++ b/mysql-test/r/select_jcl6.result	2011-01-15 06:55:56 +0000
@@ -4803,6 +4803,85 @@
 1
 1
 DROP TABLE t1;
+#
+# Bug #702310: usage of 2 join buffers after ref access to an empty table 
+#
+CREATE TABLE t1 (f1 int) ;
+INSERT INTO t1 VALUES (9);
+CREATE TABLE t2 (f1 int);
+INSERT INTO t2 VALUES (3),(7),(18);
+INSERT INTO t2 VALUES (3),(7),(18);
+INSERT INTO t2 VALUES (3),(7),(18);
+INSERT INTO t2 VALUES (3),(7),(18);
+CREATE TABLE t3 (f1 int);
+INSERT INTO t3 VALUES (17);
+CREATE TABLE t4  (f1 int PRIMARY KEY, f2 varchar(1024)) ;
+CREATE TABLE t5 (f1 int) ;
+INSERT INTO t5 VALUES (20),(5);
+CREATE TABLE t6(f1 int);
+INSERT INTO t6 VALUES (9),(7);
+SET SESSION join_buffer_size = 2048;
+EXPLAIN
+SELECT STRAIGHT_JOIN * FROM t2, (t1 LEFT JOIN (t3,t4) ON t1.f1 = t4.f1), t5, t6;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	system	NULL	NULL	NULL	NULL	1	
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	12	
+1	SIMPLE	t3	ALL	NULL	NULL	NULL	NULL	1	Using where; Using join buffer (flat, BNL join)
+1	SIMPLE	t4	eq_ref	PRIMARY	PRIMARY	4	const	1	Using join buffer (incremental, BKA join)
+1	SIMPLE	t5	ALL	NULL	NULL	NULL	NULL	2	Using join buffer (incremental, BNL join)
+1	SIMPLE	t6	ALL	NULL	NULL	NULL	NULL	2	Using join buffer (incremental, BNL join)
+SELECT STRAIGHT_JOIN * FROM t2, (t1 LEFT JOIN (t3,t4) ON t1.f1 = t4.f1), t5, t6;
+f1	f1	f1	f1	f2	f1	f1
+3	9	NULL	NULL	NULL	20	9
+7	9	NULL	NULL	NULL	20	9
+18	9	NULL	NULL	NULL	20	9
+3	9	NULL	NULL	NULL	5	9
+7	9	NULL	NULL	NULL	5	9
+18	9	NULL	NULL	NULL	5	9
+3	9	NULL	NULL	NULL	20	7
+7	9	NULL	NULL	NULL	20	7
+18	9	NULL	NULL	NULL	20	7
+3	9	NULL	NULL	NULL	5	7
+7	9	NULL	NULL	NULL	5	7
+18	9	NULL	NULL	NULL	5	7
+3	9	NULL	NULL	NULL	20	9
+7	9	NULL	NULL	NULL	20	9
+18	9	NULL	NULL	NULL	20	9
+3	9	NULL	NULL	NULL	5	9
+7	9	NULL	NULL	NULL	5	9
+18	9	NULL	NULL	NULL	5	9
+3	9	NULL	NULL	NULL	20	7
+7	9	NULL	NULL	NULL	20	7
+18	9	NULL	NULL	NULL	20	7
+3	9	NULL	NULL	NULL	5	7
+7	9	NULL	NULL	NULL	5	7
+18	9	NULL	NULL	NULL	5	7
+3	9	NULL	NULL	NULL	20	9
+7	9	NULL	NULL	NULL	20	9
+18	9	NULL	NULL	NULL	20	9
+3	9	NULL	NULL	NULL	5	9
+7	9	NULL	NULL	NULL	5	9
+18	9	NULL	NULL	NULL	5	9
+3	9	NULL	NULL	NULL	20	7
+7	9	NULL	NULL	NULL	20	7
+18	9	NULL	NULL	NULL	20	7
+3	9	NULL	NULL	NULL	5	7
+7	9	NULL	NULL	NULL	5	7
+18	9	NULL	NULL	NULL	5	7
+3	9	NULL	NULL	NULL	20	9
+7	9	NULL	NULL	NULL	20	9
+18	9	NULL	NULL	NULL	20	9
+3	9	NULL	NULL	NULL	5	9
+7	9	NULL	NULL	NULL	5	9
+18	9	NULL	NULL	NULL	5	9
+3	9	NULL	NULL	NULL	20	7
+7	9	NULL	NULL	NULL	20	7
+18	9	NULL	NULL	NULL	20	7
+3	9	NULL	NULL	NULL	5	7
+7	9	NULL	NULL	NULL	5	7
+18	9	NULL	NULL	NULL	5	7
+SET SESSION join_buffer_size = DEFAULT;
+DROP TABLE t1,t2,t3,t4,t5,t6;
 End of 5.1 tests
 set join_cache_level=default;
 show variables like 'join_cache_level';

=== modified file 'mysql-test/r/select_pkeycache.result'
--- a/mysql-test/r/select_pkeycache.result	2010-11-01 17:43:02 +0000
+++ b/mysql-test/r/select_pkeycache.result	2011-01-15 06:55:56 +0000
@@ -4796,4 +4796,83 @@
 1
 1
 DROP TABLE t1;
+#
+# Bug #702310: usage of 2 join buffers after ref access to an empty table 
+#
+CREATE TABLE t1 (f1 int) ;
+INSERT INTO t1 VALUES (9);
+CREATE TABLE t2 (f1 int);
+INSERT INTO t2 VALUES (3),(7),(18);
+INSERT INTO t2 VALUES (3),(7),(18);
+INSERT INTO t2 VALUES (3),(7),(18);
+INSERT INTO t2 VALUES (3),(7),(18);
+CREATE TABLE t3 (f1 int);
+INSERT INTO t3 VALUES (17);
+CREATE TABLE t4  (f1 int PRIMARY KEY, f2 varchar(1024)) ;
+CREATE TABLE t5 (f1 int) ;
+INSERT INTO t5 VALUES (20),(5);
+CREATE TABLE t6(f1 int);
+INSERT INTO t6 VALUES (9),(7);
+SET SESSION join_buffer_size = 2048;
+EXPLAIN
+SELECT STRAIGHT_JOIN * FROM t2, (t1 LEFT JOIN (t3,t4) ON t1.f1 = t4.f1), t5, t6;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	system	NULL	NULL	NULL	NULL	1	
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	12	
+1	SIMPLE	t3	ALL	NULL	NULL	NULL	NULL	1	Using where
+1	SIMPLE	t4	eq_ref	PRIMARY	PRIMARY	4	const	1	
+1	SIMPLE	t5	ALL	NULL	NULL	NULL	NULL	2	Using join buffer (flat, BNL join)
+1	SIMPLE	t6	ALL	NULL	NULL	NULL	NULL	2	Using join buffer (flat, BNL join)
+SELECT STRAIGHT_JOIN * FROM t2, (t1 LEFT JOIN (t3,t4) ON t1.f1 = t4.f1), t5, t6;
+f1	f1	f1	f1	f2	f1	f1
+3	9	NULL	NULL	NULL	20	9
+7	9	NULL	NULL	NULL	20	9
+3	9	NULL	NULL	NULL	20	7
+7	9	NULL	NULL	NULL	20	7
+3	9	NULL	NULL	NULL	5	9
+7	9	NULL	NULL	NULL	5	9
+3	9	NULL	NULL	NULL	5	7
+7	9	NULL	NULL	NULL	5	7
+18	9	NULL	NULL	NULL	20	9
+3	9	NULL	NULL	NULL	20	9
+18	9	NULL	NULL	NULL	20	7
+3	9	NULL	NULL	NULL	20	7
+18	9	NULL	NULL	NULL	5	9
+3	9	NULL	NULL	NULL	5	9
+18	9	NULL	NULL	NULL	5	7
+3	9	NULL	NULL	NULL	5	7
+7	9	NULL	NULL	NULL	20	9
+18	9	NULL	NULL	NULL	20	9
+7	9	NULL	NULL	NULL	20	7
+18	9	NULL	NULL	NULL	20	7
+7	9	NULL	NULL	NULL	5	9
+18	9	NULL	NULL	NULL	5	9
+7	9	NULL	NULL	NULL	5	7
+18	9	NULL	NULL	NULL	5	7
+3	9	NULL	NULL	NULL	20	9
+7	9	NULL	NULL	NULL	20	9
+3	9	NULL	NULL	NULL	20	7
+7	9	NULL	NULL	NULL	20	7
+3	9	NULL	NULL	NULL	5	9
+7	9	NULL	NULL	NULL	5	9
+3	9	NULL	NULL	NULL	5	7
+7	9	NULL	NULL	NULL	5	7
+18	9	NULL	NULL	NULL	20	9
+3	9	NULL	NULL	NULL	20	9
+18	9	NULL	NULL	NULL	20	7
+3	9	NULL	NULL	NULL	20	7
+18	9	NULL	NULL	NULL	5	9
+3	9	NULL	NULL	NULL	5	9
+18	9	NULL	NULL	NULL	5	7
+3	9	NULL	NULL	NULL	5	7
+7	9	NULL	NULL	NULL	20	9
+18	9	NULL	NULL	NULL	20	9
+7	9	NULL	NULL	NULL	20	7
+18	9	NULL	NULL	NULL	20	7
+7	9	NULL	NULL	NULL	5	9
+18	9	NULL	NULL	NULL	5	9
+7	9	NULL	NULL	NULL	5	7
+18	9	NULL	NULL	NULL	5	7
+SET SESSION join_buffer_size = DEFAULT;
+DROP TABLE t1,t2,t3,t4,t5,t6;
 End of 5.1 tests

=== modified file 'mysql-test/t/select.test'
--- a/mysql-test/t/select.test	2010-06-24 17:13:08 +0000
+++ b/mysql-test/t/select.test	2011-01-15 06:55:56 +0000
@@ -4087,5 +4087,38 @@
 SELECT 1 FROM t1 ORDER BY a COLLATE latin1_german2_ci;
 DROP TABLE t1;
 
+--echo #
+--echo # Bug #702310: usage of 2 join buffers after ref access to an empty table 
+--echo #
+
+CREATE TABLE t1 (f1 int) ;
+INSERT INTO t1 VALUES (9);
+
+CREATE TABLE t2 (f1 int);
+INSERT INTO t2 VALUES (3),(7),(18);
+INSERT INTO t2 VALUES (3),(7),(18);
+INSERT INTO t2 VALUES (3),(7),(18);
+INSERT INTO t2 VALUES (3),(7),(18);
+
+CREATE TABLE t3 (f1 int);
+INSERT INTO t3 VALUES (17);
+
+CREATE TABLE t4  (f1 int PRIMARY KEY, f2 varchar(1024)) ;
+
+CREATE TABLE t5 (f1 int) ;
+INSERT INTO t5 VALUES (20),(5);
+
+CREATE TABLE t6(f1 int);
+INSERT INTO t6 VALUES (9),(7);
+
+SET SESSION join_buffer_size = 2048;
+
+EXPLAIN
+SELECT STRAIGHT_JOIN * FROM t2, (t1 LEFT JOIN (t3,t4) ON t1.f1 = t4.f1), t5, t6;
+SELECT STRAIGHT_JOIN * FROM t2, (t1 LEFT JOIN (t3,t4) ON t1.f1 = t4.f1), t5, t6;
+
+SET SESSION join_buffer_size = DEFAULT;
+
+DROP TABLE t1,t2,t3,t4,t5,t6;
 
 --echo End of 5.1 tests

=== modified file 'sql/sql_join_cache.cc'
--- a/sql/sql_join_cache.cc	2011-01-14 10:07:50 +0000
+++ b/sql/sql_join_cache.cc	2011-01-15 07:53:27 +0000
@@ -3179,7 +3179,8 @@
 
 int JOIN_TAB_SCAN::open()
 {
-  for (JOIN_TAB *tab= join->join_tab; tab != join_tab ; tab++)
+  JOIN_TAB *bound= join_tab-cache->tables;
+  for (JOIN_TAB *tab= join_tab-1; tab != bound && !tab->cache; tab--)
   {
     tab->status= tab->table->status;
     tab->table->status= 0;
@@ -3254,7 +3255,8 @@
 
 void JOIN_TAB_SCAN::close()
 {
-  for (JOIN_TAB *tab= join->join_tab; tab != join_tab ; tab++)
+  JOIN_TAB *bound= join_tab-cache->tables;
+  for (JOIN_TAB *tab= join_tab-1; tab != bound && !tab->cache; tab--)
     tab->table->status= tab->status;
 }
 
@@ -3655,7 +3657,8 @@
   /* Dynamic range access is never used with BKA */
   DBUG_ASSERT(join_tab->use_quick != 2);
 
-  for (JOIN_TAB *tab =join->join_tab; tab != join_tab ; tab++)
+  JOIN_TAB *bound= join_tab-cache->tables;
+  for (JOIN_TAB *tab= join_tab-1; tab != bound && !tab->cache; tab--)
   {
     tab->status= tab->table->status;
     tab->table->status= 0;



More information about the commits mailing list