List:Commits« Previous MessageNext Message »
From:Tor Didriksen Date:October 4 2010 1:31pm
Subject:bzr push into mysql-next-mr-bugfixing branch (tor.didriksen:3313 to 3314)
View as plain text  
 3314 Tor Didriksen	2010-10-04 [merge]
      Automerge from next-mr-opt-team

    modified:
      mysql-test/r/join_cache_jcl2.result
      mysql-test/r/join_cache_jcl3.result
      mysql-test/r/join_cache_jcl4.result
      mysql-test/r/order_by_icp_mrr.result
      mysql-test/r/select_all_jcl6.result
      mysql-test/r/select_icp_mrr.result
      mysql-test/r/select_icp_mrr_jcl6.result
      mysql-test/r/select_none_jcl6.result
      mysql-test/r/subquery_all_jcl6.result
      mysql-test/r/subquery_nomat_nosj.result
      mysql-test/r/subquery_nomat_nosj_jcl6.result
      mysql-test/r/subquery_none_jcl6.result
      sql/sql_select.cc
      sql/sql_select.h
 3313 Tor Didriksen	2010-10-04
      WL #4033 Support for informational log events
      
      Post-push fix. 
      In CTOR, initialize fields in declaration order,
      to avoid compiler warnings.

    modified:
      sql/sql_insert.cc
=== modified file 'mysql-test/r/join_cache_jcl2.result'
--- a/mysql-test/r/join_cache_jcl2.result	2010-08-11 13:28:19 +0000
+++ b/mysql-test/r/join_cache_jcl2.result	2010-09-30 14:57:06 +0000
@@ -2219,7 +2219,7 @@ GROUP BY t1.col_int_key
 ORDER BY t1.col_int_key, t1.col_datetime
 LIMIT 2;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	index	NULL	col_int_key	5	NULL	2	Using temporary; Using filesort
+1	SIMPLE	t1	index	NULL	col_int_key	5	NULL	3	Using temporary; Using filesort
 1	SIMPLE	t2	ref	col_int_key	col_int_key	5	const	1	Using where
 SELECT t1.col_int_key, t1.col_datetime 
 FROM t1,t2

=== modified file 'mysql-test/r/join_cache_jcl3.result'
--- a/mysql-test/r/join_cache_jcl3.result	2010-08-11 13:28:19 +0000
+++ b/mysql-test/r/join_cache_jcl3.result	2010-09-30 14:57:06 +0000
@@ -2219,7 +2219,7 @@ GROUP BY t1.col_int_key
 ORDER BY t1.col_int_key, t1.col_datetime
 LIMIT 2;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	index	NULL	col_int_key	5	NULL	2	Using temporary; Using filesort
+1	SIMPLE	t1	index	NULL	col_int_key	5	NULL	3	Using temporary; Using filesort
 1	SIMPLE	t2	ref	col_int_key	col_int_key	5	const	1	Using where
 SELECT t1.col_int_key, t1.col_datetime 
 FROM t1,t2

=== modified file 'mysql-test/r/join_cache_jcl4.result'
--- a/mysql-test/r/join_cache_jcl4.result	2010-08-11 13:28:19 +0000
+++ b/mysql-test/r/join_cache_jcl4.result	2010-09-30 14:57:06 +0000
@@ -2219,7 +2219,7 @@ GROUP BY t1.col_int_key
 ORDER BY t1.col_int_key, t1.col_datetime
 LIMIT 2;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	index	NULL	col_int_key	5	NULL	2	Using temporary; Using filesort
+1	SIMPLE	t1	index	NULL	col_int_key	5	NULL	3	Using temporary; Using filesort
 1	SIMPLE	t2	ref	col_int_key	col_int_key	5	const	1	Using where
 SELECT t1.col_int_key, t1.col_datetime 
 FROM t1,t2

