Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.1.1, 10.2.0, 10.3.0, 10.4.0
Description
The function btr_defragment_calc_n_recs_for_size() that was added to MariaDB 10.1.1 as part of MDEV-5834 is leaking memory when a table contains enough many columns.
There is a call to rec_get_offsets() that may invoke mem_heap_create(), but there is no call to mem_heap_free(heap).
This should be reproducible with:
SET GLOBAL innodb_defragment = 1; |
OPTIMIZE TABLE table_with_many_columns; |
Simple fix: Add
if (UNIV_LIKELY_NULL(heap)) mem_heap_free(heap); |
Better fix: Remove this kind of use of rec_get_offsets(), and implement a record field iterator that can be used for computing the size of a record. There is no need to compute any offsets except when some algorithm requires random access to the fields of an index record.
Attachments
Issue Links
- is caused by
-
MDEV-5834 Merge Kakao Defragmentation implementation to MariaDB 10.1
- Closed