← Back to team overview

maria-developers team mailing list archive

Re: MDEV-28881 Server crashes in Dep_analysis_context::create_table_value

 

Hi Oleg,

> commit 812f8cbfb3a7a02705f65d8bb7e30ae2faf13b5d
> Author: Oleg Smirnov <olernov@xxxxxxxxx>
> Date:   Tue Jun 21 16:20:17 2022 +0700
>
>     MDEV-28881 Server crashes in Dep_analysis_context::create_table_value
>
>     SELECT_LEX::first_select()->join may be NULL for some scenarios.
>     This commit adds a check for this.

Looking into Jira I can infer that the patch fixes two issues, but the commit
comment doesn't say that. Please avoid doing this in the future.

Please split the commit into two:
- first one fixing the SELECT_LEX::first_select()->join == NULL part
- the second fixing the memory management.

For the second part, I think it's not a good approach when most of the Table
Elimination data resides in a MEM_ROOT with exception of std::set which keeps
its data on the heap.

I was wondering if there's a way to get STL containers to reside on MEM_ROOT
as well, and found that yes there is, and MySQL actually already has it:

https://dev.mysql.com/worklog/task/?id=6074
https://github.com/mysql/mysql-server/blob/8.0/sql/mem_root_allocator.h

Can we copy mem_root_allocator.h from them (in a separate commit) and then
fix memory management here by making std::set use it?

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