My Project
Public Types | Public Member Functions
MDL_key Class Reference

#include <mdl.h>

List of all members.

Public Types

enum  enum_mdl_namespace {
  GLOBAL = 0, SCHEMA, TABLE, FUNCTION,
  PROCEDURE, TRIGGER, EVENT, COMMIT,
  NAMESPACE_END
}

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
enum_mdl_namespace mdl_namespace () const
void mdl_key_init (enum_mdl_namespace mdl_namespace, const char *db, const char *name)
void mdl_key_init (const MDL_key *rhs)
bool is_equal (const MDL_key *rhs) const
int cmp (const MDL_key *rhs) const
 MDL_key (const MDL_key *rhs)
 MDL_key (enum_mdl_namespace namespace_arg, const char *db_arg, const char *name_arg)
const PSI_stage_info * get_wait_state_name () const

Detailed Description

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>+

Elsewhere in the comments this triple will be referred to simply as "key" or "name".


Member Enumeration Documentation

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

  • TABLE is for tables and views.
  • FUNCTION is for stored functions.
  • PROCEDURE is for stored procedures.
  • TRIGGER is for triggers.
  • EVENT is for event scheduler events Note that although there isn't metadata locking on triggers, it's necessary to have a separate namespace for them since MDL_key is also used outside of the MDL subsystem.

Member Function Documentation

int MDL_key::cmp ( const MDL_key rhs) const [inline]

Compare two MDL keys lexicographically.

const PSI_stage_info* MDL_key::get_wait_state_name ( ) const [inline]

Get thread state name to be used in case when we have to wait on resource identified by key.

void MDL_key::mdl_key_init ( enum_mdl_namespace  mdl_namespace,
const char *  db,
const char *  name 
) [inline]

Construct a metadata lock key from a triplet (mdl_namespace, database and name).

Remarks:
The key for a table is <mdl_namespace>+<database name>="">+
mdl_namespace Id of namespace of object to be locked
Parameters:
dbName of database to which the object belongs
nameName of of the object
keyWhere to store the the MDL key.

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines