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

#include <mdl.h>

Inheritance diagram for MDL_ticket:
Collaboration diagram for MDL_ticket:

Public Member Functions

bool has_pending_conflicting_lock () const
MDL_contextget_ctx () const
bool is_upgradable_or_exclusive () const
enum_mdl_type get_type () const
MDL_lockget_lock () const
void downgrade_lock (enum_mdl_type type)
bool has_stronger_or_equal_type (enum_mdl_type type) const
bool is_incompatible_when_granted (enum_mdl_type type) const
bool is_incompatible_when_waiting (enum_mdl_type type) const
virtual bool accept_visitor (MDL_wait_for_graph_visitor *dvisitor)
virtual uint get_deadlock_weight () const

Public Attributes

MDL_ticketnext_in_context
MDL_ticket ** prev_in_context
MDL_ticketnext_in_lock
MDL_ticket ** prev_in_lock

Friends

class MDL_context

Additional Inherited Members

- Public Types inherited from MDL_wait_for_subgraph
enum  enum_deadlock_weight { DEADLOCK_WEIGHT_DML = 0, DEADLOCK_WEIGHT_DDL = 100 }

Detailed Description

A granted metadata lock.

Warning
MDL_ticket members are private to the MDL subsystem.
Note
Multiple shared locks on a same object are represented by a single ticket. The same does not apply for other lock types.
There are two groups of MDL_ticket members:
  • "Externally accessible". These members can be accessed from threads/contexts different than ticket owner in cases when ticket participates in some list of granted or waiting tickets for a lock. Therefore one should change these members before including then to waiting/granted lists or while holding lock protecting those lists.
  • "Context private". Such members are private to thread/context owning this ticket. I.e. they should not be accessed from other threads/contexts.

Definition at line 564 of file mdl.h.

Member Function Documentation

bool MDL_ticket::accept_visitor ( MDL_wait_for_graph_visitor gvisitor)
virtual

Implement MDL_wait_for_subgraph interface.

Traverse a portion of wait-for graph which is reachable through the edge represented by this ticket and search for deadlocks.

Return values
TRUEA deadlock is found. A pointer to deadlock victim is saved in the visitor.
FALSE

Implements MDL_wait_for_subgraph.

Definition at line 2590 of file mdl.cc.

void MDL_ticket::downgrade_lock ( enum_mdl_type  type)

Downgrade an EXCLUSIVE or SHARED_NO_WRITE lock to shared metadata lock.

Parameters
typeType of lock to which exclusive lock should be downgraded.

Definition at line 2793 of file mdl.cc.

Here is the caller graph for this function:

uint MDL_ticket::get_deadlock_weight ( ) const
virtual

Return the 'weight' of this ticket for the victim selection algorithm. Requests with lower weight are preferred to requests with higher weight when choosing a victim.

Implements MDL_wait_for_subgraph.

Definition at line 1205 of file mdl.cc.

Here is the caller graph for this function:

bool MDL_ticket::has_pending_conflicting_lock ( ) const

Check if we have any pending locks which conflict with existing shared lock.

Precondition
The ticket must match an acquired lock.
Returns
TRUE if there is a conflicting lock request, FALSE otherwise.

Definition at line 2863 of file mdl.cc.

bool MDL_ticket::has_stronger_or_equal_type ( enum_mdl_type  type) const

Check if ticket represents metadata lock of "stronger" or equal type than specified one. I.e. if metadata lock represented by ticket won't allow any of locks which are not allowed by specified type of lock.

Returns
TRUE if ticket has stronger or equal type FALSE otherwise.

Definition at line 1818 of file mdl.cc.

Here is the caller graph for this function:

Member Data Documentation

MDL_ticket* MDL_ticket::next_in_context

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

Definition at line 571 of file mdl.h.

MDL_ticket* MDL_ticket::next_in_lock

Pointers for participating in the list of satisfied/pending requests for the lock. Externally accessible.

Definition at line 577 of file mdl.h.


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