List:Commits« Previous MessageNext Message »
From:Tor Didriksen Date:September 29 2010 2:28pm
Subject:bzr commit into mysql-next-mr-bugfixing branch (tor.didriksen:3307)
View as plain text  
#At file:///export/home/didrik/repo/next-mr-bf-merge-from-opt-team/ based on revid:tor.didriksen@stripped

 3307 Tor Didriksen	2010-09-29 [merge]
      Merge next-mr-opt-team => next-mr-bugfixing

    modified:
      sql/sql_select.cc
      sql/sql_select.h
=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc	2010-09-28 15:17:29 +0000
+++ b/sql/sql_select.cc	2010-09-29 14:28:09 +0000
@@ -1276,12 +1276,13 @@ bool might_do_join_buffering(uint join_c
   /* 
      (1) sj_tab is not a const table
   */
-  return (sj_tab-sj_tab->join->join_tab != sj_tab->join->const_tables && // (1)
+  int sj_tabno= sj_tab - sj_tab->join->join_tab;
+  return (sj_tabno >= (int)sj_tab->join->const_tables && // (1)
           sj_tab->use_quick != QS_DYNAMIC_RANGE && 
-          ((join_cache_level != 0U && sj_tab->type == JT_ALL) ||
-           (join_cache_level > 4U && 
+          ((join_cache_level != 0 && sj_tab->type == JT_ALL) ||
+           (join_cache_level > 4 && 
             (sj_tab->type == JT_REF || 
-             sj_tab->type == JT_EQ_REF || 
+             sj_tab->type == JT_EQ_REF ||
              sj_tab->type == JT_CONST))));
 }
 
@@ -4499,6 +4500,14 @@ make_join_statistics(JOIN *join, TABLE_L
   if (!stat || !stat_ref || !table_vector)
     DBUG_RETURN(1);				// Eom /* purecov: inspected */
 
+  if (!(join->positions=
+        new (join->thd->mem_root) POSITION[table_count+1]))
+    DBUG_RETURN(TRUE);
+
+  if (!(join->best_positions=
+        new (join->thd->mem_root) POSITION[table_count+1]))
+    DBUG_RETURN(TRUE);
+
   join->best_ref=stat_vector;
 
   stat_end=stat+table_count;

=== modified file 'sql/sql_select.h'
--- a/sql/sql_select.h	2010-09-06 17:56:05 +0000
+++ b/sql/sql_select.h	2010-09-22 11:37:38 +0000
@@ -1369,7 +1369,7 @@ enum_nested_loop_state sub_select_sjm(JO
      advance_sj_state() for details.
 */
 
-typedef struct st_position
+typedef struct st_position : public Sql_alloc
 {
   /*
     The "fanout" -  number of output rows that will be produced (after
@@ -1613,7 +1613,7 @@ public:
   */
   ha_rows  fetch_limit;
   /* Finally picked QEP. This is result of join optimization */
-  POSITION best_positions[MAX_TABLES+1];
+  POSITION *best_positions;
 
 /******* Join optimization state members start *******/
   /*
@@ -1623,7 +1623,7 @@ public:
   TABLE_LIST *emb_sjm_nest;
   
   /* Current join optimization state */
-  POSITION positions[MAX_TABLES+1];
+  POSITION *positions;
   
   /*
     Bitmap of nested joins embedding the position at the end of the current 


Attachment: [text/bzr-bundle] bzr/tor.didriksen@oracle.com-20100929142809-2dw2p99ecxiqkjnq.bundle
Thread
bzr commit into mysql-next-mr-bugfixing branch (tor.didriksen:3307) Tor Didriksen29 Sep