← Back to team overview

maria-developers team mailing list archive

Re: [Commits] e60cbbbda31: MDEV-12575: Server crash in AGGR_OP::put_record or in JOIN_CACHE::free or Invalid write in JOIN::make_aggr_tables_info

 

Hi Varun,

On Fri, Nov 09, 2018 at 02:26:04PM +0530, Varun wrote:
> revision-id: e60cbbbda31d7a10e87c16313171b2036a4519c4 (mariadb-10.2.18-52-ge60cbbbda31)
> parent(s): f8268f3cce4577c28ab62e53293556d05a74fb1a
> author: Varun Gupta
> committer: Varun Gupta
> timestamp: 2018-11-01 14:27:24 +0530
> message:
> 
> MDEV-12575: Server crash in AGGR_OP::put_record or in JOIN_CACHE::free or Invalid write in JOIN::make_aggr_tables_info
> 
> During the optimize state of a query, we come know that the result set
> would atmost contain one row, then for such a query we don't need
> to compute GROUP BY, ORDER BY and DISTINCT.
> 
...
> diff --git a/sql/sql_select.cc b/sql/sql_select.cc
> index 1fa80da85a6..a721aed6ce3 100644
> --- a/sql/sql_select.cc
> +++ b/sql/sql_select.cc
> @@ -2245,6 +2245,18 @@ JOIN::optimize_inner()
>    if (!tables_list || !table_count)
>    {
>      choose_tableless_subquery_plan();
> +
> +    /* The output has atmost one row */
> +    if (group_list)
> +    {
> +      group_list= 0;
> +      group_optimized_away= 1;
> +      rollup.state= ROLLUP::STATE_NONE;
> +    }
> +    order=0;
> +    simple_order=1;
> +    select_distinct=0;
> +
Please fix the coding style:
- "x= y" (space after the =)
- use NULL for pointers
- use false for booleans

s/atmost/at most/

Ok to push after the above is addressed.

>      if (select_lex->have_window_funcs())
>      {
>        if (!(join_tab= (JOIN_TAB*) thd->alloc(sizeof(JOIN_TAB))))
> _______________________________________________
> commits mailing list
> commits@xxxxxxxxxxx
> https://lists.askmonty.org/cgi-bin/mailman/listinfo/commits

-- 
BR
 Sergei
-- 
Sergei Petrunia, Software Developer
MariaDB Corporation | Skype: sergefp | Blog: http://s.petrunia.net/blog