diff --git a/mysql-test/suite/perfschema/r/dml_setup_instruments.result b/mysql-test/suite/perfschema/r/dml_setup_instruments.result index 37beda6a059..2c806a27918 100644 --- a/mysql-test/suite/perfschema/r/dml_setup_instruments.result +++ b/mysql-test/suite/perfschema/r/dml_setup_instruments.result @@ -6,6 +6,7 @@ order by name limit 10; NAME ENABLED TIMED PROPERTIES FLAGS VOLATILITY DOCUMENTATION wait/synch/mutex/sql/Commit_order_manager::m_mutex YES YES NULL 0 NULL wait/synch/mutex/sql/Cost_constant_cache::LOCK_cost_const YES YES singleton NULL 0 NULL +wait/synch/mutex/sql/DD::object_cache_mutex YES YES NULL 0 NULL wait/synch/mutex/sql/Event_scheduler::LOCK_scheduler_state YES YES singleton NULL 0 NULL wait/synch/mutex/sql/Gtid_set::gtid_executed::free_intervals_mutex YES YES NULL 0 NULL wait/synch/mutex/sql/Gtid_state YES YES singleton NULL 0 NULL diff --git a/sql/dd/impl/cache/shared_dictionary_cache.cc b/sql/dd/impl/cache/shared_dictionary_cache.cc index 9941c8f26b8..1900a515ff0 100644 --- a/sql/dd/impl/cache/shared_dictionary_cache.cc +++ b/sql/dd/impl/cache/shared_dictionary_cache.cc @@ -37,9 +37,19 @@ namespace cache { template class Cache_element; +Shared_dictionary_cache *Shared_dictionary_cache::s_cache = nullptr; + Shared_dictionary_cache *Shared_dictionary_cache::instance() { - static Shared_dictionary_cache s_cache; - return &s_cache; + if (s_cache == nullptr) { + s_cache = new Shared_dictionary_cache(); + } + return s_cache; +} + +void Shared_dictionary_cache::destroy() { + if (s_cache == nullptr) return; + delete s_cache; + s_cache = nullptr; } void Shared_dictionary_cache::init() { diff --git a/sql/dd/impl/cache/shared_dictionary_cache.h b/sql/dd/impl/cache/shared_dictionary_cache.h index 9e73aacd7a4..cc2a8b8855e 100644 --- a/sql/dd/impl/cache/shared_dictionary_cache.h +++ b/sql/dd/impl/cache/shared_dictionary_cache.h @@ -89,6 +89,8 @@ class Shared_dictionary_cache { Shared_multi_map m_spatial_reference_system_map; Shared_multi_map m_tablespace_map; + static Shared_dictionary_cache *s_cache; + template struct Type_selector {}; // Dummy type to use for // selecting map instance. @@ -186,6 +188,8 @@ class Shared_dictionary_cache { public: static Shared_dictionary_cache *instance(); + static void destroy(); + // Set capacity of the shared maps. static void init(); diff --git a/sql/mysqld.cc b/sql/mysqld.cc index e176b83b17e..ae104a6b99f 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -11834,8 +11834,8 @@ PSI_mutex_key key_RELAYLOG_LOCK_log_end_pos; PSI_mutex_key key_RELAYLOG_LOCK_sync; PSI_mutex_key key_RELAYLOG_LOCK_xids; PSI_mutex_key key_gtid_ensure_index_mutex; -PSI_mutex_key key_object_cache_mutex; // TODO need to initialize -PSI_cond_key key_object_loading_cond; // TODO need to initialize +PSI_mutex_key key_object_cache_mutex; +PSI_cond_key key_object_loading_cond; PSI_mutex_key key_mta_temp_table_LOCK; PSI_mutex_key key_mta_gaq_LOCK; PSI_mutex_key key_thd_timer_mutex; @@ -11937,8 +11937,9 @@ static PSI_mutex_info all_server_mutexes[]= { &key_monitor_info_run_lock, "Source_IO_monitor::run_lock", 0, 0, PSI_DOCUMENT_ME}, { &key_LOCK_delegate_connection_mutex, "LOCK_delegate_connection_mutex", PSI_FLAG_SINGLETON, 0, PSI_DOCUMENT_ME}, { &key_LOCK_group_replication_connection_mutex, "LOCK_group_replication_connection_mutex", PSI_FLAG_SINGLETON, 0, PSI_DOCUMENT_ME}, -{ &key_LOCK_authentication_policy, "LOCK_authentication_policy", PSI_FLAG_SINGLETON, 0, "A lock to ensure execution of CREATE USER or ALTER USER sql and SET @@global.authentication_policy variable are serialized"}, - { &key_LOCK_global_conn_mem_limit, "LOCK_global_conn_mem_limit", PSI_FLAG_SINGLETON, 0, PSI_DOCUMENT_ME} + { &key_LOCK_authentication_policy, "LOCK_authentication_policy", PSI_FLAG_SINGLETON, 0, "A lock to ensure execution of CREATE USER or ALTER USER sql and SET @@global.authentication_policy variable are serialized"}, + { &key_LOCK_global_conn_mem_limit, "LOCK_global_conn_mem_limit", PSI_FLAG_SINGLETON, 0, PSI_DOCUMENT_ME}, + { &key_object_cache_mutex, "DD::object_cache_mutex", 0, 0, PSI_DOCUMENT_ME} }; /* clang-format on */ @@ -12054,7 +12055,8 @@ static PSI_cond_info all_server_conds[]= { &key_cond_slave_worker_hash, "Relay_log_info::replica_worker_hash_cond", 0, 0, PSI_DOCUMENT_ME}, { &key_monitor_info_run_cond, "Source_IO_monitor::run_cond", 0, 0, PSI_DOCUMENT_ME}, { &key_COND_delegate_connection_cond_var, "THD::COND_delegate_connection_cond_var", 0, 0, PSI_DOCUMENT_ME}, - { &key_COND_group_replication_connection_cond_var, "THD::COND_group_replication_connection_cond_var", 0, 0, PSI_DOCUMENT_ME} + { &key_COND_group_replication_connection_cond_var, "THD::COND_group_replication_connection_cond_var", 0, 0, PSI_DOCUMENT_ME}, + { &key_object_loading_cond, "DD::object_loading_cond", PSI_FLAG_SINGLETON, 0, PSI_DOCUMENT_ME} }; /* clang-format on */