MySQL 9.1.0
Source Code Documentation
|
#include <dictionary_client.h>
Classes | |
class | Auto_releaser |
Class to help releasing and deleting objects. More... | |
Public Member Functions | |
Dictionary_client (THD *thd) | |
~Dictionary_client () | |
template<typename T > | |
bool | acquire (Object_id id, const T **object) |
Retrieve an object by its object id. More... | |
template<typename T > | |
bool | acquire_for_modification (Object_id id, T **object) |
Retrieve an object by its object id. More... | |
template<typename T > | |
bool | acquire_uncached (Object_id id, T **object) |
Retrieve an object by its object id without caching it. More... | |
template<typename T > | |
bool | acquire_uncached (Object_id id, std::unique_ptr< T > *object_ptr) |
Retrieve an object by its object id without caching it. More... | |
template<typename T > | |
bool | acquire_uncached_uncommitted (Object_id id, T **object) |
Retrieve a possibly uncommitted object by its object id without caching it. More... | |
template<typename T > | |
bool | acquire_uncached_uncommitted (Object_id id, std::unique_ptr< T > *object_ptr) |
Retrieve a possibly uncommitted object by its object id without caching it. More... | |
template<typename T > | |
bool | acquire (const String_type &object_name, const T **object) |
Retrieve an object by its name. More... | |
template<typename T > | |
bool | acquire_for_modification (const String_type &object_name, T **object) |
Retrieve an object by its name. More... | |
template<typename T > | |
bool | acquire (const String_type &schema_name, const String_type &object_name, const T **object) |
Retrieve an object by its schema- and object name. More... | |
template<typename T > | |
bool | acquire_for_modification (const String_type &schema_name, const String_type &object_name, T **object) |
Retrieve an object by its schema- and object name. More... | |
template<typename T > | |
bool | acquire (const String_type &schema_name, const String_type &object_name, const typename T::Cache_partition **object) |
Retrieve an object by its schema- and object name. More... | |
template<typename T > | |
bool | acquire_for_modification (const String_type &schema_name, const String_type &object_name, typename T::Cache_partition **object) |
Retrieve an object by its schema- and object name. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
bool | check_constraint_exists (const Schema &schema, const String_type &check_cons_name, bool *exists) |
Check if schema contains check constraint with specified name. More... | |
template<typename T > | |
bool | fetch_schema_component_names (const Schema *schema, std::vector< String_type > *names) const |
Fetch the names of the components in the schema. More... | |
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. More... | |
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. More... | |
template<typename T > | |
bool | fetch_global_component_ids (std::vector< Object_id > *ids) const |
Fetch all global component ids of the given type. More... | |
template<typename T > | |
bool | fetch_global_component_names (std::vector< String_type > *names) const |
Fetch all global component names of the given type. More... | |
template<typename Object_type > | |
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. More... | |
template<typename T > | |
bool | fetch_schema_components (const Schema *schema, Const_ptr_vec< T > *coll) |
Fetch all components in the schema. More... | |
template<typename T > | |
bool | fetch_global_components (Const_ptr_vec< T > *coll) |
Fetch all global components of the given type. More... | |
template<typename T > | |
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. More... | |
template<typename T > | |
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 "schema". More... | |
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). More... | |
bool | invalidate (const String_type &schema_name, const String_type &table_name) |
Invalidate a cache entry. More... | |
template<typename T > | |
void | invalidate (const T *object) |
Invalidate a cache entry. More... | |
template<typename T > | |
bool | drop (const T *object) |
Remove and delete an object from the cache and the dd tables. More... | |
template<typename T > | |
bool | store (T *object) |
Store a new dictionary object. More... | |
template<typename T > | |
bool | update (T *new_object) |
Update a persisted dictionary object, but keep the shared cache unchanged. More... | |
void | rollback_modified_objects () |
Remove the uncommitted objects from the client. More... | |
void | commit_modified_objects () |
Remove the uncommitted objects from the client and put them into the shared cache, thereby making them visible to other clients. More... | |
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. More... | |
template<typename T > | |
void | dump () const |
Debug dump of a partition of the client and its registry to stderr. More... | |
template<> | |
bool | fetch_schema_component_names (const Schema *schema, std::vector< String_type > *names) const |
template<> | |
bool | fetch_schema_component_names (const Schema *schema, std::vector< String_type > *names) const |
template<> | |
bool | fetch_schema_component_names (const Schema *schema, std::vector< String_type > *names) const |
template<> | |
bool | store (Table_stat *object) |
template<> | |
bool | store (Index_stat *object) |
Private Types | |
template<typename T > | |
using | Const_ptr_vec = std::vector< const T * > |
Private Member Functions | |
template<typename K , typename T > | |
bool | acquire (const K &key, const T **object, bool *local_committed, bool *local_uncommitted) |
Get a dictionary object. More... | |
template<typename K , typename T > | |
void | acquire_uncommitted (const K &key, T **object, bool *dropped) |
Get an uncommitted dictionary object that can be modified safely. More... | |
template<typename T > | |
size_t | release (Object_registry *registry) |
Mark all objects of a certain type as not being used by this client. More... | |
size_t | release (Object_registry *registry) |
Release all objects in the submitted object registry. More... | |
template<typename T > | |
void | auto_delete (T *object) |
Register an uncached object to be auto deleted. More... | |
template<typename T > | |
void | no_auto_delete (T *object) |
Remove an object from the auto delete vector. More... | |
template<typename T > | |
void | register_uncommitted_object (T *object) |
Transfer object ownership from caller to Dictionary_client, and register the object as uncommitted. More... | |
template<typename T > | |
void | register_dropped_object (T *object) |
Transfer object ownership from caller to Dictionary_client, and register the object as dropped. More... | |
template<typename T > | |
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 shared cache, thereby making them visible to other clients. More... | |
template<typename Object_type > | |
bool | fetch (Const_ptr_vec< Object_type > *coll, const Object_key *object_key) |
Fetch objects from DD tables that match the supplied key. More... | |
template<typename T > | |
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 the caller to delete the retrieved object. More... | |
template<typename T > | |
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. More... | |
Private Attributes | |
std::vector< Entity_object * > | m_uncached_objects |
Object_registry | m_registry_committed |
Object_registry | m_registry_uncommitted |
Object_registry | m_registry_dropped |
THD * | m_thd |
Auto_releaser | m_default_releaser |
Auto_releaser * | m_current_releaser |
SPI_lru_cache_owner_ptr | m_no_table_spids |
Se-private ids known not to exist in either TABLES or PARTITIONS or both. More... | |
|
private |
|
explicit |
dd::cache::Dictionary_client::~Dictionary_client | ( | ) |
|
private |
Get a dictionary object.
The operation retrieves a dictionary object by one of its keys from the cache and returns it through the object parameter. If the object is already present in the client's local object registry, it is fetched from there. Otherwise, it is fetched from the shared cache (possibly involving a cache miss), and eventually added to the local object registry.
If no object is found for the given key, NULL is returned. The shared cache owns the returned object, i.e., the caller must not delete it. After using the object(s), the user must release it using one of the release mechanisms described earlier.
The reference counter for the object is incremented if the object is retrieved from the shared cache. If the object was present in the local registry, the reference counter stays the same. A cache miss is handled transparently by the shared cache.
K | Key type. |
T | Dictionary object type. |
key | Key to use for looking up the object. | |
[out] | object | Object pointer, if an object exists, otherwise NULL. |
[out] | local_committed | Whether the object was read from the local committed object registry. |
[out] | local_uncommitted | Whether the object was read from the local uncommitted registry. |
false | No error. |
true | Error (from handling a cache miss). |
bool dd::cache::Dictionary_client::acquire | ( | const String_type & | object_name, |
const T ** | object | ||
) |
Retrieve an object by its name.
T | Dictionary object type. |
object_name | Name of the object. | |
[out] | object | Dictionary object, if present; otherwise NULL. |
false | No error. |
true | Error (from handling a cache miss). |
bool dd::cache::Dictionary_client::acquire | ( | const String_type & | schema_name, |
const String_type & | object_name, | ||
const T ** | object | ||
) |
Retrieve an object by its schema- and object name.
T | Dictionary object type. |
schema_name | Name of the schema containing the object. | |
object_name | Name of the object. | |
[out] | object | Dictionary object, if present; otherwise NULL. |
false | No error. |
true | Error (from handling a cache miss, or from failing to get an MDL lock). |
bool dd::cache::Dictionary_client::acquire | ( | const String_type & | schema_name, |
const String_type & | object_name, | ||
const typename T::Cache_partition ** | object | ||
) |
Retrieve an object by its schema- and object name.
T | Dictionary object type. |
schema_name | Name of the schema containing the object. | |
object_name | Name of the object. | |
[out] | object | Dictionary object, if present; otherwise NULL. |
false | No error. |
true | Error (from handling a cache miss, or from failing to get an MDL lock). |
bool dd::cache::Dictionary_client::acquire | ( | Object_id | id, |
const T ** | object | ||
) |
Retrieve an object by its object id.
T | Dictionary object type. |
id | Object id to retrieve. | |
[out] | object | Dictionary object, if present; otherwise NULL. |
false | No error. |
true | Error (from handling a cache miss). |
bool dd::cache::Dictionary_client::acquire_for_modification | ( | const String_type & | object_name, |
T ** | object | ||
) |
Retrieve an object by its name.
This function returns a cloned object that can be modified.
T | Dictionary object type. |
object_name | Name of the object. | |
[out] | object | Dictionary object, if present; otherwise NULL. |
false | No error. |
true | Error (from handling a cache miss). |
bool dd::cache::Dictionary_client::acquire_for_modification | ( | const String_type & | schema_name, |
const String_type & | object_name, | ||
T ** | object | ||
) |
Retrieve an object by its schema- and object name.
This function returns a cloned object that can be modified.
T | Dictionary object type. |
schema_name | Name of the schema containing the object. | |
object_name | Name of the object. | |
[out] | object | Dictionary object, if present; otherwise NULL. |
false | No error. |
true | Error (from handling a cache miss, or from failing to get an MDL lock). |
bool dd::cache::Dictionary_client::acquire_for_modification | ( | const String_type & | schema_name, |
const String_type & | object_name, | ||
typename T::Cache_partition ** | object | ||
) |
Retrieve an object by its schema- and object name.
This function returns a cloned object that can be modified.
T | Dictionary object type. |
schema_name | Name of the schema containing the object. | |
object_name | Name of the object. | |
[out] | object | Dictionary object, if present; otherwise NULL. |
false | No error. |
true | Error (from handling a cache miss, or from failing to get an MDL lock). |
bool dd::cache::Dictionary_client::acquire_for_modification | ( | Object_id | id, |
T ** | object | ||
) |
Retrieve an object by its object id.
This function returns a cloned object that can be modified.
T | Dictionary object type. |
id | Object id to retrieve. | |
[out] | object | Dictionary object, if present; otherwise NULL. |
false | No error. |
true | Error (from handling a cache miss). |
bool dd::cache::Dictionary_client::acquire_uncached | ( | Object_id | id, |
std::unique_ptr< T > * | object_ptr | ||
) |
Retrieve an object by its object id without caching it.
The object is not cached and owned by the caller through unique_ptr it provides. The object may not be used as a parameter to the other dictionary client methods since it is not known by the object registry.
T | Dictionary object type. |
id | Object id to retrieve. | |
[out] | object_ptr | Smart pointer with dictionary object, if present or with nullptr otherwise. |
false | No error. |
true | Error (from reading the dictionary tables). |
bool dd::cache::Dictionary_client::acquire_uncached | ( | Object_id | id, |
T ** | object | ||
) |
Retrieve an object by its object id without caching it.
The object is not cached but owned by the dictionary client, who makes sure it is deleted. The object must not be released, and may not be used as a parameter to the other dictionary client methods since it is not known by the object registry.
T | Dictionary object type. |
id | Object id to retrieve. | |
[out] | object | Dictionary object, if present; otherwise NULL. |
false | No error. |
true | Error (from reading the dictionary tables). |
|
private |
Auxiliary function to retrieve an object by its object id without caching it.It is responsibility of the caller to delete the retrieved object.
bool dd::cache::Dictionary_client::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.
engine | Name of the engine storing the table. | |
se_partition_id | SE private id of the partition. | |
[out] | table | Table object, if present; otherwise NULL. |
false | No error or if object was not found. |
true | Error (from handling a cache miss). |
bool dd::cache::Dictionary_client::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.
engine | Name of the engine storing the table. | |
se_private_id | SE private id of the table. | |
[out] | table | Table object, if present; otherwise NULL. |
skip_spi_cache | Optionally skip looking into the missing SE private ID cache. Defaults to false. |
false | No error or if object was not found. |
true | Error (e.g. from reading DD tables, or if an object of a wrong type was found). |
bool dd::cache::Dictionary_client::acquire_uncached_uncommitted | ( | Object_id | id, |
std::unique_ptr< T > * | object_ptr | ||
) |
Retrieve a possibly uncommitted object by its object id without caching it.
The object is not cached and owned by the caller through unique_ptr it provides. The object may not be used as a parameter to the other dictionary client methods since it is not known by the object registry.
When the object is read from the persistent tables, the transaction isolation level is READ UNCOMMITTED. This is necessary to be able to read uncommitted data from an earlier stage of the same session.
T | Dictionary object type. |
id | Object id to retrieve. | |
[out] | object_ptr | Smart pointer with dictionary object, if present or with nullptr otherwise. |
false | No error. |
true | Error (from reading the dictionary tables). |
bool dd::cache::Dictionary_client::acquire_uncached_uncommitted | ( | Object_id | id, |
T ** | object | ||
) |
Retrieve a possibly uncommitted object by its object id without caching it.
The object is not cached but owned by the dictionary client, who makes sure it is deleted. The object must not be released, and may not be used as a parameter to the other dictionary client methods since it is not known by the object registry.
When the object is read from the persistent tables, the transaction isolation level is READ UNCOMMITTED. This is necessary to be able to read uncommitted data from an earlier stage of the same session.
T | Dictionary object type. |
id | Object id to retrieve. | |
[out] | object | Dictionary object, if present; otherwise nullptr. |
false | No error. |
true | Error (from reading the dictionary tables). |
|
private |
Auxiliary function to retrieve a possibly uncommitted object by its object id without caching it.
It is responsibility of the caller to delete the retrieved object.
|
private |
Get an uncommitted dictionary object that can be modified safely.
The difference between this method and acquire(), is that this method only looks in the local registry of uncommitted objects. That is, object created by acquire_for_modification() or registered with register_uncommitted_object(). It will not access the shared cache. Objects that have been dropped are returned as nullptr, but with the value of the parameter 'dropped' set to 'true'.
K | Key type. |
T | Dictionary object type. |
key | Key to use for looking up the object. | |
[out] | object | Object pointer, if an object exists, otherwise NULL. |
[out] | dropped | Object exists, but has been dropped and has not yet committed. In this case, 'object' is set to nullptr. |
|
inlineprivate |
Register an uncached object to be auto deleted.
T | Dictionary object type. |
object | Dictionary object to auto delete. |
bool dd::cache::Dictionary_client::check_constraint_exists | ( | const Schema & | schema, |
const String_type & | check_cons_name, | ||
bool * | exists | ||
) |
Check if schema contains check constraint with specified name.
schema | Schema containing the check constraint. | |
check_cons_name | Name of the check constraint. | |
[out] | exists | Set to true if check constraint with the name provided exists in the schema, false otherwise. |
false | No error. |
true | Error. |
bool dd::cache::Dictionary_client::check_foreign_key_exists | ( | const Schema & | schema, |
const String_type & | foreign_key_name, | ||
bool * | exists | ||
) |
Check if schema contains foreign key with specified name.
schema | Schema containing the foreign key. | |
foreign_key_name | Name of the foreign key. | |
[out] | exists | Set to true if foreign key with the name provided exists in the schema, false otherwise. |
false | No error. |
true | Error. |
void dd::cache::Dictionary_client::commit_modified_objects | ( | ) |
Remove the uncommitted objects from the client and put them into the shared cache, thereby making them visible to other clients.
Should be called after commit to disk but before metadata locks are released.
bool dd::cache::Dictionary_client::drop | ( | const T * | object | ) |
Remove and delete an object from the cache and the dd tables.
This function will remove the object from the local registry as well as the shared cache. This means that all keys associated with the object will be removed from the maps, and the cache element wrapper will be deleted. Afterwards, the object pointed to will also be deleted, and finally, the corresponding entry in the appropriate dd table is deleted. The object may not be accessed after calling this function.
T | Dictionary object type. |
object | Object to be dropped. |
false | The operation was successful. |
true | There was an error. |
void dd::cache::Dictionary_client::dump |
Debug dump of a partition of the client and its registry to stderr.
T | Dictionary object type. |
|
private |
Fetch objects from DD tables that match the supplied key.
Object_type | Type of object to fetch. |
coll | Vector to fill with objects. |
object_key | The search key. If key is not supplied, then we do full index scan. |
bool dd::cache::Dictionary_client::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).
parent_schema | Schema name of parent table. | |
parent_name | Table name of parent table. | |
parent_engine | Storage engine of parent table. | |
uncommitted | Use READ_UNCOMMITTED isolation. | |
[out] | children_schemas | Schema names of child tables. |
[out] | children_names | Table names of child tables. |
bool dd::cache::Dictionary_client::fetch_global_component_ids | ( | std::vector< Object_id > * | ids | ) | const |
Fetch all global component ids of the given type.
T | Type of components to get. |
[out] | ids | An std::vector containing all component ids. |
bool dd::cache::Dictionary_client::fetch_global_component_names | ( | std::vector< String_type > * | names | ) | const |
Fetch all global component names of the given type.
T | Type of components to get. |
[out] | names | An std::vector containing all component names. |
bool dd::cache::Dictionary_client::fetch_global_components | ( | Const_ptr_vec< T > * | coll | ) |
Fetch all global components of the given type.
T | Type of components to get. |
[out] | coll | An std::vector containing all components. |
bool dd::cache::Dictionary_client::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 "schema".
"name". The views are retrieved using READ_UNCOMMITTED reads as the views could be changed by the same statement (e.g. multi-table/-view RENAME TABLE).
T | Type of the object (View_table/View_routine) to retrieve view names for. |
schema | Schema name. | |
tbl_or_sf_name | Base table/ View/ Stored function name. | |
[out] | view_ids | Vector to store Object ids of all the views referencing schema.name. |
bool dd::cache::Dictionary_client::fetch_schema_component_names | ( | const Schema * | schema, |
std::vector< String_type > * | names | ||
) | const |
Fetch the names of the components in the schema.
Hidden components are ignored. E.g., Object with dd::Table::hidden() == true will be ignored.
T | Type of object to retrieve names for. |
schema | Schema for which to get component names. | |
[out] | names | An std::vector containing all object names. |
bool dd::cache::Dictionary_client::fetch_schema_component_names | ( | const Schema * | schema, |
std::vector< String_type > * | names | ||
) | const |
bool dd::cache::Dictionary_client::fetch_schema_component_names | ( | const Schema * | schema, |
std::vector< String_type > * | names | ||
) | const |
bool dd::cache::Dictionary_client::fetch_schema_component_names | ( | const Schema * | schema, |
std::vector< String_type > * | names | ||
) | const |
bool dd::cache::Dictionary_client::fetch_schema_components | ( | const Schema * | schema, |
Const_ptr_vec< T > * | coll | ||
) |
Fetch all components in the schema.
T | Type of components to get. |
schema | Schema for which to get components. | |
[out] | coll | An std::vector containing all components. |
bool dd::cache::Dictionary_client::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.
E.g., Object with dd::Table::hidden() == true will be ignored.
schema | Schema for which to get component names. | |
engine | Engine name of tables to match. | |
[out] | names | An std::vector containing all object names. |
bool dd::cache::Dictionary_client::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.
Ignore tables hidden by SE.
schema | Schema for which to get component names. | |
[out] | names | An std::vector containing all object names. |
bool dd::cache::Dictionary_client::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.
If the lambda returns true, iteration stops and the function returns.
Object_type | Entity type to examine. |
object_key | Key to use for selecting entities. |
processor | Lambda to execute for each entity. |
bool dd::cache::Dictionary_client::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.
engine | Name of the engine storing the table. | |
se_partition_id | SE private id of the table partition. | |
[out] | schema_name | Name of the schema containing the table. |
[out] | table_name | Name of the table. |
false | No error or if object was not found. The OUT params will be set to empty string when object is not found. |
true | Error. |
bool dd::cache::Dictionary_client::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.
engine | Name of the engine storing the table. | |
se_private_id | SE private id of the table. | |
[out] | schema_name | Name of the schema containing the table. |
[out] | table_name | Name of the table. |
false | No error OR if object was not found. The OUT params will be set to empty string when object is not found. |
true | Error. |
bool dd::cache::Dictionary_client::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.
schema | Schema containing the trigger. | |
trigger_name | Name of the trigger. | |
[out] | table_name | Name of the table for which trigger belongs to. Empty string if there is no such trigger. |
false | No error. |
true | Error. |
bool dd::cache::Dictionary_client::invalidate | ( | const String_type & | schema_name, |
const String_type & | table_name | ||
) |
Invalidate a cache entry.
This function will acquire a table object based on the schema qualified table name, and call 'invalidate(table_object)'.
schema_name | Name of the schema containing the table. |
table_name | Name of the table. |
false | No error. |
true | Error (from handling a cache miss, or from failing to get an MDL lock). |
void dd::cache::Dictionary_client::invalidate | ( | const T * | object | ) |
Invalidate a cache entry.
This function will remove and delete an object from the shared cache, based on the id of the object. If the object id is present in the local object registry and the auto releaser, it will be removed from there as well.
T | Dictionary object type. |
object | Object to be invalidated. |
bool dd::cache::Dictionary_client::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.
T | Type of dictionary objects to check. |
user | User name, including @ and host. | |
[out] | is_definer | True if the user is referenced as definer by some object. |
|
inlineprivate |
Remove an object from the auto delete vector.
T | Dictionary object type. |
object | Dictionary object to keep. |
|
private |
Transfer object ownership from caller to Dictionary_client, and register the object as dropped.
This method is used internally by the Dictionary_client for keeping track of dropped objects. This is needed before transaction commit if an attempt is made to acquire the dropped object, to avoid consulting the shared cache, which might contaminate the cache due to a cache miss (handled with isolation level READ_COMMITTED). Instead of consulting the shared cache, this Dictionary_client will recognize that the object is dropped, and return a nullptr.
This method takes a non-const argument as it only makes sense to register objects not acquired from the shared cache.
T | Dictionary object type. |
object | Object to transfer ownership. |
|
private |
Transfer object ownership from caller to Dictionary_client, and register the object as uncommitted.
This is intended for objects created by the caller that should be managed by Dictionary_client. Transferring an object in this way will make it accessible by calling acquire().
This method takes a non-const argument as it only makes sense to register objects not acquired from the shared cache.
T | Dictionary object type. |
object | Object to transfer ownership. |
|
private |
Mark all objects of a certain type as not being used by this client.
This function is called with the client's own object registry, or with the registry of an auto releaser (which will contain a subset of the objects in the client's object registry).
The function will release all objects of a given type in the registry submitted.The objects must be present and in use. If the objects become unused, they are added to the free list in the shared cache, which is then rectified to enforce its capacity constraints. The objects are also removed from the client's object registry.
T | Dictionary object type. |
registry | Object registry tp release from. |
|
private |
Release all objects in the submitted object registry.
This function will release all objects from the client's registry, or from the registry of an auto releaser.
registry | Object registry tp release from. |
bool dd::cache::Dictionary_client::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.
schema_name | Schema name of the table |
table_name | Table name of which stats should be cleaned. |
|
private |
Remove the uncommitted objects from the client and (depending on the parameter) put them into the shared cache, thereby making them visible to other clients.
Should be called after commit to disk but before metadata locks are released.
Can also be called after rollback in order to explicitly throw the modified objects away before making any actions to compensate for a partially completed statement. Note that uncommitted objects are automatically removed once the topmost stack-allocated auto releaser goes out of scope, so calling this function in case of abort is only needed to make acquire return the old object again later in the same statement.
commit_to_shared_cache | If true, uncommitted objects will be put into the shared cache. |
T | Dictionary object type. |
void dd::cache::Dictionary_client::rollback_modified_objects | ( | ) |
Remove the uncommitted objects from the client.
Can also be used to explicitly throw the modified objects away before making any actions to compensate for a partially completed statement. Note that uncommitted objects are automatically removed once the topmost stack-allocated auto releaser goes out of scope, so calling this function in case of abort is only needed to make acquire return the old object again later in the same statement.
bool dd::cache::Dictionary_client::store | ( | Index_stat * | object | ) |
bool dd::cache::Dictionary_client::store | ( | T * | object | ) |
Store a new dictionary object.
This function will write the object to the dd tables. The object is added neither to the dictionary client's object registry nor the shared cache.
T | Dictionary object type. |
object | Object to be stored. |
false | The operation was successful. |
true | There was an error. |
bool dd::cache::Dictionary_client::store | ( | Table_stat * | object | ) |
bool dd::cache::Dictionary_client::update | ( | T * | new_object | ) |
Update a persisted dictionary object, but keep the shared cache unchanged.
This function will store a dictionary object to the DD tables after verifying that an object with the same id already exists. The old object, which may be present in the shared dictionary cache, is not modified. To make the changes visible in the shared cache, please call remove_uncommitted_objects().
T | Dictionary object type. |
new_object | New object, not present in the cache, to be stored persistently. |
false | The operation was successful. |
true | There was an error. |
|
private |
|
private |
|
private |
Se-private ids known not to exist in either TABLES or PARTITIONS or both.
|
private |
|
private |
|
private |
|
private |
|
private |