mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Bug #45989 take 2 : memory leak after explain encounters an
error in the query. Fixes a leak after materializing a GROUP BY subquery to a temp table when the subquery has a blob column in the SELECT list. Fixed by correctly destructing temporary buffers for re-usable queries
This commit is contained in:
@ -354,7 +354,25 @@ public:
|
||||
*/
|
||||
bool no_const_tables;
|
||||
|
||||
JOIN *tmp_join; ///< copy of this JOIN to be used with temporary tables
|
||||
/**
|
||||
Copy of this JOIN to be used with temporary tables.
|
||||
|
||||
tmp_join is used when the JOIN needs to be "reusable" (e.g. in a subquery
|
||||
that gets re-executed several times) and we know will use temporary tables
|
||||
for materialization. The materialization to a temporary table overwrites the
|
||||
JOIN structure to point to the temporary table after the materialization is
|
||||
done. This is where tmp_join is used : it's a copy of the JOIN before the
|
||||
materialization and is used in restoring before re-execution by overwriting
|
||||
the current JOIN structure with the saved copy.
|
||||
Because of this we should pay extra care of not freeing up helper structures
|
||||
that are referenced by the original contents of the JOIN. We can check for
|
||||
this by making sure the "current" join is not the temporary copy, e.g.
|
||||
!tmp_join || tmp_join != join
|
||||
|
||||
We should free these sub-structures at JOIN::destroy() if the "current" join
|
||||
has a copy is not that copy.
|
||||
*/
|
||||
JOIN *tmp_join;
|
||||
ROLLUP rollup; ///< Used with rollup
|
||||
|
||||
bool select_distinct; ///< Set if SELECT DISTINCT
|
||||
|
Reference in New Issue
Block a user