[MDEV-19505] Do not hold mutex while calling que_graph_free() Created: 2019-05-17  Updated: 2021-09-01  Resolved: 2021-08-31

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Fix Version/s: 10.6.5

Type: Task Priority: Major
Reporter: Marko Mäkelä Assignee: Marko Mäkelä
Resolution: Fixed Votes: 0
Labels: performance

Attachments: File MDEV-19505-WIP.patch    
Issue Links:
Relates
relates to MDEV-25919 InnoDB reports misleading lock wait t... Closed

 Description   

Ever since InnoDB table cache eviction was implemented, it became necessary to invoke dict_table_close() to release table handles. Because this call requires the dict_sys->mutex to be held, the mutex currently needs to be held also while invoking que_graph_free(). This feels very inefficient and cumbersome. Could we streamline dict_table_close() further, so that no mutex is needed in this case? Note: dict_table_t::release() already uses atomic memory operations.



 Comments   
Comment by Marko Mäkelä [ 2019-05-17 ]

MDEV-19505-WIP.patch is a starting point, against 10.4 as of this writing. It will crash at InnoDB startup because of a dict_table_close() call.

Comment by Marko Mäkelä [ 2020-07-20 ]

This is about removing technical debt, or improving performance. Because I expect this to be a rather large change, I do not think that it is safe to apply in any GA version.

Comment by Marko Mäkelä [ 2021-08-02 ]

This came up while I was working on MDEV-25919.

This appears to be trivial to implement after all. In sym_tab_free_private() it is not necessary to hold a data dictionary latch; we can simply invoke dict_table_t::release().

There is some special handling in dict_table_close(), for ensuring that InnoDB persistent statistics are deinitialized on FLUSH TABLES (presumably so that a manual update of mysql.innodb_table_stats and mysql.innodb_index_stats would take effect). I do not think that the access to tables by the InnoDB internal SQL parser should interfere with that.

Generated at Thu Feb 08 08:52:13 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.