diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2021-09-02 16:32:57 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2021-09-02 16:32:57 +0300 |
commit | 2d0b62c0911639daeda8c1e1b267ef40b7674ee4 (patch) | |
tree | e3dd3797cf679e395994111944ba4cd74ba70077 | |
parent | ee39757f3c91e04a0ccbb5424fba7dd56167ad93 (diff) | |
download | mariadb-git-st-10.6-MDEV-24258.tar.gz |
MDEV-24258 fixup: Throttle purge with exclusive dict_sys.latchst-10.6-MDEV-24258
A performance regression was observed after
commit 82b7c561b7919fa24e3d24b3f04a16046e24374f
because purge tasks would end up waiting more elsewhere,
most notably trx_purge_get_next_rec() and trx_purge_truncate_history().
row_purge_parse_undo_rec(): Prevent the performance regression by
unnecessarily acquiring dict_sys.latch in exclusive mode during the
table lookup.
-rw-r--r-- | storage/innobase/row/row0purge.cc | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/storage/innobase/row/row0purge.cc b/storage/innobase/row/row0purge.cc index 4588c1d2b0a..35dd06a03e8 100644 --- a/storage/innobase/row/row0purge.cc +++ b/storage/innobase/row/row0purge.cc @@ -1027,10 +1027,21 @@ row_purge_parse_undo_rec( try_again: purge_sys.check_stop_FTS(); - - node->table = dict_table_open_on_id( - table_id, false, DICT_TABLE_OP_NORMAL, node->purge_thd, - &node->mdl_ticket); + /* FIXME: We are acquiring exclusive dict_sys.latch only to + avoid increased wait times in + trx_purge_get_next_rec() and trx_purge_truncate_history(). */ + dict_sys.lock(SRW_LOCK_CALL); + node->table = dict_table_open_on_id(table_id, true, + DICT_TABLE_OP_NORMAL); + dict_sys.unlock(); + + if (node->table) { + dict_sys.freeze(SRW_LOCK_CALL); + node->table = dict_acquire_mdl_shared<false>( + node->table, node->purge_thd, &node->mdl_ticket, + DICT_TABLE_OP_NORMAL); + dict_sys.unfreeze(SRW_LOCK_CALL); + } if (!node->table) { /* The table has been dropped: no need to do purge and |