MySQL 8.4.3
Source Code Documentation
|
A pending metadata lock request. More...
#include <mdl.h>
Public Member Functions | |
void | init_with_source (MDL_key::enum_mdl_namespace namespace_arg, const char *db_arg, const char *name_arg, enum_mdl_type mdl_type_arg, enum_mdl_duration mdl_duration_arg, const char *src_file, uint src_line) |
Initialize a lock request. More... | |
void | init_by_key_with_source (const MDL_key *key_arg, enum_mdl_type mdl_type_arg, enum_mdl_duration mdl_duration_arg, const char *src_file, uint src_line) |
Initialize a lock request using pre-built MDL_key. More... | |
void | init_by_part_key_with_source (MDL_key::enum_mdl_namespace namespace_arg, const char *part_key_arg, size_t part_key_length_arg, size_t db_length_arg, enum_mdl_type mdl_type_arg, enum_mdl_duration mdl_duration_arg, const char *src_file, uint src_line) |
Initialize a lock request using partial MDL key. More... | |
void | set_type (enum_mdl_type type_arg) |
Set type of lock request. More... | |
bool | is_write_lock_request () const |
Is this a request for a lock which allow data to be updated? More... | |
bool | is_ddl_or_lock_tables_lock_request () const |
Is this a request for a strong, DDL/LOCK TABLES-type, of lock? More... | |
MDL_request ()=default | |
This constructor exists for two reasons: More... | |
MDL_request (const MDL_request &rhs) | |
MDL_request (MDL_request &&)=default | |
MDL_request & | operator= (MDL_request &&)=default |
Static Public Member Functions | |
static void * | operator new (size_t size, MEM_ROOT *mem_root, const std::nothrow_t &arg=std::nothrow) noexcept |
static void | operator delete (void *, MEM_ROOT *, const std::nothrow_t &) noexcept |
Public Attributes | |
enum_mdl_type | type {MDL_INTENTION_EXCLUSIVE} |
Type of metadata lock. More... | |
enum_mdl_duration | duration {MDL_STATEMENT} |
Duration for requested lock. More... | |
MDL_request * | next_in_list {nullptr} |
Pointers for participating in the list of lock requests for this context. More... | |
MDL_request ** | prev_in_list {nullptr} |
MDL_ticket * | ticket {nullptr} |
Pointer to the lock ticket object for this lock request. More... | |
MDL_key | key |
A lock is requested based on a fully qualified name and type. More... | |
const char * | m_src_file {nullptr} |
uint | m_src_line {0} |
A pending metadata lock request.
A lock request and a granted metadata lock are represented by different classes because they have different allocation sites and hence different lifetimes. The allocation of lock requests is controlled from outside of the MDL subsystem, while allocation of granted locks (tickets) is controlled within the MDL subsystem.
|
default |
This constructor exists for two reasons:
In some legacy cases Table_ref objects are copy-assigned without intention to copy the Table_ref::mdl_request member. In this cases they are overwritten with an uninitialized MDL_request object. The cases are:
No new cases are expected. In all other cases, so far only Locked_tables_list::rename_locked_table(), a move assignment is actually what is intended.
|
inline |
|
default |
void MDL_request::init_by_key_with_source | ( | const MDL_key * | key_arg, |
enum_mdl_type | mdl_type_arg, | ||
enum_mdl_duration | mdl_duration_arg, | ||
const char * | src_file, | ||
uint | src_line | ||
) |
Initialize a lock request using pre-built MDL_key.
key_arg | The pre-built MDL key for the request. |
mdl_type_arg | The MDL lock type for the request. |
mdl_duration_arg | The MDL duration for the request. |
src_file | Source file name issuing the request. |
src_line | Source line number issuing the request. |
void MDL_request::init_by_part_key_with_source | ( | MDL_key::enum_mdl_namespace | namespace_arg, |
const char * | part_key_arg, | ||
size_t | part_key_length_arg, | ||
size_t | db_length_arg, | ||
enum_mdl_type | mdl_type_arg, | ||
enum_mdl_duration | mdl_duration_arg, | ||
const char * | src_file, | ||
uint | src_line | ||
) |
Initialize a lock request using partial MDL key.
namespace_arg | Id of namespace of object to be locked |
part_key_arg | Partial key. |
part_key_length_arg | Partial key length |
db_length_arg | Database name length. |
mdl_type_arg | The MDL lock type for the request. |
mdl_duration_arg | The MDL duration for the request. |
src_file | Source file name issuing the request. |
src_line | Source line number issuing the request. |
void MDL_request::init_with_source | ( | MDL_key::enum_mdl_namespace | mdl_namespace, |
const char * | db_arg, | ||
const char * | name_arg, | ||
enum_mdl_type | mdl_type_arg, | ||
enum_mdl_duration | mdl_duration_arg, | ||
const char * | src_file, | ||
uint | src_line | ||
) |
Initialize a lock request.
This is to be used for every lock request.
Note that initialization and allocation are split into two calls. This is to allow flexible memory management of lock requests. Normally a lock request is stored in statement memory (e.g. is a member of class Table_ref), but we would also like to allow allocation of lock requests in other memory roots, for example in the grant subsystem, to lock privilege tables.
The MDL subsystem does not own or manage memory of lock requests.
mdl_namespace | Id of namespace of object to be locked |
db_arg | Name of database to which the object belongs |
name_arg | Name of of the object |
mdl_type_arg | The MDL lock type for the request. |
mdl_duration_arg | The MDL duration for the request. |
src_file | Source file name issuing the request. |
src_line | Source line number issuing the request. |
|
inline |
Is this a request for a strong, DDL/LOCK TABLES-type, of lock?
|
inline |
Is this a request for a lock which allow data to be updated?
|
inlinestaticnoexcept |
|
inlinestaticnoexcept |
|
default |
|
inline |
Set type of lock request.
Can be only applied to pending locks.
enum_mdl_duration MDL_request::duration {MDL_STATEMENT} |
Duration for requested lock.
MDL_key MDL_request::key |
A lock is requested based on a fully qualified name and type.
const char* MDL_request::m_src_file {nullptr} |
uint MDL_request::m_src_line {0} |
MDL_request* MDL_request::next_in_list {nullptr} |
Pointers for participating in the list of lock requests for this context.
MDL_request** MDL_request::prev_in_list {nullptr} |
MDL_ticket* MDL_request::ticket {nullptr} |
Pointer to the lock ticket object for this lock request.
Valid only if this lock request is satisfied.
enum_mdl_type MDL_request::type {MDL_INTENTION_EXCLUSIVE} |
Type of metadata lock.