[Commits] Rev 3396: Fixed LP bug #923236. in file:///home/igor/maria/maria-5.3-mwl247-bug923236/

Igor Babaev igor at askmonty.org
Mon Jan 30 00:35:31 EET 2012


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

------------------------------------------------------------
revno: 3396
revision-id: igor at askmonty.org-20120129223530-6z8eqgfr756gdylm
parent: igor at askmonty.org-20120125073402-aan4r8l22ulhidig
committer: Igor Babaev <igor at askmonty.org>
branch nick: maria-5.3-mwl247-bug923236
timestamp: Sun 2012-01-29 14:35:30 -0800
message:
  Fixed LP bug #923236.
  When working on MWL#247 I forgot to adjust the function create_hj_key_for_table()
  that created a key definition for hash join keys. The modified function must
  set the values of the fields ext_key_parts, ext_key_flags, ext_key_part_map
  added to the key definition structure in MWL#247.
-------------- next part --------------
=== modified file 'mysql-test/r/innodb_ext_key.result'
--- a/mysql-test/r/innodb_ext_key.result	2012-01-25 07:34:02 +0000
+++ b/mysql-test/r/innodb_ext_key.result	2012-01-29 22:35:30 +0000
@@ -677,5 +677,26 @@
 24
 set optimizer_switch=@save_optimizer_switch;
 DROP TABLE t1,t2;
+#
+# LP Bug #923236: hash join + extended_keys = on 
+#
+CREATE TABLE t1 (a int) ENGINE=MyISAM;
+CREATE TABLE t2 (b int) ENGINE=MyISAM;
+INSERT INTO t1 (a) VALUES (4), (6);
+INSERT INTO t2 (b) VALUES (0), (8);
+set @save_optimizer_switch=@@optimizer_switch;
+SET join_cache_level=3;
+SET optimizer_switch='join_cache_hashed=on';
+SET optimizer_switch='join_cache_bka=on';
+SET optimizer_switch='extended_keys=on';
+EXPLAIN
+SELECT * FROM t1, t2 WHERE b=a;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	2	Using where
+1	SIMPLE	t2	hash_ALL	NULL	#hash#$hj	5	test.t1.a	2	Using where; Using join buffer (flat, BNLH join)
+SELECT * FROM t1, t2 WHERE b=a;
+a	b
+set optimizer_switch=@save_optimizer_switch;
+DROP TABLE t1,t2;
 set optimizer_switch=@save_ext_key_optimizer_switch;
 SET SESSION STORAGE_ENGINE=DEFAULT;

=== modified file 'mysql-test/t/innodb_ext_key.test'
--- a/mysql-test/t/innodb_ext_key.test	2012-01-25 07:34:02 +0000
+++ b/mysql-test/t/innodb_ext_key.test	2012-01-29 22:35:30 +0000
@@ -381,5 +381,31 @@
 
 DROP TABLE t1,t2;
 
+--echo #
+--echo # LP Bug #923236: hash join + extended_keys = on 
+--echo #
+
+CREATE TABLE t1 (a int) ENGINE=MyISAM;
+
+CREATE TABLE t2 (b int) ENGINE=MyISAM;
+
+INSERT INTO t1 (a) VALUES (4), (6);
+INSERT INTO t2 (b) VALUES (0), (8);
+
+set @save_optimizer_switch=@@optimizer_switch;
+
+SET join_cache_level=3;
+SET optimizer_switch='join_cache_hashed=on';
+SET optimizer_switch='join_cache_bka=on';
+SET optimizer_switch='extended_keys=on';
+
+EXPLAIN
+SELECT * FROM t1, t2 WHERE b=a;
+SELECT * FROM t1, t2 WHERE b=a;
+
+set optimizer_switch=@save_optimizer_switch;
+
+DROP TABLE t1,t2;
+
 set optimizer_switch=@save_ext_key_optimizer_switch;
 SET SESSION STORAGE_ENGINE=DEFAULT;

=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc	2012-01-25 05:12:02 +0000
+++ b/sql/sql_select.cc	2012-01-29 22:35:30 +0000
@@ -7320,6 +7320,10 @@
     keyuse++;
   } while (keyuse->table == table && keyuse->is_for_hash_join());
 
+  keyinfo->ext_key_parts= keyinfo->key_parts;
+  keyinfo->ext_key_flags= keyinfo->flags;
+  keyinfo->ext_key_part_map= 0;
+
   join_tab->hj_key= keyinfo;
 
   DBUG_RETURN(FALSE);



More information about the commits mailing list