diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2021-08-02 16:07:43 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2021-08-02 16:07:43 +0300 |
commit | 227159605779c98f762831e144ec7c436126d8ba (patch) | |
tree | 07821901fd68b06fdd302a5ab8e7d1a985e19661 | |
parent | 6ff40d5cb400b0e42745cf83efd2577d9d41c685 (diff) | |
download | mariadb-git-227159605779c98f762831e144ec7c436126d8ba.tar.gz |
fixup 3eb011f9046e4b255a5c2ba2823e8ad31d96edf5
-rw-r--r-- | storage/innobase/dict/dict0dict.cc | 19 | ||||
-rw-r--r-- | storage/innobase/handler/ha_innodb.cc | 6 | ||||
-rw-r--r-- | storage/innobase/include/dict0dict.h | 3 | ||||
-rw-r--r-- | storage/innobase/row/row0ins.cc | 4 | ||||
-rw-r--r-- | storage/innobase/row/row0upd.cc | 4 |
5 files changed, 29 insertions, 7 deletions
diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc index 86d095bbd78..41143133220 100644 --- a/storage/innobase/dict/dict0dict.cc +++ b/storage/innobase/dict/dict0dict.cc @@ -299,6 +299,25 @@ dict_table_try_drop_aborted_and_unlock( } } +/** Decrement the count of open handles */ +void dict_table_close(dict_table_t *table) +{ + if (dict_stats_is_persistent_enabled(table) && + strchr(table->name.m_name, '/')) + { + dict_sys.freeze(SRW_LOCK_CALL); + if (table->release()) + { + table->stats_mutex_lock(); + dict_stats_deinit(table); + table->stats_mutex_unlock(); + } + dict_sys.unfreeze(); + } + else + table->release(); +} + /** Decrements the count of open handles of a table. @param[in,out] table table @param[in] dict_locked data dictionary locked diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index e45a84863de..e2251959dc3 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -1940,7 +1940,7 @@ static int innodb_check_version(handlerton *hton, const char *path, { const trx_id_t trx_id= table->def_trx_id; DBUG_ASSERT(trx_id <= create_id); - dict_table_close(table, false, false); + dict_table_close(table); DBUG_PRINT("info", ("create_id: %llu trx_id: %llu", create_id, trx_id)); DBUG_RETURN(create_id != trx_id); } @@ -13067,7 +13067,7 @@ create_table_info_t::create_table_update_dict() innobase_parse_hint_from_comment(m_thd, innobase_table, m_form->s); - dict_table_close(innobase_table, FALSE, FALSE); + dict_table_close(innobase_table); DBUG_RETURN(0); } @@ -17105,7 +17105,7 @@ static int innodb_ft_aux_table_validate(THD *thd, st_mysql_sys_var*, table_name, FALSE, TRUE, DICT_ERR_IGNORE_NONE)) { const table_id_t id = dict_table_has_fts_index(table) ? table->id : 0; - dict_table_close(table, FALSE, FALSE); + dict_table_close(table); if (id) { innodb_ft_aux_table_id = id; if (table_name == buf) { diff --git a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict0dict.h index 5760ec9378b..4072a15b090 100644 --- a/storage/innobase/include/dict0dict.h +++ b/storage/innobase/include/dict0dict.h @@ -152,6 +152,9 @@ dict_table_open_on_id(table_id_t table_id, bool dict_locked, MDL_ticket **mdl= nullptr) MY_ATTRIBUTE((warn_unused_result)); +/** Decrement the count of open handles */ +void dict_table_close(dict_table_t *table); + /** Decrements the count of open handles of a table. @param[in,out] table table @param[in] dict_locked data dictionary locked diff --git a/storage/innobase/row/row0ins.cc b/storage/innobase/row/row0ins.cc index 95aa0b84c7a..d62cb54b616 100644 --- a/storage/innobase/row/row0ins.cc +++ b/storage/innobase/row/row0ins.cc @@ -1950,8 +1950,8 @@ row_ins_check_foreign_constraints( err = row_ins_check_foreign_constraint( TRUE, foreign, table, ref_tuple, thr); - if (ref_table != NULL) { - dict_table_close(ref_table, FALSE, FALSE); + if (ref_table) { + dict_table_close(ref_table); } } } diff --git a/storage/innobase/row/row0upd.cc b/storage/innobase/row/row0upd.cc index 88cd90fe778..fb1e0d4191d 100644 --- a/storage/innobase/row/row0upd.cc +++ b/storage/innobase/row/row0upd.cc @@ -250,8 +250,8 @@ row_upd_check_references_constraints( err = row_ins_check_foreign_constraint( FALSE, foreign, table, entry, thr); - if (ref_table != NULL) { - dict_table_close(ref_table, FALSE, FALSE); + if (ref_table) { + dict_table_close(ref_table); } if (err != DB_SUCCESS) { |