List:Commits« Previous MessageNext Message »
From:Guilhem Bichot Date:May 16 2011 2:08pm
Subject:Re: bzr commit into mysql-trunk branch (tor.didriksen:3088) Bug#12552221
View as plain text  
Tor Didriksen a écrit, Le 16.05.2011 15:01:
> On 2011-05-16 14:44, Guilhem Bichot wrote:
>> So, the only usage of Array I found is in sql_select.h:
>>   Array<Item_exists_subselect> sj_subselects;
>> which could be translated to using your new class with "object type" 
>> == "pointer to Item_exists_subselect" ...? 
> 
> indeed:
> 

> @@ -4219,11 +4219,14 @@
>        - prefer correlated subqueries over uncorrelated;
>        - prefer subqueries that have greater number of outer tables;
>    */
> -  sj_subselects.sort(subq_sj_candidate_cmp);
> +  my_qsort(sj_subselects.begin(),
> +           sj_subselects.size(), sj_subselects.element_size(),
> +           reinterpret_cast<qsort_cmp>(subq_sj_candidate_cmp));
> +  // sj_subselects.sort(subq_sj_candidate_cmp);

can delete the line after //

> === modified file 'sql/sql_select.h'
> --- sql/sql_select.h    2011-05-16 11:48:23 +0000
> +++ sql/sql_select.h    2011-05-16 12:57:28 +0000
> @@ -56,6 +56,7 @@
>        sj_pred_no(UINT_MAX)
>    {}
> 
> +
>    Key_use(TABLE *table_arg, Item *val_arg, table_map used_tables_arg,
>            uint key_arg, uint keypart_arg, uint optimize_arg,
>            key_part_map keypart_map_arg, ha_rows ref_table_rows_arg,
> @@ -1888,7 +1889,7 @@
>    bool union_part; ///< this subselect is part of union
>    bool optimized; ///< flag to avoid double optimization in EXPLAIN
> 
> -  Array<Item_exists_subselect> sj_subselects;
> +  Mem_root_array<Item_exists_subselect*, true> sj_subselects;
> 
>    /* Temporary tables used to weed-out semi-join duplicates */
>    List<TABLE> sj_tmp_tables;
> @@ -1913,7 +1914,7 @@
>         select_result *result_arg)
>      : keyuse(thd_arg->mem_root),
>        fields_list(fields_arg),
> -      sj_subselects(thd_arg->mem_root, 4)
> +      sj_subselects(thd_arg->mem_root)

The only thing I wonder is: the old code required a mem_root parameter 
in two calls: constructor, and append(); so it was theoretically 
possible that different mem_roots would be used accross the life of the 
array (there is the "statement preparation" mem_root, the "statement 
execution" mem_root)...
However, the only append() is in JOIN::prepare(), which happens at 
"statement preparation", so I guess the THD's mem_root is then the same 
as during construction (which is when JOIN is allocated).
Using two different mem_roots is also unlikely, as freeing one mem_root 
could make the array half-freed, so I imagine this doesn't happen now.
Ok to push (as separate patch). Please also delete the Array 
declaration, no need to tempt someone to use it again.
Thread
bzr commit into mysql-trunk branch (tor.didriksen:3088) Bug#12552221Tor Didriksen16 May
  • Re: bzr commit into mysql-trunk branch (tor.didriksen:3088) Bug#12552221Guilhem Bichot16 May
    • Re: bzr commit into mysql-trunk branch (tor.didriksen:3088) Bug#12552221Tor Didriksen16 May
      • Re: bzr commit into mysql-trunk branch (tor.didriksen:3088) Bug#12552221Guilhem Bichot16 May
        • Re: bzr commit into mysql-trunk branch (tor.didriksen:3088) Bug#12552221Tor Didriksen16 May
          • Re: bzr commit into mysql-trunk branch (tor.didriksen:3088) Bug#12552221Guilhem Bichot16 May
  • Re: bzr commit into mysql-trunk branch (tor.didriksen:3088) Bug#12552221Davi Arnaut16 May