My Project
Public Member Functions | Public Attributes | Friends
MDL_ticket Class Reference

#include <mdl.h>

Inheritance diagram for MDL_ticket:
MDL_wait_for_subgraph

List of all members.

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

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.

Member Function Documentation

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.

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

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

Member Data Documentation

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

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


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