List:Commits« Previous MessageNext Message »
From:Tor Didriksen Date:September 22 2010 2:14pm
Subject:bzr commit into mysql-next-mr-bugfixing branch (tor.didriksen:3247)
View as plain text  
#At file:///export/home/didrik/repo/next-mr-opt-backporting/ based on revid:jorgen.loland@stripped

 3247 Tor Didriksen	2010-09-22
      Add proper initialization of TABLE_REF objects

    modified:
      sql/sql_select.cc
      sql/sql_select.h
=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc	2010-09-22 06:51:45 +0000
+++ b/sql/sql_select.cc	2010-09-22 14:14:55 +0000
@@ -10672,7 +10672,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;
@@ -10879,7 +10879,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))
     {
@@ -10892,7 +10892,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-06 17:56:05 +0000
+++ b/sql/sql_select.h	2010-09-22 14:14:55 +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(FALSE),
+      has_record(FALSE),
+      key_parts(0),
+      key_length(0),
+      key(0),
+      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-20100922141455-9xycvu1lksw9gsoq.bundle
Thread
bzr commit into mysql-next-mr-bugfixing branch (tor.didriksen:3247) Tor Didriksen22 Sep