=== modified file 'mysql-test/r/order_by_icp_mrr.result'
--- a/mysql-test/r/order_by_icp_mrr.result	2010-07-04 15:07:55 +0000
+++ b/mysql-test/r/order_by_icp_mrr.result	2010-09-30 14:57:06 +0000
@@ -1618,6 +1618,27 @@ id	select_type	table	type	possible_keys	
 1	SIMPLE	t1	range	a	a	5	NULL	2	Using index condition; Using MRR; Using temporary; Using filesort
 1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	10	Using join buffer (BNL, regular buffers)
 DROP TABLE t1, t2;
+#
+# Bug #50394: Regression in EXPLAIN with index scan, LIMIT, GROUP BY and
+# ORDER BY computed col
+#
+CREATE TABLE t1 ( a INT NOT NULL, b INT NOT NULL, KEY( a, b ) );
+INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5);
+INSERT INTO t1 SELECT a + 5, b + 5 FROM t1;
+CREATE TABLE t2( a INT PRIMARY KEY, b INT );
+INSERT INTO t2 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5);
+INSERT INTO t2 SELECT a + 5, b + 5 FROM t2;
+EXPLAIN
+SELECT count(*) AS c, t1.a
+FROM t1 JOIN t2 ON t1.b = t2.a
+WHERE t2.b = 1
+GROUP BY t1.a
+ORDER by c
+LIMIT 2;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	index	NULL	a	8	NULL	10	Using index; Using temporary; Using filesort
+1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	4	test.t1.b	1	Using where
+DROP TABLE t1, t2;
 End of 5.1 tests
 #
 # Bug #38745: MySQL 5.1 optimizer uses filesort for ORDER BY

=== modified file 'mysql-test/r/select_all_jcl6.result'
--- a/mysql-test/r/select_all_jcl6.result	2010-09-09 18:21:34 +0000
+++ b/mysql-test/r/select_all_jcl6.result	2010-09-30 15:01:59 +0000
@@ -4435,11 +4435,6 @@ SELECT 1 FROM t1 WHERE a <> 1 AND NOT
 ROW(1,a) <=> ROW(1,(SELECT 1 FROM t1))
 INTO @var0;
 ERROR 21000: Subquery returns more than 1 row
-SELECT 1 FROM t1 WHERE a <> 1 AND NOT
-ROW(a,a) <=> ROW((SELECT 1 FROM t1 WHERE 1=2),(SELECT 1 FROM t1));
-1
-1
-1
 DROP TABLE t1;
 #
 # Bug #48458: simple query tries to allocate enormous amount of

=== modified file 'mysql-test/r/select_icp_mrr.result'
--- a/mysql-test/r/select_icp_mrr.result	2010-09-09 18:21:34 +0000
+++ b/mysql-test/r/select_icp_mrr.result	2010-09-30 15:01:59 +0000
@@ -4431,11 +4431,6 @@ SELECT 1 FROM t1 WHERE a <> 1 AND NOT
 ROW(1,a) <=> ROW(1,(SELECT 1 FROM t1))
 INTO @var0;
 ERROR 21000: Subquery returns more than 1 row
-SELECT 1 FROM t1 WHERE a <> 1 AND NOT
-ROW(a,a) <=> ROW((SELECT 1 FROM t1 WHERE 1=2),(SELECT 1 FROM t1));
-1
-1
-1
 DROP TABLE t1;
 #
 # Bug #48458: simple query tries to allocate enormous amount of

=== modified file 'mysql-test/r/select_icp_mrr_jcl6.result'
--- a/mysql-test/r/select_icp_mrr_jcl6.result	2010-09-09 18:21:34 +0000
+++ b/mysql-test/r/select_icp_mrr_jcl6.result	2010-09-30 15:01:59 +0000
@@ -4435,11 +4435,6 @@ SELECT 1 FROM t1 WHERE a <> 1 AND NOT
 ROW(1,a) <=> ROW(1,(SELECT 1 FROM t1))
 INTO @var0;
 ERROR 21000: Subquery returns more than 1 row
-SELECT 1 FROM t1 WHERE a <> 1 AND NOT
-ROW(a,a) <=> ROW((SELECT 1 FROM t1 WHERE 1=2),(SELECT 1 FROM t1));
-1
-1
-1
 DROP TABLE t1;
 #
 # Bug #48458: simple query tries to allocate enormous amount of

