24#ifndef DD_CACHE__DICTIONARY_CLIENT_INCLUDED
25#define DD_CACHE__DICTIONARY_CLIENT_INCLUDED
215 template <
typename T>
218 assert(
m_prev !=
nullptr);
229 template <
typename T>
245 template <
typename T>
266 template <
typename T>
325 template <
typename K,
typename T>
326 [[nodiscard]]
bool acquire(
const K &
key,
const T **
object,
327 bool *local_committed,
bool *local_uncommitted);
347 template <
typename K,
typename T>
369 template <
typename T>
392 template <
typename T>
398 static_cast<const typename T::Cache_partition *
>(
object), &element);
399 assert(element ==
nullptr);
403 static_cast<const typename T::Cache_partition *
>(
object), &element);
404 assert(element ==
nullptr);
421 template <
typename T>
427 static_cast<const typename T::Cache_partition *
>(
object), &element);
428 assert(element !=
nullptr);
450 template <
typename T>
473 template <
typename T>
496 template <
typename T>
499 template <
typename T>
514 template <
typename Object_type>
522 template <
typename T>
530 template <
typename T>
554 template <typename
T>
570 template <typename
T>
589 template <typename
T>
607 template <typename
T>
631 template <typename
T>
653 template <typename
T>
668 template <typename
T>
684 template <typename
T>
710 template <typename
T>
738 template <typename
T>
771 template <typename
T>
774 const typename
T::Cache_partition **
object);
806 template <typename
T>
809 typename
T::Cache_partition **
object);
832 bool skip_spi_cache = false);
947 template <typename
T>
996 template <typename
T>
1010 template <typename
T>
1027 template <typename Object_type>
1044 template <typename
T>
1058 template <typename
T>
1072 template <typename
T>
1074 bool *is_definer) const;
1092 template <typename
T>
1094 const
char *schema, const
char *tbl_or_sf_name,
1121 const
String_type &parent_engine,
bool uncommitted,
1159 template <typename
T>
1193 template <typename
T>
1194 [[nodiscard]]
bool drop(const
T *
object);
1221 template <typename
T>
1222 [[nodiscard]]
bool store(
T *
object);
1249 template <typename
T>
1250 [[nodiscard]]
bool update(
T *new_object);
1293 template <typename
T>
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
Base class for dictionary objects which has single column integer primary key.
Definition: entity_object.h:48
Definition: object_key.h:38
Implementation of a dictionary client.
Definition: cache_element.h:69
Class to help releasing and deleting objects.
Definition: dictionary_client.h:194
void dump() const
Definition: dictionary_client.cc:601
Auto_releaser * m_prev
Definition: dictionary_client.h:200
~Auto_releaser()
Definition: dictionary_client.cc:514
std::vector< Release_lock_descriptor > m_release_locks
Cache of MDL_keys which have been asserted to hold when acquiring, and which should be re-checked bef...
Definition: dictionary_client.h:205
Auto_releaser * remove(Cache_element< T > *element)
Remove an element from some auto releaser down the chain.
Dictionary_client * m_client
Definition: dictionary_client.h:198
Object_registry m_release_registry
Definition: dictionary_client.h:199
Auto_releaser()
Definition: dictionary_client.cc:496
void transfer_release(const T *object)
Transfer an object from the current to the previous auto releaser.
Definition: dictionary_client.cc:446
void auto_release(Cache_element< T > *element)
Register an object to be auto released.
Definition: dictionary_client.h:216
Definition: dictionary_client.h:166
THD * m_thd
Definition: dictionary_client.h:275
bool acquire_uncached(Object_id id, T **object)
Retrieve an object by its object id without caching it.
Definition: dictionary_client.cc:960
Auto_releaser * m_current_releaser
Definition: dictionary_client.h:277
void dump() const
Debug dump of a partition of the client and its registry to stderr.
Definition: dictionary_client.cc:2749
bool fetch_referencing_views_object_id(const char *schema, const char *tbl_or_sf_name, std::vector< Object_id > *view_ids) const
Fetch Object ids of all the views referencing base table/ view/ stored function name specified in "sc...
Definition: dictionary_client.cc:2106
Object_registry m_registry_committed
Definition: dictionary_client.h:272
bool drop(const T *object)
Remove and delete an object from the cache and the dd tables.
Definition: dictionary_client.cc:2339
bool acquire_for_modification(Object_id id, T **object)
Retrieve an object by its object id.
Definition: dictionary_client.cc:897
bool fetch_global_components(Const_ptr_vec< T > *coll)
Fetch all global components of the given type.
Definition: dictionary_client.cc:2060
bool fetch_fk_children_uncached(const String_type &parent_schema, const String_type &parent_name, const String_type &parent_engine, bool uncommitted, std::vector< String_type > *children_schemas, std::vector< String_type > *children_names)
Fetch the names of tables (children) which have foreign keys defined to the given table (parent).
Definition: dictionary_client.cc:2152
Object_registry m_registry_dropped
Definition: dictionary_client.h:274
~Dictionary_client()
Definition: dictionary_client.cc:838
bool get_table_name_by_trigger_name(const Schema &schema, const String_type &trigger_name, String_type *table_name)
Retrieve a table name of a given trigger name and schema.
Definition: dictionary_client.cc:1666
bool check_foreign_key_exists(const Schema &schema, const String_type &foreign_key_name, bool *exists)
Check if schema contains foreign key with specified name.
Definition: dictionary_client.cc:1711
bool acquire(const K &key, const T **object, bool *local_committed, bool *local_uncommitted)
Get a dictionary object.
Definition: dictionary_client.cc:639
SPI_lru_cache_owner_ptr m_no_table_spids
Se-private ids known not to exist in either TABLES or PARTITIONS or both.
Definition: dictionary_client.h:283
Auto_releaser m_default_releaser
Definition: dictionary_client.h:276
std::vector< const T * > Const_ptr_vec
Definition: dictionary_client.h:500
bool fetch(Const_ptr_vec< Object_type > *coll, const Object_key *object_key)
Fetch objects from DD tables that match the supplied key.
Definition: dictionary_client.cc:2021
bool acquire_uncached_table_by_se_private_id(const String_type &engine, Object_id se_private_id, Table **table, bool skip_spi_cache=false)
Retrieve a table object by its se private id.
Definition: dictionary_client.cc:1342
bool is_user_definer(const LEX_USER &user, bool *is_definer) const
Check if a user is referenced as definer by some object of the given type.
Definition: dictionary_client.cc:2072
bool acquire_uncached_table_by_partition_se_private_id(const String_type &engine, Object_id se_partition_id, Table **table)
Retrieve a table object by its partition se private id.
Definition: dictionary_client.cc:1401
std::vector< Entity_object * > m_uncached_objects
Definition: dictionary_client.h:271
bool store(T *object)
Store a new dictionary object.
Definition: dictionary_client.cc:2374
bool foreach(const Object_key *object_key, std::function< bool(std::unique_ptr< Object_type > &)> const &processor) const
Execute the submitted lambda function for each entity of the given type selected by the submitted key...
Definition: dictionary_client.cc:1944
void commit_modified_objects()
Remove the uncommitted objects from the client and put them into the shared cache,...
Definition: dictionary_client.cc:2733
bool fetch_schema_table_names_not_hidden_by_se(const Schema *schema, std::vector< String_type > *names) const
Fetch the names of the server tables in the schema.
Definition: dictionary_client.cc:1853
bool fetch_global_component_names(std::vector< String_type > *names) const
Fetch all global component names of the given type.
Definition: dictionary_client.cc:1815
bool update(T *new_object)
Update a persisted dictionary object, but keep the shared cache unchanged.
Definition: dictionary_client.cc:2424
bool remove_table_dynamic_statistics(const String_type &schema_name, const String_type &table_name)
Remove table statistics entries from mysql.table_stats and mysql.index_stats.
Definition: dictionary_client.cc:1492
void remove_uncommitted_objects(bool commit_to_shared_cache)
Remove the uncommitted objects from the client and (depending on the parameter) put them into the sha...
Definition: dictionary_client.cc:2611
bool fetch_schema_component_names(const Schema *schema, std::vector< String_type > *names) const
Fetch the names of the components in the schema.
Definition: dictionary_client.cc:1931
bool fetch_schema_base_table_names_not_hidden_by_se(const Schema *schema, std::vector< String_type > *names) const
TODO.dt.
Definition: dictionary_client.cc:1866
void rollback_modified_objects()
Remove the uncommitted objects from the client.
Definition: dictionary_client.cc:2720
bool fetch_schema_components(const Schema *schema, Const_ptr_vec< T > *coll)
Fetch all components in the schema.
Definition: dictionary_client.cc:2044
bool invalidate(const String_type &schema_name, const String_type &table_name)
Invalidate a cache entry.
Definition: dictionary_client.cc:2238
void register_dropped_object(T *object)
Transfer object ownership from caller to Dictionary_client, and register the object as dropped.
Definition: dictionary_client.cc:2548
bool check_constraint_exists(const Schema &schema, const String_type &check_cons_name, bool *exists)
Check if schema contains check constraint with specified name.
Definition: dictionary_client.cc:1736
Object_registry m_registry_uncommitted
Definition: dictionary_client.h:273
void auto_delete(T *object)
Register an uncached object to be auto deleted.
Definition: dictionary_client.h:393
bool acquire_uncached_uncommitted(Object_id id, T **object)
Retrieve a possibly uncommitted object by its object id without caching it.
Definition: dictionary_client.cc:1025
bool fetch_schema_table_names_by_engine(const Schema *schema, const String_type &engine, std::vector< String_type > *names) const
Fetch the names of the tables in the schema belonging to specific storage engine.
Definition: dictionary_client.cc:1834
void acquire_uncommitted(const K &key, T **object, bool *dropped)
Get an uncommitted dictionary object that can be modified safely.
Definition: dictionary_client.cc:745
size_t release(Object_registry *registry)
Mark all objects of a certain type as not being used by this client.
Definition: dictionary_client.cc:784
bool acquire_uncached_uncommitted_impl(Object_id id, T **object)
Auxiliary function to retrieve a possibly uncommitted object by its object id without caching it.
Definition: dictionary_client.cc:977
void no_auto_delete(T *object)
Remove an object from the auto delete vector.
Definition: dictionary_client.h:422
bool get_table_name_by_se_private_id(const String_type &engine, Object_id se_private_id, String_type *schema_name, String_type *table_name)
Retrieve schema and table name by the se private id of the table.
Definition: dictionary_client.cc:1577
Dictionary_client(THD *thd)
Definition: dictionary_client.cc:828
bool acquire_uncached_impl(Object_id id, T **object)
Auxiliary function to retrieve an object by its object id without caching it.It is responsibility of ...
Definition: dictionary_client.cc:932
bool get_table_name_by_partition_se_private_id(const String_type &engine, Object_id se_partition_id, String_type *schema_name, String_type *table_name)
Retrieve schema and table name by the se private id of the partition.
Definition: dictionary_client.cc:1624
bool fetch_global_component_ids(std::vector< Object_id > *ids) const
Fetch all global component ids of the given type.
Definition: dictionary_client.cc:1795
void register_uncommitted_object(T *object)
Transfer object ownership from caller to Dictionary_client, and register the object as uncommitted.
Definition: dictionary_client.cc:2512
Object registry containing several maps.
Definition: object_registry.h:62
void put(Cache_element< T > *element)
Add a new element to the registry.
Definition: object_registry.h:279
void get(const K &key, Cache_element< T > **element) const
Get the element corresponding to the given key.
Definition: object_registry.h:263
A smart-pointer for managing an SPI_lru_cache even when it is only forward declared.
Definition: dictionary_client.h:62
SPI_lru_cache * m_spi_lru_cache
Definition: dictionary_client.h:63
~SPI_lru_cache_owner_ptr()
Calls delete on m_spi_lru_cache unless nullptr.
Definition: dictionary_client.cc:426
SPI_lru_cache * operator->()
Creates cache on demand if m_spi_lru_cache is nullptr.
Definition: dictionary_client.cc:432
bool is_nullptr() const
Definition: dictionary_client.h:86
const SPI_lru_cache * operator->() const
Const overload which does not create cache on demand, but merely returns the pointer.
Definition: dictionary_client.h:80
Inherit from an instantiation of the template to allow forward-declaring in Dictionary_client.
Definition: dictionary_client.cc:424
#define T
Definition: jit_executor_value.cc:373
Header for compiler-dependent features.
#define MY_COMPILER_DIAGNOSTIC_PUSH()
save the compiler's diagnostic (enabled warnings, errors, ...) state
Definition: my_compiler.h:277
#define MY_COMPILER_DIAGNOSTIC_POP()
restore the compiler's diagnostic (enabled warnings, errors, ...) state
Definition: my_compiler.h:278
#define MY_COMPILER_CLANG_WORKAROUND_TPARAM_DOCBUG()
ignore -Wdocumentation compiler warnings for @tparam.
Definition: my_compiler.h:300
char * user
Definition: mysqladmin.cc:67
static PFS_engine_table_share_proxy table
Definition: pfs.cc:61
bool is_cached(const SPI_lru_cache_owner_ptr &cache, Object_id id, SPI_missing_type t)
Definition: dictionary_client.cc:439
Definition: dictionary_client.h:1301
void insert(dd::cache::SPI_lru_cache_owner_ptr &c, dd::Object_id id)
Definition: dictionary_client.cc:3077
The version of the current data dictionary table definitions.
Definition: dictionary_client.h:44
unsigned long long Object_id
Definition: object_id.h:31
Char_string_template< String_type_allocator > String_type
Definition: string_type.h:51
static mysql_service_status_t remove(reference_caching_channel channel, const char *implementation_name) noexcept
Definition: component.cc:137
const char * table_name
Definition: rules_table_service.cc:56
Define std::hash<Gtid>.
Definition: gtid.h:355
std::vector< T, ut::allocator< T > > vector
Specialization of vector which uses allocator.
Definition: ut0new.h:2880
std::conditional_t< !std::is_array< T >::value, std::unique_ptr< T, detail::Deleter< T > >, std::conditional_t< detail::is_unbounded_array_v< T >, std::unique_ptr< T, detail::Array_deleter< std::remove_extent_t< T > > >, void > > unique_ptr
The following is a common type that is returned by all the ut::make_unique (non-aligned) specializati...
Definition: ut0new.h:2444
static int exists(node_address *name, node_list const *nodes, u_int with_uid)
Definition: node_list.cc:107
required string key
Definition: replication_asynchronous_connection_failover.proto:60
enum_mdl_type
Type of metadata lock request.
Definition: sql_lexer_yacc_state.h:106
@ MDL_TYPE_END
Definition: sql_lexer_yacc_state.h:238
Metadata lock object key.
Definition: mdl.h:366
Data needed to check if an MDL is held.
Definition: dictionary_client.h:152
enum_mdl_type m_mdl_type
Definition: dictionary_client.h:154
MDL_key m_mdl_key
Definition: dictionary_client.h:153
Tracks MDLs for shared DD object.
Definition: dictionary_client.h:160
const Entity_object * m_object
Definition: dictionary_client.h:162
MDL_descriptor m_mdld
Definition: dictionary_client.h:161