MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MDL_request Class Reference

#include <mdl.h>

Collaboration diagram for MDL_request:

Public Member Functions

void init (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)
void init (const MDL_key *key_arg, enum_mdl_type mdl_type_arg, enum_mdl_duration mdl_duration_arg)
void set_type (enum_mdl_type type_arg)
MDL_requestoperator= (const MDL_request &rhs)
 MDL_request (const MDL_request *rhs)

Static Public Member Functions

static void * operator new (size_t size, MEM_ROOT *mem_root) throw ()
static void operator delete (void *ptr, MEM_ROOT *mem_root)

Public Attributes

enum enum_mdl_type type
enum enum_mdl_duration duration
MDL_requestnext_in_list
MDL_request ** prev_in_list
MDL_ticketticket
MDL_key key

Detailed Description

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.

MDL_request is a C structure, you don't need to call a constructor or destructor for it.

Definition at line 418 of file mdl.h.

Member Function Documentation

void MDL_request::init ( 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 
)

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 struct TABLE_LIST), 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.

Parameters
mdl_namespaceId of namespace of object to be locked
dbName of database to which the object belongs
nameName of of the object
mdl_typeThe MDL lock type for the request.

Definition at line 1109 of file mdl.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

void MDL_request::init ( const MDL_key key_arg,
enum_mdl_type  mdl_type_arg,
enum_mdl_duration  mdl_duration_arg 
)

Initialize a lock request using pre-built MDL_key.

See Also
MDL_request::init(namespace, db, name, type).
Parameters
key_argThe pre-built MDL key for the request.
mdl_type_argThe MDL lock type for the request.

Definition at line 1131 of file mdl.cc.

Here is the call graph for this function:

void MDL_request::set_type ( enum_mdl_type  type_arg)
inline

Set type of lock request. Can be only applied to pending locks.

Definition at line 452 of file mdl.h.

Here is the caller graph for this function:

Member Data Documentation

enum enum_mdl_duration MDL_request::duration

Duration for requested lock.

Definition at line 424 of file mdl.h.

MDL_key MDL_request::key

A lock is requested based on a fully qualified name and type.

Definition at line 438 of file mdl.h.

MDL_request* MDL_request::next_in_list

Pointers for participating in the list of lock requests for this context.

Definition at line 429 of file mdl.h.

MDL_ticket* MDL_request::ticket

Pointer to the lock ticket object for this lock request. Valid only if this lock request is satisfied.

Definition at line 435 of file mdl.h.

enum enum_mdl_type MDL_request::type

Type of metadata lock.

Definition at line 422 of file mdl.h.


The documentation for this class was generated from the following files: