Bug #117778 AHI hash table memory is invisible to Performance Schema

Submitted: 24 Mar 2025 10:23 Modified: 24 Mar 2025 13:44
Reporter: Alexey Kopytov Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S3 (Non-critical)
Version:8.0, 8.4, 9.2 OS:Any
Assigned to: CPU Architecture:Any

[24 Mar 2025 10:23] Alexey Kopytov
Description:
As reported in bug #112223 AHI allocates memory on server startup, even if it is disabled.

This report is about that memory not being visible to Performannce Schema. For example, on a machine with a 192 GB buffer pool 3 GB is allocated to AHI hash table. But this is what gets reported by Performance Schema:

mysql> select * from sys.memory_global_by_current_bytes limit 3;
+---------------------------------+---------------+---------------+-------------------+------------+------------+----------------+
| event_name                      | current_count | current_alloc | current_avg_alloc | high_count | high_alloc | high_avg_alloc |
+---------------------------------+---------------+---------------+-------------------+------------+------------+----------------+
| memory/innodb/buf_buf_pool      |          1512 | 192.97 GiB    | 130.69 MiB        |       1512 | 192.97 GiB | 130.69 MiB     |
| memory/innodb/log_buffer_memory |             1 | 64.00 MiB     | 64.00 MiB         |          1 | 64.00 MiB  | 64.00 MiB      |
| memory/innodb/ut0link_buf       |             2 | 24.00 MiB     | 12.00 MiB         |          2 | 24.00 MiB  | 12.00 MiB      |
+---------------------------------+---------------+---------------+-------------------+------------+------------+----------------+
3 rows in set (0.00 sec)

The reason is that ib_create() where that allocation happens uses allocation facilities that are not instrumented with Performance Schema:

hash_table_t *ib_create(size_t n, latch_id_t id, size_t n_sync_obj,
                        uint32_t type) {
  hash_table_t *table;

  ut_a(type == MEM_HEAP_FOR_BTR_SEARCH || type == MEM_HEAP_FOR_PAGE_HASH);

  ut_ad(ut_is_2pow(n_sync_obj));
  table = ut::new_<hash_table_t>(n); // <-- not PS-instrumented allocation

How to repeat:
select * from sys.memory_global_by_current_bytes;
[24 Mar 2025 13:44] MySQL Verification Team
Hello Alexey Kopytov,

Thank you for the report and feedback.

regards,
Umesh

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.039 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.