Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions sql/mdl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ PSI_stage_info MDL_key::m_namespace_to_wait_state_name[NAMESPACE_END]=

static const LEX_STRING lock_types[]=
{
{},
{ C_STRING_WITH_LEN("MDL_INTENTION_EXCLUSIVE") },
{ C_STRING_WITH_LEN("MDL_SHARED") },
{ C_STRING_WITH_LEN("MDL_SHARED_HIGH_PRIO") },
Expand All @@ -129,6 +130,7 @@ static const LEX_STRING lock_types[]=

static const LEX_STRING backup_lock_types[]=
{
{},
{ C_STRING_WITH_LEN("MDL_BACKUP_START") },
{ C_STRING_WITH_LEN("MDL_BACKUP_FLUSH") },
{ C_STRING_WITH_LEN("MDL_BACKUP_WAIT_FLUSH") },
Expand Down Expand Up @@ -2154,6 +2156,7 @@ void MDL_lock::reschedule_waiters()
const MDL_lock::bitmap_t
MDL_lock::MDL_scoped_lock::m_granted_incompatible[MDL_TYPE_END]=
{
0,
MDL_BIT(MDL_EXCLUSIVE) | MDL_BIT(MDL_SHARED),
MDL_BIT(MDL_EXCLUSIVE) | MDL_BIT(MDL_INTENTION_EXCLUSIVE),
0, 0, 0, 0, 0, 0, 0,
Expand All @@ -2163,6 +2166,7 @@ MDL_lock::MDL_scoped_lock::m_granted_incompatible[MDL_TYPE_END]=
const MDL_lock::bitmap_t
MDL_lock::MDL_scoped_lock::m_waiting_incompatible[MDL_TYPE_END]=
{
0,
MDL_BIT(MDL_EXCLUSIVE) | MDL_BIT(MDL_SHARED),
MDL_BIT(MDL_EXCLUSIVE), 0, 0, 0, 0, 0, 0, 0, 0
};
Expand Down Expand Up @@ -2227,6 +2231,7 @@ MDL_lock::MDL_scoped_lock::m_waiting_incompatible[MDL_TYPE_END]=
const MDL_lock::bitmap_t
MDL_lock::MDL_object_lock::m_granted_incompatible[MDL_TYPE_END]=
{
0,
0,
MDL_BIT(MDL_EXCLUSIVE),
MDL_BIT(MDL_EXCLUSIVE),
Expand Down Expand Up @@ -2255,6 +2260,7 @@ MDL_lock::MDL_object_lock::m_granted_incompatible[MDL_TYPE_END]=
const MDL_lock::bitmap_t
MDL_lock::MDL_object_lock::m_waiting_incompatible[MDL_TYPE_END]=
{
0,
0,
MDL_BIT(MDL_EXCLUSIVE),
0,
Expand Down Expand Up @@ -2330,6 +2336,7 @@ MDL_lock::MDL_object_lock::m_waiting_incompatible[MDL_TYPE_END]=
const MDL_lock::bitmap_t
MDL_lock::MDL_backup_lock::m_granted_incompatible[MDL_BACKUP_END]=
{
0,
/* MDL_BACKUP_START */
MDL_BIT(MDL_BACKUP_START) | MDL_BIT(MDL_BACKUP_FLUSH) | MDL_BIT(MDL_BACKUP_WAIT_FLUSH) | MDL_BIT(MDL_BACKUP_WAIT_DDL) | MDL_BIT(MDL_BACKUP_WAIT_COMMIT) | MDL_BIT(MDL_BACKUP_BLOCK_DDL),
MDL_BIT(MDL_BACKUP_START),
Expand Down Expand Up @@ -2357,6 +2364,7 @@ MDL_lock::MDL_backup_lock::m_granted_incompatible[MDL_BACKUP_END]=
const MDL_lock::bitmap_t
MDL_lock::MDL_backup_lock::m_waiting_incompatible[MDL_BACKUP_END]=
{
0,
/* MDL_BACKUP_START */
MDL_BIT(MDL_BACKUP_FLUSH) | MDL_BIT(MDL_BACKUP_WAIT_FLUSH) | MDL_BIT(MDL_BACKUP_WAIT_DDL) | MDL_BIT(MDL_BACKUP_WAIT_COMMIT) | MDL_BIT(MDL_BACKUP_BLOCK_DDL),
0,
Expand Down
34 changes: 17 additions & 17 deletions sql/mdl.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ enum enum_mdl_type {
that not-inited request has MDL_INTENTION_EXCLUSIVE.
Must fix tests, as at least mysql_rm_table_no_locks() depends on this.
*/
MDL_NOT_INITIALIZED= -1,
MDL_NOT_INITIALIZED= 0,
/*
An intention exclusive metadata lock (IX). Used only for scoped locks.
Owner of this type of lock can acquire upgradable exclusive locks on
Expand All @@ -149,7 +149,7 @@ enum enum_mdl_type {
object metadata. Object may refer table, stored procedure, trigger,
view/etc.
*/
MDL_INTENTION_EXCLUSIVE= 0,
MDL_INTENTION_EXCLUSIVE,
/*
A shared metadata lock (S).
To be used in cases when we are interested in object metadata only
Expand Down Expand Up @@ -273,51 +273,51 @@ enum enum_mdl_type {
/**
Block concurrent backup
*/
#define MDL_BACKUP_START enum_mdl_type(0)
#define MDL_BACKUP_START enum_mdl_type(1)
/**
Block new write requests to non transactional tables
*/
#define MDL_BACKUP_FLUSH enum_mdl_type(1)
#define MDL_BACKUP_FLUSH enum_mdl_type(2)
/**
In addition to previous locks, blocks running requests to non trans tables
Used to wait until all DML usage of on trans tables are finished
*/
#define MDL_BACKUP_WAIT_FLUSH enum_mdl_type(2)
#define MDL_BACKUP_WAIT_FLUSH enum_mdl_type(3)
/**
In addition to previous locks, blocks new DDL's from starting
*/
#define MDL_BACKUP_WAIT_DDL enum_mdl_type(3)
#define MDL_BACKUP_WAIT_DDL enum_mdl_type(4)
/**
In addition to previous locks, blocks commits
*/
#define MDL_BACKUP_WAIT_COMMIT enum_mdl_type(4)
#define MDL_BACKUP_WAIT_COMMIT enum_mdl_type(5)

/**
Blocks (or is blocked by) statements that intend to modify data. Acquired
before commit lock by FLUSH TABLES WITH READ LOCK.
*/
#define MDL_BACKUP_FTWRL1 enum_mdl_type(5)
#define MDL_BACKUP_FTWRL1 enum_mdl_type(6)

/**
Blocks (or is blocked by) commits. Acquired after global read lock by
FLUSH TABLES WITH READ LOCK.
*/
#define MDL_BACKUP_FTWRL2 enum_mdl_type(6)
#define MDL_BACKUP_FTWRL2 enum_mdl_type(7)

#define MDL_BACKUP_DML enum_mdl_type(7)
#define MDL_BACKUP_TRANS_DML enum_mdl_type(8)
#define MDL_BACKUP_SYS_DML enum_mdl_type(9)
#define MDL_BACKUP_DML enum_mdl_type(8)
#define MDL_BACKUP_TRANS_DML enum_mdl_type(9)
#define MDL_BACKUP_SYS_DML enum_mdl_type(10)

/**
Must be acquired by DDL statements that intend to modify data.
Currently it's also used for LOCK TABLES.
*/
#define MDL_BACKUP_DDL enum_mdl_type(10)
#define MDL_BACKUP_DDL enum_mdl_type(11)

/**
Blocks new DDL's. Used by backup code to enable DDL logging
*/
#define MDL_BACKUP_BLOCK_DDL enum_mdl_type(11)
#define MDL_BACKUP_BLOCK_DDL enum_mdl_type(12)

/*
Statement is modifying data, but will not block MDL_BACKUP_DDL or earlier
Expand All @@ -326,13 +326,13 @@ enum enum_mdl_type {
MDL_BACKUP_ALTER_COPY while alter table is copying or modifying data.
*/

#define MDL_BACKUP_ALTER_COPY enum_mdl_type(12)
#define MDL_BACKUP_ALTER_COPY enum_mdl_type(13)

/**
Must be acquired during commit.
*/
#define MDL_BACKUP_COMMIT enum_mdl_type(13)
#define MDL_BACKUP_END enum_mdl_type(14)
#define MDL_BACKUP_COMMIT enum_mdl_type(14)
#define MDL_BACKUP_END enum_mdl_type(15)


/** Duration of metadata lock. */
Expand Down
Loading