← Back to team overview

maria-developers team mailing list archive

Re: [Commits] b718e87caaf: MDEV-11274: Executing EXPLAIN of complex query over join limit causes server to crash

 

Hi Varun,

On Sat, Mar 24, 2018 at 03:31:59AM +0530, Varun wrote:
> revision-id: b718e87caaf2d0a60c19cd042dfc04868f4bb0b4 (mariadb-5.5.56-187-gb718e87caaf)
> parent(s): dfc79ae949f6d831ff65a08a5d32d14b59ba06e6
> author: Varun Gupta
> committer: Varun Gupta
> timestamp: 2018-03-24 03:31:18 +0530
> message:
> 
> MDEV-11274: Executing EXPLAIN of complex query over join limit causes server to crash
> 
> For this case we have a view that is mergeable but we are not able to merge it in the
> parent select because that would exceed the maximum tables allowed in the join list, so we
> materialise this view
> TABLE_LIST::dervied is NULL for such views, it is only set for views which have ALGORITHM=TEMPTABLE
> Fixed by making sure TABLE_LIST::derived is set for views that could not be merged
> 
> ---
>  mysql-test/r/view.result | 197 +++++++++++++++++++++++++++++++++++++++++++++++
>  mysql-test/t/view.test   | 196 ++++++++++++++++++++++++++++++++++++++++++++++
>  sql/table.h              |   2 +
>  3 files changed, 395 insertions(+)
> 
> diff --git a/sql/table.h b/sql/table.h
> index 98f8c7ad73f..7b58f62e659 100644
> --- a/sql/table.h
> +++ b/sql/table.h
> @@ -46,6 +46,7 @@ struct TABLE_LIST;
>  class ACL_internal_schema_access;
>  class ACL_internal_table_access;
>  class Field;
> +struct LEX;
>  
>  /*
>    Used to identify NESTED_JOIN structures within a join (applicable only to

What is the above needed for? Please remove this change.
Ok to push after this is addressed.

> @@ -2125,6 +2126,7 @@ struct TABLE_LIST
>      DBUG_PRINT("enter", ("Alias: '%s'  Unit: %p",
>                          (alias ? alias : "<NULL>"),
>                           get_unit()));
> +    derived= get_unit();
>      derived_type= ((derived_type & (derived ? DTYPE_MASK : DTYPE_VIEW)) |
>                     DTYPE_TABLE | DTYPE_MATERIALIZE);
>      set_check_materialized();

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