summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/main/backup_interaction.result24
-rw-r--r--mysql-test/main/backup_interaction.test27
-rw-r--r--sql/mdl.cc11
-rw-r--r--sql/sql_reload.cc6
4 files changed, 15 insertions, 53 deletions
diff --git a/mysql-test/main/backup_interaction.result b/mysql-test/main/backup_interaction.result
index f1354f6778e..3c3071b8e70 100644
--- a/mysql-test/main/backup_interaction.result
+++ b/mysql-test/main/backup_interaction.result
@@ -521,26 +521,8 @@ BACKUP STAGE END;
CREATE OR REPLACE TABLE t1 (pk INT PRIMARY KEY, f INT);
BACKUP STAGE START;
FLUSH TABLE t1 FOR EXPORT;
-UNLOCK TABLES;
-BACKUP STAGE END;
-DROP TABLE t1;
-CREATE TABLE t1 (a INT);
-BACKUP STAGE START;
-FLUSH TABLE t1 FOR EXPORT;
-UNLOCK TABLES;
-connect con1,localhost,root,,test;
-BACKUP STAGE START;
-connection default;
-BACKUP STAGE END;
-connection con1;
-BACKUP STAGE END;
-disconnect con1;
-connection default;
-DROP TABLE t1;
-CREATE TABLE t1 (a INT);
-BACKUP STAGE START;
-FLUSH TABLES t1 WITH READ LOCK;
-UNLOCK TABLES;
-BACKUP STAGE BLOCK_COMMIT;
+ERROR HY000: Can't execute the command as you have a BACKUP STAGE active
+FLUSH TABLE t1 WITH READ LOCK;
+ERROR HY000: Can't execute the command as you have a BACKUP STAGE active
BACKUP STAGE END;
DROP TABLE t1;
diff --git a/mysql-test/main/backup_interaction.test b/mysql-test/main/backup_interaction.test
index 8ac905cc6ff..09ed769c898 100644
--- a/mysql-test/main/backup_interaction.test
+++ b/mysql-test/main/backup_interaction.test
@@ -509,30 +509,9 @@ BACKUP STAGE END;
CREATE OR REPLACE TABLE t1 (pk INT PRIMARY KEY, f INT);
BACKUP STAGE START;
+--error ER_BACKUP_LOCK_IS_ACTIVE
FLUSH TABLE t1 FOR EXPORT;
-UNLOCK TABLES;
-BACKUP STAGE END;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a INT);
-BACKUP STAGE START;
-FLUSH TABLE t1 FOR EXPORT;
-UNLOCK TABLES;
---connect (con1,localhost,root,,test)
---send BACKUP STAGE START
---connection default
-BACKUP STAGE END;
---connection con1
-reap;
-BACKUP STAGE END;
---disconnect con1
---connection default
-DROP TABLE t1;
-
-CREATE TABLE t1 (a INT);
-BACKUP STAGE START;
-FLUSH TABLES t1 WITH READ LOCK;
-UNLOCK TABLES;
-BACKUP STAGE BLOCK_COMMIT;
+--error ER_BACKUP_LOCK_IS_ACTIVE
+FLUSH TABLE t1 WITH READ LOCK;
BACKUP STAGE END;
DROP TABLE t1;
diff --git a/sql/mdl.cc b/sql/mdl.cc
index e7c0d699d76..591127dc1d8 100644
--- a/sql/mdl.cc
+++ b/sql/mdl.cc
@@ -3166,19 +3166,14 @@ void MDL_context::set_transaction_duration_for_all_locks()
DBUG_ASSERT(m_tickets[MDL_STATEMENT].is_empty());
- /* Don't swap locks if this thread is running backup stages */
- if (current_thd->current_backup_stage == BACKUP_FINISHED)
- m_tickets[MDL_TRANSACTION].swap(m_tickets[MDL_EXPLICIT]);
+ m_tickets[MDL_TRANSACTION].swap(m_tickets[MDL_EXPLICIT]);
Ticket_iterator it_ticket(m_tickets[MDL_EXPLICIT]);
while ((ticket= it_ticket++))
{
- if (ticket->get_key()->mdl_namespace() != MDL_key::BACKUP)
- {
- m_tickets[MDL_EXPLICIT].remove(ticket);
- m_tickets[MDL_TRANSACTION].push_front(ticket);
- }
+ m_tickets[MDL_EXPLICIT].remove(ticket);
+ m_tickets[MDL_TRANSACTION].push_front(ticket);
}
#ifndef DBUG_OFF
diff --git a/sql/sql_reload.cc b/sql/sql_reload.cc
index 0e166b169aa..0898bea6d41 100644
--- a/sql/sql_reload.cc
+++ b/sql/sql_reload.cc
@@ -525,6 +525,12 @@ bool flush_tables_with_read_lock(THD *thd, TABLE_LIST *all_tables)
goto error;
}
+ if (thd->current_backup_stage != BACKUP_FINISHED)
+ {
+ my_error(ER_BACKUP_LOCK_IS_ACTIVE, MYF(0));
+ return true;
+ }
+
if (thd->lex->type & REFRESH_READ_LOCK)
{
/*