summaryrefslogtreecommitdiff
path: root/sql/mdl.cc
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2021-03-30 17:06:55 +0300
committerSergei Golubchik <serg@mariadb.org>2021-05-19 22:54:13 +0200
commit83e529eced51aa965805e894349bbadd26881f3f (patch)
tree2f13b79cf5648498ee709424ea37105be730fcf3 /sql/mdl.cc
parent496a14e18714ac3f0b686ec5f57bf88e96512d2f (diff)
downloadmariadb-git-83e529eced51aa965805e894349bbadd26881f3f.tar.gz
MDEV-18465 Logging of DDL statements during backup
Many of the changes was needed to be able to collect and print engine name and table version id's in the ddl log.
Diffstat (limited to 'sql/mdl.cc')
-rw-r--r--sql/mdl.cc21
1 files changed, 15 insertions, 6 deletions
diff --git a/sql/mdl.cc b/sql/mdl.cc
index e83ef151554..1bacdf8f67b 100644
--- a/sql/mdl.cc
+++ b/sql/mdl.cc
@@ -1584,7 +1584,7 @@ MDL_lock::MDL_object_lock::m_waiting_incompatible[MDL_TYPE_END]=
TD | + + + + + - - + + + + + + + |
SD | + + + + - - - + + + + + + + |
DDL | + + + - - - - + + + + - + + |
- BLOCK_DDL | + + + + + + + + + + - + + + |
+ BLOCK_DDL | - + + + + + + + + + - + + + |
ALTER_COP | + + + + + - - + + + + + + + |
COMMIT | + + + + - + - + + + + + + + |
@@ -1623,7 +1623,7 @@ const MDL_lock::bitmap_t
MDL_lock::MDL_backup_lock::m_granted_incompatible[MDL_BACKUP_END]=
{
/* 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_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),
MDL_BIT(MDL_BACKUP_START) | MDL_BIT(MDL_BACKUP_DML),
MDL_BIT(MDL_BACKUP_START) | MDL_BIT(MDL_BACKUP_DML) | MDL_BIT(MDL_BACKUP_DDL),
@@ -1639,7 +1639,7 @@ MDL_lock::MDL_backup_lock::m_granted_incompatible[MDL_BACKUP_END]=
/* MDL_BACKUP_DDL */
MDL_BIT(MDL_BACKUP_WAIT_DDL) | MDL_BIT(MDL_BACKUP_WAIT_COMMIT) | MDL_BIT(MDL_BACKUP_FTWRL1) | MDL_BIT(MDL_BACKUP_FTWRL2) | MDL_BIT(MDL_BACKUP_BLOCK_DDL),
/* MDL_BACKUP_BLOCK_DDL */
- MDL_BIT(MDL_BACKUP_DDL),
+ 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_DDL),
MDL_BIT(MDL_BACKUP_FTWRL1) | MDL_BIT(MDL_BACKUP_FTWRL2),
/* MDL_BACKUP_COMMIT */
MDL_BIT(MDL_BACKUP_WAIT_COMMIT) | MDL_BIT(MDL_BACKUP_FTWRL2)
@@ -1650,7 +1650,7 @@ const MDL_lock::bitmap_t
MDL_lock::MDL_backup_lock::m_waiting_incompatible[MDL_BACKUP_END]=
{
/* 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_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,
0,
0,
@@ -1666,7 +1666,7 @@ MDL_lock::MDL_backup_lock::m_waiting_incompatible[MDL_BACKUP_END]=
/* MDL_BACKUP_DDL */
MDL_BIT(MDL_BACKUP_WAIT_DDL) | MDL_BIT(MDL_BACKUP_WAIT_COMMIT) | MDL_BIT(MDL_BACKUP_FTWRL1) | MDL_BIT(MDL_BACKUP_FTWRL2) | MDL_BIT(MDL_BACKUP_BLOCK_DDL),
/* MDL_BACKUP_BLOCK_DDL */
- 0,
+ MDL_BIT(MDL_BACKUP_START),
MDL_BIT(MDL_BACKUP_FTWRL1) | MDL_BIT(MDL_BACKUP_FTWRL2),
/* MDL_BACKUP_COMMIT */
MDL_BIT(MDL_BACKUP_WAIT_COMMIT) | MDL_BIT(MDL_BACKUP_FTWRL2)
@@ -2911,6 +2911,10 @@ void MDL_context::release_all_locks_for_name(MDL_ticket *name)
void MDL_ticket::downgrade_lock(enum_mdl_type type)
{
+ DBUG_ENTER("MDL_ticket::downgrade_lock");
+ DBUG_PRINT("enter",("old_type: %s new_type: %s",
+ get_type_name()->str,
+ get_type_name(type)->str));
/*
Do nothing if already downgraded. Used when we FLUSH TABLE under
LOCK TABLES and a table is listed twice in LOCK TABLES list.
@@ -2919,7 +2923,10 @@ void MDL_ticket::downgrade_lock(enum_mdl_type type)
here that target lock is weaker than existing lock.
*/
if (m_type == type || !has_stronger_or_equal_type(type))
- return;
+ {
+ DBUG_PRINT("info", ("Nothing to downgrade"));
+ DBUG_VOID_RETURN;
+ }
/* Only allow downgrade in some specific known cases */
DBUG_ASSERT((get_key()->mdl_namespace() != MDL_key::BACKUP &&
@@ -2927,6 +2934,7 @@ void MDL_ticket::downgrade_lock(enum_mdl_type type)
m_type == MDL_SHARED_NO_WRITE)) ||
(get_key()->mdl_namespace() == MDL_key::BACKUP &&
(m_type == MDL_BACKUP_DDL ||
+ m_type == MDL_BACKUP_BLOCK_DDL ||
m_type == MDL_BACKUP_WAIT_FLUSH)));
mysql_prlock_wrlock(&m_lock->m_rwlock);
@@ -2939,6 +2947,7 @@ void MDL_ticket::downgrade_lock(enum_mdl_type type)
m_lock->m_granted.add_ticket(this);
m_lock->reschedule_waiters();
mysql_prlock_unlock(&m_lock->m_rwlock);
+ DBUG_VOID_RETURN;
}