24#ifndef DD_CACHE__DICTIONARY_CLIENT_INCLUDED
25#define DD_CACHE__DICTIONARY_CLIENT_INCLUDED
192 template <
typename T>
195 assert(
m_prev !=
nullptr);
206 template <
typename T>
222 template <
typename T>
243 template <
typename T>
301 template <
typename K,
typename T>
302 [[nodiscard]]
bool acquire(
const K &
key,
const T **
object,
303 bool *local_committed,
bool *local_uncommitted);
323 template <
typename K,
typename T>
345 template <
typename T>
368 template <
typename T>
374 static_cast<const typename T::Cache_partition *
>(
object), &element);
375 assert(element ==
nullptr);
379 static_cast<const typename T::Cache_partition *
>(
object), &element);
380 assert(element ==
nullptr);
397 template <
typename T>
403 static_cast<const typename T::Cache_partition *
>(
object), &element);
404 assert(element !=
nullptr);
426 template <
typename T>
449 template <
typename T>
472 template <
typename T>
475 template <
typename T>
490 template <
typename Object_type>
498 template <
typename T>
506 template <
typename T>
530 template <typename T>
546 template <typename T>
565 template <typename T>
583 template <typename T>
607 template <typename T>
629 template <typename T>
644 template <typename T>
660 template <typename T>
686 template <typename T>
714 template <typename T>
747 template <typename T>
750 const typename T::Cache_partition **
object);
782 template <typename T>
785 typename T::Cache_partition **
object);
808 bool skip_spi_cache = false);
923 template <typename T>
968 template <typename T>
982 template <typename T>
999 template <typename Object_type>
1016 template <typename T>
1030 template <typename T>
1044 template <typename T>
1046 bool *is_definer) const;
1064 template <typename T>
1066 const
char *schema, const
char *tbl_or_sf_name,
1093 const
String_type &parent_engine,
bool uncommitted,
1131 template <typename T>
1165 template <typename T>
1166 [[nodiscard]]
bool drop(const T *
object);
1193 template <typename T>
1194 [[nodiscard]]
bool store(T *
object);
1221 template <typename T>
1222 [[nodiscard]]
bool update(T *new_object);
1266 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:177
void dump() const
Definition: dictionary_client.cc:828
Auto_releaser * m_prev
Definition: dictionary_client.h:183
~Auto_releaser()
Definition: dictionary_client.cc:784
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:181
Object_registry m_release_registry
Definition: dictionary_client.h:182
Auto_releaser()
Definition: dictionary_client.cc:766
void transfer_release(const T *object)
Transfer an object from the current to the previous auto releaser.
Definition: dictionary_client.cc:735
void auto_release(Cache_element< T > *element)
Register an object to be auto released.
Definition: dictionary_client.h:193
Definition: dictionary_client.h:149
THD * m_thd
Definition: dictionary_client.h:252
bool acquire_uncached(Object_id id, T **object)
Retrieve an object by its object id without caching it.
Definition: dictionary_client.cc:1187
Auto_releaser * m_current_releaser
Definition: dictionary_client.h:254
void dump() const
Debug dump of a partition of the client and its registry to stderr.
Definition: dictionary_client.cc:2943
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:2300
Object_registry m_registry_committed
Definition: dictionary_client.h:249
bool drop(const T *object)
Remove and delete an object from the cache and the dd tables.
Definition: dictionary_client.cc:2533
bool acquire_for_modification(Object_id id, T **object)
Retrieve an object by its object id.
Definition: dictionary_client.cc:1124
bool fetch_global_components(Const_ptr_vec< T > *coll)
Fetch all global components of the given type.
Definition: dictionary_client.cc:2254
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:2346
Object_registry m_registry_dropped
Definition: dictionary_client.h:251
~Dictionary_client()
Definition: dictionary_client.cc:1065
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:1888
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:1933
bool acquire(const K &key, const T **object, bool *local_committed, bool *local_uncommitted)
Get a dictionary object.
Definition: dictionary_client.cc:866
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:260
Auto_releaser m_default_releaser
Definition: dictionary_client.h:253
std::vector< const T * > Const_ptr_vec
Definition: dictionary_client.h:476
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:2215
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:1564
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:2266
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:1623
std::vector< Entity_object * > m_uncached_objects
Definition: dictionary_client.h:248
bool store(T *object)
Store a new dictionary object.
Definition: dictionary_client.cc:2568
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:2138
void commit_modified_objects()
Remove the uncommitted objects from the client and put them into the shared cache,...
Definition: dictionary_client.cc:2927
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:2075
bool fetch_global_component_names(std::vector< String_type > *names) const
Fetch all global component names of the given type.
Definition: dictionary_client.cc:2037
bool update(T *new_object)
Update a persisted dictionary object, but keep the shared cache unchanged.
Definition: dictionary_client.cc:2618
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:1714
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:2805
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:2125
void rollback_modified_objects()
Remove the uncommitted objects from the client.
Definition: dictionary_client.cc:2914
bool fetch_schema_components(const Schema *schema, Const_ptr_vec< T > *coll)
Fetch all components in the schema.
Definition: dictionary_client.cc:2238
bool invalidate(const String_type &schema_name, const String_type &table_name)
Invalidate a cache entry.
Definition: dictionary_client.cc:2432
void register_dropped_object(T *object)
Transfer object ownership from caller to Dictionary_client, and register the object as dropped.
Definition: dictionary_client.cc:2742
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:1958
Object_registry m_registry_uncommitted
Definition: dictionary_client.h:250
void auto_delete(T *object)
Register an uncached object to be auto deleted.
Definition: dictionary_client.h:369
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:1253
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:2056
void acquire_uncommitted(const K &key, T **object, bool *dropped)
Get an uncommitted dictionary object that can be modified safely.
Definition: dictionary_client.cc:951
size_t release(Object_registry *registry)
Mark all objects of a certain type as not being used by this client.
Definition: dictionary_client.cc:990
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:1204
void no_auto_delete(T *object)
Remove an object from the auto delete vector.
Definition: dictionary_client.h:398
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:1799
Dictionary_client(THD *thd)
Definition: dictionary_client.cc:1055
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:1159
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:1846
bool fetch_global_component_ids(std::vector< Object_id > *ids) const
Fetch all global component ids of the given type.
Definition: dictionary_client.cc:2017
void register_uncommitted_object(T *object)
Transfer object ownership from caller to Dictionary_client, and register the object as uncommitted.
Definition: dictionary_client.cc:2706
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:61
SPI_lru_cache * m_spi_lru_cache
Definition: dictionary_client.h:62
~SPI_lru_cache_owner_ptr()
Calls delete on m_spi_lru_cache unless nullptr.
Definition: dictionary_client.cc:715
SPI_lru_cache * operator->()
Creates cache on demand if m_spi_lru_cache is nullptr.
Definition: dictionary_client.cc:721
bool is_nullptr() const
Definition: dictionary_client.h:85
const SPI_lru_cache * operator->() const
Const overload which does not create cache on demand, but merely returns the pointer.
Definition: dictionary_client.h:79
Inherit from an instantiation of the template to allow forward-declaring in Dictionary_client.
Definition: dictionary_client.cc:713
Header for compiler-dependent features.
#define MY_COMPILER_DIAGNOSTIC_PUSH()
save the compiler's diagnostic (enabled warnings, errors, ...) state
Definition: my_compiler.h:285
#define MY_COMPILER_DIAGNOSTIC_POP()
restore the compiler's diagnostic (enabled warnings, errors, ...) state
Definition: my_compiler.h:286
#define MY_COMPILER_CLANG_WORKAROUND_TPARAM_DOCBUG()
ignore -Wdocumentation compiler warnings for @tparam.
Definition: my_compiler.h:308
char * user
Definition: mysqladmin.cc:66
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:728
Definition: dictionary_client.h:1274
void insert(dd::cache::SPI_lru_cache_owner_ptr &c, dd::Object_id id)
Definition: dictionary_client.cc:3252
The version of the current data dictionary table definitions.
Definition: dictionary_client.h:43
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
Definition: gcs_xcom_synode.h:64
std::vector< T, ut::allocator< T > > vector
Specialization of vector which uses allocator.
Definition: ut0new.h:2875
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:2439
static int exists(node_address *name, node_list const *nodes, u_int with_uid)
Definition: node_list.cc:106
required string key
Definition: replication_asynchronous_connection_failover.proto:60