[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: |
|
||||||||
| Issue Links: |
|
||||||||
| 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 |
| 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 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. |