diff options
author | Varun Gupta <varun.gupta@mariadb.com> | 2020-07-23 14:17:05 +0530 |
---|---|---|
committer | Varun Gupta <varun.gupta@mariadb.com> | 2020-08-05 11:28:32 +0530 |
commit | 1e31d74833d56609f8711022394c1eb2eb25a19a (patch) | |
tree | cd2cdd29f24f56c758fa4e9640c720387cfed750 /sql/records.h | |
parent | 91caf130b71ac7532b5f1a387b7cf506ea2b09e2 (diff) | |
download | mariadb-git-1e31d74833d56609f8711022394c1eb2eb25a19a.tar.gz |
MDEV-17066: Bytes lost or Assertion `status_var.local_memory_used == 0 after DELETE with subquery with ROLLUP
The issue here is when records are read from the temporary file
(filesort result in this case) via a cache(rr_from_cache).
The cache is initialized with init_rr_cache.
For correlated subquery the cache allocation is happening at each execution
of the subquery but the deallocation happens only once and that was
when the query execution was done.
So generally for subqueries we do two types of cleanup
1) Full cleanup: we should free all resources of the query(like temp tables).
This is done generally when the query execution is complete or the subquery
re-execution is not needed (case with uncorrelated subquery)
2) Partial cleanup: Minor cleanup that is required if
the subquery needs recalculation. This is done for all the structures that
need to be allocated for each execution (example SORT_INFO for filesort
is allocated for each execution of the correlated subquery).
The fix here would be free the cache used by rr_from_cache in the partial
cleanup phase.
Diffstat (limited to 'sql/records.h')
-rw-r--r-- | sql/records.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/sql/records.h b/sql/records.h index b5f04dbd161..dd63d3608bb 100644 --- a/sql/records.h +++ b/sql/records.h @@ -30,6 +30,7 @@ class SORT_INFO; struct READ_RECORD; void end_read_record(READ_RECORD *info); +void free_cache(READ_RECORD *info); /** A context for reading through a single table using a chosen access method: |