Bug #100549 | InnoDB allocates too much memory during create index | ||
---|---|---|---|
Submitted: | 17 Aug 2020 18:04 | Modified: | 18 Aug 2020 13:06 |
Reporter: | Mark Callaghan | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: InnoDB storage engine | Severity: | S4 (Feature request) |
Version: | 8.0.18, 8.0.21 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[17 Aug 2020 18:04]
Mark Callaghan
[17 Aug 2020 18:05]
Mark Callaghan
Here is an example of what I see when sort is in progress via the PS. This allocation is the source of my OOM. For this test innodb_page_size=8192 and the results below appear to be ~8KB allocations EVENT_NAME: memory/innodb/memory COUNT_ALLOC: 74418223 COUNT_FREE: 73863301 SUM_NUMBER_OF_BYTES_ALLOC: 130435380648 SUM_NUMBER_OF_BYTES_FREE: 125882388224 LOW_COUNT_USED: 0 CURRENT_COUNT_USED: 554922 HIGH_COUNT_USED: 819040 LOW_NUMBER_OF_BYTES_USED: 0 CURRENT_NUMBER_OF_BYTES_USED: 4552992424 HIGH_NUMBER_OF_BYTES_USED: 6723130240
[17 Aug 2020 19:09]
Sunny Bains
FWIW, the design and code are in need of lots of love. I have a WIP branch which will fix this and other issues. The control flow is just too convoluted for my taste.
[17 Aug 2020 23:05]
Mark Callaghan
I worked on the repro script for a few hours then ran out of time. But code review should be able to confirm that InnoDB does 3 allocations of size innodb_sort_buffer_size and background reading on external sort will confirm that only one large allocation is needed. The merge phase only needs a small buffer per sorted run and a small output buffer. I won't suggest more because I worked on the RDBMS sort at Oracle.
[18 Aug 2020 13:06]
MySQL Verification Team
Hello Mark, Thank you for feedback and reasonable feature request! Observed this with 8.0.21 release build. Thanks, Umesh