![]() |
MySQL 9.2.0
Source Code Documentation
|
Metadata lock object key. More...
#include <mdl.h>
Public Types | |
enum | enum_mdl_namespace { GLOBAL = 0 , BACKUP_LOCK , TABLESPACE , SCHEMA , TABLE , FUNCTION , PROCEDURE , TRIGGER , EVENT , COMMIT , USER_LEVEL_LOCK , LOCKING_SERVICE , SRID , ACL_CACHE , COLUMN_STATISTICS , RESOURCE_GROUPS , FOREIGN_KEY , CHECK_CONSTRAINT , LIBRARY , NAMESPACE_END } |
Object namespaces. More... | |
Public Member Functions | |
const uchar * | ptr () const |
uint | length () const |
const char * | db_name () const |
uint | db_name_length () const |
const char * | name () const |
uint | name_length () const |
const char * | col_name () const |
uint | col_name_length () const |
enum_mdl_namespace | mdl_namespace () const |
void | mdl_key_init (enum_mdl_namespace mdl_namespace, const char *db, const char *name) |
Construct a metadata lock key from a triplet (mdl_namespace, database and name). More... | |
void | mdl_key_init (enum_mdl_namespace mdl_namespace, const char *db, const char *name, const char *column_name) |
Construct a metadata lock key from a quadruplet (mdl_namespace, database, table and column name). More... | |
void | mdl_key_init (enum_mdl_namespace mdl_namespace, const char *db, const char *normalized_name, size_t normalized_name_len, const char *name) |
Construct a metadata lock key from a quadruplet (mdl_namespace, database, normalized object name buffer and the object name). More... | |
void | mdl_key_init (enum_mdl_namespace mdl_namespace, const char *part_key, size_t part_key_length, size_t db_length) |
Construct a metadata lock key from namespace and partial key, which contains info about object database and name. More... | |
void | mdl_key_init (const MDL_key *rhs) |
void | reset () |
bool | is_equal (const MDL_key *rhs) const |
int | cmp (const MDL_key *rhs) const |
Compare two MDL keys lexicographically. More... | |
MDL_key (const MDL_key &rhs) | |
MDL_key & | operator= (const MDL_key &rhs) |
MDL_key (enum_mdl_namespace namespace_arg, const char *db_arg, const char *name_arg) | |
MDL_key ()=default | |
const PSI_stage_info * | get_wait_state_name () const |
Get thread state name to be used in case when we have to wait on resource identified by key. More... | |
Static Public Member Functions | |
static void | init_psi_keys () |
Private Member Functions | |
bool | use_normalized_object_name () const |
Check if normalized object name should be used. More... | |
Private Attributes | |
uint16 | m_length {0} |
uint16 | m_db_name_length {0} |
uint16 | m_object_name_length {0} |
char | m_ptr [MAX_MDLKEY_LENGTH] {0} |
Static Private Attributes | |
static PSI_stage_info | m_namespace_to_wait_state_name [NAMESPACE_END] |
Thread state names to be used in case when we have to wait on resource belonging to certain namespace. More... | |
Metadata lock object key.
A lock is requested or granted based on a fully qualified name and type. E.g. They key for a table consists of <0 (=table)>+<database>+<table name>. Elsewhere in the comments this triple will be referred to simply as "key" or "name".
Object namespaces.
Sic: when adding a new member to this enum make sure to update m_namespace_to_wait_state_name array in mdl.cc!
Different types of objects exist in different namespaces
|
inline |
|
inline |
|
default |
|
inline |
Compare two MDL keys lexicographically.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Get thread state name to be used in case when we have to wait on resource identified by key.
|
static |
|
inline |
|
inline |
|
inline |
|
inline |
Construct a metadata lock key from a triplet (mdl_namespace, database and name).
mdl_namespace | Id of namespace of object to be locked |
db | Name of database to which the object belongs |
name | Name of of the object |
|
inline |
Construct a metadata lock key from a quadruplet (mdl_namespace, database, table and column name).
mdl_namespace | Id of namespace of object to be locked |
db | Name of database to which the object belongs |
name | Name of of the object |
column_name | Name of of the column |
|
inline |
Construct a metadata lock key from a quadruplet (mdl_namespace, database, normalized object name buffer and the object name).
Routine, Event and Resource group names are case sensitive and accent sensitive. So normalized object name is used to form a MDL_key.
With the UTF8MB3 charset space reserved for the db name/object name is 64 * 3 bytes. utf8mb3_general_ci collation is used for the Routine, Event and Resource group names. With this collation, the normalized object name uses just 2 bytes for each character (max length = 64 * 2 bytes). MDL_key has still some space to store the object names. If there is a sufficient space for the object name in the MDL_key then it is stored in the MDL_key (similar to the column names in the MDL_key). Actual object name is used by the PFS. Not listing actual object name from the PFS should be OK when there is no space to store it (instead of increasing the MDL_key size). Object name is not used in the key comparisons. So only (mdl_namespace + strlen(db) + 1 + normalized_name_len + 1) value is stored in the m_length member.
mdl_namespace | Id of namespace of object to be locked. |
db | Name of database to which the object belongs. |
normalized_name | Normalized name of the object. |
normalized_name_len | Length of the normalized object name. |
name | Name of the object. |
|
inline |
Construct a metadata lock key from namespace and partial key, which contains info about object database and name.
mdl_namespace | Id of namespace of object to be locked |
part_key | Partial key. |
part_key_length | Partial key length |
db_length | Database name length. |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlineprivate |
Check if normalized object name should be used.
|
private |
|
private |
|
staticprivate |
Thread state names to be used in case when we have to wait on resource belonging to certain namespace.
|
private |
|
private |