=== modified file 'mysql-test/r/select_none_jcl6.result'
--- a/mysql-test/r/select_none_jcl6.result	2010-09-09 18:21:34 +0000
+++ b/mysql-test/r/select_none_jcl6.result	2010-09-30 15:01:59 +0000
@@ -4434,11 +4434,6 @@ SELECT 1 FROM t1 WHERE a <> 1 AND NOT
 ROW(1,a) <=> ROW(1,(SELECT 1 FROM t1))
 INTO @var0;
 ERROR 21000: Subquery returns more than 1 row
-SELECT 1 FROM t1 WHERE a <> 1 AND NOT
-ROW(a,a) <=> ROW((SELECT 1 FROM t1 WHERE 1=2),(SELECT 1 FROM t1));
-1
-1
-1
 DROP TABLE t1;
 #
 # Bug #48458: simple query tries to allocate enormous amount of

=== modified file 'mysql-test/r/subquery_all_jcl6.result'
--- a/mysql-test/r/subquery_all_jcl6.result	2010-09-01 13:46:08 +0000
+++ b/mysql-test/r/subquery_all_jcl6.result	2010-09-30 15:08:22 +0000
@@ -927,7 +927,7 @@ select a, (select a,b,c from t1 where t1
 a	(select a,b,c from t1 where t1.a=t2.a) = ROW(a,2,'a')	(select c from t1 where a=t2.a)
 1	1	a
 2	0	b
-NULL	0	NULL
+NULL	NULL	NULL
 select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,3,'b'),(select c from t1 where a=t2.a) from t2;
 a	(select a,b,c from t1 where t1.a=t2.a) = ROW(a,3,'b')	(select c from t1 where a=t2.a)
 1	0	a
