List:Commits« Previous MessageNext Message »
From:Tor Didriksen Date:September 28 2010 12:35pm
Subject:bzr commit into mysql-next-mr-bugfixing branch (tor.didriksen:3252) Bug#56689
View as plain text  
#At file:///export/home/didrik/repo/next-mr-opt-backporting-bug56689/ based on revid:tor.didriksen@stripped

 3252 Tor Didriksen	2010-09-28
      Bug #56689  Valgrind warning in print_keyuse() with --debug
      
      Initialize all fields in KEUSE struct before copying it into keyuse_array.
     @ sql/sql_select.cc
        Assigning a value to keyuse.ref_table_rows *after* we have copied the struct
        into the array had no effect, as insert_dynamic() copies by value.
        
        Also re-order lines, to match declaration order of member fields in KEYUSE
        (makes it easier to verify that all fields are indeed initialized)

    modified:
      sql/sql_select.cc
=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc	2010-09-23 12:16:36 +0000
+++ b/sql/sql_select.cc	2010-09-28 12:35:50 +0000
@@ -5837,7 +5837,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))
   {
@@ -5853,20 +5852,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;
 	}
       }
     }


Attachment: [text/bzr-bundle] bzr/tor.didriksen@oracle.com-20100928123550-1bhjdy55hkzu11ol.bundle
Thread
bzr commit into mysql-next-mr-bugfixing branch (tor.didriksen:3252) Bug#56689Tor Didriksen28 Sep