[Commits] Rev 2799: Fix buildbot valgrind failure in file:///home/psergey/dev2/maria-5.3-merge/

Sergey Petrunya psergey at askmonty.org
Tue Jul 6 18:16:26 EEST 2010


At file:///home/psergey/dev2/maria-5.3-merge/

------------------------------------------------------------
revno: 2799
revision-id: psergey at askmonty.org-20100706151624-tej4f5xkxl92ptnb
parent: igor at askmonty.org-20100702051319-muclxb5nd2ftirah
committer: Sergey Petrunya <psergey at askmonty.org>
branch nick: maria-5.3-merge
timestamp: Tue 2010-07-06 19:16:24 +0400
message:
  Fix buildbot valgrind failure
  - Item_in_subselect::init_left_expr_cache() should not try to 
    guess whether the left expression is accessed "over the grouping operation"
    (i.e. the subselect is evaluated after the grouping while the left_expr is
     an Item_ref that wraps an expression from before the grouping). Instead, 
    let new_Cached_item not to try accessing item->real_item() when creating 
    left expr cache.
=== modified file 'sql/item.h'
--- a/sql/item.h	2010-06-26 10:05:41 +0000
+++ b/sql/item.h	2010-07-06 15:16:24 +0000
@@ -3414,7 +3414,7 @@
                                     Item_ident *resolved_item);
 
 extern Cached_item *new_Cached_item(THD *thd, Item *item,
-                                    bool use_result_field);
+                                    bool pass_through_ref);
 extern Item_result item_cmp_type(Item_result a,Item_result b);
 extern void resolve_const_item(THD *thd, Item **ref, Item *cmp_item);
 extern int stored_field_cmp_to_item(THD *thd, Field *field, Item *item);

=== modified file 'sql/item_buff.cc'
--- a/sql/item_buff.cc	2010-01-28 13:48:33 +0000
+++ b/sql/item_buff.cc	2010-07-06 15:16:24 +0000
@@ -27,14 +27,13 @@
   Create right type of Cached_item for an item.
 */
 
-Cached_item *new_Cached_item(THD *thd, Item *item, bool use_result_field)
+Cached_item *new_Cached_item(THD *thd, Item *item, bool pass_through_ref)
 {
-  if (item->real_item()->type() == Item::FIELD_ITEM &&
+  if (pass_through_ref && item->real_item()->type() == Item::FIELD_ITEM &&
       !(((Item_field *) (item->real_item()))->field->flags & BLOB_FLAG))
   {
     Item_field *real_item= (Item_field *) item->real_item();
-    Field *cached_field= use_result_field ? real_item->result_field :
-                                            real_item->field;
+    Field *cached_field= real_item->field;
     return new Cached_item_field(cached_field);
   }
   switch (item->result_type()) {

=== modified file 'sql/item_subselect.cc'
--- a/sql/item_subselect.cc	2010-06-26 10:05:41 +0000
+++ b/sql/item_subselect.cc	2010-07-06 15:16:24 +0000
@@ -2192,8 +2192,6 @@
 bool Item_in_subselect::init_left_expr_cache()
 {
   JOIN *outer_join;
-  Next_select_func end_select;
-  bool use_result_field= FALSE;
 
   outer_join= unit->outer_select()->join;
   /*
@@ -2202,18 +2200,6 @@
   */ 
   if (!outer_join || !outer_join->tables || !outer_join->tables_list)
     return TRUE;
-  /*
-    If we use end_[send | write]_group to handle complete rows of the outer
-    query, make the cache of the left IN operand use Item_field::result_field
-    instead of Item_field::field.  We need this because normally
-    Cached_item_field uses Item::field to fetch field data, while
-    copy_ref_key() that copies the left IN operand into a lookup key uses
-    Item::result_field. In the case end_[send | write]_group result_field is
-    one row behind field.
-  */
-  end_select= outer_join->join_tab[outer_join->tables-1].next_select;
-  if (end_select == end_send_group || end_select == end_write_group)
-    use_result_field= TRUE;
 
   if (!(left_expr_cache= new List<Cached_item>))
     return TRUE;
@@ -2222,7 +2208,7 @@
   {
     Cached_item *cur_item_cache= new_Cached_item(thd,
                                                  left_expr->element_index(i),
-                                                 use_result_field);
+                                                 FALSE);
     if (!cur_item_cache || left_expr_cache->push_front(cur_item_cache))
       return TRUE;
   }

=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc	2010-06-26 19:05:09 +0000
+++ b/sql/sql_select.cc	2010-07-06 15:16:24 +0000
@@ -16778,7 +16778,7 @@
   {
     for (; group ; group=group->next)
     {
-      Cached_item *tmp=new_Cached_item(join->thd, *group->item, FALSE);
+      Cached_item *tmp=new_Cached_item(join->thd, *group->item, TRUE);
       if (!tmp || join->group_fields.push_front(tmp))
 	return TRUE;
     }



More information about the commits mailing list