@@ -937,7 +937,7 @@ select a, (select a,b,c from t1 where t1
 a	(select a,b,c from t1 where t1.a=t2.a) = ROW(a,4,'c')	(select c from t1 where a=t2.a)
 1	0	a
 2	0	b
-NULL	0	NULL
+NULL	NULL	NULL
 drop table t1,t2;
 create table t1 (a int, b real, c varchar(10));
 insert into t1 values (1, 1, 'a'), (2,2,'b'), (NULL, 2, 'b');

=== modified file 'mysql-test/r/subquery_nomat_nosj.result'
--- a/mysql-test/r/subquery_nomat_nosj.result	2010-09-01 13:46:08 +0000
+++ b/mysql-test/r/subquery_nomat_nosj.result	2010-09-30 15:08:22 +0000
@@ -923,7 +923,7 @@ select a, (select a,b,c from t1 where t1
 a	(select a,b,c from t1 where t1.a=t2.a) = ROW(a,2,'a')	(select c from t1 where a=t2.a)
 1	1	a
 2	0	b
-NULL	0	NULL
+NULL	NULL	NULL
 select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,3,'b'),(select c from t1 where a=t2.a) from t2;
 a	(select a,b,c from t1 where t1.a=t2.a) = ROW(a,3,'b')	(select c from t1 where a=t2.a)
 1	0	a
@@ -933,7 +933,7 @@ select a, (select a,b,c from t1 where t1
 a	(select a,b,c from t1 where t1.a=t2.a) = ROW(a,4,'c')	(select c from t1 where a=t2.a)
 1	0	a
 2	0	b
-NULL	0	NULL
+NULL	NULL	NULL
 drop table t1,t2;
 create table t1 (a int, b real, c varchar(10));
 insert into t1 values (1, 1, 'a'), (2,2,'b'), (NULL, 2, 'b');

=== modified file 'mysql-test/r/subquery_nomat_nosj_jcl6.result'
--- a/mysql-test/r/subquery_nomat_nosj_jcl6.result	2010-09-01 13:46:08 +0000
+++ b/mysql-test/r/subquery_nomat_nosj_jcl6.result	2010-09-30 15:08:22 +0000
@@ -927,7 +927,7 @@ select a, (select a,b,c from t1 where t1
 a	(select a,b,c from t1 where t1.a=t2.a) = ROW(a,2,'a')	(select c from t1 where a=t2.a)
 1	1	a
 2	0	b
-NULL	0	NULL
+NULL	NULL	NULL
 select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,3,'b'),(select c from t1 where a=t2.a) from t2;
 a	(select a,b,c from t1 where t1.a=t2.a) = ROW(a,3,'b')	(select c from t1 where a=t2.a)
 1	0	a
@@ -937,7 +937,7 @@ select a, (select a,b,c from t1 where t1
 a	(select a,b,c from t1 where t1.a=t2.a) = ROW(a,4,'c')	(select c from t1 where a=t2.a)
 1	0	a
 2	0	b
-NULL	0	NULL
+NULL	NULL	NULL
 drop table t1,t2;
 create table t1 (a int, b real, c varchar(10));
 insert into t1 values (1, 1, 'a'), (2,2,'b'), (NULL, 2, 'b');

=== modified file 'mysql-test/r/subquery_none_jcl6.result'
--- a/mysql-test/r/subquery_none_jcl6.result	2010-09-01 13:46:08 +0000
+++ b/mysql-test/r/subquery_none_jcl6.result	2010-09-30 15:08:22 +0000
@@ -926,7 +926,7 @@ select a, (select a,b,c from t1 where t1
 a	(select a,b,c from t1 where t1.a=t2.a) = ROW(a,2,'a')	(select c from t1 where a=t2.a)
 1	1	a
 2	0	b
-NULL	0	NULL
+NULL	NULL	NULL
 select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,3,'b'),(select c from t1 where a=t2.a) from t2;
 a	(select a,b,c from t1 where t1.a=t2.a) = ROW(a,3,'b')	(select c from t1 where a=t2.a)
 1	0	a
@@ -936,7 +936,7 @@ select a, (select a,b,c from t1 where t1
 a	(select a,b,c from t1 where t1.a=t2.a) = ROW(a,4,'c')	(select c from t1 where a=t2.a)
 1	0	a
 2	0	b
-NULL	0	NULL
+NULL	NULL	NULL
 drop table t1,t2;
 create table t1 (a int, b real, c varchar(10));
 insert into t1 values (1, 1, 'a'), (2,2,'b'), (NULL, 2, 'b');

=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc	2010-09-29 14:28:09 +0000
+++ b/sql/sql_select.cc	2010-09-30 14:53:11 +0000
@@ -5846,7 +5846,6 @@ add_key_part(DYNAMIC_ARRAY *keyuse_array
 {
   Field *field=key_field->field;
   TABLE *form= field->table;
-  KEYUSE keyuse;
 
   if (key_field->eq_func && !(key_field->optimize & KEY_OPTIMIZE_EXISTS))
   {
@@ -5862,20 +5861,21 @@ add_key_part(DYNAMIC_ARRAY *keyuse_array
       {
 	if (field->eq(form->key_info[key].key_part[part].field))
 	{
-	  keyuse.table= field->table;
-	  keyuse.val =  key_field->val;
-	  keyuse.key =  key;
-	  keyuse.keypart=part;
-	  keyuse.keypart_map= (key_part_map) 1 << part;
-	  keyuse.used_tables=key_field->val->used_tables();
-	  keyuse.optimize= key_field->optimize & KEY_OPTIMIZE_REF_OR_NULL;
-          keyuse.null_rejecting= key_field->null_rejecting;
-          keyuse.cond_guard= key_field->cond_guard;
-          keyuse.sj_pred_no= key_field->sj_pred_no;
-	  if (insert_dynamic(keyuse_array,(uchar*) &keyuse))
-            return TRUE;
+          KEYUSE keyuse;
+          keyuse.table=          field->table;
+          keyuse.val=            key_field->val;
+          keyuse.used_tables=    key_field->val->used_tables();
+          keyuse.key=            key;
+          keyuse.keypart=        part;
+          keyuse.optimize=       key_field->optimize & KEY_OPTIMIZE_REF_OR_NULL;
+          keyuse.keypart_map=    (key_part_map) 1 << part;
           /* This will be set accordingly in optimize_keyuse */
           keyuse.ref_table_rows= ~(ha_rows) 0;
+          keyuse.null_rejecting= key_field->null_rejecting;
+          keyuse.cond_guard=     key_field->cond_guard;
+          keyuse.sj_pred_no=     key_field->sj_pred_no;
+          if (insert_dynamic(keyuse_array, (uchar*) &keyuse))
+            return TRUE;
 	}
       }
     }
@@ -10689,7 +10689,7 @@ bool setup_sj_materialization(JOIN_TAB *
       temptable.
     */
     TABLE_REF *tab_ref;
-    if (!(tab_ref= (TABLE_REF*) thd->alloc(sizeof(TABLE_REF))))
+    if (!(tab_ref= new (thd->mem_root) TABLE_REF))
       DBUG_RETURN(TRUE); /* purecov: inspected */
     tab_ref->key= 0; /* The only temp table index. */
     tab_ref->key_length= tmp_key->key_length;
@@ -10702,10 +10702,8 @@ bool setup_sj_materialization(JOIN_TAB *
           (Item**) thd->alloc(sizeof(Item*) * tmp_key_parts)))
       DBUG_RETURN(TRUE); /* purecov: inspected */
 
-    tab_ref->key_buff2=tab_ref->key_buff+ALIGN_SIZE(tmp_key->key_length);
-    tab_ref->key_err=1;
+    tab_ref->key_buff2= tab_ref->key_buff+ALIGN_SIZE(tmp_key->key_length);
     tab_ref->null_rejecting= 1;
-    tab_ref->disable_cache= FALSE;
 
     KEY_PART_INFO *cur_key_part= tmp_key->key_part;
     store_key **ref_key= tab_ref->key_copy;
@@ -10896,7 +10894,7 @@ make_join_readinfo(JOIN *join, ulonglong
     {
       if (!(tab->loosescan_buf= (uchar*)join->thd->alloc(tab->
                                                          loosescan_key_len)))
-        return TRUE; /* purecov: inspected */
+        DBUG_RETURN(TRUE); /* purecov: inspected */
     }
     if (sj_is_materialize_strategy(join->best_positions[i].sj_strategy))
     {
@@ -10909,7 +10907,7 @@ make_join_readinfo(JOIN *join, ulonglong
        tab[-1].next_select= sub_select_sjm;
 
       if (setup_sj_materialization(tab))
-        return TRUE;
+        DBUG_RETURN(TRUE);
     }
     switch (tab->type) {
     case JT_EQ_REF:

=== modified file 'sql/sql_select.h'
--- a/sql/sql_select.h	2010-09-22 11:37:38 +0000
+++ b/sql/sql_select.h	2010-09-23 12:16:36 +0000
@@ -72,7 +72,7 @@ typedef struct keyuse_t {
 
 class store_key;
 
-typedef struct st_table_ref
+typedef struct st_table_ref : public Sql_alloc
 {
   bool		key_err;
   /** True if something was read into buffer in join_read_key.  */
@@ -116,6 +116,25 @@ typedef struct st_table_ref
   */
   bool          disable_cache;
 
+  st_table_ref()
+    : key_err(TRUE),
+      has_record(FALSE),
+      key_parts(0),
+      key_length(0),
+      key(-1),
+      key_buff(NULL),
+      key_buff2(NULL),
+      key_copy(NULL),
+      items(NULL),
+      cond_guards(NULL),
+      null_rejecting(0),
+      depend_map(0),
+      null_ref_key(NULL),
+      use_count(0),
+      disable_cache(FALSE)
+  {
+  }
+
   /**
     @returns whether the reference contains NULL values which could never give
     a match.


Attachment: [text/bzr-bundle] bzr/tor.didriksen@oracle.com-20101004133104-edejt8htrg41zwl7.bundle
Thread
bzr push into mysql-next-mr-bugfixing branch (tor.didriksen:3313 to 3314) Tor Didriksen4 Oct