#At file:///ext/mysql/bzr/backup/bug32702/
2741 Rafal Somla 2008-12-17
BUG#32702 - Backup: DDL blocker does not block all it should
WL#4644 - Online Backup: Fix the DDL blocker
After this patch, the DDL blocker will be renamed to Backup Metadata Lock and
will block all the statements listed in WL#4644. Test backup_ddl_blocker will be
renamed to backup_bml and extended to test all these statements.
This patch implements an alternative, simpler and I believe better solution than
the one currently described in LLD. Namely, it marks all statements which need
to be blocked by BML with special CF_BLOCKED_BY_BML flag. Then registering and
unregistering marked statements with BML is done globally in
mysql_execute_command().
This makes changes in the parser code minimal, makes it easy to trace the list
of statements which ale blocked and easily ensures that each bml_enter() call is
matched with bml_leave().
added:
mysql-test/suite/backup/include/
mysql-test/suite/backup/include/bml_test.inc
renamed:
mysql-test/suite/backup/r/backup_ddl_blocker.result => mysql-test/suite/backup/r/backup_bml.result
mysql-test/suite/backup/t/backup_ddl_blocker.test => mysql-test/suite/backup/t/backup_bml.test
sql/ddl_blocker.cc => sql/bml.cc
sql/ddl_blocker.h => sql/bml.h
modified:
mysql-test/suite/backup/r/backup_logs.result
mysql-test/suite/backup/r/backup_logs_output.result
mysql-test/suite/backup/r/backup_logs_purge.result
mysql-test/suite/backup/r/backup_timeout.result
mysql-test/suite/backup/t/backup_timeout.test
sql/CMakeLists.txt
sql/Makefile.am
sql/backup/kernel.cc
sql/mysqld.cc
sql/si_logs.cc
sql/si_logs.h
sql/si_objects.cc
sql/si_objects.h
sql/sql_class.cc
sql/sql_class.h
sql/sql_parse.cc
mysql-test/suite/backup/r/backup_bml.result
mysql-test/suite/backup/t/backup_bml.test
sql/bml.cc
sql/bml.h
per-file messages:
mysql-test/suite/backup/include/bml_test.inc
A "subroutine" for backup_bml.test.
mysql-test/suite/backup/r/backup_logs.result
Update result because of new "prepared" state being reported in backup_progress
log.
mysql-test/suite/backup/r/backup_logs_output.result
Update result because of new "prepared" state being reported in backup_progress
log.
mysql-test/suite/backup/r/backup_logs_purge.result
Update result because of new "prepared" state being reported in backup_progress
log.
mysql-test/suite/backup/t/backup_bml.test
Almost complete rewrite of the test.
mysql-test/suite/backup/t/backup_timeout.test
Remove references to "DDL blocker" and update synchronization point names.
sql/CMakeLists.txt
Rename ddl_blocker.{h,cc} -> bml.{h,cc}.
sql/Makefile.am
Rename ddl_blocker.{h,cc} -> bml.{h,cc}.
sql/backup/kernel.cc
- Add new sync. points "after_backup_restore_prepare" and "start_do_restore"
(needed in backup_bml.test).
- Add code reporting "prepared" state of backup/restore operation.
sql/bml.cc
Rename "DDL blocker" -> "Backup Metadata Lock":
- change class and member names.
- update documentation.
sql/bml.h
Rename "DDL blocker" -> "Backup Metadata Lock":
- change class and member names.
- update documentation.
sql/mysqld.cc
Rename "DDL blocker" -> "Backup Metadata Lock".
sql/si_logs.cc
Add new "prepared" state.
sql/si_logs.h
Add new "prepared" state.
sql/si_objects.cc
Rename "DDL blocker" -> "Backup Metadata Lock".
sql/si_objects.h
Rename "DDL blocker" -> "Backup Metadata Lock".
sql/sql_class.cc
Rename "DDL blocker" -> "Backup Metadata Lock".
sql/sql_class.h
- Rename "DDL blocker" -> "Backup Metadata Lock".
- Define CF_BLOCKED_BY_BML flag.
sql/sql_parse.cc
Handle statements which should be blocked by BML:
- Mark each statement with CF_BLOCKED_BY_BML flag.
- In mysql_execute_command(), for each marked statement call bml_enter() before
the big switch and bml_leave() after it.
- Remove earlier DDL blocker calls from within the big switch.
=== added directory 'mysql-test/suite/backup/include'
=== added file 'mysql-test/suite/backup/include/bml_test.inc'
--- a/mysql-test/suite/backup/include/bml_test.inc 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/backup/include/bml_test.inc 2008-12-17 14:32:46 +0000
@@ -0,0 +1,319 @@
+# This is a "subroutine" for backup_ddl_blocker test. It executes DDL
+# statements given by variables $DDL1-4 in parallel with BACKUP/RESTORE
+# statement and checks that they correctly block each other.
+#
+# If $backup_to has value, then BACKUP operation is performed and backup image
+# is stored at location $backup_to.
+#
+# If $restore_from has value, then RESTORE operation from the given image is
+# performed.
+#
+# To use this file the following conditions must be satisfied:
+# - five connections con1-5 must be set up,
+# - database bml_results must exist,
+# - procedure test.check_results(), used to check effects of DDLs must
+# be defined,
+# - If $restore_from is set, it must point at valid backup image.
+#
+# It is responsibility of the user of this file to populate buo_ddl_blocker
+# database with data prior to using it.
+#
+# Backup test sequence diagram (not UML)
+# --------------------------------------
+# Four DDL statements and a backup command are specified.
+# The first two DDL statements are run as "in progress" when
+# the backup starts. The other two DDL statements are run
+# when the backup or restore is already running. Tests results
+# show the realization of the assumptions above.
+#
+# con5 con1 con2 con3 con4 default
+# (setup) | | | | |
+# | | | | | |
+# | | | | | check A
+# | DDL1 | | | |
+# | * DDL2 | | |
+# | * * | | |
+# BACKUP/RESTORE * * | | |
+# * * * | | |
+# * * * | | check B
+# * = = | | |
+# * | | | | check C
+# * | | DDL3 | |
+# * | | * DDL4 |
+# * | | * * check D
+# = | | * * |
+# | | | = = |
+# | | | | | check E
+#
+# Notes: Symbol '*' denotes execution of a statement, symbol '=' its
+# termination.
+#
+# During test, the following checks are made:
+#
+# Checkpoint A) To see the initial situation.
+# Checkpoint B) BACKUP/RESTORE is blocked.
+# Checkpoint C) DDL1 and DDL2 completed and BACKUP/RESTORE started its job.
+# Checkpoint D) DDL3 and DDL4 are blocked.
+# Checkpoint E) BACKUP/RESTORE and all DDLs completed.
+#
+# Note by Ingo: I wonder if the line above "(results)" is correct.
+# I understand the above explanations so that DDL3 and 4 cannot
+# resume before BACKUP/RESTORE finished. But the line indicates
+# that these can resume in any order.
+
+if (`select '$backup_to' <> ''`)
+{
+ let $operation= BACKUP DATABASE bml_test TO '$backup_to';
+}
+
+if (`select '$restore_from' <> ''`)
+{
+ let $operation= RESTORE FROM '$restore_from' OVERWRITE;
+}
+
+--echo
+--echo ########################################################
+--echo # Running BML test for the following statements:
+--echo #
+--echo # DDL1= $DDL1
+--echo # DDL2= $DDL2
+--echo # DDL3= $DDL3
+--echo # DDL4= $DDL4
+--echo #
+--echo # BML is activated by $operation.
+--echo ########################################################
+--echo
+
+connection default;
+SET DEBUG_SYNC= 'reset';
+PURGE BACKUP LOGS;
+
+#
+# Make bml_test the default database in all connections.
+#
+USE bml_test;
+connection con1;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+connection con2;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+connection con3;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+connection con4;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+connection con5;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+
+--echo
+--echo == Checkpoint A ==
+--echo # Check the initial situation.
+CALL test.check_results();
+--echo ==================
+--echo
+
+# Start DDL1 and DDL2
+
+ connection con1;
+ --echo # con1: Start DDL1 making it to stop after it has started (and
+ --echo # possibly registered with BML).
+ SET DEBUG_SYNC= 'before_execute_sql_command SIGNAL ddl1_started
+ WAIT_FOR continue_ddl';
+ --send
+ eval $DDL1;
+
+ connection con2;
+ --echo # con2: Wait for DDL1 to reach its synchronization point.
+ SET DEBUG_SYNC= 'now WAIT_FOR ddl1_started TIMEOUT 3';
+ --echo # con2: Start DDL2 making it to stop after it has started (and
+ --echo # possibly registered with BML).
+ SET DEBUG_SYNC= 'before_execute_sql_command SIGNAL ddl2_started
+ WAIT_FOR continue_ddl';
+ --send
+ eval $DDL2;
+
+# Start BACKUP/RESTORE
+
+ connection con5;
+ --echo # con5: Wait for DDL2 to reach its synchronization point.
+ SET DEBUG_SYNC= 'now WAIT_FOR ddl2_started TIMEOUT 3';
+ # To be safe clear before_execute_sql_command which is hit by
+ # every executed statement
+ SET DEBUG_SYNC='before_execute_sql_command CLEAR';
+
+ --echo # con5: Activate synchronization points for BACKUP/RESTORE.
+ #
+ # Make BACKUP/RESTORE to operation which should be blocked by ongoing
+ # statements. Make it send 'bup_waiting' signal just before it checks
+ # for registered statements inside BML.
+ #
+ SET DEBUG_SYNC= 'bml_get_check2 SIGNAL bup_waiting';
+ #
+ # Whether BACKUP/RESTORE is blocked or not make it stop after it
+ # completes preparations, including activating the BML.
+ #
+ SET DEBUG_SYNC= 'after_backup_start_backup WAIT_FOR continue_bup';
+ SET DEBUG_SYNC= 'after_backup_start_restore WAIT_FOR continue_bup';
+ #
+ # Also make it to stop in the middle of operation after seeing
+ # 'continue_bup' so that DDL3 and DDL4 can be started in parallel
+ #
+ SET DEBUG_SYNC= 'before_backup_meta SIGNAL bup_running WAIT_FOR finish_bup';
+ SET DEBUG_SYNC= 'start_do_restore SIGNAL bup_running WAIT_FOR finish_bup';
+
+ --echo # con5: Starting BACKUP/RESTORE operation -- should be blocked
+ --echo # by ongoing DDLs.
+ # arrange for deterministic backup_id = 500
+ SET SESSION debug="+d,set_backup_id";
+ --send
+ eval $operation;
+
+connection default;
+--echo # Waiting for BACKUP/RESTORE to reach its synchronization point.
+SET DEBUG_SYNC= 'now WAIT_FOR bup_waiting TIMEOUT 1';
+
+--echo
+--echo == Checkpoint B ==
+--echo #
+--echo # DDL1= $DDL1
+--echo # DDL2= $DDL2
+--echo # DDL3= $DDL3
+--echo # DDL4= $DDL4
+--echo #
+eval SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
+ WHERE info LIKE "BACKUP DATABASE%"
+ OR info LIKE "RESTORE FROM%"
+ OR info LIKE "$DDL1%"
+ OR info LIKE "$DDL2%";
+--echo # Checking that BACKUP is blocked by DDLs.
+SELECT object, notes, error_num FROM mysql.backup_progress WHERE backup_id=500;
+--echo # Checking that DDL1 and DDL2 have not executed.
+CALL test.check_results();
+--echo ==================
+--echo
+
+--echo # Resume DDL1 and DDL2.
+--echo # Now BACKUP/RESTORE should stop after activating DDL blocker.
+SET DEBUG_SYNC= 'now SIGNAL continue_ddl';
+
+ connection con1;
+ --echo # con1: Reaping DDL1
+ reap;
+
+ connection con2;
+ --echo # con2: Reaping DDL2
+ reap;
+
+connection default;
+# Ensure that BACKUP/RESTORE is in progress, after activating BML.
+SET DEBUG_SYNC= 'now SIGNAL continue_bup WAIT_FOR bup_running TIMEOUT 1';
+
+--echo
+--echo == Checkpoint C ==
+--echo #
+--echo # DDL1= $DDL1
+--echo # DDL2= $DDL2
+--echo # DDL3= $DDL3
+--echo # DDL4= $DDL4
+--echo #
+SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
+ WHERE info LIKE "BACKUP DATABASE%"
+ OR info LIKE "RESTORE FROM%";
+--echo # Checking that DDL1 and DDL2 have executed.
+CALL test.check_results();
+--echo ==================
+--echo
+
+# Start DDL3 and DDL4 while DDL blocker is active.
+
+ connection con3;
+ --echo # con3: Send DDL3 but it is blocked by BACKUP/RESTORE
+ --echo # (will not be in backup) make it send signal when
+ --echo # blocked on BML.
+ SET DEBUG_SYNC= 'bml_enter_check SIGNAL ddl3_blocked';
+ --send
+ eval $DDL3;
+
+ connection con4;
+ --echo # Wait for DDL3 to send its signal.
+ SET DEBUG_SYNC= 'now WAIT_FOR ddl3_blocked TIMEOUT 3';
+ --echo # con3: Send DDL3 but it is blocked by BACKUP/RESTORE
+ --echo # (will not be in backup) make it send signal when
+ --echo # blocked on BML.
+ SET DEBUG_SYNC= 'bml_enter_check SIGNAL ddl4_blocked';
+ --send
+ eval $DDL4;
+
+# check that DDL3 and DDL4 are blocked
+
+connection default;
+--echo # Wait for DDL4 to send its signal.
+SET DEBUG_SYNC= 'now WAIT_FOR ddl4_blocked TIMEOUT 3';
+
+--echo
+--echo == Checkpoint D ==
+--echo #
+--echo # DDL1= $DDL1
+--echo # DDL2= $DDL2
+--echo # DDL3= $DDL3
+--echo # DDL4= $DDL4
+--echo #
+eval SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
+ WHERE info LIKE "$DDL3%"
+ OR info LIKE "$DDL4%";
+--echo # Checking that DDL3 and DDL4 have not executed.
+CALL test.check_results();
+--echo ==================
+--echo
+
+--echo # Resume BACKUP/RESTORE - this allows DDL3 and DDL4 to complete.
+SET DEBUG_SYNC= 'now SIGNAL finish_bup';
+
+ connection con5;
+ --echo # con5: Reaping BACKUP/RESTORE
+ reap;
+ SET debug="-d";
+
+ connection con3;
+ --echo # con3: Completing DDL3
+ reap;
+
+ connection con4;
+ --echo # con4: Completing DDL4
+ reap;
+
+connection default;
+
+--echo
+--echo == Checkpoint E ==
+--echo #
+--echo # DDL1= $DDL1
+--echo # DDL2= $DDL2
+--echo # DDL3= $DDL3
+--echo # DDL4= $DDL4
+--echo #
+--echo # Checking that DDL3 and DDL4 have executed.
+CALL test.check_results();
+--echo ==================
+--echo
+
+# Cleanup
+
+connection con1;
+SET DEBUG_SYNC= 'reset';
+connection con2;
+SET DEBUG_SYNC= 'reset';
+connection con3;
+SET DEBUG_SYNC= 'reset';
+connection con4;
+SET DEBUG_SYNC= 'reset';
+connection con5;
+SET DEBUG_SYNC= 'reset';
+connection default;
+SET DEBUG_SYNC= 'reset';
+
+let $backup_to=;
+let $restore_from=;
=== renamed file 'mysql-test/suite/backup/r/backup_ddl_blocker.result' => 'mysql-test/suite/backup/r/backup_bml.result'
--- a/mysql-test/suite/backup/r/backup_ddl_blocker.result 2008-11-20 14:07:23 +0000
+++ b/mysql-test/suite/backup/r/backup_bml.result 2008-12-17 14:32:46 +0000
@@ -1,1625 +1,3342 @@
+DROP DATABASE IF EXISTS bml_test;
+CREATE DATABASE bml_test;
+USE test;
+CREATE TABLE objects (pos int, type char(10), name char(16), args text);
+CREATE FUNCTION drop_stmt(pos_arg int) RETURNS text
+BEGIN
+DECLARE stmt text;
+SELECT concat('DROP ', type, ' ', name)
+INTO stmt
+FROM test.objects WHERE pos=pos_arg;
+RETURN stmt;
+END\\
+CREATE FUNCTION create_stmt(pos_arg int) RETURNS text
+BEGIN
+DECLARE stmt text;
+SELECT concat('CREATE ', type, ' ', name, args)
+INTO stmt
+FROM test.objects WHERE pos=pos_arg;
+RETURN stmt;
+END\\
+CREATE FUNCTION alter_stmt(pos_arg int) RETURNS text
+BEGIN
+DECLARE stmt text;
+SELECT concat('ALTER ', type, ' ', name, args)
+INTO stmt
+FROM test.objects WHERE pos=pos_arg;
+RETURN stmt;
+END\\
+USE test;
+TRUNCATE TABLE test.objects;
+INSERT INTO test.objects VALUES
+(1, 'DATABASE', 'bml_test_db1', ''),
+(2, 'TABLE', 't1', '(a int)'),
+(3, 'VIEW', 'v1', ' AS SELECT * FROM t2'),
+(4, 'FUNCTION', 'f1', '() RETURNS int RETURN 1'),
+(5, 'PROCEDURE','p1', '() SET @foo=1'),
+(6, 'EVENT', 'e1', ' ON SCHEDULE EVERY 1 YEAR DISABLE DO SET @foo=1'),
+(7, 'TRIGGER', 'r1', ' AFTER UPDATE ON t2 FOR EACH ROW SET @foo=1'),
+(8, 'INDEX', 'i1 ON t2', '(b)');
+DROP PROCEDURE IF EXISTS test.check_results\\
+Warnings:
+Note 1305 PROCEDURE test.check_results does not exist
+CREATE PROCEDURE test.check_results()
+BEGIN
+# show databases
+SHOW DATABASES LIKE 'bml%';
+# show objects in bml_test database
+SELECT table_name AS name, table_type AS type
+FROM information_schema.tables
+WHERE table_schema = 'bml_test'
+ UNION SELECT routine_name , routine_type
+FROM information_schema.routines
+WHERE routine_schema = 'bml_test'
+ UNION SELECT event_name, 'EVENT'
+ FROM information_schema.events
+WHERE event_schema = 'bml_test'
+ UNION SELECT trigger_name, 'TRIGGER'
+ FROM information_schema.triggers
+WHERE trigger_schema = 'bml_test';
+# show definiton of t2 to see the index if created
+SHOW CREATE TABLE bml_test.t2;
+END\\
+USE bml_test;
+CREATE TABLE t2 (b int);
+CREATE DATABASE bml_test_db1;
+CREATE TABLE t1(a int);
+CREATE VIEW v1 AS SELECT * FROM t2;
+CREATE FUNCTION f1() RETURNS int RETURN 1;
+CREATE PROCEDURE p1() SET @foo=1;
+CREATE EVENT e1 ON SCHEDULE EVERY 1 YEAR DISABLE DO SET @foo=1;
+CREATE TRIGGER r1 AFTER UPDATE ON t2 FOR EACH ROW SET @foo=1;
+CREATE INDEX i1 ON t2(b);
+CALL test.check_results();
+Database (bml%)
+bml_test
+bml_test_db1
+name type
+t1 BASE TABLE
+t2 BASE TABLE
+v1 VIEW
+f1 FUNCTION
+p1 PROCEDURE
+e1 EVENT
+r1 TRIGGER
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `b` int(11) DEFAULT NULL,
+ KEY `i1` (`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+BACKUP DATABASE bml_test, bml_test_db1 TO 'bml_test_orig.bkp';
+backup_id
+#
+DROP VIEW v1;
+DROP TABLE t1;
+
+########################################################
+# Running BML test for the following statements:
+#
+# DDL1= CREATE VIEW v1 AS SELECT * FROM t2
+# DDL2= DROP FUNCTION f1
+# DDL3= DROP DATABASE bml_test_db1
+# DDL4= CREATE TABLE t1(a int)
+#
+# BML is activated by BACKUP DATABASE bml_test TO 'bml_test.bkp'.
+########################################################
+
+SET DEBUG_SYNC= 'reset';
+PURGE BACKUP LOGS;
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
SET DEBUG_SYNC= 'reset';
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
-Starting Test 1 - Backup
+== Checkpoint A ==
+# Check the initial situation.
+CALL test.check_results();
+Database (bml%)
+bml_test
+bml_test_db1
+name type
+t2 BASE TABLE
+f1 FUNCTION
+p1 PROCEDURE
+e1 EVENT
+r1 TRIGGER
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `b` int(11) DEFAULT NULL,
+ KEY `i1` (`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+==================
+
+# con1: Start DDL1 making it to stop after it has started (and
+# possibly registered with BML).
+SET DEBUG_SYNC= 'before_execute_sql_command SIGNAL ddl1_started
+ WAIT_FOR continue_ddl';
+CREATE VIEW v1 AS SELECT * FROM t2;
+# con2: Wait for DDL1 to reach its synchronization point.
+SET DEBUG_SYNC= 'now WAIT_FOR ddl1_started TIMEOUT 3';
+# con2: Start DDL2 making it to stop after it has started (and
+# possibly registered with BML).
+SET DEBUG_SYNC= 'before_execute_sql_command SIGNAL ddl2_started
+ WAIT_FOR continue_ddl';
+DROP FUNCTION f1;
+# con5: Wait for DDL2 to reach its synchronization point.
+SET DEBUG_SYNC= 'now WAIT_FOR ddl2_started TIMEOUT 3';
+SET DEBUG_SYNC='before_execute_sql_command CLEAR';
+# con5: Activate synchronization points for BACKUP/RESTORE.
+SET DEBUG_SYNC= 'bml_get_check2 SIGNAL bup_waiting';
+SET DEBUG_SYNC= 'after_backup_start_backup WAIT_FOR continue_bup';
+SET DEBUG_SYNC= 'after_backup_start_restore WAIT_FOR continue_bup';
+SET DEBUG_SYNC= 'before_backup_meta SIGNAL bup_running WAIT_FOR finish_bup';
+SET DEBUG_SYNC= 'start_do_restore SIGNAL bup_running WAIT_FOR finish_bup';
+# con5: Starting BACKUP/RESTORE operation -- should be blocked
+# by ongoing DDLs.
+SET SESSION debug="+d,set_backup_id";
+BACKUP DATABASE bml_test TO 'bml_test.bkp';
+# Waiting for BACKUP/RESTORE to reach its synchronization point.
+SET DEBUG_SYNC= 'now WAIT_FOR bup_waiting TIMEOUT 1';
+
+== Checkpoint B ==
+#
+# DDL1= CREATE VIEW v1 AS SELECT * FROM t2
+# DDL2= DROP FUNCTION f1
+# DDL3= DROP DATABASE bml_test_db1
+# DDL4= CREATE TABLE t1(a int)
+#
+SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
+WHERE info LIKE "BACKUP DATABASE%"
+ OR info LIKE "RESTORE FROM%"
+ OR info LIKE "CREATE VIEW v1 AS SELECT * FROM t2%"
+ OR info LIKE "DROP FUNCTION f1%";
+state info
+BML: waiting for all statements to leave BACKUP DATABASE bml_test TO 'bml_test.bkp'
+debug sync point: before_execute_sql_command DROP FUNCTION f1
+debug sync point: before_execute_sql_command CREATE VIEW v1 AS SELECT * FROM t2
+# Checking that BACKUP is blocked by DDLs.
+SELECT object, notes, error_num FROM mysql.backup_progress WHERE backup_id=500;
+object notes error_num
+backup kernel starting 0
+backup kernel running 0
+# Checking that DDL1 and DDL2 have not executed.
+CALL test.check_results();
+Database (bml%)
+bml_test
+bml_test_db1
+name type
+t2 BASE TABLE
+f1 FUNCTION
+p1 PROCEDURE
+e1 EVENT
+r1 TRIGGER
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `b` int(11) DEFAULT NULL,
+ KEY `i1` (`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+==================
+
+# Resume DDL1 and DDL2.
+# Now BACKUP/RESTORE should stop after activating DDL blocker.
+SET DEBUG_SYNC= 'now SIGNAL continue_ddl';
+# con1: Reaping DDL1
+# con2: Reaping DDL2
+SET DEBUG_SYNC= 'now SIGNAL continue_bup WAIT_FOR bup_running TIMEOUT 1';
+
+== Checkpoint C ==
+#
+# DDL1= CREATE VIEW v1 AS SELECT * FROM t2
+# DDL2= DROP FUNCTION f1
+# DDL3= DROP DATABASE bml_test_db1
+# DDL4= CREATE TABLE t1(a int)
+#
+SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
+WHERE info LIKE "BACKUP DATABASE%"
+ OR info LIKE "RESTORE FROM%";
+state info
+debug sync point: before_backup_meta BACKUP DATABASE bml_test TO 'bml_test.bkp'
+# Checking that DDL1 and DDL2 have executed.
+CALL test.check_results();
+Database (bml%)
+bml_test
+bml_test_db1
+name type
+t2 BASE TABLE
+v1 VIEW
+p1 PROCEDURE
+e1 EVENT
+r1 TRIGGER
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `b` int(11) DEFAULT NULL,
+ KEY `i1` (`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+==================
+
+# con3: Send DDL3 but it is blocked by BACKUP/RESTORE
+# (will not be in backup) make it send signal when
+# blocked on BML.
+SET DEBUG_SYNC= 'bml_enter_check SIGNAL ddl3_blocked';
+DROP DATABASE bml_test_db1;
+# Wait for DDL3 to send its signal.
+SET DEBUG_SYNC= 'now WAIT_FOR ddl3_blocked TIMEOUT 3';
+# con3: Send DDL3 but it is blocked by BACKUP/RESTORE
+# (will not be in backup) make it send signal when
+# blocked on BML.
+SET DEBUG_SYNC= 'bml_enter_check SIGNAL ddl4_blocked';
+CREATE TABLE t1(a int);
+# Wait for DDL4 to send its signal.
+SET DEBUG_SYNC= 'now WAIT_FOR ddl4_blocked TIMEOUT 3';
+
+== Checkpoint D ==
+#
+# DDL1= CREATE VIEW v1 AS SELECT * FROM t2
+# DDL2= DROP FUNCTION f1
+# DDL3= DROP DATABASE bml_test_db1
+# DDL4= CREATE TABLE t1(a int)
+#
+SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
+WHERE info LIKE "DROP DATABASE bml_test_db1%"
+ OR info LIKE "CREATE TABLE t1(a int)%";
+state info
+BML: waiting until released CREATE TABLE t1(a int)
+BML: waiting until released DROP DATABASE bml_test_db1
+# Checking that DDL3 and DDL4 have not executed.
+CALL test.check_results();
+Database (bml%)
+bml_test
+bml_test_db1
+name type
+t2 BASE TABLE
+v1 VIEW
+p1 PROCEDURE
+e1 EVENT
+r1 TRIGGER
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `b` int(11) DEFAULT NULL,
+ KEY `i1` (`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+==================
+
+# Resume BACKUP/RESTORE - this allows DDL3 and DDL4 to complete.
+SET DEBUG_SYNC= 'now SIGNAL finish_bup';
+# con5: Reaping BACKUP/RESTORE
+backup_id
+500
+SET debug="-d";
+# con3: Completing DDL3
+# con4: Completing DDL4
+
+== Checkpoint E ==
+#
+# DDL1= CREATE VIEW v1 AS SELECT * FROM t2
+# DDL2= DROP FUNCTION f1
+# DDL3= DROP DATABASE bml_test_db1
+# DDL4= CREATE TABLE t1(a int)
+#
+# Checking that DDL3 and DDL4 have executed.
+CALL test.check_results();
+Database (bml%)
+bml_test
+name type
+t1 BASE TABLE
+t2 BASE TABLE
+v1 VIEW
+p1 PROCEDURE
+e1 EVENT
+r1 TRIGGER
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `b` int(11) DEFAULT NULL,
+ KEY `i1` (`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+==================
-DROP DATABASE IF EXISTS bup_ddl_blocker;
-CREATE DATABASE bup_ddl_blocker;
-con1: Creating tables
-CREATE TABLE bup_ddl_blocker.t1 (col_a CHAR(40)) ENGINE=INNODB;
-CREATE TABLE bup_ddl_blocker.t2 (col_a CHAR(40)) ENGINE=MYISAM;
-CREATE TABLE bup_ddl_blocker.t3 (col_a CHAR(40)) ENGINE=INNODB;
-CREATE TABLE bup_ddl_blocker.t4 (col_a CHAR(40)) ENGINE=MYISAM;
-con1: Loading data
-INSERT INTO bup_ddl_blocker.t1 VALUES ("01 Some data to test");
-INSERT INTO bup_ddl_blocker.t1 VALUES ("02 Some data to test");
-INSERT INTO bup_ddl_blocker.t1 VALUES ("03 Some data to test");
-INSERT INTO bup_ddl_blocker.t2 VALUES ("01 Some data to test");
-INSERT INTO bup_ddl_blocker.t2 VALUES ("02 Some data to test");
-INSERT INTO bup_ddl_blocker.t2 VALUES ("03 Some data to test");
-INSERT INTO bup_ddl_blocker.t3 VALUES ("01 Some data to test");
-INSERT INTO bup_ddl_blocker.t3 VALUES ("02 Some data to test");
-INSERT INTO bup_ddl_blocker.t3 VALUES ("03 Some data to test");
-INSERT INTO bup_ddl_blocker.t4 VALUES ("01 Some data to test");
-INSERT INTO bup_ddl_blocker.t4 VALUES ("02 Some data to test");
-INSERT INTO bup_ddl_blocker.t4 VALUES ("03 Some data to test");
-DROP TABLE bup_ddl_blocker.t1, bup_ddl_blocker.t3;
-con2: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'after_start_ddl SIGNAL con2_started WAIT_FOR status_shown';
-con2: Get a DDL going and stop in the middle
-CREATE TABLE bup_ddl_blocker.t1 (col_a CHAR(40)) ENGINE=INNODB;
-con3: Wait for con2 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con2_started';
-con3: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'after_start_ddl SIGNAL con3_started WAIT_FOR status_shown';
-con3: Get a DDL going and stop in the middle
-ALTER TABLE bup_ddl_blocker.t2 ADD COLUMN col_b int;
-con1: Wait for con3 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con3_started';
-con1: Activate synchronization points for backup.
-SET DEBUG_SYNC= 'before_block_ddl SIGNAL bup_blocked WAIT_FOR status_shown';
-SET DEBUG_SYNC= 'after_block_ddl SIGNAL bup_started WAIT_FOR status_shown2';
-con1: Backing up database -- will block with lock
-BACKUP DATABASE bup_ddl_blocker TO "bup_ddl_blocker.bak";
-con6: Wait for con1 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR bup_blocked';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "BACKUP DATABASE%";
-state info
-debug sync point: before_block_ddl BACKUP DATABASE bup_ddl_blocker TO "bup_ddl_blocker.bak"
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "CREATE TABLE bup_ddl_blocker.t1%";
-state info
-debug sync point: after_start_ddl CREATE TABLE bup_ddl_blocker.t1 (col_a CHAR(40)) ENGINE=INNODB
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "ALTER TABLE bup_ddl_blocker.t2%";
-state info
-debug sync point: after_start_ddl ALTER TABLE bup_ddl_blocker.t2 ADD COLUMN col_b int
-con6: Resume all and wait for backup to start after DDL finish.
-SET DEBUG_SYNC= 'now SIGNAL status_shown WAIT_FOR bup_started';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "BACKUP DATABASE%";
-state info
-debug sync point: after_block_ddl BACKUP DATABASE bup_ddl_blocker TO "bup_ddl_blocker.bak"
-con4: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'before_check_ddl_blocked SIGNAL con4_started
- WAIT_FOR status_shown2';
-con4: Try a DDL but it is blocked by backup -- will not be in backup
-CREATE TABLE bup_ddl_blocker.t3 (col_a CHAR(40)) ENGINE=INNODB;
-con5: Wait for con4 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con4_started';
-con5: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'before_check_ddl_blocked SIGNAL con5_started
- WAIT_FOR status_shown2';
-con5: Try a DDL but it is blocked by backup -- will not be in backup
-ALTER TABLE bup_ddl_blocker.t4 ADD COLUMN col_b int;
-con6: Wait for con5 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con5_started';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "CREATE TABLE bup_ddl_blocker.t3%";
-state info
-debug sync point: before_check_ddl_blocked CREATE TABLE bup_ddl_blocker.t3 (col_a CHAR(40)) ENGINE=INNODB
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "ALTER TABLE bup_ddl_blocker.t4%";
-state info
-debug sync point: before_check_ddl_blocked ALTER TABLE bup_ddl_blocker.t4 ADD COLUMN col_b int
-con6: Resume all.
-SET DEBUG_SYNC= 'now SIGNAL status_shown2';
-con2: Completing DDL
-con3: Completing DDL
-con4: Completing DDL
-con5: Completing DDL
-backup_id
-#
-
-Verifying Test 1 results for backup.
-
-con1: Showing columns after updates and backup
-DESCRIBE bup_ddl_blocker.t1;
-Field Type Null Key Default Extra
-col_a char(40) YES NULL
-DESCRIBE bup_ddl_blocker.t2;
-Field Type Null Key Default Extra
-col_a char(40) YES NULL
-col_b int(11) YES NULL
-DESCRIBE bup_ddl_blocker.t3;
-Field Type Null Key Default Extra
-col_a char(40) YES NULL
-DESCRIBE bup_ddl_blocker.t4;
-Field Type Null Key Default Extra
-col_a char(40) YES NULL
-col_b int(11) YES NULL
-con1: Dropping the database tables
-DROP TABLE bup_ddl_blocker.t1, bup_ddl_blocker.t2,
-bup_ddl_blocker.t3, bup_ddl_blocker.t4;
-con1: Restoring the database
-RESTORE FROM "bup_ddl_blocker.bak" OVERWRITE;
-backup_id
-#
-con1: Showing columns that were backed up
-con1: Table t3 should not be in restored data.
-con1: Table t4 should not have new column in restored data.
-DESCRIBE bup_ddl_blocker.t1;
-Field Type Null Key Default Extra
-col_a char(40) YES NULL
-DESCRIBE bup_ddl_blocker.t2;
-Field Type Null Key Default Extra
-col_a char(40) YES NULL
-col_b int(11) YES NULL
-DESCRIBE bup_ddl_blocker.t3;
-ERROR 42S02: Table 'bup_ddl_blocker.t3' doesn't exist
-DESCRIBE bup_ddl_blocker.t4;
-Field Type Null Key Default Extra
-col_a char(40) YES NULL
-
-Starting Test 1 - Restore
-
-DROP DATABASE IF EXISTS bup_ddl_blocker;
-CREATE DATABASE bup_ddl_blocker;
-con1: Creating tables
-CREATE TABLE bup_ddl_blocker.t1 (col_a CHAR(40)) ENGINE=INNODB;
-CREATE TABLE bup_ddl_blocker.t2 (col_a CHAR(40)) ENGINE=MYISAM;
-CREATE TABLE bup_ddl_blocker.t3 (col_a CHAR(40)) ENGINE=INNODB;
-CREATE TABLE bup_ddl_blocker.t4 (col_a CHAR(40)) ENGINE=MYISAM;
-con1: Loading data
-INSERT INTO bup_ddl_blocker.t1 VALUES ("01 Some data to test");
-INSERT INTO bup_ddl_blocker.t1 VALUES ("02 Some data to test");
-INSERT INTO bup_ddl_blocker.t1 VALUES ("03 Some data to test");
-INSERT INTO bup_ddl_blocker.t2 VALUES ("01 Some data to test");
-INSERT INTO bup_ddl_blocker.t2 VALUES ("02 Some data to test");
-INSERT INTO bup_ddl_blocker.t2 VALUES ("03 Some data to test");
-INSERT INTO bup_ddl_blocker.t3 VALUES ("01 Some data to test");
-INSERT INTO bup_ddl_blocker.t3 VALUES ("02 Some data to test");
-INSERT INTO bup_ddl_blocker.t3 VALUES ("03 Some data to test");
-INSERT INTO bup_ddl_blocker.t4 VALUES ("01 Some data to test");
-INSERT INTO bup_ddl_blocker.t4 VALUES ("02 Some data to test");
-INSERT INTO bup_ddl_blocker.t4 VALUES ("03 Some data to test");
-DROP TABLE bup_ddl_blocker.t1, bup_ddl_blocker.t3;
-BACKUP DATABASE bup_ddl_blocker to 'bup_ddl_blocker_orig.bak';
-backup_id
-#
-con2: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'after_start_ddl SIGNAL con2_started WAIT_FOR status_shown';
-con2: Get a DDL going and stop in the middle
-CREATE TABLE bup_ddl_blocker.t1 (col_a CHAR(40)) ENGINE=INNODB;
-con3: Wait for con2 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con2_started';
-con3: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'after_start_ddl SIGNAL con3_started WAIT_FOR status_shown';
-con3: Get a DDL going and stop in the middle
-ALTER TABLE bup_ddl_blocker.t2 ADD COLUMN col_b int;
-con1: Wait for con3 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con3_started';
-con1: Activate synchronization points for restore.
-SET DEBUG_SYNC= 'before_block_ddl SIGNAL bup_blocked WAIT_FOR status_shown';
-SET DEBUG_SYNC= 'after_block_ddl SIGNAL bup_started WAIT_FOR status_shown2';
-con1: Restoring database -- will block with lock
-RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE;
-con6: Wait for con1 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR bup_blocked';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "RESTORE FROM%";
-state info
-debug sync point: before_block_ddl RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "CREATE TABLE bup_ddl_blocker.t1%";
-state info
-debug sync point: after_start_ddl CREATE TABLE bup_ddl_blocker.t1 (col_a CHAR(40)) ENGINE=INNODB
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "ALTER TABLE bup_ddl_blocker.t2%";
-state info
-debug sync point: after_start_ddl ALTER TABLE bup_ddl_blocker.t2 ADD COLUMN col_b int
-con6: Resume all and wait for restore to start after DDL finish.
-SET DEBUG_SYNC= 'now SIGNAL status_shown WAIT_FOR bup_started';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "RESTORE FROM%";
-state info
-debug sync point: after_block_ddl RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE
-con4: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'before_check_ddl_blocked SIGNAL con4_started
- WAIT_FOR status_shown2';
-con4: Try a DDL but it is blocked by backup -- will not be in backup
-CREATE TABLE bup_ddl_blocker.t3 (col_a CHAR(40)) ENGINE=INNODB;
-con5: Wait for con4 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con4_started';
-con5: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'before_check_ddl_blocked SIGNAL con5_started
- WAIT_FOR status_shown2';
-con5: Try a DDL but it is blocked by backup -- will not be in backup
-ALTER TABLE bup_ddl_blocker.t4 ADD COLUMN col_b int;
-con6: Wait for con5 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con5_started';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "CREATE TABLE bup_ddl_blocker.t3%";
-state info
-debug sync point: before_check_ddl_blocked CREATE TABLE bup_ddl_blocker.t3 (col_a CHAR(40)) ENGINE=INNODB
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "ALTER TABLE bup_ddl_blocker.t4%";
-state info
-debug sync point: before_check_ddl_blocked ALTER TABLE bup_ddl_blocker.t4 ADD COLUMN col_b int
-con6: Resume all.
-SET DEBUG_SYNC= 'now SIGNAL status_shown2';
-con2: Completing DDL
-con3: Completing DDL
-con4: Completing DDL
-con5: Completing DDL
-backup_id
-#
-
-Verifying Test 1 results for restore.
-
-con1: Table t1 should not be in restored data.
-con1: Table t2 should not have new column in restored data.
-con1: Table t3 should be in restored data.
-con1: Table t4 should have new column in restored data.
-DESCRIBE bup_ddl_blocker.t1;
-ERROR 42S02: Table 'bup_ddl_blocker.t1' doesn't exist
-DESCRIBE bup_ddl_blocker.t2;
-Field Type Null Key Default Extra
-col_a char(40) YES NULL
-DESCRIBE bup_ddl_blocker.t3;
-Field Type Null Key Default Extra
-col_a char(40) YES NULL
-DESCRIBE bup_ddl_blocker.t4;
-Field Type Null Key Default Extra
-col_a char(40) YES NULL
-col_b int(11) YES NULL
-
-Starting Test 2 - Backup
-
-DROP DATABASE IF EXISTS bup_ddl_blocker;
-CREATE DATABASE bup_ddl_blocker;
-con1: Creating tables
-CREATE TABLE bup_ddl_blocker.t1 (col_a CHAR(40)) ENGINE=INNODB;
-CREATE TABLE bup_ddl_blocker.t2 (col_a CHAR(40)) ENGINE=MYISAM;
-CREATE TABLE bup_ddl_blocker.t3 (col_a CHAR(40)) ENGINE=INNODB;
-CREATE TABLE bup_ddl_blocker.t4 (col_a CHAR(40)) ENGINE=MYISAM;
-con1: Loading data
-INSERT INTO bup_ddl_blocker.t1 VALUES ("01 Some data to test");
-INSERT INTO bup_ddl_blocker.t1 VALUES ("02 Some data to test");
-INSERT INTO bup_ddl_blocker.t1 VALUES ("03 Some data to test");
-INSERT INTO bup_ddl_blocker.t2 VALUES ("01 Some data to test");
-INSERT INTO bup_ddl_blocker.t2 VALUES ("02 Some data to test");
-INSERT INTO bup_ddl_blocker.t2 VALUES ("03 Some data to test");
-INSERT INTO bup_ddl_blocker.t3 VALUES ("01 Some data to test");
-INSERT INTO bup_ddl_blocker.t3 VALUES ("02 Some data to test");
-INSERT INTO bup_ddl_blocker.t3 VALUES ("03 Some data to test");
-INSERT INTO bup_ddl_blocker.t4 VALUES ("01 Some data to test");
-INSERT INTO bup_ddl_blocker.t4 VALUES ("02 Some data to test");
-INSERT INTO bup_ddl_blocker.t4 VALUES ("03 Some data to test");
-con2: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'after_start_ddl SIGNAL con2_started WAIT_FOR status_shown';
-con2: Get a DDL going and stop in the middle
-RENAME TABLE bup_ddl_blocker.t1 TO bup_ddl_blocker.t01;
-con3: Wait for con2 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con2_started';
-con3: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'after_start_ddl SIGNAL con3_started WAIT_FOR status_shown';
-con3: Get a DDL going and stop in the middle
-REPAIR TABLE bup_ddl_blocker.t2;
-con1: Wait for con3 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con3_started';
-con1: Activate synchronization points for backup.
-SET DEBUG_SYNC= 'before_block_ddl SIGNAL bup_blocked WAIT_FOR status_shown';
-SET DEBUG_SYNC= 'after_block_ddl SIGNAL bup_started WAIT_FOR status_shown2';
-con1: Backing up database -- will block with lock
-BACKUP DATABASE bup_ddl_blocker TO "bup_ddl_blocker.bak";
-con6: Wait for con1 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR bup_blocked';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "BACKUP DATABASE%";
-state info
-debug sync point: before_block_ddl BACKUP DATABASE bup_ddl_blocker TO "bup_ddl_blocker.bak"
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "RENAME TABLE bup_ddl_blocker.t1%";
-state info
-debug sync point: after_start_ddl RENAME TABLE bup_ddl_blocker.t1 TO bup_ddl_blocker.t01
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "REPAIR TABLE bup_ddl_blocker.t2%";
-state info
-debug sync point: after_start_ddl REPAIR TABLE bup_ddl_blocker.t2
-con6: Resume all and wait for backup to start after DDL finish.
-SET DEBUG_SYNC= 'now SIGNAL status_shown WAIT_FOR bup_started';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "BACKUP DATABASE%";
-state info
-debug sync point: after_block_ddl BACKUP DATABASE bup_ddl_blocker TO "bup_ddl_blocker.bak"
-con4: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'before_check_ddl_blocked SIGNAL con4_started
- WAIT_FOR status_shown2';
-con4: Try a DDL but it is blocked by backup -- will not be in backup
-RENAME TABLE bup_ddl_blocker.t3 TO bup_ddl_blocker.t03;
-con5: Wait for con4 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con4_started';
-con5: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'before_check_ddl_blocked SIGNAL con5_started
- WAIT_FOR status_shown2';
-con5: Try a DDL but it is blocked by backup -- will not be in backup
-REPAIR TABLE bup_ddl_blocker.t4;
-con6: Wait for con5 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con5_started';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "RENAME TABLE bup_ddl_blocker.t3%";
-state info
-debug sync point: before_check_ddl_blocked RENAME TABLE bup_ddl_blocker.t3 TO bup_ddl_blocker.t03
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "REPAIR TABLE bup_ddl_blocker.t4%";
-state info
-debug sync point: before_check_ddl_blocked REPAIR TABLE bup_ddl_blocker.t4
-con6: Resume all.
-SET DEBUG_SYNC= 'now SIGNAL status_shown2';
-con2: Completing DDL
-con3: Completing DDL
-Table Op Msg_type Msg_text
-bup_ddl_blocker.t2 repair status OK
-con4: Completing DDL
-con5: Completing DDL
-Table Op Msg_type Msg_text
-bup_ddl_blocker.t4 repair status OK
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+
+########################################################
+# Running BML test for the following statements:
+#
+# DDL1= CREATE DATABASE bml_test_db1
+# DDL2= DROP TABLE t1
+# DDL3= DROP VIEW v1
+# DDL4= CREATE FUNCTION f1() RETURNS int RETURN 1
+#
+# BML is activated by RESTORE FROM 'bml_test.bkp' OVERWRITE.
+########################################################
+
+SET DEBUG_SYNC= 'reset';
+PURGE BACKUP LOGS;
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+
+== Checkpoint A ==
+# Check the initial situation.
+CALL test.check_results();
+Database (bml%)
+bml_test
+name type
+t1 BASE TABLE
+t2 BASE TABLE
+v1 VIEW
+p1 PROCEDURE
+e1 EVENT
+r1 TRIGGER
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `b` int(11) DEFAULT NULL,
+ KEY `i1` (`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+==================
+
+# con1: Start DDL1 making it to stop after it has started (and
+# possibly registered with BML).
+SET DEBUG_SYNC= 'before_execute_sql_command SIGNAL ddl1_started
+ WAIT_FOR continue_ddl';
+CREATE DATABASE bml_test_db1;
+# con2: Wait for DDL1 to reach its synchronization point.
+SET DEBUG_SYNC= 'now WAIT_FOR ddl1_started TIMEOUT 3';
+# con2: Start DDL2 making it to stop after it has started (and
+# possibly registered with BML).
+SET DEBUG_SYNC= 'before_execute_sql_command SIGNAL ddl2_started
+ WAIT_FOR continue_ddl';
+DROP TABLE t1;
+# con5: Wait for DDL2 to reach its synchronization point.
+SET DEBUG_SYNC= 'now WAIT_FOR ddl2_started TIMEOUT 3';
+SET DEBUG_SYNC='before_execute_sql_command CLEAR';
+# con5: Activate synchronization points for BACKUP/RESTORE.
+SET DEBUG_SYNC= 'bml_get_check2 SIGNAL bup_waiting';
+SET DEBUG_SYNC= 'after_backup_start_backup WAIT_FOR continue_bup';
+SET DEBUG_SYNC= 'after_backup_start_restore WAIT_FOR continue_bup';
+SET DEBUG_SYNC= 'before_backup_meta SIGNAL bup_running WAIT_FOR finish_bup';
+SET DEBUG_SYNC= 'start_do_restore SIGNAL bup_running WAIT_FOR finish_bup';
+# con5: Starting BACKUP/RESTORE operation -- should be blocked
+# by ongoing DDLs.
+SET SESSION debug="+d,set_backup_id";
+RESTORE FROM 'bml_test.bkp' OVERWRITE;
+# Waiting for BACKUP/RESTORE to reach its synchronization point.
+SET DEBUG_SYNC= 'now WAIT_FOR bup_waiting TIMEOUT 1';
+
+== Checkpoint B ==
+#
+# DDL1= CREATE DATABASE bml_test_db1
+# DDL2= DROP TABLE t1
+# DDL3= DROP VIEW v1
+# DDL4= CREATE FUNCTION f1() RETURNS int RETURN 1
+#
+SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
+WHERE info LIKE "BACKUP DATABASE%"
+ OR info LIKE "RESTORE FROM%"
+ OR info LIKE "CREATE DATABASE bml_test_db1%"
+ OR info LIKE "DROP TABLE t1%";
+state info
+BML: waiting for all statements to leave RESTORE FROM 'bml_test.bkp' OVERWRITE
+debug sync point: before_execute_sql_command DROP TABLE t1
+debug sync point: before_execute_sql_command CREATE DATABASE bml_test_db1
+# Checking that BACKUP is blocked by DDLs.
+SELECT object, notes, error_num FROM mysql.backup_progress WHERE backup_id=500;
+object notes error_num
+backup kernel starting 0
+backup kernel running 0
+# Checking that DDL1 and DDL2 have not executed.
+CALL test.check_results();
+Database (bml%)
+bml_test
+name type
+t1 BASE TABLE
+t2 BASE TABLE
+v1 VIEW
+p1 PROCEDURE
+e1 EVENT
+r1 TRIGGER
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `b` int(11) DEFAULT NULL,
+ KEY `i1` (`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+==================
+
+# Resume DDL1 and DDL2.
+# Now BACKUP/RESTORE should stop after activating DDL blocker.
+SET DEBUG_SYNC= 'now SIGNAL continue_ddl';
+# con1: Reaping DDL1
+# con2: Reaping DDL2
+SET DEBUG_SYNC= 'now SIGNAL continue_bup WAIT_FOR bup_running TIMEOUT 1';
+
+== Checkpoint C ==
+#
+# DDL1= CREATE DATABASE bml_test_db1
+# DDL2= DROP TABLE t1
+# DDL3= DROP VIEW v1
+# DDL4= CREATE FUNCTION f1() RETURNS int RETURN 1
+#
+SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
+WHERE info LIKE "BACKUP DATABASE%"
+ OR info LIKE "RESTORE FROM%";
+state info
+debug sync point: start_do_restore RESTORE FROM 'bml_test.bkp' OVERWRITE
+# Checking that DDL1 and DDL2 have executed.
+CALL test.check_results();
+Database (bml%)
+bml_test
+bml_test_db1
+name type
+t2 BASE TABLE
+v1 VIEW
+p1 PROCEDURE
+e1 EVENT
+r1 TRIGGER
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `b` int(11) DEFAULT NULL,
+ KEY `i1` (`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+==================
+
+# con3: Send DDL3 but it is blocked by BACKUP/RESTORE
+# (will not be in backup) make it send signal when
+# blocked on BML.
+SET DEBUG_SYNC= 'bml_enter_check SIGNAL ddl3_blocked';
+DROP VIEW v1;
+# Wait for DDL3 to send its signal.
+SET DEBUG_SYNC= 'now WAIT_FOR ddl3_blocked TIMEOUT 3';
+# con3: Send DDL3 but it is blocked by BACKUP/RESTORE
+# (will not be in backup) make it send signal when
+# blocked on BML.
+SET DEBUG_SYNC= 'bml_enter_check SIGNAL ddl4_blocked';
+CREATE FUNCTION f1() RETURNS int RETURN 1;
+# Wait for DDL4 to send its signal.
+SET DEBUG_SYNC= 'now WAIT_FOR ddl4_blocked TIMEOUT 3';
+
+== Checkpoint D ==
+#
+# DDL1= CREATE DATABASE bml_test_db1
+# DDL2= DROP TABLE t1
+# DDL3= DROP VIEW v1
+# DDL4= CREATE FUNCTION f1() RETURNS int RETURN 1
+#
+SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
+WHERE info LIKE "DROP VIEW v1%"
+ OR info LIKE "CREATE FUNCTION f1() RETURNS int RETURN 1%";
+state info
+BML: waiting until released CREATE FUNCTION f1() RETURNS int RETURN 1
+BML: waiting until released DROP VIEW v1
+# Checking that DDL3 and DDL4 have not executed.
+CALL test.check_results();
+Database (bml%)
+bml_test
+bml_test_db1
+name type
+t2 BASE TABLE
+v1 VIEW
+p1 PROCEDURE
+e1 EVENT
+r1 TRIGGER
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `b` int(11) DEFAULT NULL,
+ KEY `i1` (`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+==================
+
+# Resume BACKUP/RESTORE - this allows DDL3 and DDL4 to complete.
+SET DEBUG_SYNC= 'now SIGNAL finish_bup';
+# con5: Reaping BACKUP/RESTORE
+backup_id
+500
+SET debug="-d";
+# con3: Completing DDL3
+# con4: Completing DDL4
+
+== Checkpoint E ==
+#
+# DDL1= CREATE DATABASE bml_test_db1
+# DDL2= DROP TABLE t1
+# DDL3= DROP VIEW v1
+# DDL4= CREATE FUNCTION f1() RETURNS int RETURN 1
+#
+# Checking that DDL3 and DDL4 have executed.
+CALL test.check_results();
+Database (bml%)
+bml_test
+bml_test_db1
+name type
+t2 BASE TABLE
+f1 FUNCTION
+p1 PROCEDURE
+e1 EVENT
+r1 TRIGGER
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `b` int(11) DEFAULT NULL,
+ KEY `i1` (`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+==================
+
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+CREATE VIEW v1 AS SELECT * FROM t2;
+DROP TRIGGER r1;
+DROP EVENT e1;
+
+########################################################
+# Running BML test for the following statements:
+#
+# DDL1= CREATE TRIGGER r1 AFTER UPDATE ON t2 FOR EACH ROW SET @foo=1
+# DDL2= DROP INDEX i1 ON t2
+# DDL3= DROP PROCEDURE p1
+# DDL4= CREATE EVENT e1 ON SCHEDULE EVERY 1 YEAR DISABLE DO SET @foo=1
+#
+# BML is activated by BACKUP DATABASE bml_test TO 'bml_test.bkp'.
+########################################################
+
+SET DEBUG_SYNC= 'reset';
+PURGE BACKUP LOGS;
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+
+== Checkpoint A ==
+# Check the initial situation.
+CALL test.check_results();
+Database (bml%)
+bml_test
+bml_test_db1
+name type
+t2 BASE TABLE
+v1 VIEW
+f1 FUNCTION
+p1 PROCEDURE
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `b` int(11) DEFAULT NULL,
+ KEY `i1` (`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+==================
+
+# con1: Start DDL1 making it to stop after it has started (and
+# possibly registered with BML).
+SET DEBUG_SYNC= 'before_execute_sql_command SIGNAL ddl1_started
+ WAIT_FOR continue_ddl';
+CREATE TRIGGER r1 AFTER UPDATE ON t2 FOR EACH ROW SET @foo=1;
+# con2: Wait for DDL1 to reach its synchronization point.
+SET DEBUG_SYNC= 'now WAIT_FOR ddl1_started TIMEOUT 3';
+# con2: Start DDL2 making it to stop after it has started (and
+# possibly registered with BML).
+SET DEBUG_SYNC= 'before_execute_sql_command SIGNAL ddl2_started
+ WAIT_FOR continue_ddl';
+DROP INDEX i1 ON t2;
+# con5: Wait for DDL2 to reach its synchronization point.
+SET DEBUG_SYNC= 'now WAIT_FOR ddl2_started TIMEOUT 3';
+SET DEBUG_SYNC='before_execute_sql_command CLEAR';
+# con5: Activate synchronization points for BACKUP/RESTORE.
+SET DEBUG_SYNC= 'bml_get_check2 SIGNAL bup_waiting';
+SET DEBUG_SYNC= 'after_backup_start_backup WAIT_FOR continue_bup';
+SET DEBUG_SYNC= 'after_backup_start_restore WAIT_FOR continue_bup';
+SET DEBUG_SYNC= 'before_backup_meta SIGNAL bup_running WAIT_FOR finish_bup';
+SET DEBUG_SYNC= 'start_do_restore SIGNAL bup_running WAIT_FOR finish_bup';
+# con5: Starting BACKUP/RESTORE operation -- should be blocked
+# by ongoing DDLs.
+SET SESSION debug="+d,set_backup_id";
+BACKUP DATABASE bml_test TO 'bml_test.bkp';
+# Waiting for BACKUP/RESTORE to reach its synchronization point.
+SET DEBUG_SYNC= 'now WAIT_FOR bup_waiting TIMEOUT 1';
+
+== Checkpoint B ==
+#
+# DDL1= CREATE TRIGGER r1 AFTER UPDATE ON t2 FOR EACH ROW SET @foo=1
+# DDL2= DROP INDEX i1 ON t2
+# DDL3= DROP PROCEDURE p1
+# DDL4= CREATE EVENT e1 ON SCHEDULE EVERY 1 YEAR DISABLE DO SET @foo=1
+#
+SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
+WHERE info LIKE "BACKUP DATABASE%"
+ OR info LIKE "RESTORE FROM%"
+ OR info LIKE "CREATE TRIGGER r1 AFTER UPDATE ON t2 FOR EACH ROW SET @foo=1%"
+ OR info LIKE "DROP INDEX i1 ON t2%";
+state info
+BML: waiting for all statements to leave BACKUP DATABASE bml_test TO 'bml_test.bkp'
+debug sync point: before_execute_sql_command DROP INDEX i1 ON t2
+debug sync point: before_execute_sql_command CREATE TRIGGER r1 AFTER UPDATE ON t2 FOR EACH ROW SET @foo=1
+# Checking that BACKUP is blocked by DDLs.
+SELECT object, notes, error_num FROM mysql.backup_progress WHERE backup_id=500;
+object notes error_num
+backup kernel starting 0
+backup kernel running 0
+# Checking that DDL1 and DDL2 have not executed.
+CALL test.check_results();
+Database (bml%)
+bml_test
+bml_test_db1
+name type
+t2 BASE TABLE
+v1 VIEW
+f1 FUNCTION
+p1 PROCEDURE
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `b` int(11) DEFAULT NULL,
+ KEY `i1` (`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+==================
+
+# Resume DDL1 and DDL2.
+# Now BACKUP/RESTORE should stop after activating DDL blocker.
+SET DEBUG_SYNC= 'now SIGNAL continue_ddl';
+# con1: Reaping DDL1
+# con2: Reaping DDL2
+SET DEBUG_SYNC= 'now SIGNAL continue_bup WAIT_FOR bup_running TIMEOUT 1';
+
+== Checkpoint C ==
+#
+# DDL1= CREATE TRIGGER r1 AFTER UPDATE ON t2 FOR EACH ROW SET @foo=1
+# DDL2= DROP INDEX i1 ON t2
+# DDL3= DROP PROCEDURE p1
+# DDL4= CREATE EVENT e1 ON SCHEDULE EVERY 1 YEAR DISABLE DO SET @foo=1
+#
+SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
+WHERE info LIKE "BACKUP DATABASE%"
+ OR info LIKE "RESTORE FROM%";
+state info
+debug sync point: before_backup_meta BACKUP DATABASE bml_test TO 'bml_test.bkp'
+# Checking that DDL1 and DDL2 have executed.
+CALL test.check_results();
+Database (bml%)
+bml_test
+bml_test_db1
+name type
+t2 BASE TABLE
+v1 VIEW
+f1 FUNCTION
+p1 PROCEDURE
+r1 TRIGGER
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `b` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+==================
+
+# con3: Send DDL3 but it is blocked by BACKUP/RESTORE
+# (will not be in backup) make it send signal when
+# blocked on BML.
+SET DEBUG_SYNC= 'bml_enter_check SIGNAL ddl3_blocked';
+DROP PROCEDURE p1;
+# Wait for DDL3 to send its signal.
+SET DEBUG_SYNC= 'now WAIT_FOR ddl3_blocked TIMEOUT 3';
+# con3: Send DDL3 but it is blocked by BACKUP/RESTORE
+# (will not be in backup) make it send signal when
+# blocked on BML.
+SET DEBUG_SYNC= 'bml_enter_check SIGNAL ddl4_blocked';
+CREATE EVENT e1 ON SCHEDULE EVERY 1 YEAR DISABLE DO SET @foo=1;
+# Wait for DDL4 to send its signal.
+SET DEBUG_SYNC= 'now WAIT_FOR ddl4_blocked TIMEOUT 3';
+
+== Checkpoint D ==
+#
+# DDL1= CREATE TRIGGER r1 AFTER UPDATE ON t2 FOR EACH ROW SET @foo=1
+# DDL2= DROP INDEX i1 ON t2
+# DDL3= DROP PROCEDURE p1
+# DDL4= CREATE EVENT e1 ON SCHEDULE EVERY 1 YEAR DISABLE DO SET @foo=1
+#
+SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
+WHERE info LIKE "DROP PROCEDURE p1%"
+ OR info LIKE "CREATE EVENT e1 ON SCHEDULE EVERY 1 YEAR DISABLE DO SET @foo=1%";
+state info
+BML: waiting until released CREATE EVENT e1 ON SCHEDULE EVERY 1 YEAR DISABLE DO SET @foo=1
+BML: waiting until released DROP PROCEDURE p1
+# Checking that DDL3 and DDL4 have not executed.
+CALL test.check_results();
+Database (bml%)
+bml_test
+bml_test_db1
+name type
+t2 BASE TABLE
+v1 VIEW
+f1 FUNCTION
+p1 PROCEDURE
+r1 TRIGGER
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `b` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+==================
+
+# Resume BACKUP/RESTORE - this allows DDL3 and DDL4 to complete.
+SET DEBUG_SYNC= 'now SIGNAL finish_bup';
+# con5: Reaping BACKUP/RESTORE
+backup_id
+500
+SET debug="-d";
+# con3: Completing DDL3
+# con4: Completing DDL4
+
+== Checkpoint E ==
+#
+# DDL1= CREATE TRIGGER r1 AFTER UPDATE ON t2 FOR EACH ROW SET @foo=1
+# DDL2= DROP INDEX i1 ON t2
+# DDL3= DROP PROCEDURE p1
+# DDL4= CREATE EVENT e1 ON SCHEDULE EVERY 1 YEAR DISABLE DO SET @foo=1
+#
+# Checking that DDL3 and DDL4 have executed.
+CALL test.check_results();
+Database (bml%)
+bml_test
+bml_test_db1
+name type
+t2 BASE TABLE
+v1 VIEW
+f1 FUNCTION
+e1 EVENT
+r1 TRIGGER
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `b` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+==================
+
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+
+########################################################
+# Running BML test for the following statements:
+#
+# DDL1= CREATE PROCEDURE p1() SET @foo=1
+# DDL2= DROP EVENT e1
+# DDL3= DROP TRIGGER r1
+# DDL4= CREATE INDEX i1 ON t2(b)
+#
+# BML is activated by RESTORE FROM 'bml_test.bkp' OVERWRITE.
+########################################################
+
+SET DEBUG_SYNC= 'reset';
+PURGE BACKUP LOGS;
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+
+== Checkpoint A ==
+# Check the initial situation.
+CALL test.check_results();
+Database (bml%)
+bml_test
+bml_test_db1
+name type
+t2 BASE TABLE
+v1 VIEW
+f1 FUNCTION
+e1 EVENT
+r1 TRIGGER
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `b` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+==================
+
+# con1: Start DDL1 making it to stop after it has started (and
+# possibly registered with BML).
+SET DEBUG_SYNC= 'before_execute_sql_command SIGNAL ddl1_started
+ WAIT_FOR continue_ddl';
+CREATE PROCEDURE p1() SET @foo=1;
+# con2: Wait for DDL1 to reach its synchronization point.
+SET DEBUG_SYNC= 'now WAIT_FOR ddl1_started TIMEOUT 3';
+# con2: Start DDL2 making it to stop after it has started (and
+# possibly registered with BML).
+SET DEBUG_SYNC= 'before_execute_sql_command SIGNAL ddl2_started
+ WAIT_FOR continue_ddl';
+DROP EVENT e1;
+# con5: Wait for DDL2 to reach its synchronization point.
+SET DEBUG_SYNC= 'now WAIT_FOR ddl2_started TIMEOUT 3';
+SET DEBUG_SYNC='before_execute_sql_command CLEAR';
+# con5: Activate synchronization points for BACKUP/RESTORE.
+SET DEBUG_SYNC= 'bml_get_check2 SIGNAL bup_waiting';
+SET DEBUG_SYNC= 'after_backup_start_backup WAIT_FOR continue_bup';
+SET DEBUG_SYNC= 'after_backup_start_restore WAIT_FOR continue_bup';
+SET DEBUG_SYNC= 'before_backup_meta SIGNAL bup_running WAIT_FOR finish_bup';
+SET DEBUG_SYNC= 'start_do_restore SIGNAL bup_running WAIT_FOR finish_bup';
+# con5: Starting BACKUP/RESTORE operation -- should be blocked
+# by ongoing DDLs.
+SET SESSION debug="+d,set_backup_id";
+RESTORE FROM 'bml_test.bkp' OVERWRITE;
+# Waiting for BACKUP/RESTORE to reach its synchronization point.
+SET DEBUG_SYNC= 'now WAIT_FOR bup_waiting TIMEOUT 1';
+
+== Checkpoint B ==
+#
+# DDL1= CREATE PROCEDURE p1() SET @foo=1
+# DDL2= DROP EVENT e1
+# DDL3= DROP TRIGGER r1
+# DDL4= CREATE INDEX i1 ON t2(b)
+#
+SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
+WHERE info LIKE "BACKUP DATABASE%"
+ OR info LIKE "RESTORE FROM%"
+ OR info LIKE "CREATE PROCEDURE p1() SET @foo=1%"
+ OR info LIKE "DROP EVENT e1%";
+state info
+BML: waiting for all statements to leave RESTORE FROM 'bml_test.bkp' OVERWRITE
+debug sync point: before_execute_sql_command DROP EVENT e1
+debug sync point: before_execute_sql_command CREATE PROCEDURE p1() SET @foo=1
+# Checking that BACKUP is blocked by DDLs.
+SELECT object, notes, error_num FROM mysql.backup_progress WHERE backup_id=500;
+object notes error_num
+backup kernel starting 0
+backup kernel running 0
+# Checking that DDL1 and DDL2 have not executed.
+CALL test.check_results();
+Database (bml%)
+bml_test
+bml_test_db1
+name type
+t2 BASE TABLE
+v1 VIEW
+f1 FUNCTION
+e1 EVENT
+r1 TRIGGER
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `b` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+==================
+
+# Resume DDL1 and DDL2.
+# Now BACKUP/RESTORE should stop after activating DDL blocker.
+SET DEBUG_SYNC= 'now SIGNAL continue_ddl';
+# con1: Reaping DDL1
+# con2: Reaping DDL2
+SET DEBUG_SYNC= 'now SIGNAL continue_bup WAIT_FOR bup_running TIMEOUT 1';
+
+== Checkpoint C ==
+#
+# DDL1= CREATE PROCEDURE p1() SET @foo=1
+# DDL2= DROP EVENT e1
+# DDL3= DROP TRIGGER r1
+# DDL4= CREATE INDEX i1 ON t2(b)
+#
+SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
+WHERE info LIKE "BACKUP DATABASE%"
+ OR info LIKE "RESTORE FROM%";
+state info
+debug sync point: start_do_restore RESTORE FROM 'bml_test.bkp' OVERWRITE
+# Checking that DDL1 and DDL2 have executed.
+CALL test.check_results();
+Database (bml%)
+bml_test
+bml_test_db1
+name type
+t2 BASE TABLE
+v1 VIEW
+f1 FUNCTION
+p1 PROCEDURE
+r1 TRIGGER
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `b` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+==================
+
+# con3: Send DDL3 but it is blocked by BACKUP/RESTORE
+# (will not be in backup) make it send signal when
+# blocked on BML.
+SET DEBUG_SYNC= 'bml_enter_check SIGNAL ddl3_blocked';
+DROP TRIGGER r1;
+# Wait for DDL3 to send its signal.
+SET DEBUG_SYNC= 'now WAIT_FOR ddl3_blocked TIMEOUT 3';
+# con3: Send DDL3 but it is blocked by BACKUP/RESTORE
+# (will not be in backup) make it send signal when
+# blocked on BML.
+SET DEBUG_SYNC= 'bml_enter_check SIGNAL ddl4_blocked';
+CREATE INDEX i1 ON t2(b);
+# Wait for DDL4 to send its signal.
+SET DEBUG_SYNC= 'now WAIT_FOR ddl4_blocked TIMEOUT 3';
+
+== Checkpoint D ==
+#
+# DDL1= CREATE PROCEDURE p1() SET @foo=1
+# DDL2= DROP EVENT e1
+# DDL3= DROP TRIGGER r1
+# DDL4= CREATE INDEX i1 ON t2(b)
+#
+SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
+WHERE info LIKE "DROP TRIGGER r1%"
+ OR info LIKE "CREATE INDEX i1 ON t2(b)%";
+state info
+BML: waiting until released CREATE INDEX i1 ON t2(b)
+BML: waiting until released DROP TRIGGER r1
+# Checking that DDL3 and DDL4 have not executed.
+CALL test.check_results();
+Database (bml%)
+bml_test
+bml_test_db1
+name type
+t2 BASE TABLE
+v1 VIEW
+f1 FUNCTION
+p1 PROCEDURE
+r1 TRIGGER
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `b` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+==================
+
+# Resume BACKUP/RESTORE - this allows DDL3 and DDL4 to complete.
+SET DEBUG_SYNC= 'now SIGNAL finish_bup';
+# con5: Reaping BACKUP/RESTORE
+backup_id
+500
+SET debug="-d";
+# con3: Completing DDL3
+# con4: Completing DDL4
+
+== Checkpoint E ==
+#
+# DDL1= CREATE PROCEDURE p1() SET @foo=1
+# DDL2= DROP EVENT e1
+# DDL3= DROP TRIGGER r1
+# DDL4= CREATE INDEX i1 ON t2(b)
+#
+# Checking that DDL3 and DDL4 have executed.
+CALL test.check_results();
+Database (bml%)
+bml_test
+bml_test_db1
+name type
+t2 BASE TABLE
+v1 VIEW
+f1 FUNCTION
+p1 PROCEDURE
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `b` int(11) DEFAULT NULL,
+ KEY `i1` (`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+==================
+
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+CREATE TRIGGER r1 AFTER UPDATE ON t2 FOR EACH ROW SET @foo=1;
+RESTORE FROM 'bml_test_orig.bkp' OVERWRITE;
backup_id
+501
+TRUNCATE TABLE test.objects;
+INSERT INTO test.objects VALUES
+(1, 'DATABASE', 'bml_test_db1', ' CHARACTER SET = utf8'),
+(2, 'TABLE', 't1', ' ADD INDEX `i` (a)'),
+(3, 'VIEW', 'v1', ' AS SELECT 1'),
+(4, 'FUNCTION', 'f1', " COMMENT 'testing alter'"),
+(5, 'PROCEDURE', 'p1', " COMMENT 'testing alter'"),
+(6, 'EVENT', 'e1', ' RENAME TO e2');
+DROP PROCEDURE IF EXISTS test.check_results\\
+CREATE PROCEDURE test.check_results()
+BEGIN
+SHOW CREATE DATABASE bml_test_db1;
+SHOW CREATE TABLE bml_test.t1;
+SHOW CREATE VIEW bml_test.v1;
+SHOW CREATE FUNCTION bml_test.f1;
+SHOW CREATE PROCEDURE bml_test.p1;
+SELECT event_name FROM information_schema.events
+WHERE event_schema = 'bml_test';
+END\\
+CALL test.check_results();
+Database Create Database
+bml_test_db1 CREATE DATABASE `bml_test_db1` /*!40100 DEFAULT CHARACTER SET latin1 */
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `bml_test`.`v1` AS select `bml_test`.`t2`.`b` AS `b` from `bml_test`.`t2` latin1 latin1_swedish_ci
+Function sql_mode Create Function character_set_client collation_connection Database Collation
+f1 CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
+RETURN 1 latin1 latin1_swedish_ci latin1_swedish_ci
+Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
+p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+SET @foo=1 latin1 latin1_swedish_ci latin1_swedish_ci
+event_name
+e1
+
+########################################################
+# Running BML test for the following statements:
+#
+# DDL1= ALTER DATABASE bml_test_db1 CHARACTER SET = utf8
+# DDL2= ALTER TABLE t1 ADD INDEX `i` (a)
+# DDL3= ALTER VIEW v1 AS SELECT 1
+# DDL4= ALTER FUNCTION f1 COMMENT 'testing alter'
#
+# BML is activated by BACKUP DATABASE bml_test TO 'bml_test.bkp'.
+########################################################
-Verifying Test 2 results for backup.
+SET DEBUG_SYNC= 'reset';
+PURGE BACKUP LOGS;
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
-con1: Showing columns after updates and backup
-use bup_ddl_blocker;
-SHOW TABLES;
-Tables_in_bup_ddl_blocker
-t01
-t03
-t2
-t4
-con1: Dropping the database tables
-DROP TABLE bup_ddl_blocker.t01, bup_ddl_blocker.t2,
-bup_ddl_blocker.t03, bup_ddl_blocker.t4;
-con1: Restoring the database
-RESTORE FROM "bup_ddl_blocker.bak" OVERWRITE;
-backup_id
-#
-con1: Showing columns that were backed up
-con1: Table t01 should be in restore
-con1: Table t03 should not be in restore
-use bup_ddl_blocker;
-SHOW TABLES;
-Tables_in_bup_ddl_blocker
-t01
-t2
-t3
-t4
-
-Starting Test 2 - Restore
-
-DROP DATABASE IF EXISTS bup_ddl_blocker;
-CREATE DATABASE bup_ddl_blocker;
-con1: Creating tables
-CREATE TABLE bup_ddl_blocker.t1 (col_a CHAR(40)) ENGINE=INNODB;
-CREATE TABLE bup_ddl_blocker.t2 (col_a CHAR(40)) ENGINE=MYISAM;
-CREATE TABLE bup_ddl_blocker.t3 (col_a CHAR(40)) ENGINE=INNODB;
-CREATE TABLE bup_ddl_blocker.t4 (col_a CHAR(40)) ENGINE=MYISAM;
-con1: Loading data
-INSERT INTO bup_ddl_blocker.t1 VALUES ("01 Some data to test");
-INSERT INTO bup_ddl_blocker.t1 VALUES ("02 Some data to test");
-INSERT INTO bup_ddl_blocker.t1 VALUES ("03 Some data to test");
-INSERT INTO bup_ddl_blocker.t2 VALUES ("01 Some data to test");
-INSERT INTO bup_ddl_blocker.t2 VALUES ("02 Some data to test");
-INSERT INTO bup_ddl_blocker.t2 VALUES ("03 Some data to test");
-INSERT INTO bup_ddl_blocker.t3 VALUES ("01 Some data to test");
-INSERT INTO bup_ddl_blocker.t3 VALUES ("02 Some data to test");
-INSERT INTO bup_ddl_blocker.t3 VALUES ("03 Some data to test");
-INSERT INTO bup_ddl_blocker.t4 VALUES ("01 Some data to test");
-INSERT INTO bup_ddl_blocker.t4 VALUES ("02 Some data to test");
-INSERT INTO bup_ddl_blocker.t4 VALUES ("03 Some data to test");
-BACKUP DATABASE bup_ddl_blocker to 'bup_ddl_blocker_orig.bak';
-backup_id
-#
-con2: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'after_start_ddl SIGNAL con2_started WAIT_FOR status_shown';
-con2: Get a DDL going and stop in the middle
-RENAME TABLE bup_ddl_blocker.t1 TO bup_ddl_blocker.t01;
-con3: Wait for con2 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con2_started';
-con3: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'after_start_ddl SIGNAL con3_started WAIT_FOR status_shown';
-con3: Get a DDL going and stop in the middle
-REPAIR TABLE bup_ddl_blocker.t2;
-con1: Wait for con3 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con3_started';
-con1: Activate synchronization points for restore.
-SET DEBUG_SYNC= 'before_block_ddl SIGNAL bup_blocked WAIT_FOR status_shown';
-SET DEBUG_SYNC= 'after_block_ddl SIGNAL bup_started WAIT_FOR status_shown2';
-con1: Restoring database -- will block with lock
-RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE;
-con6: Wait for con1 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR bup_blocked';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "RESTORE FROM%";
-state info
-debug sync point: before_block_ddl RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "RENAME TABLE bup_ddl_blocker.t1%";
-state info
-debug sync point: after_start_ddl RENAME TABLE bup_ddl_blocker.t1 TO bup_ddl_blocker.t01
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "REPAIR TABLE bup_ddl_blocker.t2%";
-state info
-debug sync point: after_start_ddl REPAIR TABLE bup_ddl_blocker.t2
-con6: Resume all and wait for restore to start after DDL finish.
-SET DEBUG_SYNC= 'now SIGNAL status_shown WAIT_FOR bup_started';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "RESTORE FROM%";
-state info
-debug sync point: after_block_ddl RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE
-con4: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'before_check_ddl_blocked SIGNAL con4_started
- WAIT_FOR status_shown2';
-con4: Try a DDL but it is blocked by backup -- will not be in backup
-RENAME TABLE bup_ddl_blocker.t3 TO bup_ddl_blocker.t03;
-con5: Wait for con4 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con4_started';
-con5: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'before_check_ddl_blocked SIGNAL con5_started
- WAIT_FOR status_shown2';
-con5: Try a DDL but it is blocked by backup -- will not be in backup
-REPAIR TABLE bup_ddl_blocker.t4;
-con6: Wait for con5 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con5_started';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "RENAME TABLE bup_ddl_blocker.t3%";
-state info
-debug sync point: before_check_ddl_blocked RENAME TABLE bup_ddl_blocker.t3 TO bup_ddl_blocker.t03
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "REPAIR TABLE bup_ddl_blocker.t4%";
-state info
-debug sync point: before_check_ddl_blocked REPAIR TABLE bup_ddl_blocker.t4
-con6: Resume all.
-SET DEBUG_SYNC= 'now SIGNAL status_shown2';
-con2: Completing DDL
-con3: Completing DDL
-Table Op Msg_type Msg_text
-bup_ddl_blocker.t2 repair status OK
-con4: Completing DDL
-con5: Completing DDL
-Table Op Msg_type Msg_text
-bup_ddl_blocker.t4 repair status OK
+== Checkpoint A ==
+# Check the initial situation.
+CALL test.check_results();
+Database Create Database
+bml_test_db1 CREATE DATABASE `bml_test_db1` /*!40100 DEFAULT CHARACTER SET latin1 */
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `bml_test`.`v1` AS select `bml_test`.`t2`.`b` AS `b` from `bml_test`.`t2` latin1 latin1_swedish_ci
+Function sql_mode Create Function character_set_client collation_connection Database Collation
+f1 CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
+RETURN 1 latin1 latin1_swedish_ci latin1_swedish_ci
+Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
+p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+SET @foo=1 latin1 latin1_swedish_ci latin1_swedish_ci
+event_name
+e1
+==================
+
+# con1: Start DDL1 making it to stop after it has started (and
+# possibly registered with BML).
+SET DEBUG_SYNC= 'before_execute_sql_command SIGNAL ddl1_started
+ WAIT_FOR continue_ddl';
+ALTER DATABASE bml_test_db1 CHARACTER SET = utf8;
+# con2: Wait for DDL1 to reach its synchronization point.
+SET DEBUG_SYNC= 'now WAIT_FOR ddl1_started TIMEOUT 3';
+# con2: Start DDL2 making it to stop after it has started (and
+# possibly registered with BML).
+SET DEBUG_SYNC= 'before_execute_sql_command SIGNAL ddl2_started
+ WAIT_FOR continue_ddl';
+ALTER TABLE t1 ADD INDEX `i` (a);
+# con5: Wait for DDL2 to reach its synchronization point.
+SET DEBUG_SYNC= 'now WAIT_FOR ddl2_started TIMEOUT 3';
+SET DEBUG_SYNC='before_execute_sql_command CLEAR';
+# con5: Activate synchronization points for BACKUP/RESTORE.
+SET DEBUG_SYNC= 'bml_get_check2 SIGNAL bup_waiting';
+SET DEBUG_SYNC= 'after_backup_start_backup WAIT_FOR continue_bup';
+SET DEBUG_SYNC= 'after_backup_start_restore WAIT_FOR continue_bup';
+SET DEBUG_SYNC= 'before_backup_meta SIGNAL bup_running WAIT_FOR finish_bup';
+SET DEBUG_SYNC= 'start_do_restore SIGNAL bup_running WAIT_FOR finish_bup';
+# con5: Starting BACKUP/RESTORE operation -- should be blocked
+# by ongoing DDLs.
+SET SESSION debug="+d,set_backup_id";
+BACKUP DATABASE bml_test TO 'bml_test.bkp';
+# Waiting for BACKUP/RESTORE to reach its synchronization point.
+SET DEBUG_SYNC= 'now WAIT_FOR bup_waiting TIMEOUT 1';
+
+== Checkpoint B ==
+#
+# DDL1= ALTER DATABASE bml_test_db1 CHARACTER SET = utf8
+# DDL2= ALTER TABLE t1 ADD INDEX `i` (a)
+# DDL3= ALTER VIEW v1 AS SELECT 1
+# DDL4= ALTER FUNCTION f1 COMMENT 'testing alter'
+#
+SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
+WHERE info LIKE "BACKUP DATABASE%"
+ OR info LIKE "RESTORE FROM%"
+ OR info LIKE "ALTER DATABASE bml_test_db1 CHARACTER SET = utf8%"
+ OR info LIKE "ALTER TABLE t1 ADD INDEX `i` (a)%";
+state info
+BML: waiting for all statements to leave BACKUP DATABASE bml_test TO 'bml_test.bkp'
+debug sync point: before_execute_sql_command ALTER TABLE t1 ADD INDEX `i` (a)
+debug sync point: before_execute_sql_command ALTER DATABASE bml_test_db1 CHARACTER SET = utf8
+# Checking that BACKUP is blocked by DDLs.
+SELECT object, notes, error_num FROM mysql.backup_progress WHERE backup_id=500;
+object notes error_num
+backup kernel starting 0
+backup kernel running 0
+# Checking that DDL1 and DDL2 have not executed.
+CALL test.check_results();
+Database Create Database
+bml_test_db1 CREATE DATABASE `bml_test_db1` /*!40100 DEFAULT CHARACTER SET latin1 */
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `bml_test`.`v1` AS select `bml_test`.`t2`.`b` AS `b` from `bml_test`.`t2` latin1 latin1_swedish_ci
+Function sql_mode Create Function character_set_client collation_connection Database Collation
+f1 CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
+RETURN 1 latin1 latin1_swedish_ci latin1_swedish_ci
+Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
+p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+SET @foo=1 latin1 latin1_swedish_ci latin1_swedish_ci
+event_name
+e1
+==================
+
+# Resume DDL1 and DDL2.
+# Now BACKUP/RESTORE should stop after activating DDL blocker.
+SET DEBUG_SYNC= 'now SIGNAL continue_ddl';
+# con1: Reaping DDL1
+# con2: Reaping DDL2
+SET DEBUG_SYNC= 'now SIGNAL continue_bup WAIT_FOR bup_running TIMEOUT 1';
+
+== Checkpoint C ==
+#
+# DDL1= ALTER DATABASE bml_test_db1 CHARACTER SET = utf8
+# DDL2= ALTER TABLE t1 ADD INDEX `i` (a)
+# DDL3= ALTER VIEW v1 AS SELECT 1
+# DDL4= ALTER FUNCTION f1 COMMENT 'testing alter'
+#
+SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
+WHERE info LIKE "BACKUP DATABASE%"
+ OR info LIKE "RESTORE FROM%";
+state info
+debug sync point: before_backup_meta BACKUP DATABASE bml_test TO 'bml_test.bkp'
+# Checking that DDL1 and DDL2 have executed.
+CALL test.check_results();
+Database Create Database
+bml_test_db1 CREATE DATABASE `bml_test_db1` /*!40100 DEFAULT CHARACTER SET utf8 */
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ KEY `i` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `bml_test`.`v1` AS select `bml_test`.`t2`.`b` AS `b` from `bml_test`.`t2` latin1 latin1_swedish_ci
+Function sql_mode Create Function character_set_client collation_connection Database Collation
+f1 CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
+RETURN 1 latin1 latin1_swedish_ci latin1_swedish_ci
+Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
+p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+SET @foo=1 latin1 latin1_swedish_ci latin1_swedish_ci
+event_name
+e1
+==================
+
+# con3: Send DDL3 but it is blocked by BACKUP/RESTORE
+# (will not be in backup) make it send signal when
+# blocked on BML.
+SET DEBUG_SYNC= 'bml_enter_check SIGNAL ddl3_blocked';
+ALTER VIEW v1 AS SELECT 1;
+# Wait for DDL3 to send its signal.
+SET DEBUG_SYNC= 'now WAIT_FOR ddl3_blocked TIMEOUT 3';
+# con3: Send DDL3 but it is blocked by BACKUP/RESTORE
+# (will not be in backup) make it send signal when
+# blocked on BML.
+SET DEBUG_SYNC= 'bml_enter_check SIGNAL ddl4_blocked';
+ALTER FUNCTION f1 COMMENT 'testing alter';
+# Wait for DDL4 to send its signal.
+SET DEBUG_SYNC= 'now WAIT_FOR ddl4_blocked TIMEOUT 3';
+
+== Checkpoint D ==
+#
+# DDL1= ALTER DATABASE bml_test_db1 CHARACTER SET = utf8
+# DDL2= ALTER TABLE t1 ADD INDEX `i` (a)
+# DDL3= ALTER VIEW v1 AS SELECT 1
+# DDL4= ALTER FUNCTION f1 COMMENT 'testing alter'
+#
+SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
+WHERE info LIKE "ALTER VIEW v1 AS SELECT 1%"
+ OR info LIKE "ALTER FUNCTION f1 COMMENT 'testing alter'%";
+state info
+BML: waiting until released ALTER FUNCTION f1 COMMENT 'testing alter'
+BML: waiting until released ALTER VIEW v1 AS SELECT 1
+# Checking that DDL3 and DDL4 have not executed.
+CALL test.check_results();
+Database Create Database
+bml_test_db1 CREATE DATABASE `bml_test_db1` /*!40100 DEFAULT CHARACTER SET utf8 */
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ KEY `i` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `bml_test`.`v1` AS select `bml_test`.`t2`.`b` AS `b` from `bml_test`.`t2` latin1 latin1_swedish_ci
+Function sql_mode Create Function character_set_client collation_connection Database Collation
+f1 CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
+RETURN 1 latin1 latin1_swedish_ci latin1_swedish_ci
+Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
+p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+SET @foo=1 latin1 latin1_swedish_ci latin1_swedish_ci
+event_name
+e1
+==================
+
+# Resume BACKUP/RESTORE - this allows DDL3 and DDL4 to complete.
+SET DEBUG_SYNC= 'now SIGNAL finish_bup';
+# con5: Reaping BACKUP/RESTORE
+backup_id
+500
+SET debug="-d";
+# con3: Completing DDL3
+# con4: Completing DDL4
+
+== Checkpoint E ==
+#
+# DDL1= ALTER DATABASE bml_test_db1 CHARACTER SET = utf8
+# DDL2= ALTER TABLE t1 ADD INDEX `i` (a)
+# DDL3= ALTER VIEW v1 AS SELECT 1
+# DDL4= ALTER FUNCTION f1 COMMENT 'testing alter'
+#
+# Checking that DDL3 and DDL4 have executed.
+CALL test.check_results();
+Database Create Database
+bml_test_db1 CREATE DATABASE `bml_test_db1` /*!40100 DEFAULT CHARACTER SET utf8 */
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ KEY `i` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `bml_test`.`v1` AS select 1 AS `1` latin1 latin1_swedish_ci
+Function sql_mode Create Function character_set_client collation_connection Database Collation
+f1 CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
+ COMMENT 'testing alter'
+RETURN 1 latin1 latin1_swedish_ci latin1_swedish_ci
+Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
+p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+SET @foo=1 latin1 latin1_swedish_ci latin1_swedish_ci
+event_name
+e1
+==================
+
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+RESTORE FROM 'bml_test_orig.bkp' OVERWRITE;
+backup_id
+501
+
+########################################################
+# Running BML test for the following statements:
+#
+# DDL1= ALTER VIEW v1 AS SELECT 1
+# DDL2= ALTER FUNCTION f1 COMMENT 'testing alter'
+# DDL3= ALTER PROCEDURE p1 COMMENT 'testing alter'
+# DDL4= ALTER EVENT e1 RENAME TO e2
+#
+# BML is activated by RESTORE FROM 'bml_test.bkp' OVERWRITE.
+########################################################
+
+SET DEBUG_SYNC= 'reset';
+PURGE BACKUP LOGS;
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+
+== Checkpoint A ==
+# Check the initial situation.
+CALL test.check_results();
+Database Create Database
+bml_test_db1 CREATE DATABASE `bml_test_db1` /*!40100 DEFAULT CHARACTER SET latin1 */
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `bml_test`.`v1` AS select `bml_test`.`t2`.`b` AS `b` from `bml_test`.`t2` latin1 latin1_swedish_ci
+Function sql_mode Create Function character_set_client collation_connection Database Collation
+f1 CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
+RETURN 1 latin1 latin1_swedish_ci latin1_swedish_ci
+Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
+p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+SET @foo=1 latin1 latin1_swedish_ci latin1_swedish_ci
+event_name
+e1
+==================
+
+# con1: Start DDL1 making it to stop after it has started (and
+# possibly registered with BML).
+SET DEBUG_SYNC= 'before_execute_sql_command SIGNAL ddl1_started
+ WAIT_FOR continue_ddl';
+ALTER VIEW v1 AS SELECT 1;
+# con2: Wait for DDL1 to reach its synchronization point.
+SET DEBUG_SYNC= 'now WAIT_FOR ddl1_started TIMEOUT 3';
+# con2: Start DDL2 making it to stop after it has started (and
+# possibly registered with BML).
+SET DEBUG_SYNC= 'before_execute_sql_command SIGNAL ddl2_started
+ WAIT_FOR continue_ddl';
+ALTER FUNCTION f1 COMMENT 'testing alter';
+# con5: Wait for DDL2 to reach its synchronization point.
+SET DEBUG_SYNC= 'now WAIT_FOR ddl2_started TIMEOUT 3';
+SET DEBUG_SYNC='before_execute_sql_command CLEAR';
+# con5: Activate synchronization points for BACKUP/RESTORE.
+SET DEBUG_SYNC= 'bml_get_check2 SIGNAL bup_waiting';
+SET DEBUG_SYNC= 'after_backup_start_backup WAIT_FOR continue_bup';
+SET DEBUG_SYNC= 'after_backup_start_restore WAIT_FOR continue_bup';
+SET DEBUG_SYNC= 'before_backup_meta SIGNAL bup_running WAIT_FOR finish_bup';
+SET DEBUG_SYNC= 'start_do_restore SIGNAL bup_running WAIT_FOR finish_bup';
+# con5: Starting BACKUP/RESTORE operation -- should be blocked
+# by ongoing DDLs.
+SET SESSION debug="+d,set_backup_id";
+RESTORE FROM 'bml_test.bkp' OVERWRITE;
+# Waiting for BACKUP/RESTORE to reach its synchronization point.
+SET DEBUG_SYNC= 'now WAIT_FOR bup_waiting TIMEOUT 1';
+
+== Checkpoint B ==
+#
+# DDL1= ALTER VIEW v1 AS SELECT 1
+# DDL2= ALTER FUNCTION f1 COMMENT 'testing alter'
+# DDL3= ALTER PROCEDURE p1 COMMENT 'testing alter'
+# DDL4= ALTER EVENT e1 RENAME TO e2
+#
+SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
+WHERE info LIKE "BACKUP DATABASE%"
+ OR info LIKE "RESTORE FROM%"
+ OR info LIKE "ALTER VIEW v1 AS SELECT 1%"
+ OR info LIKE "ALTER FUNCTION f1 COMMENT 'testing alter'%";
+state info
+BML: waiting for all statements to leave RESTORE FROM 'bml_test.bkp' OVERWRITE
+debug sync point: before_execute_sql_command ALTER FUNCTION f1 COMMENT 'testing alter'
+debug sync point: before_execute_sql_command ALTER VIEW v1 AS SELECT 1
+# Checking that BACKUP is blocked by DDLs.
+SELECT object, notes, error_num FROM mysql.backup_progress WHERE backup_id=500;
+object notes error_num
+backup kernel starting 0
+backup kernel running 0
+# Checking that DDL1 and DDL2 have not executed.
+CALL test.check_results();
+Database Create Database
+bml_test_db1 CREATE DATABASE `bml_test_db1` /*!40100 DEFAULT CHARACTER SET latin1 */
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `bml_test`.`v1` AS select `bml_test`.`t2`.`b` AS `b` from `bml_test`.`t2` latin1 latin1_swedish_ci
+Function sql_mode Create Function character_set_client collation_connection Database Collation
+f1 CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
+RETURN 1 latin1 latin1_swedish_ci latin1_swedish_ci
+Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
+p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+SET @foo=1 latin1 latin1_swedish_ci latin1_swedish_ci
+event_name
+e1
+==================
+
+# Resume DDL1 and DDL2.
+# Now BACKUP/RESTORE should stop after activating DDL blocker.
+SET DEBUG_SYNC= 'now SIGNAL continue_ddl';
+# con1: Reaping DDL1
+# con2: Reaping DDL2
+SET DEBUG_SYNC= 'now SIGNAL continue_bup WAIT_FOR bup_running TIMEOUT 1';
+
+== Checkpoint C ==
+#
+# DDL1= ALTER VIEW v1 AS SELECT 1
+# DDL2= ALTER FUNCTION f1 COMMENT 'testing alter'
+# DDL3= ALTER PROCEDURE p1 COMMENT 'testing alter'
+# DDL4= ALTER EVENT e1 RENAME TO e2
+#
+SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
+WHERE info LIKE "BACKUP DATABASE%"
+ OR info LIKE "RESTORE FROM%";
+state info
+debug sync point: start_do_restore RESTORE FROM 'bml_test.bkp' OVERWRITE
+# Checking that DDL1 and DDL2 have executed.
+CALL test.check_results();
+Database Create Database
+bml_test_db1 CREATE DATABASE `bml_test_db1` /*!40100 DEFAULT CHARACTER SET latin1 */
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `bml_test`.`v1` AS select 1 AS `1` latin1 latin1_swedish_ci
+Function sql_mode Create Function character_set_client collation_connection Database Collation
+f1 CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
+ COMMENT 'testing alter'
+RETURN 1 latin1 latin1_swedish_ci latin1_swedish_ci
+Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
+p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+SET @foo=1 latin1 latin1_swedish_ci latin1_swedish_ci
+event_name
+e1
+==================
+
+# con3: Send DDL3 but it is blocked by BACKUP/RESTORE
+# (will not be in backup) make it send signal when
+# blocked on BML.
+SET DEBUG_SYNC= 'bml_enter_check SIGNAL ddl3_blocked';
+ALTER PROCEDURE p1 COMMENT 'testing alter';
+# Wait for DDL3 to send its signal.
+SET DEBUG_SYNC= 'now WAIT_FOR ddl3_blocked TIMEOUT 3';
+# con3: Send DDL3 but it is blocked by BACKUP/RESTORE
+# (will not be in backup) make it send signal when
+# blocked on BML.
+SET DEBUG_SYNC= 'bml_enter_check SIGNAL ddl4_blocked';
+ALTER EVENT e1 RENAME TO e2;
+# Wait for DDL4 to send its signal.
+SET DEBUG_SYNC= 'now WAIT_FOR ddl4_blocked TIMEOUT 3';
+
+== Checkpoint D ==
+#
+# DDL1= ALTER VIEW v1 AS SELECT 1
+# DDL2= ALTER FUNCTION f1 COMMENT 'testing alter'
+# DDL3= ALTER PROCEDURE p1 COMMENT 'testing alter'
+# DDL4= ALTER EVENT e1 RENAME TO e2
+#
+SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
+WHERE info LIKE "ALTER PROCEDURE p1 COMMENT 'testing alter'%"
+ OR info LIKE "ALTER EVENT e1 RENAME TO e2%";
+state info
+BML: waiting until released ALTER EVENT e1 RENAME TO e2
+BML: waiting until released ALTER PROCEDURE p1 COMMENT 'testing alter'
+# Checking that DDL3 and DDL4 have not executed.
+CALL test.check_results();
+Database Create Database
+bml_test_db1 CREATE DATABASE `bml_test_db1` /*!40100 DEFAULT CHARACTER SET latin1 */
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `bml_test`.`v1` AS select 1 AS `1` latin1 latin1_swedish_ci
+Function sql_mode Create Function character_set_client collation_connection Database Collation
+f1 CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
+ COMMENT 'testing alter'
+RETURN 1 latin1 latin1_swedish_ci latin1_swedish_ci
+Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
+p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+SET @foo=1 latin1 latin1_swedish_ci latin1_swedish_ci
+event_name
+e1
+==================
+
+# Resume BACKUP/RESTORE - this allows DDL3 and DDL4 to complete.
+SET DEBUG_SYNC= 'now SIGNAL finish_bup';
+# con5: Reaping BACKUP/RESTORE
+backup_id
+500
+SET debug="-d";
+# con3: Completing DDL3
+# con4: Completing DDL4
+
+== Checkpoint E ==
+#
+# DDL1= ALTER VIEW v1 AS SELECT 1
+# DDL2= ALTER FUNCTION f1 COMMENT 'testing alter'
+# DDL3= ALTER PROCEDURE p1 COMMENT 'testing alter'
+# DDL4= ALTER EVENT e1 RENAME TO e2
+#
+# Checking that DDL3 and DDL4 have executed.
+CALL test.check_results();
+Database Create Database
+bml_test_db1 CREATE DATABASE `bml_test_db1` /*!40100 DEFAULT CHARACTER SET latin1 */
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ KEY `i` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `bml_test`.`v1` AS select `bml_test`.`t2`.`b` AS `b` from `bml_test`.`t2` latin1 latin1_swedish_ci
+Function sql_mode Create Function character_set_client collation_connection Database Collation
+f1 CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
+RETURN 1 latin1 latin1_swedish_ci latin1_swedish_ci
+Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
+p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+ COMMENT 'testing alter'
+SET @foo=1 latin1 latin1_swedish_ci latin1_swedish_ci
+event_name
+e2
+==================
+
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+RESTORE FROM 'bml_test_orig.bkp' OVERWRITE;
+backup_id
+501
+
+########################################################
+# Running BML test for the following statements:
+#
+# DDL1= ALTER PROCEDURE p1 COMMENT 'testing alter'
+# DDL2= ALTER EVENT e1 RENAME TO e2
+# DDL3= ALTER DATABASE bml_test_db1 CHARACTER SET = utf8
+# DDL4= ALTER TABLE t1 ADD INDEX `i` (a)
+#
+# BML is activated by BACKUP DATABASE bml_test TO 'bml_test.bkp'.
+########################################################
+
+SET DEBUG_SYNC= 'reset';
+PURGE BACKUP LOGS;
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+
+== Checkpoint A ==
+# Check the initial situation.
+CALL test.check_results();
+Database Create Database
+bml_test_db1 CREATE DATABASE `bml_test_db1` /*!40100 DEFAULT CHARACTER SET latin1 */
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `bml_test`.`v1` AS select `bml_test`.`t2`.`b` AS `b` from `bml_test`.`t2` latin1 latin1_swedish_ci
+Function sql_mode Create Function character_set_client collation_connection Database Collation
+f1 CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
+RETURN 1 latin1 latin1_swedish_ci latin1_swedish_ci
+Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
+p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+SET @foo=1 latin1 latin1_swedish_ci latin1_swedish_ci
+event_name
+e1
+==================
+
+# con1: Start DDL1 making it to stop after it has started (and
+# possibly registered with BML).
+SET DEBUG_SYNC= 'before_execute_sql_command SIGNAL ddl1_started
+ WAIT_FOR continue_ddl';
+ALTER PROCEDURE p1 COMMENT 'testing alter';
+# con2: Wait for DDL1 to reach its synchronization point.
+SET DEBUG_SYNC= 'now WAIT_FOR ddl1_started TIMEOUT 3';
+# con2: Start DDL2 making it to stop after it has started (and
+# possibly registered with BML).
+SET DEBUG_SYNC= 'before_execute_sql_command SIGNAL ddl2_started
+ WAIT_FOR continue_ddl';
+ALTER EVENT e1 RENAME TO e2;
+# con5: Wait for DDL2 to reach its synchronization point.
+SET DEBUG_SYNC= 'now WAIT_FOR ddl2_started TIMEOUT 3';
+SET DEBUG_SYNC='before_execute_sql_command CLEAR';
+# con5: Activate synchronization points for BACKUP/RESTORE.
+SET DEBUG_SYNC= 'bml_get_check2 SIGNAL bup_waiting';
+SET DEBUG_SYNC= 'after_backup_start_backup WAIT_FOR continue_bup';
+SET DEBUG_SYNC= 'after_backup_start_restore WAIT_FOR continue_bup';
+SET DEBUG_SYNC= 'before_backup_meta SIGNAL bup_running WAIT_FOR finish_bup';
+SET DEBUG_SYNC= 'start_do_restore SIGNAL bup_running WAIT_FOR finish_bup';
+# con5: Starting BACKUP/RESTORE operation -- should be blocked
+# by ongoing DDLs.
+SET SESSION debug="+d,set_backup_id";
+BACKUP DATABASE bml_test TO 'bml_test.bkp';
+# Waiting for BACKUP/RESTORE to reach its synchronization point.
+SET DEBUG_SYNC= 'now WAIT_FOR bup_waiting TIMEOUT 1';
+
+== Checkpoint B ==
+#
+# DDL1= ALTER PROCEDURE p1 COMMENT 'testing alter'
+# DDL2= ALTER EVENT e1 RENAME TO e2
+# DDL3= ALTER DATABASE bml_test_db1 CHARACTER SET = utf8
+# DDL4= ALTER TABLE t1 ADD INDEX `i` (a)
+#
+SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
+WHERE info LIKE "BACKUP DATABASE%"
+ OR info LIKE "RESTORE FROM%"
+ OR info LIKE "ALTER PROCEDURE p1 COMMENT 'testing alter'%"
+ OR info LIKE "ALTER EVENT e1 RENAME TO e2%";
+state info
+BML: waiting for all statements to leave BACKUP DATABASE bml_test TO 'bml_test.bkp'
+debug sync point: before_execute_sql_command ALTER EVENT e1 RENAME TO e2
+debug sync point: before_execute_sql_command ALTER PROCEDURE p1 COMMENT 'testing alter'
+# Checking that BACKUP is blocked by DDLs.
+SELECT object, notes, error_num FROM mysql.backup_progress WHERE backup_id=500;
+object notes error_num
+backup kernel starting 0
+backup kernel running 0
+# Checking that DDL1 and DDL2 have not executed.
+CALL test.check_results();
+Database Create Database
+bml_test_db1 CREATE DATABASE `bml_test_db1` /*!40100 DEFAULT CHARACTER SET latin1 */
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `bml_test`.`v1` AS select `bml_test`.`t2`.`b` AS `b` from `bml_test`.`t2` latin1 latin1_swedish_ci
+Function sql_mode Create Function character_set_client collation_connection Database Collation
+f1 CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
+RETURN 1 latin1 latin1_swedish_ci latin1_swedish_ci
+Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
+p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+SET @foo=1 latin1 latin1_swedish_ci latin1_swedish_ci
+event_name
+e1
+==================
+
+# Resume DDL1 and DDL2.
+# Now BACKUP/RESTORE should stop after activating DDL blocker.
+SET DEBUG_SYNC= 'now SIGNAL continue_ddl';
+# con1: Reaping DDL1
+# con2: Reaping DDL2
+SET DEBUG_SYNC= 'now SIGNAL continue_bup WAIT_FOR bup_running TIMEOUT 1';
+
+== Checkpoint C ==
+#
+# DDL1= ALTER PROCEDURE p1 COMMENT 'testing alter'
+# DDL2= ALTER EVENT e1 RENAME TO e2
+# DDL3= ALTER DATABASE bml_test_db1 CHARACTER SET = utf8
+# DDL4= ALTER TABLE t1 ADD INDEX `i` (a)
+#
+SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
+WHERE info LIKE "BACKUP DATABASE%"
+ OR info LIKE "RESTORE FROM%";
+state info
+debug sync point: before_backup_meta BACKUP DATABASE bml_test TO 'bml_test.bkp'
+# Checking that DDL1 and DDL2 have executed.
+CALL test.check_results();
+Database Create Database
+bml_test_db1 CREATE DATABASE `bml_test_db1` /*!40100 DEFAULT CHARACTER SET latin1 */
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `bml_test`.`v1` AS select `bml_test`.`t2`.`b` AS `b` from `bml_test`.`t2` latin1 latin1_swedish_ci
+Function sql_mode Create Function character_set_client collation_connection Database Collation
+f1 CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
+RETURN 1 latin1 latin1_swedish_ci latin1_swedish_ci
+Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
+p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+ COMMENT 'testing alter'
+SET @foo=1 latin1 latin1_swedish_ci latin1_swedish_ci
+event_name
+e2
+==================
+
+# con3: Send DDL3 but it is blocked by BACKUP/RESTORE
+# (will not be in backup) make it send signal when
+# blocked on BML.
+SET DEBUG_SYNC= 'bml_enter_check SIGNAL ddl3_blocked';
+ALTER DATABASE bml_test_db1 CHARACTER SET = utf8;
+# Wait for DDL3 to send its signal.
+SET DEBUG_SYNC= 'now WAIT_FOR ddl3_blocked TIMEOUT 3';
+# con3: Send DDL3 but it is blocked by BACKUP/RESTORE
+# (will not be in backup) make it send signal when
+# blocked on BML.
+SET DEBUG_SYNC= 'bml_enter_check SIGNAL ddl4_blocked';
+ALTER TABLE t1 ADD INDEX `i` (a);
+# Wait for DDL4 to send its signal.
+SET DEBUG_SYNC= 'now WAIT_FOR ddl4_blocked TIMEOUT 3';
+
+== Checkpoint D ==
+#
+# DDL1= ALTER PROCEDURE p1 COMMENT 'testing alter'
+# DDL2= ALTER EVENT e1 RENAME TO e2
+# DDL3= ALTER DATABASE bml_test_db1 CHARACTER SET = utf8
+# DDL4= ALTER TABLE t1 ADD INDEX `i` (a)
+#
+SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
+WHERE info LIKE "ALTER DATABASE bml_test_db1 CHARACTER SET = utf8%"
+ OR info LIKE "ALTER TABLE t1 ADD INDEX `i` (a)%";
+state info
+BML: waiting until released ALTER TABLE t1 ADD INDEX `i` (a)
+BML: waiting until released ALTER DATABASE bml_test_db1 CHARACTER SET = utf8
+# Checking that DDL3 and DDL4 have not executed.
+CALL test.check_results();
+Database Create Database
+bml_test_db1 CREATE DATABASE `bml_test_db1` /*!40100 DEFAULT CHARACTER SET latin1 */
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `bml_test`.`v1` AS select `bml_test`.`t2`.`b` AS `b` from `bml_test`.`t2` latin1 latin1_swedish_ci
+Function sql_mode Create Function character_set_client collation_connection Database Collation
+f1 CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
+RETURN 1 latin1 latin1_swedish_ci latin1_swedish_ci
+Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
+p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+ COMMENT 'testing alter'
+SET @foo=1 latin1 latin1_swedish_ci latin1_swedish_ci
+event_name
+e2
+==================
+
+# Resume BACKUP/RESTORE - this allows DDL3 and DDL4 to complete.
+SET DEBUG_SYNC= 'now SIGNAL finish_bup';
+# con5: Reaping BACKUP/RESTORE
+backup_id
+500
+SET debug="-d";
+# con3: Completing DDL3
+# con4: Completing DDL4
+
+== Checkpoint E ==
+#
+# DDL1= ALTER PROCEDURE p1 COMMENT 'testing alter'
+# DDL2= ALTER EVENT e1 RENAME TO e2
+# DDL3= ALTER DATABASE bml_test_db1 CHARACTER SET = utf8
+# DDL4= ALTER TABLE t1 ADD INDEX `i` (a)
+#
+# Checking that DDL3 and DDL4 have executed.
+CALL test.check_results();
+Database Create Database
+bml_test_db1 CREATE DATABASE `bml_test_db1` /*!40100 DEFAULT CHARACTER SET utf8 */
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ KEY `i` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `bml_test`.`v1` AS select `bml_test`.`t2`.`b` AS `b` from `bml_test`.`t2` latin1 latin1_swedish_ci
+Function sql_mode Create Function character_set_client collation_connection Database Collation
+f1 CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
+RETURN 1 latin1 latin1_swedish_ci latin1_swedish_ci
+Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
+p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+ COMMENT 'testing alter'
+SET @foo=1 latin1 latin1_swedish_ci latin1_swedish_ci
+event_name
+e2
+==================
+
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+RESTORE FROM 'bml_test_orig.bkp' OVERWRITE;
+backup_id
+501
+
+########################################################
+# Running BML test for the following statements:
+#
+# DDL1= ALTER DATABASE bml_test_db1 CHARACTER SET = utf8
+# DDL2= ALTER TABLE t1 ADD INDEX `i` (a)
+# DDL3= ALTER VIEW v1 AS SELECT 1
+# DDL4= ALTER FUNCTION f1 COMMENT 'testing alter'
+#
+# BML is activated by RESTORE FROM 'bml_test.bkp' OVERWRITE.
+########################################################
+
+SET DEBUG_SYNC= 'reset';
+PURGE BACKUP LOGS;
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+
+== Checkpoint A ==
+# Check the initial situation.
+CALL test.check_results();
+Database Create Database
+bml_test_db1 CREATE DATABASE `bml_test_db1` /*!40100 DEFAULT CHARACTER SET latin1 */
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `bml_test`.`v1` AS select `bml_test`.`t2`.`b` AS `b` from `bml_test`.`t2` latin1 latin1_swedish_ci
+Function sql_mode Create Function character_set_client collation_connection Database Collation
+f1 CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
+RETURN 1 latin1 latin1_swedish_ci latin1_swedish_ci
+Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
+p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+SET @foo=1 latin1 latin1_swedish_ci latin1_swedish_ci
+event_name
+e1
+==================
+
+# con1: Start DDL1 making it to stop after it has started (and
+# possibly registered with BML).
+SET DEBUG_SYNC= 'before_execute_sql_command SIGNAL ddl1_started
+ WAIT_FOR continue_ddl';
+ALTER DATABASE bml_test_db1 CHARACTER SET = utf8;
+# con2: Wait for DDL1 to reach its synchronization point.
+SET DEBUG_SYNC= 'now WAIT_FOR ddl1_started TIMEOUT 3';
+# con2: Start DDL2 making it to stop after it has started (and
+# possibly registered with BML).
+SET DEBUG_SYNC= 'before_execute_sql_command SIGNAL ddl2_started
+ WAIT_FOR continue_ddl';
+ALTER TABLE t1 ADD INDEX `i` (a);
+# con5: Wait for DDL2 to reach its synchronization point.
+SET DEBUG_SYNC= 'now WAIT_FOR ddl2_started TIMEOUT 3';
+SET DEBUG_SYNC='before_execute_sql_command CLEAR';
+# con5: Activate synchronization points for BACKUP/RESTORE.
+SET DEBUG_SYNC= 'bml_get_check2 SIGNAL bup_waiting';
+SET DEBUG_SYNC= 'after_backup_start_backup WAIT_FOR continue_bup';
+SET DEBUG_SYNC= 'after_backup_start_restore WAIT_FOR continue_bup';
+SET DEBUG_SYNC= 'before_backup_meta SIGNAL bup_running WAIT_FOR finish_bup';
+SET DEBUG_SYNC= 'start_do_restore SIGNAL bup_running WAIT_FOR finish_bup';
+# con5: Starting BACKUP/RESTORE operation -- should be blocked
+# by ongoing DDLs.
+SET SESSION debug="+d,set_backup_id";
+RESTORE FROM 'bml_test.bkp' OVERWRITE;
+# Waiting for BACKUP/RESTORE to reach its synchronization point.
+SET DEBUG_SYNC= 'now WAIT_FOR bup_waiting TIMEOUT 1';
+
+== Checkpoint B ==
+#
+# DDL1= ALTER DATABASE bml_test_db1 CHARACTER SET = utf8
+# DDL2= ALTER TABLE t1 ADD INDEX `i` (a)
+# DDL3= ALTER VIEW v1 AS SELECT 1
+# DDL4= ALTER FUNCTION f1 COMMENT 'testing alter'
+#
+SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
+WHERE info LIKE "BACKUP DATABASE%"
+ OR info LIKE "RESTORE FROM%"
+ OR info LIKE "ALTER DATABASE bml_test_db1 CHARACTER SET = utf8%"
+ OR info LIKE "ALTER TABLE t1 ADD INDEX `i` (a)%";
+state info
+BML: waiting for all statements to leave RESTORE FROM 'bml_test.bkp' OVERWRITE
+debug sync point: before_execute_sql_command ALTER TABLE t1 ADD INDEX `i` (a)
+debug sync point: before_execute_sql_command ALTER DATABASE bml_test_db1 CHARACTER SET = utf8
+# Checking that BACKUP is blocked by DDLs.
+SELECT object, notes, error_num FROM mysql.backup_progress WHERE backup_id=500;
+object notes error_num
+backup kernel starting 0
+backup kernel running 0
+# Checking that DDL1 and DDL2 have not executed.
+CALL test.check_results();
+Database Create Database
+bml_test_db1 CREATE DATABASE `bml_test_db1` /*!40100 DEFAULT CHARACTER SET latin1 */
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `bml_test`.`v1` AS select `bml_test`.`t2`.`b` AS `b` from `bml_test`.`t2` latin1 latin1_swedish_ci
+Function sql_mode Create Function character_set_client collation_connection Database Collation
+f1 CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
+RETURN 1 latin1 latin1_swedish_ci latin1_swedish_ci
+Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
+p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+SET @foo=1 latin1 latin1_swedish_ci latin1_swedish_ci
+event_name
+e1
+==================
+
+# Resume DDL1 and DDL2.
+# Now BACKUP/RESTORE should stop after activating DDL blocker.
+SET DEBUG_SYNC= 'now SIGNAL continue_ddl';
+# con1: Reaping DDL1
+# con2: Reaping DDL2
+SET DEBUG_SYNC= 'now SIGNAL continue_bup WAIT_FOR bup_running TIMEOUT 1';
+
+== Checkpoint C ==
+#
+# DDL1= ALTER DATABASE bml_test_db1 CHARACTER SET = utf8
+# DDL2= ALTER TABLE t1 ADD INDEX `i` (a)
+# DDL3= ALTER VIEW v1 AS SELECT 1
+# DDL4= ALTER FUNCTION f1 COMMENT 'testing alter'
+#
+SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
+WHERE info LIKE "BACKUP DATABASE%"
+ OR info LIKE "RESTORE FROM%";
+state info
+debug sync point: start_do_restore RESTORE FROM 'bml_test.bkp' OVERWRITE
+# Checking that DDL1 and DDL2 have executed.
+CALL test.check_results();
+Database Create Database
+bml_test_db1 CREATE DATABASE `bml_test_db1` /*!40100 DEFAULT CHARACTER SET utf8 */
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ KEY `i` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `bml_test`.`v1` AS select `bml_test`.`t2`.`b` AS `b` from `bml_test`.`t2` latin1 latin1_swedish_ci
+Function sql_mode Create Function character_set_client collation_connection Database Collation
+f1 CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
+RETURN 1 latin1 latin1_swedish_ci latin1_swedish_ci
+Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
+p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+SET @foo=1 latin1 latin1_swedish_ci latin1_swedish_ci
+event_name
+e1
+==================
+
+# con3: Send DDL3 but it is blocked by BACKUP/RESTORE
+# (will not be in backup) make it send signal when
+# blocked on BML.
+SET DEBUG_SYNC= 'bml_enter_check SIGNAL ddl3_blocked';
+ALTER VIEW v1 AS SELECT 1;
+# Wait for DDL3 to send its signal.
+SET DEBUG_SYNC= 'now WAIT_FOR ddl3_blocked TIMEOUT 3';
+# con3: Send DDL3 but it is blocked by BACKUP/RESTORE
+# (will not be in backup) make it send signal when
+# blocked on BML.
+SET DEBUG_SYNC= 'bml_enter_check SIGNAL ddl4_blocked';
+ALTER FUNCTION f1 COMMENT 'testing alter';
+# Wait for DDL4 to send its signal.
+SET DEBUG_SYNC= 'now WAIT_FOR ddl4_blocked TIMEOUT 3';
+
+== Checkpoint D ==
+#
+# DDL1= ALTER DATABASE bml_test_db1 CHARACTER SET = utf8
+# DDL2= ALTER TABLE t1 ADD INDEX `i` (a)
+# DDL3= ALTER VIEW v1 AS SELECT 1
+# DDL4= ALTER FUNCTION f1 COMMENT 'testing alter'
+#
+SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
+WHERE info LIKE "ALTER VIEW v1 AS SELECT 1%"
+ OR info LIKE "ALTER FUNCTION f1 COMMENT 'testing alter'%";
+state info
+BML: waiting until released ALTER FUNCTION f1 COMMENT 'testing alter'
+BML: waiting until released ALTER VIEW v1 AS SELECT 1
+# Checking that DDL3 and DDL4 have not executed.
+CALL test.check_results();
+Database Create Database
+bml_test_db1 CREATE DATABASE `bml_test_db1` /*!40100 DEFAULT CHARACTER SET utf8 */
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ KEY `i` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `bml_test`.`v1` AS select `bml_test`.`t2`.`b` AS `b` from `bml_test`.`t2` latin1 latin1_swedish_ci
+Function sql_mode Create Function character_set_client collation_connection Database Collation
+f1 CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
+RETURN 1 latin1 latin1_swedish_ci latin1_swedish_ci
+Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
+p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+SET @foo=1 latin1 latin1_swedish_ci latin1_swedish_ci
+event_name
+e1
+==================
+
+# Resume BACKUP/RESTORE - this allows DDL3 and DDL4 to complete.
+SET DEBUG_SYNC= 'now SIGNAL finish_bup';
+# con5: Reaping BACKUP/RESTORE
+backup_id
+500
+SET debug="-d";
+# con3: Completing DDL3
+# con4: Completing DDL4
+
+== Checkpoint E ==
+#
+# DDL1= ALTER DATABASE bml_test_db1 CHARACTER SET = utf8
+# DDL2= ALTER TABLE t1 ADD INDEX `i` (a)
+# DDL3= ALTER VIEW v1 AS SELECT 1
+# DDL4= ALTER FUNCTION f1 COMMENT 'testing alter'
+#
+# Checking that DDL3 and DDL4 have executed.
+CALL test.check_results();
+Database Create Database
+bml_test_db1 CREATE DATABASE `bml_test_db1` /*!40100 DEFAULT CHARACTER SET utf8 */
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `bml_test`.`v1` AS select 1 AS `1` latin1 latin1_swedish_ci
+Function sql_mode Create Function character_set_client collation_connection Database Collation
+f1 CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
+ COMMENT 'testing alter'
+RETURN 1 latin1 latin1_swedish_ci latin1_swedish_ci
+Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
+p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+SET @foo=1 latin1 latin1_swedish_ci latin1_swedish_ci
+event_name
+e2
+==================
+
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+RESTORE FROM 'bml_test_orig.bkp' OVERWRITE;
backup_id
+501
+DROP TABLE test.objects;
+DROP DATABASE bml_test;
+CREATE DATABASE bml_test;
+CREATE USER bml_u1;
+CREATE USER bml_u2;
+CREATE USER bml_u3;
+CREATE TABLESPACE bml_ts1 ADD DATAFILE 'bml_ts1.dat' ENGINE=falcon;
+CREATE TABLESPACE bml_ts2 ADD DATAFILE 'bml_ts2.dat' ENGINE=falcon;
+CREATE TABLE bml_test.t1 (a int);
+CREATE TABLE bml_test.t2 (b int);
+DROP PROCEDURE IF EXISTS test.check_results\\
+CREATE PROCEDURE test.check_results()
+BEGIN
+SHOW TABLES IN bml_test;
+# show users
+SELECT DISTINCT grantee AS user
+FROM information_schema.user_privileges
+WHERE grantee like '%bml%';
+# show privileges
+SELECT grantee, count(*) > 0 AS has_privileges
+FROM information_schema.schema_privileges
+WHERE grantee like '%bml%'
+ GROUP BY grantee;
+# show tablespaces
+SELECT tablespace_name, file_name
+FROM information_schema.files
+WHERE tablespace_name like 'bml%';
+END\\
+
+########################################################
+# Running BML test for the following statements:
+#
+# DDL1= RENAME TABLE t1 TO t1_renamed
+# DDL2= DROP USER bml_u1
+# DDL3= RENAME USER bml_u2 TO bml_u2_renamed
+# DDL4= DROP TABLESPACE bml_ts1 ENGINE=falcon
#
+# BML is activated by BACKUP DATABASE bml_test TO 'bml_test.bkp'.
+########################################################
-Verifying Test 2 results for restore.
+SET DEBUG_SYNC= 'reset';
+PURGE BACKUP LOGS;
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
-con1: Table t01 should not be in restored data.
-use bup_ddl_blocker;
-SHOW TABLES;
-Tables_in_bup_ddl_blocker
-t03
+== Checkpoint A ==
+# Check the initial situation.
+CALL test.check_results();
+Tables_in_bml_test
+t1
+t2
+user
+'bml_u1'@'%'
+'bml_u2'@'%'
+'bml_u3'@'%'
+grantee has_privileges
+tablespace_name file_name
+bml_ts1 bml_ts1.dat
+bml_ts2 bml_ts2.dat
+==================
+
+# con1: Start DDL1 making it to stop after it has started (and
+# possibly registered with BML).
+SET DEBUG_SYNC= 'before_execute_sql_command SIGNAL ddl1_started
+ WAIT_FOR continue_ddl';
+RENAME TABLE t1 TO t1_renamed;
+# con2: Wait for DDL1 to reach its synchronization point.
+SET DEBUG_SYNC= 'now WAIT_FOR ddl1_started TIMEOUT 3';
+# con2: Start DDL2 making it to stop after it has started (and
+# possibly registered with BML).
+SET DEBUG_SYNC= 'before_execute_sql_command SIGNAL ddl2_started
+ WAIT_FOR continue_ddl';
+DROP USER bml_u1;
+# con5: Wait for DDL2 to reach its synchronization point.
+SET DEBUG_SYNC= 'now WAIT_FOR ddl2_started TIMEOUT 3';
+SET DEBUG_SYNC='before_execute_sql_command CLEAR';
+# con5: Activate synchronization points for BACKUP/RESTORE.
+SET DEBUG_SYNC= 'bml_get_check2 SIGNAL bup_waiting';
+SET DEBUG_SYNC= 'after_backup_start_backup WAIT_FOR continue_bup';
+SET DEBUG_SYNC= 'after_backup_start_restore WAIT_FOR continue_bup';
+SET DEBUG_SYNC= 'before_backup_meta SIGNAL bup_running WAIT_FOR finish_bup';
+SET DEBUG_SYNC= 'start_do_restore SIGNAL bup_running WAIT_FOR finish_bup';
+# con5: Starting BACKUP/RESTORE operation -- should be blocked
+# by ongoing DDLs.
+SET SESSION debug="+d,set_backup_id";
+BACKUP DATABASE bml_test TO 'bml_test.bkp';
+# Waiting for BACKUP/RESTORE to reach its synchronization point.
+SET DEBUG_SYNC= 'now WAIT_FOR bup_waiting TIMEOUT 1';
+
+== Checkpoint B ==
+#
+# DDL1= RENAME TABLE t1 TO t1_renamed
+# DDL2= DROP USER bml_u1
+# DDL3= RENAME USER bml_u2 TO bml_u2_renamed
+# DDL4= DROP TABLESPACE bml_ts1 ENGINE=falcon
+#
+SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
+WHERE info LIKE "BACKUP DATABASE%"
+ OR info LIKE "RESTORE FROM%"
+ OR info LIKE "RENAME TABLE t1 TO t1_renamed%"
+ OR info LIKE "DROP USER bml_u1%";
+state info
+BML: waiting for all statements to leave BACKUP DATABASE bml_test TO 'bml_test.bkp'
+debug sync point: before_execute_sql_command DROP USER bml_u1
+debug sync point: before_execute_sql_command RENAME TABLE t1 TO t1_renamed
+# Checking that BACKUP is blocked by DDLs.
+SELECT object, notes, error_num FROM mysql.backup_progress WHERE backup_id=500;
+object notes error_num
+backup kernel starting 0
+backup kernel running 0
+# Checking that DDL1 and DDL2 have not executed.
+CALL test.check_results();
+Tables_in_bml_test
t1
t2
-t4
+user
+'bml_u1'@'%'
+'bml_u2'@'%'
+'bml_u3'@'%'
+grantee has_privileges
+tablespace_name file_name
+bml_ts1 bml_ts1.dat
+bml_ts2 bml_ts2.dat
+==================
+
+# Resume DDL1 and DDL2.
+# Now BACKUP/RESTORE should stop after activating DDL blocker.
+SET DEBUG_SYNC= 'now SIGNAL continue_ddl';
+# con1: Reaping DDL1
+# con2: Reaping DDL2
+SET DEBUG_SYNC= 'now SIGNAL continue_bup WAIT_FOR bup_running TIMEOUT 1';
+
+== Checkpoint C ==
+#
+# DDL1= RENAME TABLE t1 TO t1_renamed
+# DDL2= DROP USER bml_u1
+# DDL3= RENAME USER bml_u2 TO bml_u2_renamed
+# DDL4= DROP TABLESPACE bml_ts1 ENGINE=falcon
+#
+SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
+WHERE info LIKE "BACKUP DATABASE%"
+ OR info LIKE "RESTORE FROM%";
+state info
+debug sync point: before_backup_meta BACKUP DATABASE bml_test TO 'bml_test.bkp'
+# Checking that DDL1 and DDL2 have executed.
+CALL test.check_results();
+Tables_in_bml_test
+t1_renamed
+t2
+user
+'bml_u2'@'%'
+'bml_u3'@'%'
+grantee has_privileges
+tablespace_name file_name
+bml_ts1 bml_ts1.dat
+bml_ts2 bml_ts2.dat
+==================
+
+# con3: Send DDL3 but it is blocked by BACKUP/RESTORE
+# (will not be in backup) make it send signal when
+# blocked on BML.
+SET DEBUG_SYNC= 'bml_enter_check SIGNAL ddl3_blocked';
+RENAME USER bml_u2 TO bml_u2_renamed;
+# Wait for DDL3 to send its signal.
+SET DEBUG_SYNC= 'now WAIT_FOR ddl3_blocked TIMEOUT 3';
+# con3: Send DDL3 but it is blocked by BACKUP/RESTORE
+# (will not be in backup) make it send signal when
+# blocked on BML.
+SET DEBUG_SYNC= 'bml_enter_check SIGNAL ddl4_blocked';
+DROP TABLESPACE bml_ts1 ENGINE=falcon;
+# Wait for DDL4 to send its signal.
+SET DEBUG_SYNC= 'now WAIT_FOR ddl4_blocked TIMEOUT 3';
+
+== Checkpoint D ==
+#
+# DDL1= RENAME TABLE t1 TO t1_renamed
+# DDL2= DROP USER bml_u1
+# DDL3= RENAME USER bml_u2 TO bml_u2_renamed
+# DDL4= DROP TABLESPACE bml_ts1 ENGINE=falcon
+#
+SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
+WHERE info LIKE "RENAME USER bml_u2 TO bml_u2_renamed%"
+ OR info LIKE "DROP TABLESPACE bml_ts1 ENGINE=falcon%";
+state info
+BML: waiting until released DROP TABLESPACE bml_ts1 ENGINE=falcon
+BML: waiting until released RENAME USER bml_u2 TO bml_u2_renamed
+# Checking that DDL3 and DDL4 have not executed.
+CALL test.check_results();
+Tables_in_bml_test
+t1_renamed
+t2
+user
+'bml_u2'@'%'
+'bml_u3'@'%'
+grantee has_privileges
+tablespace_name file_name
+bml_ts1 bml_ts1.dat
+bml_ts2 bml_ts2.dat
+==================
+
+# Resume BACKUP/RESTORE - this allows DDL3 and DDL4 to complete.
+SET DEBUG_SYNC= 'now SIGNAL finish_bup';
+# con5: Reaping BACKUP/RESTORE
+backup_id
+500
+SET debug="-d";
+# con3: Completing DDL3
+# con4: Completing DDL4
+
+== Checkpoint E ==
+#
+# DDL1= RENAME TABLE t1 TO t1_renamed
+# DDL2= DROP USER bml_u1
+# DDL3= RENAME USER bml_u2 TO bml_u2_renamed
+# DDL4= DROP TABLESPACE bml_ts1 ENGINE=falcon
+#
+# Checking that DDL3 and DDL4 have executed.
+CALL test.check_results();
+Tables_in_bml_test
+t1_renamed
+t2
+user
+'bml_u2_renamed'@'%'
+'bml_u3'@'%'
+grantee has_privileges
+tablespace_name file_name
+bml_ts2 bml_ts2.dat
+==================
-Starting Test 3 - Backup
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
-DROP DATABASE IF EXISTS bup_ddl_blocker;
-CREATE DATABASE bup_ddl_blocker;
-con1: Creating tables
-CREATE TABLE bup_ddl_blocker.t1 (col_a CHAR(40)) ENGINE=INNODB;
-CREATE TABLE bup_ddl_blocker.t2 (col_a CHAR(40)) ENGINE=MYISAM;
-CREATE TABLE bup_ddl_blocker.t3 (col_a CHAR(40)) ENGINE=INNODB;
-CREATE TABLE bup_ddl_blocker.t4 (col_a CHAR(40)) ENGINE=MYISAM;
-con1: Loading data
-INSERT INTO bup_ddl_blocker.t1 VALUES ("01 Some data to test");
-INSERT INTO bup_ddl_blocker.t1 VALUES ("02 Some data to test");
-INSERT INTO bup_ddl_blocker.t1 VALUES ("03 Some data to test");
-INSERT INTO bup_ddl_blocker.t2 VALUES ("01 Some data to test");
-INSERT INTO bup_ddl_blocker.t2 VALUES ("02 Some data to test");
-INSERT INTO bup_ddl_blocker.t2 VALUES ("03 Some data to test");
-INSERT INTO bup_ddl_blocker.t3 VALUES ("01 Some data to test");
-INSERT INTO bup_ddl_blocker.t3 VALUES ("02 Some data to test");
-INSERT INTO bup_ddl_blocker.t3 VALUES ("03 Some data to test");
-INSERT INTO bup_ddl_blocker.t4 VALUES ("01 Some data to test");
-INSERT INTO bup_ddl_blocker.t4 VALUES ("02 Some data to test");
-INSERT INTO bup_ddl_blocker.t4 VALUES ("03 Some data to test");
-con2: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'after_start_ddl SIGNAL con2_started WAIT_FOR status_shown';
-con2: Get a DDL going and stop in the middle
-OPTIMIZE TABLE bup_ddl_blocker.t1;
-con3: Wait for con2 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con2_started';
-con3: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'after_start_ddl SIGNAL con3_started WAIT_FOR status_shown';
-con3: Get a DDL going and stop in the middle
-DROP TABLE bup_ddl_blocker.t2;
-con1: Wait for con3 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con3_started';
-con1: Activate synchronization points for backup.
-SET DEBUG_SYNC= 'before_block_ddl SIGNAL bup_blocked WAIT_FOR status_shown';
-SET DEBUG_SYNC= 'after_block_ddl SIGNAL bup_started WAIT_FOR status_shown2';
-con1: Backing up database -- will block with lock
-BACKUP DATABASE bup_ddl_blocker TO "bup_ddl_blocker.bak";
-con6: Wait for con1 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR bup_blocked';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "BACKUP DATABASE%";
-state info
-debug sync point: before_block_ddl BACKUP DATABASE bup_ddl_blocker TO "bup_ddl_blocker.bak"
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "OPTIMIZE TABLE bup_ddl_blocker.t1%";
-state info
-debug sync point: after_start_ddl OPTIMIZE TABLE bup_ddl_blocker.t1
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "DROP TABLE bup_ddl_blocker.t2%";
-state info
-debug sync point: after_start_ddl DROP TABLE bup_ddl_blocker.t2
-con6: Resume all and wait for backup to start after DDL finish.
-SET DEBUG_SYNC= 'now SIGNAL status_shown WAIT_FOR bup_started';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "BACKUP DATABASE%";
-state info
-debug sync point: after_block_ddl BACKUP DATABASE bup_ddl_blocker TO "bup_ddl_blocker.bak"
-con4: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'before_check_ddl_blocked SIGNAL con4_started
- WAIT_FOR status_shown2';
-con4: Try a DDL but it is blocked by backup -- will not be in backup
-OPTIMIZE TABLE bup_ddl_blocker.t3;
-con5: Wait for con4 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con4_started';
-con5: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'before_check_ddl_blocked SIGNAL con5_started
- WAIT_FOR status_shown2';
-con5: Try a DDL but it is blocked by backup -- will not be in backup
-DROP TABLE bup_ddl_blocker.t4;
-con6: Wait for con5 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con5_started';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "OPTIMIZE TABLE bup_ddl_blocker.t3%";
-state info
-debug sync point: before_check_ddl_blocked OPTIMIZE TABLE bup_ddl_blocker.t3
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "DROP TABLE bup_ddl_blocker.t4%";
-state info
-debug sync point: before_check_ddl_blocked DROP TABLE bup_ddl_blocker.t4
-con6: Resume all.
-SET DEBUG_SYNC= 'now SIGNAL status_shown2';
-con2: Completing DDL
-Table Op Msg_type Msg_text
-bup_ddl_blocker.t1 optimize note Table does not support optimize, doing recreate + analyze instead
-bup_ddl_blocker.t1 optimize status OK
-con3: Completing DDL
-con4: Completing DDL
-Table Op Msg_type Msg_text
-bup_ddl_blocker.t3 optimize note Table does not support optimize, doing recreate + analyze instead
-bup_ddl_blocker.t3 optimize status OK
-con5: Completing DDL
-backup_id
+########################################################
+# Running BML test for the following statements:
+#
+# DDL1= RENAME USER bml_u2_renamed TO bml_u2
+# DDL2= GRANT ALL ON bml_test.* TO bml_u3
+# DDL3= RENAME TABLE t1_renamed TO t1
+# DDL4= GRANT ALL ON bml_test.* TO bml_u2
#
+# BML is activated by RESTORE FROM 'bml_test.bkp' OVERWRITE.
+########################################################
-Verifying Test 3 results for backup.
+SET DEBUG_SYNC= 'reset';
+PURGE BACKUP LOGS;
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
-con1: Showing columns after updates and backup
-use bup_ddl_blocker;
-SHOW TABLES;
-Tables_in_bup_ddl_blocker
+== Checkpoint A ==
+# Check the initial situation.
+CALL test.check_results();
+Tables_in_bml_test
+t1_renamed
+t2
+user
+'bml_u2_renamed'@'%'
+'bml_u3'@'%'
+grantee has_privileges
+tablespace_name file_name
+bml_ts2 bml_ts2.dat
+==================
+
+# con1: Start DDL1 making it to stop after it has started (and
+# possibly registered with BML).
+SET DEBUG_SYNC= 'before_execute_sql_command SIGNAL ddl1_started
+ WAIT_FOR continue_ddl';
+RENAME USER bml_u2_renamed TO bml_u2;
+# con2: Wait for DDL1 to reach its synchronization point.
+SET DEBUG_SYNC= 'now WAIT_FOR ddl1_started TIMEOUT 3';
+# con2: Start DDL2 making it to stop after it has started (and
+# possibly registered with BML).
+SET DEBUG_SYNC= 'before_execute_sql_command SIGNAL ddl2_started
+ WAIT_FOR continue_ddl';
+GRANT ALL ON bml_test.* TO bml_u3;
+# con5: Wait for DDL2 to reach its synchronization point.
+SET DEBUG_SYNC= 'now WAIT_FOR ddl2_started TIMEOUT 3';
+SET DEBUG_SYNC='before_execute_sql_command CLEAR';
+# con5: Activate synchronization points for BACKUP/RESTORE.
+SET DEBUG_SYNC= 'bml_get_check2 SIGNAL bup_waiting';
+SET DEBUG_SYNC= 'after_backup_start_backup WAIT_FOR continue_bup';
+SET DEBUG_SYNC= 'after_backup_start_restore WAIT_FOR continue_bup';
+SET DEBUG_SYNC= 'before_backup_meta SIGNAL bup_running WAIT_FOR finish_bup';
+SET DEBUG_SYNC= 'start_do_restore SIGNAL bup_running WAIT_FOR finish_bup';
+# con5: Starting BACKUP/RESTORE operation -- should be blocked
+# by ongoing DDLs.
+SET SESSION debug="+d,set_backup_id";
+RESTORE FROM 'bml_test.bkp' OVERWRITE;
+# Waiting for BACKUP/RESTORE to reach its synchronization point.
+SET DEBUG_SYNC= 'now WAIT_FOR bup_waiting TIMEOUT 1';
+
+== Checkpoint B ==
+#
+# DDL1= RENAME USER bml_u2_renamed TO bml_u2
+# DDL2= GRANT ALL ON bml_test.* TO bml_u3
+# DDL3= RENAME TABLE t1_renamed TO t1
+# DDL4= GRANT ALL ON bml_test.* TO bml_u2
+#
+SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
+WHERE info LIKE "BACKUP DATABASE%"
+ OR info LIKE "RESTORE FROM%"
+ OR info LIKE "RENAME USER bml_u2_renamed TO bml_u2%"
+ OR info LIKE "GRANT ALL ON bml_test.* TO bml_u3%";
+state info
+BML: waiting for all statements to leave RESTORE FROM 'bml_test.bkp' OVERWRITE
+debug sync point: before_execute_sql_command GRANT ALL ON bml_test.* TO bml_u3
+debug sync point: before_execute_sql_command RENAME USER bml_u2_renamed TO bml_u2
+# Checking that BACKUP is blocked by DDLs.
+SELECT object, notes, error_num FROM mysql.backup_progress WHERE backup_id=500;
+object notes error_num
+backup kernel starting 0
+backup kernel running 0
+# Checking that DDL1 and DDL2 have not executed.
+CALL test.check_results();
+Tables_in_bml_test
+t1_renamed
+t2
+user
+'bml_u2_renamed'@'%'
+'bml_u3'@'%'
+grantee has_privileges
+tablespace_name file_name
+bml_ts2 bml_ts2.dat
+==================
+
+# Resume DDL1 and DDL2.
+# Now BACKUP/RESTORE should stop after activating DDL blocker.
+SET DEBUG_SYNC= 'now SIGNAL continue_ddl';
+# con1: Reaping DDL1
+# con2: Reaping DDL2
+SET DEBUG_SYNC= 'now SIGNAL continue_bup WAIT_FOR bup_running TIMEOUT 1';
+
+== Checkpoint C ==
+#
+# DDL1= RENAME USER bml_u2_renamed TO bml_u2
+# DDL2= GRANT ALL ON bml_test.* TO bml_u3
+# DDL3= RENAME TABLE t1_renamed TO t1
+# DDL4= GRANT ALL ON bml_test.* TO bml_u2
+#
+SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
+WHERE info LIKE "BACKUP DATABASE%"
+ OR info LIKE "RESTORE FROM%";
+state info
+debug sync point: start_do_restore RESTORE FROM 'bml_test.bkp' OVERWRITE
+# Checking that DDL1 and DDL2 have executed.
+CALL test.check_results();
+Tables_in_bml_test
+t1_renamed
+t2
+user
+'bml_u2'@'%'
+'bml_u3'@'%'
+grantee has_privileges
+'bml_u3'@'%' 1
+tablespace_name file_name
+bml_ts2 bml_ts2.dat
+==================
+
+# con3: Send DDL3 but it is blocked by BACKUP/RESTORE
+# (will not be in backup) make it send signal when
+# blocked on BML.
+SET DEBUG_SYNC= 'bml_enter_check SIGNAL ddl3_blocked';
+RENAME TABLE t1_renamed TO t1;
+# Wait for DDL3 to send its signal.
+SET DEBUG_SYNC= 'now WAIT_FOR ddl3_blocked TIMEOUT 3';
+# con3: Send DDL3 but it is blocked by BACKUP/RESTORE
+# (will not be in backup) make it send signal when
+# blocked on BML.
+SET DEBUG_SYNC= 'bml_enter_check SIGNAL ddl4_blocked';
+GRANT ALL ON bml_test.* TO bml_u2;
+# Wait for DDL4 to send its signal.
+SET DEBUG_SYNC= 'now WAIT_FOR ddl4_blocked TIMEOUT 3';
+
+== Checkpoint D ==
+#
+# DDL1= RENAME USER bml_u2_renamed TO bml_u2
+# DDL2= GRANT ALL ON bml_test.* TO bml_u3
+# DDL3= RENAME TABLE t1_renamed TO t1
+# DDL4= GRANT ALL ON bml_test.* TO bml_u2
+#
+SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
+WHERE info LIKE "RENAME TABLE t1_renamed TO t1%"
+ OR info LIKE "GRANT ALL ON bml_test.* TO bml_u2%";
+state info
+BML: waiting until released GRANT ALL ON bml_test.* TO bml_u2
+BML: waiting until released RENAME TABLE t1_renamed TO t1
+# Checking that DDL3 and DDL4 have not executed.
+CALL test.check_results();
+Tables_in_bml_test
+t1_renamed
+t2
+user
+'bml_u2'@'%'
+'bml_u3'@'%'
+grantee has_privileges
+'bml_u3'@'%' 1
+tablespace_name file_name
+bml_ts2 bml_ts2.dat
+==================
+
+# Resume BACKUP/RESTORE - this allows DDL3 and DDL4 to complete.
+SET DEBUG_SYNC= 'now SIGNAL finish_bup';
+# con5: Reaping BACKUP/RESTORE
+backup_id
+500
+SET debug="-d";
+# con3: Completing DDL3
+# con4: Completing DDL4
+
+== Checkpoint E ==
+#
+# DDL1= RENAME USER bml_u2_renamed TO bml_u2
+# DDL2= GRANT ALL ON bml_test.* TO bml_u3
+# DDL3= RENAME TABLE t1_renamed TO t1
+# DDL4= GRANT ALL ON bml_test.* TO bml_u2
+#
+# Checking that DDL3 and DDL4 have executed.
+CALL test.check_results();
+Tables_in_bml_test
t1
-t3
-con1: Dropping the database tables
-DROP TABLE bup_ddl_blocker.t1, bup_ddl_blocker.t3;
-con1: Restoring the database
-RESTORE FROM "bup_ddl_blocker.bak" OVERWRITE;
-backup_id
+t2
+user
+'bml_u2'@'%'
+'bml_u3'@'%'
+grantee has_privileges
+'bml_u2'@'%' 1
+'bml_u3'@'%' 1
+tablespace_name file_name
+bml_ts2 bml_ts2.dat
+==================
+
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+
+########################################################
+# Running BML test for the following statements:
#
-con1: Showing columns that were backed up
-con1: Table t2 should not be in restore
-use bup_ddl_blocker;
-SHOW TABLES;
-Tables_in_bup_ddl_blocker
+# DDL1= DROP TABLESPACE bml_ts2 ENGINE=falcon
+# DDL2= REVOKE ALL ON bml_test.* FROM bml_u2
+# DDL3= DROP USER bml_u2
+# DDL4= REVOKE ALL ON bml_test.* FROM bml_u3
+#
+# BML is activated by BACKUP DATABASE bml_test TO 'bml_test.bkp'.
+########################################################
+
+SET DEBUG_SYNC= 'reset';
+PURGE BACKUP LOGS;
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+
+== Checkpoint A ==
+# Check the initial situation.
+CALL test.check_results();
+Tables_in_bml_test
t1
-t3
-t4
+t2
+user
+'bml_u2'@'%'
+'bml_u3'@'%'
+grantee has_privileges
+'bml_u2'@'%' 1
+'bml_u3'@'%' 1
+tablespace_name file_name
+bml_ts2 bml_ts2.dat
+==================
+
+# con1: Start DDL1 making it to stop after it has started (and
+# possibly registered with BML).
+SET DEBUG_SYNC= 'before_execute_sql_command SIGNAL ddl1_started
+ WAIT_FOR continue_ddl';
+DROP TABLESPACE bml_ts2 ENGINE=falcon;
+# con2: Wait for DDL1 to reach its synchronization point.
+SET DEBUG_SYNC= 'now WAIT_FOR ddl1_started TIMEOUT 3';
+# con2: Start DDL2 making it to stop after it has started (and
+# possibly registered with BML).
+SET DEBUG_SYNC= 'before_execute_sql_command SIGNAL ddl2_started
+ WAIT_FOR continue_ddl';
+REVOKE ALL ON bml_test.* FROM bml_u2;
+# con5: Wait for DDL2 to reach its synchronization point.
+SET DEBUG_SYNC= 'now WAIT_FOR ddl2_started TIMEOUT 3';
+SET DEBUG_SYNC='before_execute_sql_command CLEAR';
+# con5: Activate synchronization points for BACKUP/RESTORE.
+SET DEBUG_SYNC= 'bml_get_check2 SIGNAL bup_waiting';
+SET DEBUG_SYNC= 'after_backup_start_backup WAIT_FOR continue_bup';
+SET DEBUG_SYNC= 'after_backup_start_restore WAIT_FOR continue_bup';
+SET DEBUG_SYNC= 'before_backup_meta SIGNAL bup_running WAIT_FOR finish_bup';
+SET DEBUG_SYNC= 'start_do_restore SIGNAL bup_running WAIT_FOR finish_bup';
+# con5: Starting BACKUP/RESTORE operation -- should be blocked
+# by ongoing DDLs.
+SET SESSION debug="+d,set_backup_id";
+BACKUP DATABASE bml_test TO 'bml_test.bkp';
+# Waiting for BACKUP/RESTORE to reach its synchronization point.
+SET DEBUG_SYNC= 'now WAIT_FOR bup_waiting TIMEOUT 1';
+
+== Checkpoint B ==
+#
+# DDL1= DROP TABLESPACE bml_ts2 ENGINE=falcon
+# DDL2= REVOKE ALL ON bml_test.* FROM bml_u2
+# DDL3= DROP USER bml_u2
+# DDL4= REVOKE ALL ON bml_test.* FROM bml_u3
+#
+SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
+WHERE info LIKE "BACKUP DATABASE%"
+ OR info LIKE "RESTORE FROM%"
+ OR info LIKE "DROP TABLESPACE bml_ts2 ENGINE=falcon%"
+ OR info LIKE "REVOKE ALL ON bml_test.* FROM bml_u2%";
+state info
+BML: waiting for all statements to leave BACKUP DATABASE bml_test TO 'bml_test.bkp'
+debug sync point: before_execute_sql_command REVOKE ALL ON bml_test.* FROM bml_u2
+debug sync point: before_execute_sql_command DROP TABLESPACE bml_ts2 ENGINE=falcon
+# Checking that BACKUP is blocked by DDLs.
+SELECT object, notes, error_num FROM mysql.backup_progress WHERE backup_id=500;
+object notes error_num
+backup kernel starting 0
+backup kernel running 0
+# Checking that DDL1 and DDL2 have not executed.
+CALL test.check_results();
+Tables_in_bml_test
+t1
+t2
+user
+'bml_u2'@'%'
+'bml_u3'@'%'
+grantee has_privileges
+'bml_u2'@'%' 1
+'bml_u3'@'%' 1
+tablespace_name file_name
+bml_ts2 bml_ts2.dat
+==================
+
+# Resume DDL1 and DDL2.
+# Now BACKUP/RESTORE should stop after activating DDL blocker.
+SET DEBUG_SYNC= 'now SIGNAL continue_ddl';
+# con1: Reaping DDL1
+# con2: Reaping DDL2
+SET DEBUG_SYNC= 'now SIGNAL continue_bup WAIT_FOR bup_running TIMEOUT 1';
+
+== Checkpoint C ==
+#
+# DDL1= DROP TABLESPACE bml_ts2 ENGINE=falcon
+# DDL2= REVOKE ALL ON bml_test.* FROM bml_u2
+# DDL3= DROP USER bml_u2
+# DDL4= REVOKE ALL ON bml_test.* FROM bml_u3
+#
+SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
+WHERE info LIKE "BACKUP DATABASE%"
+ OR info LIKE "RESTORE FROM%";
+state info
+debug sync point: before_backup_meta BACKUP DATABASE bml_test TO 'bml_test.bkp'
+# Checking that DDL1 and DDL2 have executed.
+CALL test.check_results();
+Tables_in_bml_test
+t1
+t2
+user
+'bml_u2'@'%'
+'bml_u3'@'%'
+grantee has_privileges
+'bml_u3'@'%' 1
+tablespace_name file_name
+==================
+
+# con3: Send DDL3 but it is blocked by BACKUP/RESTORE
+# (will not be in backup) make it send signal when
+# blocked on BML.
+SET DEBUG_SYNC= 'bml_enter_check SIGNAL ddl3_blocked';
+DROP USER bml_u2;
+# Wait for DDL3 to send its signal.
+SET DEBUG_SYNC= 'now WAIT_FOR ddl3_blocked TIMEOUT 3';
+# con3: Send DDL3 but it is blocked by BACKUP/RESTORE
+# (will not be in backup) make it send signal when
+# blocked on BML.
+SET DEBUG_SYNC= 'bml_enter_check SIGNAL ddl4_blocked';
+REVOKE ALL ON bml_test.* FROM bml_u3;
+# Wait for DDL4 to send its signal.
+SET DEBUG_SYNC= 'now WAIT_FOR ddl4_blocked TIMEOUT 3';
+
+== Checkpoint D ==
+#
+# DDL1= DROP TABLESPACE bml_ts2 ENGINE=falcon
+# DDL2= REVOKE ALL ON bml_test.* FROM bml_u2
+# DDL3= DROP USER bml_u2
+# DDL4= REVOKE ALL ON bml_test.* FROM bml_u3
+#
+SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
+WHERE info LIKE "DROP USER bml_u2%"
+ OR info LIKE "REVOKE ALL ON bml_test.* FROM bml_u3%";
+state info
+BML: waiting until released REVOKE ALL ON bml_test.* FROM bml_u3
+BML: waiting until released DROP USER bml_u2
+# Checking that DDL3 and DDL4 have not executed.
+CALL test.check_results();
+Tables_in_bml_test
+t1
+t2
+user
+'bml_u2'@'%'
+'bml_u3'@'%'
+grantee has_privileges
+'bml_u3'@'%' 1
+tablespace_name file_name
+==================
+
+# Resume BACKUP/RESTORE - this allows DDL3 and DDL4 to complete.
+SET DEBUG_SYNC= 'now SIGNAL finish_bup';
+# con5: Reaping BACKUP/RESTORE
+backup_id
+500
+SET debug="-d";
+# con3: Completing DDL3
+# con4: Completing DDL4
+
+== Checkpoint E ==
+#
+# DDL1= DROP TABLESPACE bml_ts2 ENGINE=falcon
+# DDL2= REVOKE ALL ON bml_test.* FROM bml_u2
+# DDL3= DROP USER bml_u2
+# DDL4= REVOKE ALL ON bml_test.* FROM bml_u3
+#
+# Checking that DDL3 and DDL4 have executed.
+CALL test.check_results();
+Tables_in_bml_test
+t1
+t2
+user
+'bml_u3'@'%'
+grantee has_privileges
+tablespace_name file_name
+==================
-Starting Test 3 - Restore
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+DROP USER bml_u3;
+CALL test.check_results();
+Tables_in_bml_test
+t1
+t2
+user
+grantee has_privileges
+tablespace_name file_name
+DROP DATABASE bml_test;
+CREATE DATABASE bml_test;
+USE bml_test;
+CREATE TABLE t1 (a int) ENGINE=myisam;
+CREATE TABLE t2 (a int) ENGINE=myisam;
+INSERT INTO t1 VALUES (1),(2);
+INSERT INTO t2 VALUES (3),(4);
+DROP PROCEDURE IF EXISTS test.check_results\\
+CREATE PROCEDURE test.check_results()
+BEGIN
+SHOW TABLES IN bml_test;
+SELECT count(*) AS rows_in_t1 FROM bml_test.t1;
+SELECT count(*) AS rows_in_t2 FROM bml_test.t2;
+CHECKSUM TABLE bml_test.t1, bml_test.t2 EXTENDED;
+END\\
+
+########################################################
+# Running BML test for the following statements:
+#
+# DDL1= OPTIMIZE TABLE t1
+# DDL2= REPAIR TABLE t2 USE_FRM
+# DDL3= TRUNCATE TABLE t1
+# DDL4= TRUNCATE TABLE t2
+#
+# BML is activated by BACKUP DATABASE bml_test TO 'bml_test.bkp'.
+########################################################
-DROP DATABASE IF EXISTS bup_ddl_blocker;
-CREATE DATABASE bup_ddl_blocker;
-con1: Creating tables
-CREATE TABLE bup_ddl_blocker.t1 (col_a CHAR(40)) ENGINE=INNODB;
-CREATE TABLE bup_ddl_blocker.t2 (col_a CHAR(40)) ENGINE=MYISAM;
-CREATE TABLE bup_ddl_blocker.t3 (col_a CHAR(40)) ENGINE=INNODB;
-CREATE TABLE bup_ddl_blocker.t4 (col_a CHAR(40)) ENGINE=MYISAM;
-con1: Loading data
-INSERT INTO bup_ddl_blocker.t1 VALUES ("01 Some data to test");
-INSERT INTO bup_ddl_blocker.t1 VALUES ("02 Some data to test");
-INSERT INTO bup_ddl_blocker.t1 VALUES ("03 Some data to test");
-INSERT INTO bup_ddl_blocker.t2 VALUES ("01 Some data to test");
-INSERT INTO bup_ddl_blocker.t2 VALUES ("02 Some data to test");
-INSERT INTO bup_ddl_blocker.t2 VALUES ("03 Some data to test");
-INSERT INTO bup_ddl_blocker.t3 VALUES ("01 Some data to test");
-INSERT INTO bup_ddl_blocker.t3 VALUES ("02 Some data to test");
-INSERT INTO bup_ddl_blocker.t3 VALUES ("03 Some data to test");
-INSERT INTO bup_ddl_blocker.t4 VALUES ("01 Some data to test");
-INSERT INTO bup_ddl_blocker.t4 VALUES ("02 Some data to test");
-INSERT INTO bup_ddl_blocker.t4 VALUES ("03 Some data to test");
-BACKUP DATABASE bup_ddl_blocker to 'bup_ddl_blocker_orig.bak';
-backup_id
-#
-con2: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'after_start_ddl SIGNAL con2_started WAIT_FOR status_shown';
-con2: Get a DDL going and stop in the middle
-OPTIMIZE TABLE bup_ddl_blocker.t1;
-con3: Wait for con2 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con2_started';
-con3: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'after_start_ddl SIGNAL con3_started WAIT_FOR status_shown';
-con3: Get a DDL going and stop in the middle
-DROP TABLE bup_ddl_blocker.t2;
-con1: Wait for con3 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con3_started';
-con1: Activate synchronization points for restore.
-SET DEBUG_SYNC= 'before_block_ddl SIGNAL bup_blocked WAIT_FOR status_shown';
-SET DEBUG_SYNC= 'after_block_ddl SIGNAL bup_started WAIT_FOR status_shown2';
-con1: Restoring database -- will block with lock
-RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE;
-con6: Wait for con1 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR bup_blocked';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "RESTORE FROM%";
-state info
-debug sync point: before_block_ddl RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "OPTIMIZE TABLE bup_ddl_blocker.t1%";
-state info
-debug sync point: after_start_ddl OPTIMIZE TABLE bup_ddl_blocker.t1
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "DROP TABLE bup_ddl_blocker.t2%";
-state info
-debug sync point: after_start_ddl DROP TABLE bup_ddl_blocker.t2
-con6: Resume all and wait for restore to start after DDL finish.
-SET DEBUG_SYNC= 'now SIGNAL status_shown WAIT_FOR bup_started';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "RESTORE FROM%";
-state info
-debug sync point: after_block_ddl RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE
-con4: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'before_check_ddl_blocked SIGNAL con4_started
- WAIT_FOR status_shown2';
-con4: Try a DDL but it is blocked by backup -- will not be in backup
-OPTIMIZE TABLE bup_ddl_blocker.t3;
-con5: Wait for con4 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con4_started';
-con5: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'before_check_ddl_blocked SIGNAL con5_started
- WAIT_FOR status_shown2';
-con5: Try a DDL but it is blocked by backup -- will not be in backup
-DROP TABLE bup_ddl_blocker.t4;
-con6: Wait for con5 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con5_started';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "OPTIMIZE TABLE bup_ddl_blocker.t3%";
-state info
-debug sync point: before_check_ddl_blocked OPTIMIZE TABLE bup_ddl_blocker.t3
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "DROP TABLE bup_ddl_blocker.t4%";
-state info
-debug sync point: before_check_ddl_blocked DROP TABLE bup_ddl_blocker.t4
-con6: Resume all.
-SET DEBUG_SYNC= 'now SIGNAL status_shown2';
-con2: Completing DDL
+SET DEBUG_SYNC= 'reset';
+PURGE BACKUP LOGS;
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+
+== Checkpoint A ==
+# Check the initial situation.
+CALL test.check_results();
+Tables_in_bml_test
+t1
+t2
+rows_in_t1
+2
+rows_in_t2
+2
+Table Checksum
+bml_test.t1 2865344526
+bml_test.t2 1578680517
+==================
+
+# con1: Start DDL1 making it to stop after it has started (and
+# possibly registered with BML).
+SET DEBUG_SYNC= 'before_execute_sql_command SIGNAL ddl1_started
+ WAIT_FOR continue_ddl';
+OPTIMIZE TABLE t1;
+# con2: Wait for DDL1 to reach its synchronization point.
+SET DEBUG_SYNC= 'now WAIT_FOR ddl1_started TIMEOUT 3';
+# con2: Start DDL2 making it to stop after it has started (and
+# possibly registered with BML).
+SET DEBUG_SYNC= 'before_execute_sql_command SIGNAL ddl2_started
+ WAIT_FOR continue_ddl';
+REPAIR TABLE t2 USE_FRM;
+# con5: Wait for DDL2 to reach its synchronization point.
+SET DEBUG_SYNC= 'now WAIT_FOR ddl2_started TIMEOUT 3';
+SET DEBUG_SYNC='before_execute_sql_command CLEAR';
+# con5: Activate synchronization points for BACKUP/RESTORE.
+SET DEBUG_SYNC= 'bml_get_check2 SIGNAL bup_waiting';
+SET DEBUG_SYNC= 'after_backup_start_backup WAIT_FOR continue_bup';
+SET DEBUG_SYNC= 'after_backup_start_restore WAIT_FOR continue_bup';
+SET DEBUG_SYNC= 'before_backup_meta SIGNAL bup_running WAIT_FOR finish_bup';
+SET DEBUG_SYNC= 'start_do_restore SIGNAL bup_running WAIT_FOR finish_bup';
+# con5: Starting BACKUP/RESTORE operation -- should be blocked
+# by ongoing DDLs.
+SET SESSION debug="+d,set_backup_id";
+BACKUP DATABASE bml_test TO 'bml_test.bkp';
+# Waiting for BACKUP/RESTORE to reach its synchronization point.
+SET DEBUG_SYNC= 'now WAIT_FOR bup_waiting TIMEOUT 1';
+
+== Checkpoint B ==
+#
+# DDL1= OPTIMIZE TABLE t1
+# DDL2= REPAIR TABLE t2 USE_FRM
+# DDL3= TRUNCATE TABLE t1
+# DDL4= TRUNCATE TABLE t2
+#
+SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
+WHERE info LIKE "BACKUP DATABASE%"
+ OR info LIKE "RESTORE FROM%"
+ OR info LIKE "OPTIMIZE TABLE t1%"
+ OR info LIKE "REPAIR TABLE t2 USE_FRM%";
+state info
+BML: waiting for all statements to leave BACKUP DATABASE bml_test TO 'bml_test.bkp'
+debug sync point: before_execute_sql_command REPAIR TABLE t2 USE_FRM
+debug sync point: before_execute_sql_command OPTIMIZE TABLE t1
+# Checking that BACKUP is blocked by DDLs.
+SELECT object, notes, error_num FROM mysql.backup_progress WHERE backup_id=500;
+object notes error_num
+backup kernel starting 0
+backup kernel running 0
+# Checking that DDL1 and DDL2 have not executed.
+CALL test.check_results();
+Tables_in_bml_test
+t1
+t2
+rows_in_t1
+2
+rows_in_t2
+2
+Table Checksum
+bml_test.t1 2865344526
+bml_test.t2 1578680517
+==================
+
+# Resume DDL1 and DDL2.
+# Now BACKUP/RESTORE should stop after activating DDL blocker.
+SET DEBUG_SYNC= 'now SIGNAL continue_ddl';
+# con1: Reaping DDL1
Table Op Msg_type Msg_text
-bup_ddl_blocker.t1 optimize note Table does not support optimize, doing recreate + analyze instead
-bup_ddl_blocker.t1 optimize status OK
-con3: Completing DDL
-con4: Completing DDL
+bml_test.t1 optimize status OK
+# con2: Reaping DDL2
Table Op Msg_type Msg_text
-bup_ddl_blocker.t3 optimize note Table does not support optimize, doing recreate + analyze instead
-bup_ddl_blocker.t3 optimize status OK
-con5: Completing DDL
-backup_id
+bml_test.t2 repair warning Number of rows changed from 0 to 2
+bml_test.t2 repair status OK
+SET DEBUG_SYNC= 'now SIGNAL continue_bup WAIT_FOR bup_running TIMEOUT 1';
+
+== Checkpoint C ==
#
+# DDL1= OPTIMIZE TABLE t1
+# DDL2= REPAIR TABLE t2 USE_FRM
+# DDL3= TRUNCATE TABLE t1
+# DDL4= TRUNCATE TABLE t2
+#
+SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
+WHERE info LIKE "BACKUP DATABASE%"
+ OR info LIKE "RESTORE FROM%";
+state info
+debug sync point: before_backup_meta BACKUP DATABASE bml_test TO 'bml_test.bkp'
+# Checking that DDL1 and DDL2 have executed.
+CALL test.check_results();
+Tables_in_bml_test
+t1
+t2
+rows_in_t1
+2
+rows_in_t2
+2
+Table Checksum
+bml_test.t1 2865344526
+bml_test.t2 1578680517
+==================
+
+# con3: Send DDL3 but it is blocked by BACKUP/RESTORE
+# (will not be in backup) make it send signal when
+# blocked on BML.
+SET DEBUG_SYNC= 'bml_enter_check SIGNAL ddl3_blocked';
+TRUNCATE TABLE t1;
+# Wait for DDL3 to send its signal.
+SET DEBUG_SYNC= 'now WAIT_FOR ddl3_blocked TIMEOUT 3';
+# con3: Send DDL3 but it is blocked by BACKUP/RESTORE
+# (will not be in backup) make it send signal when
+# blocked on BML.
+SET DEBUG_SYNC= 'bml_enter_check SIGNAL ddl4_blocked';
+TRUNCATE TABLE t2;
+# Wait for DDL4 to send its signal.
+SET DEBUG_SYNC= 'now WAIT_FOR ddl4_blocked TIMEOUT 3';
+
+== Checkpoint D ==
+#
+# DDL1= OPTIMIZE TABLE t1
+# DDL2= REPAIR TABLE t2 USE_FRM
+# DDL3= TRUNCATE TABLE t1
+# DDL4= TRUNCATE TABLE t2
+#
+SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
+WHERE info LIKE "TRUNCATE TABLE t1%"
+ OR info LIKE "TRUNCATE TABLE t2%";
+state info
+BML: waiting until released TRUNCATE TABLE t2
+BML: waiting until released TRUNCATE TABLE t1
+# Checking that DDL3 and DDL4 have not executed.
+CALL test.check_results();
+Tables_in_bml_test
+t1
+t2
+rows_in_t1
+2
+rows_in_t2
+2
+Table Checksum
+bml_test.t1 2865344526
+bml_test.t2 1578680517
+==================
+
+# Resume BACKUP/RESTORE - this allows DDL3 and DDL4 to complete.
+SET DEBUG_SYNC= 'now SIGNAL finish_bup';
+# con5: Reaping BACKUP/RESTORE
+backup_id
+500
+SET debug="-d";
+# con3: Completing DDL3
+# con4: Completing DDL4
+
+== Checkpoint E ==
+#
+# DDL1= OPTIMIZE TABLE t1
+# DDL2= REPAIR TABLE t2 USE_FRM
+# DDL3= TRUNCATE TABLE t1
+# DDL4= TRUNCATE TABLE t2
+#
+# Checking that DDL3 and DDL4 have executed.
+CALL test.check_results();
+Tables_in_bml_test
+t1
+t2
+rows_in_t1
+0
+rows_in_t2
+0
+Table Checksum
+bml_test.t1 0
+bml_test.t2 0
+==================
-Verifying Test 3 results for restore.
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (3);
+
+########################################################
+# Running BML test for the following statements:
+#
+# DDL1= TRUNCATE t1
+# DDL2= TRUNCATE t2
+# DDL3= REPAIR TABLE t1
+# DDL4= OPTIMIZE TABLE t2
+#
+# BML is activated by RESTORE FROM 'bml_test.bkp' OVERWRITE.
+########################################################
+
+SET DEBUG_SYNC= 'reset';
+PURGE BACKUP LOGS;
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
+SET DEBUG_SYNC= 'reset';
+USE bml_test;
-con1: Table t4 should not be in restored data.
-use bup_ddl_blocker;
-SHOW TABLES;
-Tables_in_bup_ddl_blocker
+== Checkpoint A ==
+# Check the initial situation.
+CALL test.check_results();
+Tables_in_bml_test
t1
t2
-t3
-
-Starting Test 4 - Backup
+rows_in_t1
+1
+rows_in_t2
+1
+Table Checksum
+bml_test.t1 3459908756
+bml_test.t2 1681116191
+==================
+
+# con1: Start DDL1 making it to stop after it has started (and
+# possibly registered with BML).
+SET DEBUG_SYNC= 'before_execute_sql_command SIGNAL ddl1_started
+ WAIT_FOR continue_ddl';
+TRUNCATE t1;
+# con2: Wait for DDL1 to reach its synchronization point.
+SET DEBUG_SYNC= 'now WAIT_FOR ddl1_started TIMEOUT 3';
+# con2: Start DDL2 making it to stop after it has started (and
+# possibly registered with BML).
+SET DEBUG_SYNC= 'before_execute_sql_command SIGNAL ddl2_started
+ WAIT_FOR continue_ddl';
+TRUNCATE t2;
+# con5: Wait for DDL2 to reach its synchronization point.
+SET DEBUG_SYNC= 'now WAIT_FOR ddl2_started TIMEOUT 3';
+SET DEBUG_SYNC='before_execute_sql_command CLEAR';
+# con5: Activate synchronization points for BACKUP/RESTORE.
+SET DEBUG_SYNC= 'bml_get_check2 SIGNAL bup_waiting';
+SET DEBUG_SYNC= 'after_backup_start_backup WAIT_FOR continue_bup';
+SET DEBUG_SYNC= 'after_backup_start_restore WAIT_FOR continue_bup';
+SET DEBUG_SYNC= 'before_backup_meta SIGNAL bup_running WAIT_FOR finish_bup';
+SET DEBUG_SYNC= 'start_do_restore SIGNAL bup_running WAIT_FOR finish_bup';
+# con5: Starting BACKUP/RESTORE operation -- should be blocked
+# by ongoing DDLs.
+SET SESSION debug="+d,set_backup_id";
+RESTORE FROM 'bml_test.bkp' OVERWRITE;
+# Waiting for BACKUP/RESTORE to reach its synchronization point.
+SET DEBUG_SYNC= 'now WAIT_FOR bup_waiting TIMEOUT 1';
+
+== Checkpoint B ==
+#
+# DDL1= TRUNCATE t1
+# DDL2= TRUNCATE t2
+# DDL3= REPAIR TABLE t1
+# DDL4= OPTIMIZE TABLE t2
+#
+SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
+WHERE info LIKE "BACKUP DATABASE%"
+ OR info LIKE "RESTORE FROM%"
+ OR info LIKE "TRUNCATE t1%"
+ OR info LIKE "TRUNCATE t2%";
+state info
+BML: waiting for all statements to leave RESTORE FROM 'bml_test.bkp' OVERWRITE
+debug sync point: before_execute_sql_command TRUNCATE t2
+debug sync point: before_execute_sql_command TRUNCATE t1
+# Checking that BACKUP is blocked by DDLs.
+SELECT object, notes, error_num FROM mysql.backup_progress WHERE backup_id=500;
+object notes error_num
+backup kernel starting 0
+backup kernel running 0
+# Checking that DDL1 and DDL2 have not executed.
+CALL test.check_results();
+Tables_in_bml_test
+t1
+t2
+rows_in_t1
+1
+rows_in_t2
+1
+Table Checksum
+bml_test.t1 3459908756
+bml_test.t2 1681116191
+==================
+
+# Resume DDL1 and DDL2.
+# Now BACKUP/RESTORE should stop after activating DDL blocker.
+SET DEBUG_SYNC= 'now SIGNAL continue_ddl';
+# con1: Reaping DDL1
+# con2: Reaping DDL2
+SET DEBUG_SYNC= 'now SIGNAL continue_bup WAIT_FOR bup_running TIMEOUT 1';
+
+== Checkpoint C ==
+#
+# DDL1= TRUNCATE t1
+# DDL2= TRUNCATE t2
+# DDL3= REPAIR TABLE t1
+# DDL4= OPTIMIZE TABLE t2
+#
+SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
+WHERE info LIKE "BACKUP DATABASE%"
+ OR info LIKE "RESTORE FROM%";
+state info
+debug sync point: start_do_restore RESTORE FROM 'bml_test.bkp' OVERWRITE
+# Checking that DDL1 and DDL2 have executed.
+CALL test.check_results();
+Tables_in_bml_test
+t1
+t2
+rows_in_t1
+0
+rows_in_t2
+0
+Table Checksum
+bml_test.t1 0
+bml_test.t2 0
+==================
+
+# con3: Send DDL3 but it is blocked by BACKUP/RESTORE
+# (will not be in backup) make it send signal when
+# blocked on BML.
+SET DEBUG_SYNC= 'bml_enter_check SIGNAL ddl3_blocked';
+REPAIR TABLE t1;
+# Wait for DDL3 to send its signal.
+SET DEBUG_SYNC= 'now WAIT_FOR ddl3_blocked TIMEOUT 3';
+# con3: Send DDL3 but it is blocked by BACKUP/RESTORE
+# (will not be in backup) make it send signal when
+# blocked on BML.
+SET DEBUG_SYNC= 'bml_enter_check SIGNAL ddl4_blocked';
+OPTIMIZE TABLE t2;
+# Wait for DDL4 to send its signal.
+SET DEBUG_SYNC= 'now WAIT_FOR ddl4_blocked TIMEOUT 3';
+
+== Checkpoint D ==
+#
+# DDL1= TRUNCATE t1
+# DDL2= TRUNCATE t2
+# DDL3= REPAIR TABLE t1
+# DDL4= OPTIMIZE TABLE t2
+#
+SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
+WHERE info LIKE "REPAIR TABLE t1%"
+ OR info LIKE "OPTIMIZE TABLE t2%";
+state info
+BML: waiting until released OPTIMIZE TABLE t2
+BML: waiting until released REPAIR TABLE t1
+# Checking that DDL3 and DDL4 have not executed.
+CALL test.check_results();
+Tables_in_bml_test
+t1
+t2
+rows_in_t1
+0
+rows_in_t2
+0
+Table Checksum
+bml_test.t1 0
+bml_test.t2 0
+==================
+
+# Resume BACKUP/RESTORE - this allows DDL3 and DDL4 to complete.
+SET DEBUG_SYNC= 'now SIGNAL finish_bup';
+# con5: Reaping BACKUP/RESTORE
+backup_id
+500
+SET debug="-d";
+# con3: Completing DDL3
+Table Op Msg_type Msg_text
+bml_test.t1 repair status OK
+# con4: Completing DDL4
+Table Op Msg_type Msg_text
+bml_test.t2 optimize status OK
-DROP DATABASE IF EXISTS bup_ddl_blocker_1;
-DROP DATABASE IF EXISTS bup_ddl_blocker_2;
-DROP DATABASE IF EXISTS bup_ddl_blocker_3;
-DROP DATABASE IF EXISTS bup_ddl_blocker_4;
-con1: Creating databases
-CREATE DATABASE bup_ddl_blocker_2;
-CREATE DATABASE bup_ddl_blocker_4;
-con1: Creating tables
-CREATE TABLE bup_ddl_blocker_2.t1 (col_a CHAR(40)) ENGINE=INNODB;
-CREATE TABLE bup_ddl_blocker_4.t1 (col_a CHAR(40)) ENGINE=MYISAM;
-con1: Loading data
-INSERT INTO bup_ddl_blocker_2.t1 VALUES ("01 Some data to test");
-INSERT INTO bup_ddl_blocker_2.t1 VALUES ("02 Some data to test");
-INSERT INTO bup_ddl_blocker_2.t1 VALUES ("03 Some data to test");
-INSERT INTO bup_ddl_blocker_4.t1 VALUES ("01 Some data to test");
-INSERT INTO bup_ddl_blocker_4.t1 VALUES ("02 Some data to test");
-INSERT INTO bup_ddl_blocker_4.t1 VALUES ("03 Some data to test");
-con1: Show that the new data doesn't exist before backup.
-SHOW DATABASES LIKE 'bup_ddl_blocker_%';
-Database (bup_ddl_blocker_%)
-bup_ddl_blocker_2
-bup_ddl_blocker_4
-con2: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'after_start_ddl SIGNAL con2_started WAIT_FOR status_shown';
-con2: Get a DDL going and stop in the middle
-CREATE DATABASE bup_ddl_blocker_1;
-con3: Wait for con2 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con2_started';
-con3: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'after_start_ddl SIGNAL con3_started WAIT_FOR status_shown';
-con3: Get a DDL going and stop in the middle
-DROP DATABASE bup_ddl_blocker_2;
-con1: Wait for con3 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con3_started';
-con1: Activate synchronization points for backup.
-SET DEBUG_SYNC= 'before_block_ddl SIGNAL bup_blocked WAIT_FOR status_shown';
-SET DEBUG_SYNC= 'after_block_ddl SIGNAL bup_started WAIT_FOR status_shown2';
-con1: Backing up database -- will block with lock
-BACKUP DATABASE * TO "bup_ddl_blocker.bak";
-con6: Wait for con1 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR bup_blocked';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "BACKUP DATABASE%";
-state info
-debug sync point: before_block_ddl BACKUP DATABASE * TO "bup_ddl_blocker.bak"
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "CREATE DATABASE bup_ddl_blocker_1%";
-state info
-debug sync point: after_start_ddl CREATE DATABASE bup_ddl_blocker_1
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "DROP DATABASE bup_ddl_blocker_2%";
-state info
-debug sync point: after_start_ddl DROP DATABASE bup_ddl_blocker_2
-con6: Resume all and wait for backup to start after DDL finish.
-SET DEBUG_SYNC= 'now SIGNAL status_shown WAIT_FOR bup_started';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "BACKUP DATABASE%";
-state info
-debug sync point: after_block_ddl BACKUP DATABASE * TO "bup_ddl_blocker.bak"
-con4: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'before_check_ddl_blocked SIGNAL con4_started
- WAIT_FOR status_shown2';
-con4: Try a DDL but it is blocked by backup -- will not be in backup
-CREATE DATABASE bup_ddl_blocker_3;
-con5: Wait for con4 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con4_started';
-con5: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'before_check_ddl_blocked SIGNAL con5_started
- WAIT_FOR status_shown2';
-con5: Try a DDL but it is blocked by backup -- will not be in backup
-DROP DATABASE bup_ddl_blocker_4;
-con6: Wait for con5 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con5_started';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "CREATE DATABASE bup_ddl_blocker_3%";
-state info
-debug sync point: before_check_ddl_blocked CREATE DATABASE bup_ddl_blocker_3
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "DROP DATABASE bup_ddl_blocker_4%";
-state info
-debug sync point: before_check_ddl_blocked DROP DATABASE bup_ddl_blocker_4
-con6: Resume all.
-SET DEBUG_SYNC= 'now SIGNAL status_shown2';
-con2: Completing DDL
-con3: Completing DDL
-con4: Completing DDL
-con5: Completing DDL
-backup_id
-#
-
-Verifying Test 4 results for backup.
-
-con1: Showing databases after updates and backup
-con1: bup_ddl_blocker_2 and bup_ddl_blocker_4 are not present
-SHOW DATABASES LIKE 'bup_ddl_blocker_%';
-Database (bup_ddl_blocker_%)
-bup_ddl_blocker_1
-bup_ddl_blocker_3
-con1: Dropping the database tables
-DROP DATABASE bup_ddl_blocker_1;
-DROP DATABASE bup_ddl_blocker_3;
-con1: Restoring the database
-RESTORE FROM "bup_ddl_blocker.bak" OVERWRITE;
-backup_id
-#
-con1: Showing databases that were backed up
-con1: bup_ddl_blocker_2 and bup_ddl_blocker_3 are not present
-SHOW DATABASES LIKE 'bup_ddl_blocker_%';
-Database (bup_ddl_blocker_%)
-bup_ddl_blocker_1
-bup_ddl_blocker_4
-con1: Cleanup
-DROP DATABASE bup_ddl_blocker_1;
-DROP DATABASE bup_ddl_blocker_4;
-
-Starting Test 4 - Restore
-
-DROP DATABASE IF EXISTS bup_ddl_blocker_1;
-DROP DATABASE IF EXISTS bup_ddl_blocker_2;
-DROP DATABASE IF EXISTS bup_ddl_blocker_3;
-DROP DATABASE IF EXISTS bup_ddl_blocker_4;
-con1: Creating databases
-CREATE DATABASE bup_ddl_blocker_2;
-CREATE DATABASE bup_ddl_blocker_4;
-con1: Creating tables
-CREATE TABLE bup_ddl_blocker_2.t1 (col_a CHAR(40)) ENGINE=INNODB;
-CREATE TABLE bup_ddl_blocker_4.t1 (col_a CHAR(40)) ENGINE=MYISAM;
-con1: Loading data
-INSERT INTO bup_ddl_blocker_2.t1 VALUES ("01 Some data to test");
-INSERT INTO bup_ddl_blocker_2.t1 VALUES ("02 Some data to test");
-INSERT INTO bup_ddl_blocker_2.t1 VALUES ("03 Some data to test");
-INSERT INTO bup_ddl_blocker_4.t1 VALUES ("01 Some data to test");
-INSERT INTO bup_ddl_blocker_4.t1 VALUES ("02 Some data to test");
-INSERT INTO bup_ddl_blocker_4.t1 VALUES ("03 Some data to test");
-con1: Show that the new data doesn't exist before backup.
-SHOW DATABASES LIKE 'bup_ddl_blocker_%';
-Database (bup_ddl_blocker_%)
-bup_ddl_blocker_2
-bup_ddl_blocker_4
-BACKUP DATABASE bup_ddl_blocker_2, bup_ddl_blocker_4 to 'bup_ddl_blocker_orig.bak';
-backup_id
-#
-con2: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'after_start_ddl SIGNAL con2_started WAIT_FOR status_shown';
-con2: Get a DDL going and stop in the middle
-CREATE DATABASE bup_ddl_blocker_1;
-con3: Wait for con2 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con2_started';
-con3: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'after_start_ddl SIGNAL con3_started WAIT_FOR status_shown';
-con3: Get a DDL going and stop in the middle
-DROP DATABASE bup_ddl_blocker_2;
-con1: Wait for con3 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con3_started';
-con1: Activate synchronization points for restore.
-SET DEBUG_SYNC= 'before_block_ddl SIGNAL bup_blocked WAIT_FOR status_shown';
-SET DEBUG_SYNC= 'after_block_ddl SIGNAL bup_started WAIT_FOR status_shown2';
-con1: Restoring database -- will block with lock
-RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE;
-con6: Wait for con1 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR bup_blocked';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "RESTORE FROM%";
-state info
-debug sync point: before_block_ddl RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "CREATE DATABASE bup_ddl_blocker_1%";
-state info
-debug sync point: after_start_ddl CREATE DATABASE bup_ddl_blocker_1
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "DROP DATABASE bup_ddl_blocker_2%";
-state info
-debug sync point: after_start_ddl DROP DATABASE bup_ddl_blocker_2
-con6: Resume all and wait for restore to start after DDL finish.
-SET DEBUG_SYNC= 'now SIGNAL status_shown WAIT_FOR bup_started';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "RESTORE FROM%";
-state info
-debug sync point: after_block_ddl RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE
-con4: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'before_check_ddl_blocked SIGNAL con4_started
- WAIT_FOR status_shown2';
-con4: Try a DDL but it is blocked by backup -- will not be in backup
-CREATE DATABASE bup_ddl_blocker_3;
-con5: Wait for con4 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con4_started';
-con5: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'before_check_ddl_blocked SIGNAL con5_started
- WAIT_FOR status_shown2';
-con5: Try a DDL but it is blocked by backup -- will not be in backup
-DROP DATABASE bup_ddl_blocker_4;
-con6: Wait for con5 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con5_started';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "CREATE DATABASE bup_ddl_blocker_3%";
-state info
-debug sync point: before_check_ddl_blocked CREATE DATABASE bup_ddl_blocker_3
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "DROP DATABASE bup_ddl_blocker_4%";
-state info
-debug sync point: before_check_ddl_blocked DROP DATABASE bup_ddl_blocker_4
-con6: Resume all.
-SET DEBUG_SYNC= 'now SIGNAL status_shown2';
-con2: Completing DDL
-con3: Completing DDL
-con4: Completing DDL
-con5: Completing DDL
-backup_id
-#
-
-Verifying Test 4 results for restore.
-
-con1: Database bup_ddl_blocker_4 should not be in restored data.
-SHOW DATABASES LIKE 'bup_ddl_blocker_%';
-Database (bup_ddl_blocker_%)
-bup_ddl_blocker_1
-bup_ddl_blocker_2
-bup_ddl_blocker_3
-
-Starting Test 5 - Backup
-
-DROP DATABASE IF EXISTS bup_ddl_blocker_1;
-DROP DATABASE IF EXISTS bup_ddl_blocker_2;
-DROP DATABASE IF EXISTS bup_ddl_blocker_3;
-DROP DATABASE IF EXISTS bup_ddl_blocker_4;
-con1: Creating databases
-CREATE DATABASE bup_ddl_blocker_2 CHARACTER SET latin1;
-CREATE DATABASE bup_ddl_blocker_4 CHARACTER SET latin1;
-con1: Creating tables
-CREATE TABLE bup_ddl_blocker_2.t1 (col_a CHAR(40)) ENGINE=INNODB;
-CREATE TABLE bup_ddl_blocker_4.t1 (col_a CHAR(40)) ENGINE=MYISAM;
-con1: Loading data
-INSERT INTO bup_ddl_blocker_2.t1 VALUES ("01 Some data to test");
-INSERT INTO bup_ddl_blocker_2.t1 VALUES ("02 Some data to test");
-INSERT INTO bup_ddl_blocker_2.t1 VALUES ("03 Some data to test");
-INSERT INTO bup_ddl_blocker_4.t1 VALUES ("01 Some data to test");
-INSERT INTO bup_ddl_blocker_4.t1 VALUES ("02 Some data to test");
-INSERT INTO bup_ddl_blocker_4.t1 VALUES ("03 Some data to test");
-con1: Show that the new data doesn't exist before backup.
-SHOW DATABASES LIKE 'bup_ddl_blocker_%';
-Database (bup_ddl_blocker_%)
-bup_ddl_blocker_2
-bup_ddl_blocker_4
-con2: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'after_start_ddl SIGNAL con2_started WAIT_FOR status_shown';
-con2: Get a DDL going and stop in the middle
-TRUNCATE TABLE bup_ddl_blocker_2.t1;
-con3: Wait for con2 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con2_started';
-con3: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'after_start_ddl SIGNAL con3_started WAIT_FOR status_shown';
-con3: Get a DDL going and stop in the middle
-ALTER DATABASE bup_ddl_blocker_2 CHARACTER SET latin2;
-con1: Wait for con3 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con3_started';
-con1: Activate synchronization points for backup.
-SET DEBUG_SYNC= 'before_block_ddl SIGNAL bup_blocked WAIT_FOR status_shown';
-SET DEBUG_SYNC= 'after_block_ddl SIGNAL bup_started WAIT_FOR status_shown2';
-con1: Backing up database -- will block with lock
-BACKUP DATABASE * TO "bup_ddl_blocker.bak";
-con6: Wait for con1 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR bup_blocked';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "BACKUP DATABASE%";
-state info
-debug sync point: before_block_ddl BACKUP DATABASE * TO "bup_ddl_blocker.bak"
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "TRUNCATE TABLE bup_ddl_blocker_2%";
-state info
-debug sync point: after_start_ddl TRUNCATE TABLE bup_ddl_blocker_2.t1
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "ALTER DATABASE bup_ddl_blocker_2%";
-state info
-debug sync point: after_start_ddl ALTER DATABASE bup_ddl_blocker_2 CHARACTER SET latin2
-con6: Resume all and wait for backup to start after DDL finish.
-SET DEBUG_SYNC= 'now SIGNAL status_shown WAIT_FOR bup_started';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "BACKUP DATABASE%";
-state info
-debug sync point: after_block_ddl BACKUP DATABASE * TO "bup_ddl_blocker.bak"
-con4: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'before_check_ddl_blocked SIGNAL con4_started
- WAIT_FOR status_shown2';
-con4: Try a DDL but it is blocked by backup -- will not be in backup
-TRUNCATE TABLE bup_ddl_blocker_4.t1;
-con5: Wait for con4 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con4_started';
-con5: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'before_check_ddl_blocked SIGNAL con5_started
- WAIT_FOR status_shown2';
-con5: Try a DDL but it is blocked by backup -- will not be in backup
-ALTER DATABASE bup_ddl_blocker_4 CHARACTER SET latin2;
-con6: Wait for con5 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con5_started';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "ALTER DATABASE bup_ddl_blocker_4%";
-state info
-debug sync point: before_check_ddl_blocked ALTER DATABASE bup_ddl_blocker_4 CHARACTER SET latin2
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "TRUNCATE TABLE bup_ddl_blocker_4%";
-state info
-debug sync point: before_check_ddl_blocked TRUNCATE TABLE bup_ddl_blocker_4.t1
-con6: Resume all.
-SET DEBUG_SYNC= 'now SIGNAL status_shown2';
-con2: Completing DDL
-con3: Completing DDL
-con4: Completing DDL
-con5: Completing DDL
-backup_id
-#
-
-Verifying Test 5 results for backup.
-
-con1: Showing databases after updates and backup
-con1: bup_ddl_blocker_2.t1 has been truncated.
-con1: bup_ddl_blocker_1 and bup_ddl_blocker_3 are renamed
-con1: bup_ddl_blocker_4.t1 has been truncated.
-con1: bup_ddl_blocker_2 and bup_ddl_blocker_4 have had their charset changed.
-SHOW DATABASES LIKE 'bup_ddl_blocker_%';
-Database (bup_ddl_blocker_%)
-bup_ddl_blocker_2
-bup_ddl_blocker_4
-SHOW CREATE DATABASE bup_ddl_blocker_2;
-Database Create Database
-bup_ddl_blocker_2 CREATE DATABASE `bup_ddl_blocker_2` /*!40100 DEFAULT CHARACTER SET latin2 */
-SHOW CREATE DATABASE bup_ddl_blocker_4;
-Database Create Database
-bup_ddl_blocker_4 CREATE DATABASE `bup_ddl_blocker_4` /*!40100 DEFAULT CHARACTER SET latin2 */
-SELECT * FROM bup_ddl_blocker_2.t1;
-col_a
-SELECT * FROM bup_ddl_blocker_4.t1;
-col_a
-con1: Dropping the database tables
-DROP DATABASE bup_ddl_blocker_2;
-DROP DATABASE bup_ddl_blocker_4;
-con1: Restoring the database
-RESTORE FROM "bup_ddl_blocker.bak" OVERWRITE;
-backup_id
-#
-con1: Showing databases that were backed up
-con1: bup_ddl_blocker_1 has been renamed and
-con1: bup_ddl_blocker_2.t1 has been truncated.
-con1: bup_ddl_blocker_4 has not had its character set changed.
-con1: bup_ddl_blocker_4.t1 has not been truncated.
-SHOW DATABASES LIKE 'bup_ddl_blocker_%';
-Database (bup_ddl_blocker_%)
-bup_ddl_blocker_2
-bup_ddl_blocker_4
-SHOW CREATE DATABASE bup_ddl_blocker_2;
-Database Create Database
-bup_ddl_blocker_2 CREATE DATABASE `bup_ddl_blocker_2` /*!40100 DEFAULT CHARACTER SET latin2 */
-SHOW CREATE DATABASE bup_ddl_blocker_4;
-Database Create Database
-bup_ddl_blocker_4 CREATE DATABASE `bup_ddl_blocker_4` /*!40100 DEFAULT CHARACTER SET latin1 */
-SELECT * FROM bup_ddl_blocker_2.t1;
-col_a
-SELECT * FROM bup_ddl_blocker_4.t1;
-col_a
-01 Some data to test
-02 Some data to test
-03 Some data to test
-con1: Cleanup
-DROP DATABASE bup_ddl_blocker_2;
-DROP DATABASE bup_ddl_blocker_4;
-
-Starting Test 5 - Restore
-
-DROP DATABASE IF EXISTS bup_ddl_blocker_1;
-DROP DATABASE IF EXISTS bup_ddl_blocker_2;
-DROP DATABASE IF EXISTS bup_ddl_blocker_3;
-DROP DATABASE IF EXISTS bup_ddl_blocker_4;
-con1: Creating databases
-CREATE DATABASE bup_ddl_blocker_2 CHARACTER SET latin1;
-CREATE DATABASE bup_ddl_blocker_4 CHARACTER SET latin1;
-con1: Creating tables
-CREATE TABLE bup_ddl_blocker_2.t1 (col_a CHAR(40)) ENGINE=INNODB;
-CREATE TABLE bup_ddl_blocker_4.t1 (col_a CHAR(40)) ENGINE=MYISAM;
-con1: Loading data
-INSERT INTO bup_ddl_blocker_2.t1 VALUES ("01 Some data to test");
-INSERT INTO bup_ddl_blocker_2.t1 VALUES ("02 Some data to test");
-INSERT INTO bup_ddl_blocker_2.t1 VALUES ("03 Some data to test");
-INSERT INTO bup_ddl_blocker_4.t1 VALUES ("01 Some data to test");
-INSERT INTO bup_ddl_blocker_4.t1 VALUES ("02 Some data to test");
-INSERT INTO bup_ddl_blocker_4.t1 VALUES ("03 Some data to test");
-con1: Show that the new data doesn't exist before backup.
-SHOW DATABASES LIKE 'bup_ddl_blocker_%';
-Database (bup_ddl_blocker_%)
-bup_ddl_blocker_2
-bup_ddl_blocker_4
-BACKUP DATABASE bup_ddl_blocker_2, bup_ddl_blocker_4 to 'bup_ddl_blocker_orig.bak';
-backup_id
-#
-con2: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'after_start_ddl SIGNAL con2_started WAIT_FOR status_shown';
-con2: Get a DDL going and stop in the middle
-TRUNCATE TABLE bup_ddl_blocker_2.t1;
-con3: Wait for con2 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con2_started';
-con3: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'after_start_ddl SIGNAL con3_started WAIT_FOR status_shown';
-con3: Get a DDL going and stop in the middle
-ALTER DATABASE bup_ddl_blocker_2 CHARACTER SET latin2;
-con1: Wait for con3 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con3_started';
-con1: Activate synchronization points for restore.
-SET DEBUG_SYNC= 'before_block_ddl SIGNAL bup_blocked WAIT_FOR status_shown';
-SET DEBUG_SYNC= 'after_block_ddl SIGNAL bup_started WAIT_FOR status_shown2';
-con1: Restoring database -- will block with lock
-RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE;
-con6: Wait for con1 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR bup_blocked';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "RESTORE FROM%";
-state info
-debug sync point: before_block_ddl RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "ALTER DATABASE bup_ddl_blocker_2%";
-state info
-debug sync point: after_start_ddl ALTER DATABASE bup_ddl_blocker_2 CHARACTER SET latin2
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "TRUNCATE TABLE bup_ddl_blocker_2%";
-state info
-debug sync point: after_start_ddl TRUNCATE TABLE bup_ddl_blocker_2.t1
-con6: Resume all and wait for restore to start after DDL finish.
-SET DEBUG_SYNC= 'now SIGNAL status_shown WAIT_FOR bup_started';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "RESTORE FROM%";
-state info
-debug sync point: after_block_ddl RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE
-con4: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'before_check_ddl_blocked SIGNAL con4_started
- WAIT_FOR status_shown2';
-con4: Try a DDL but it is blocked by backup -- will not be in backup
-TRUNCATE TABLE bup_ddl_blocker_4.t1;
-con5: Wait for con4 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con4_started';
-con5: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'before_check_ddl_blocked SIGNAL con5_started
- WAIT_FOR status_shown2';
-con5: Try a DDL but it is blocked by backup -- will not be in backup
-ALTER DATABASE bup_ddl_blocker_4 CHARACTER SET latin2;
-con6: Wait for con5 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con5_started';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "TRUNCATE TABLE bup_ddl_blocker_4%";
-state info
-debug sync point: before_check_ddl_blocked TRUNCATE TABLE bup_ddl_blocker_4.t1
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "ALTER DATABASE bup_ddl_blocker_4%";
-state info
-debug sync point: before_check_ddl_blocked ALTER DATABASE bup_ddl_blocker_4 CHARACTER SET latin2
-con6: Resume all.
-SET DEBUG_SYNC= 'now SIGNAL status_shown2';
-con2: Completing DDL
-con3: Completing DDL
-con4: Completing DDL
-con5: Completing DDL
-backup_id
-#
-
-Verifying Test 5 results for restore.
-
-con1: bup_ddl_blocker_4 has had its character set changed.
-con1: bup_ddl_blocker_2.t1 has not been truncated.
-con1: bup_ddl_blocker_4.t1 has been truncated.
-SHOW DATABASES LIKE 'bup_ddl_blocker_%';
-Database (bup_ddl_blocker_%)
-bup_ddl_blocker_2
-bup_ddl_blocker_4
-SHOW CREATE DATABASE bup_ddl_blocker_2;
-Database Create Database
-bup_ddl_blocker_2 CREATE DATABASE `bup_ddl_blocker_2` /*!40100 DEFAULT CHARACTER SET latin1 */
-SHOW CREATE DATABASE bup_ddl_blocker_4;
-Database Create Database
-bup_ddl_blocker_4 CREATE DATABASE `bup_ddl_blocker_4` /*!40100 DEFAULT CHARACTER SET latin2 */
-SELECT * FROM bup_ddl_blocker_2.t1;
-col_a
-01 Some data to test
-02 Some data to test
-03 Some data to test
-SELECT * FROM bup_ddl_blocker_4.t1;
-col_a
-con1: Cleanup
-DROP DATABASE bup_ddl_blocker_2;
-DROP DATABASE bup_ddl_blocker_4;
-
-Starting Test 6 - Backup
-
-DROP DATABASE IF EXISTS bup_ddl_blocker_1;
-DROP DATABASE IF EXISTS bup_ddl_blocker_2;
-DROP DATABASE IF EXISTS bup_ddl_blocker_3;
-DROP DATABASE IF EXISTS bup_ddl_blocker_4;
-con1: Creating databases
-CREATE DATABASE bup_ddl_blocker_1;
-CREATE DATABASE bup_ddl_blocker_2;
-CREATE DATABASE bup_ddl_blocker_3;
-CREATE DATABASE bup_ddl_blocker_4;
-con1: Creating tables
-CREATE TABLE bup_ddl_blocker_1.t1 (col_a CHAR(40), col_b int) ENGINE=INNODB;
-CREATE TABLE bup_ddl_blocker_2.t1 (col_a CHAR(40), col_b int) ENGINE=INNODB;
-CREATE TABLE bup_ddl_blocker_3.t1 (col_a CHAR(40), col_b int) ENGINE=INNODB;
-CREATE TABLE bup_ddl_blocker_4.t1 (col_a CHAR(40), col_b int) ENGINE=INNODB;
-con1: Loading data
-INSERT INTO bup_ddl_blocker_1.t1 VALUES ("01 Some data to test", 10);
-INSERT INTO bup_ddl_blocker_1.t1 VALUES ("02 Some data to test", 09);
-INSERT INTO bup_ddl_blocker_1.t1 VALUES ("03 Some data to test", 12);
-INSERT INTO bup_ddl_blocker_2.t1 VALUES ("01 Some data to test", 3);
-INSERT INTO bup_ddl_blocker_2.t1 VALUES ("02 Some data to test", 8);
-INSERT INTO bup_ddl_blocker_2.t1 VALUES ("03 Some data to test", 11);
-CREATE INDEX 2t1col_b ON bup_ddl_blocker_2.t1 (col_b);
-INSERT INTO bup_ddl_blocker_3.t1 VALUES ("01 Some data to test", 2);
-INSERT INTO bup_ddl_blocker_3.t1 VALUES ("02 Some data to test", 4);
-INSERT INTO bup_ddl_blocker_3.t1 VALUES ("03 Some data to test", 5);
-INSERT INTO bup_ddl_blocker_4.t1 VALUES ("01 Some data to test", 1);
-INSERT INTO bup_ddl_blocker_4.t1 VALUES ("02 Some data to test", 12);
-INSERT INTO bup_ddl_blocker_4.t1 VALUES ("03 Some data to test", 3);
-CREATE INDEX 4t1col_b ON bup_ddl_blocker_4.t1 (col_b);
-con2: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'after_start_ddl SIGNAL con2_started WAIT_FOR status_shown';
-con2: Get a DDL going and stop in the middle
-CREATE INDEX 1t1col_b ON bup_ddl_blocker_1.t1 (col_b);
-con3: Wait for con2 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con2_started';
-con3: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'after_start_ddl SIGNAL con3_started WAIT_FOR status_shown';
-con3: Get a DDL going and stop in the middle
-DROP INDEX 2t1col_b ON bup_ddl_blocker_2.t1;
-con1: Wait for con3 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con3_started';
-con1: Activate synchronization points for backup.
-SET DEBUG_SYNC= 'before_block_ddl SIGNAL bup_blocked WAIT_FOR status_shown';
-SET DEBUG_SYNC= 'after_block_ddl SIGNAL bup_started WAIT_FOR status_shown2';
-con1: Backing up database -- will block with lock
-BACKUP DATABASE bup_ddl_blocker_1, bup_ddl_blocker_2,
-bup_ddl_blocker_3, bup_ddl_blocker_4
-TO "bup_ddl_blocker.bak";
-con6: Wait for con1 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR bup_blocked';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "BACKUP DATABASE%";
-state info
-debug sync point: before_block_ddl BACKUP DATABASE bup_ddl_blocker_1, bup_ddl_blocker_2,
-bup_ddl_blocker_3, bup_ddl_blocker_4
-TO "bup_ddl_blocker.bak"
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "CREATE INDEX 1t1col_b%";
-state info
-debug sync point: after_start_ddl CREATE INDEX 1t1col_b ON bup_ddl_blocker_1.t1 (col_b)
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "DROP INDEX 2t1col_b%";
-state info
-debug sync point: after_start_ddl DROP INDEX 2t1col_b ON bup_ddl_blocker_2.t1
-con6: Resume all and wait for backup to start after DDL finish.
-SET DEBUG_SYNC= 'now SIGNAL status_shown WAIT_FOR bup_started';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "BACKUP DATABASE%";
-state info
-debug sync point: after_block_ddl BACKUP DATABASE bup_ddl_blocker_1, bup_ddl_blocker_2,
-bup_ddl_blocker_3, bup_ddl_blocker_4
-TO "bup_ddl_blocker.bak"
-con4: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'before_check_ddl_blocked SIGNAL con4_started
- WAIT_FOR status_shown2';
-con4: Try a DDL but it is blocked by backup -- will not be in backup
-CREATE INDEX 3t1col_b ON bup_ddl_blocker_3.t1 (col_b);
-con5: Wait for con4 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con4_started';
-con5: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'before_check_ddl_blocked SIGNAL con5_started
- WAIT_FOR status_shown2';
-con5: Try a DDL but it is blocked by backup -- will not be in backup
-DROP INDEX 4t1col_b ON bup_ddl_blocker_4.t1;
-con6: Wait for con5 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con5_started';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "CREATE INDEX 3t1col_b%";
-state info
-debug sync point: before_check_ddl_blocked CREATE INDEX 3t1col_b ON bup_ddl_blocker_3.t1 (col_b)
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "DROP INDEX 4t1col_b%";
-state info
-debug sync point: before_check_ddl_blocked DROP INDEX 4t1col_b ON bup_ddl_blocker_4.t1
-con6: Resume all.
-SET DEBUG_SYNC= 'now SIGNAL status_shown2';
-con2: Completing DDL
-con3: Completing DDL
-con4: Completing DDL
-con5: Completing DDL
-backup_id
-#
-
-Verifying Test 6 results for backup.
-
-con1: Showing database tables after updates and backup
-con1: bup_ddl_blocker_2 and bup_ddl_blocker_4 indexes are not present
-SHOW INDEX FROM bup_ddl_blocker_1.t1;
-Table t1
-Non_unique 1
-Key_name 1t1col_b
-Seq_in_index 1
-Column_name col_b
-Collation A
-Cardinality 3
-Sub_part NULL
-Packed NULL
-Null YES
-Index_type BTREE
-Comment
-Index_Comment
-SHOW INDEX FROM bup_ddl_blocker_2.t1;
-SHOW INDEX FROM bup_ddl_blocker_3.t1;
-Table t1
-Non_unique 1
-Key_name 3t1col_b
-Seq_in_index 1
-Column_name col_b
-Collation A
-Cardinality 3
-Sub_part NULL
-Packed NULL
-Null YES
-Index_type BTREE
-Comment
-Index_Comment
-SHOW INDEX FROM bup_ddl_blocker_4.t1;
-con1: Dropping the database tables
-DROP DATABASE bup_ddl_blocker_1;
-DROP DATABASE bup_ddl_blocker_2;
-DROP DATABASE bup_ddl_blocker_3;
-DROP DATABASE bup_ddl_blocker_4;
-con1: Restoring the database
-RESTORE FROM "bup_ddl_blocker.bak" OVERWRITE;
-backup_id
-#
-con1: Showing databases that were backed up
-con1: bup_ddl_blocker_2 and bup_ddl_blocker_3 indexes are not present
-SHOW INDEX FROM bup_ddl_blocker_1.t1;
-Table t1
-Non_unique 1
-Key_name 1t1col_b
-Seq_in_index 1
-Column_name col_b
-Collation A
-Cardinality 3
-Sub_part NULL
-Packed NULL
-Null YES
-Index_type BTREE
-Comment
-Index_Comment
-SHOW INDEX FROM bup_ddl_blocker_2.t1;
-SHOW INDEX FROM bup_ddl_blocker_3.t1;
-SHOW INDEX FROM bup_ddl_blocker_4.t1;
-Table t1
-Non_unique 1
-Key_name 4t1col_b
-Seq_in_index 1
-Column_name col_b
-Collation A
-Cardinality 3
-Sub_part NULL
-Packed NULL
-Null YES
-Index_type BTREE
-Comment
-Index_Comment
-con1: Cleanup
-DROP DATABASE bup_ddl_blocker_1;
-DROP DATABASE bup_ddl_blocker_2;
-DROP DATABASE bup_ddl_blocker_3;
-DROP DATABASE bup_ddl_blocker_4;
-
-Starting Test 6 - Restore
-
-DROP DATABASE IF EXISTS bup_ddl_blocker_1;
-DROP DATABASE IF EXISTS bup_ddl_blocker_2;
-DROP DATABASE IF EXISTS bup_ddl_blocker_3;
-DROP DATABASE IF EXISTS bup_ddl_blocker_4;
-con1: Creating databases
-CREATE DATABASE bup_ddl_blocker_1;
-CREATE DATABASE bup_ddl_blocker_2;
-CREATE DATABASE bup_ddl_blocker_3;
-CREATE DATABASE bup_ddl_blocker_4;
-con1: Creating tables
-CREATE TABLE bup_ddl_blocker_1.t1 (col_a CHAR(40), col_b int) ENGINE=INNODB;
-CREATE TABLE bup_ddl_blocker_2.t1 (col_a CHAR(40), col_b int) ENGINE=INNODB;
-CREATE TABLE bup_ddl_blocker_3.t1 (col_a CHAR(40), col_b int) ENGINE=INNODB;
-CREATE TABLE bup_ddl_blocker_4.t1 (col_a CHAR(40), col_b int) ENGINE=INNODB;
-con1: Loading data
-INSERT INTO bup_ddl_blocker_1.t1 VALUES ("01 Some data to test", 10);
-INSERT INTO bup_ddl_blocker_1.t1 VALUES ("02 Some data to test", 09);
-INSERT INTO bup_ddl_blocker_1.t1 VALUES ("03 Some data to test", 12);
-INSERT INTO bup_ddl_blocker_2.t1 VALUES ("01 Some data to test", 3);
-INSERT INTO bup_ddl_blocker_2.t1 VALUES ("02 Some data to test", 8);
-INSERT INTO bup_ddl_blocker_2.t1 VALUES ("03 Some data to test", 11);
-CREATE INDEX 2t1col_b ON bup_ddl_blocker_2.t1 (col_b);
-INSERT INTO bup_ddl_blocker_3.t1 VALUES ("01 Some data to test", 2);
-INSERT INTO bup_ddl_blocker_3.t1 VALUES ("02 Some data to test", 4);
-INSERT INTO bup_ddl_blocker_3.t1 VALUES ("03 Some data to test", 5);
-INSERT INTO bup_ddl_blocker_4.t1 VALUES ("01 Some data to test", 1);
-INSERT INTO bup_ddl_blocker_4.t1 VALUES ("02 Some data to test", 12);
-INSERT INTO bup_ddl_blocker_4.t1 VALUES ("03 Some data to test", 3);
-CREATE INDEX 4t1col_b ON bup_ddl_blocker_4.t1 (col_b);
-BACKUP DATABASE bup_ddl_blocker_1, bup_ddl_blocker_2,
-bup_ddl_blocker_3, bup_ddl_blocker_4
-TO "bup_ddl_blocker_orig.bak";
-backup_id
-#
-con2: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'after_start_ddl SIGNAL con2_started WAIT_FOR status_shown';
-con2: Get a DDL going and stop in the middle
-CREATE INDEX 1t1col_b ON bup_ddl_blocker_1.t1 (col_b);
-con3: Wait for con2 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con2_started';
-con3: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'after_start_ddl SIGNAL con3_started WAIT_FOR status_shown';
-con3: Get a DDL going and stop in the middle
-DROP INDEX 2t1col_b ON bup_ddl_blocker_2.t1;
-con1: Wait for con3 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con3_started';
-con1: Activate synchronization points for restore.
-SET DEBUG_SYNC= 'before_block_ddl SIGNAL bup_blocked WAIT_FOR status_shown';
-SET DEBUG_SYNC= 'after_block_ddl SIGNAL bup_started WAIT_FOR status_shown2';
-con1: Restoring database -- will block with lock
-RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE;
-con6: Wait for con1 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR bup_blocked';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "RESTORE FROM%";
-state info
-debug sync point: before_block_ddl RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "CREATE INDEX 1t1col_b%";
-state info
-debug sync point: after_start_ddl CREATE INDEX 1t1col_b ON bup_ddl_blocker_1.t1 (col_b)
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "DROP INDEX 2t1col_b%";
-state info
-debug sync point: after_start_ddl DROP INDEX 2t1col_b ON bup_ddl_blocker_2.t1
-con6: Resume all and wait for restore to start after DDL finish.
-SET DEBUG_SYNC= 'now SIGNAL status_shown WAIT_FOR bup_started';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "RESTORE FROM%";
-state info
-debug sync point: after_block_ddl RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE
-con4: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'before_check_ddl_blocked SIGNAL con4_started
- WAIT_FOR status_shown2';
-con4: Try a DDL but it is blocked by backup -- will not be in backup
-CREATE INDEX 3t1col_b ON bup_ddl_blocker_3.t1 (col_b);
-con5: Wait for con4 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con4_started';
-con5: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'before_check_ddl_blocked SIGNAL con5_started
- WAIT_FOR status_shown2';
-con5: Try a DDL but it is blocked by backup -- will not be in backup
-DROP INDEX 4t1col_b ON bup_ddl_blocker_4.t1;
-con6: Wait for con5 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con5_started';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "CREATE INDEX 3t1col_b%";
-state info
-debug sync point: before_check_ddl_blocked CREATE INDEX 3t1col_b ON bup_ddl_blocker_3.t1 (col_b)
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "DROP INDEX 4t1col_b%";
-state info
-debug sync point: before_check_ddl_blocked DROP INDEX 4t1col_b ON bup_ddl_blocker_4.t1
-con6: Resume all.
-SET DEBUG_SYNC= 'now SIGNAL status_shown2';
-con2: Completing DDL
-con3: Completing DDL
-con4: Completing DDL
-con5: Completing DDL
-backup_id
-#
-
-Verifying Test 6 results for restore.
-
-con1: Showing databases that were backed up
-con1: bup_ddl_blocker_1 and bup_ddl_blocker_4 indexes are not present
-SHOW INDEX FROM bup_ddl_blocker_1.t1;
-SHOW INDEX FROM bup_ddl_blocker_2.t1;
-Table t1
-Non_unique 1
-Key_name 2t1col_b
-Seq_in_index 1
-Column_name col_b
-Collation A
-Cardinality 3
-Sub_part NULL
-Packed NULL
-Null YES
-Index_type BTREE
-Comment
-Index_Comment
-SHOW INDEX FROM bup_ddl_blocker_3.t1;
-Table t1
-Non_unique 1
-Key_name 3t1col_b
-Seq_in_index 1
-Column_name col_b
-Collation A
-Cardinality 3
-Sub_part NULL
-Packed NULL
-Null YES
-Index_type BTREE
-Comment
-Index_Comment
-SHOW INDEX FROM bup_ddl_blocker_4.t1;
-con1: Cleanup
-DROP DATABASE bup_ddl_blocker_1;
-DROP DATABASE bup_ddl_blocker_2;
-DROP DATABASE bup_ddl_blocker_3;
-DROP DATABASE bup_ddl_blocker_4;
-
-Starting Test 7
-
-DROP TABLE IF EXISTS test.t2;
-DROP TABLE IF EXISTS bup_ddl_blocker.t1, bup_ddl_blocker.t3;
-con1: Creating tables
-CREATE TABLE bup_ddl_blocker.t1 (col_a CHAR(40)) ENGINE=INNODB;
-CREATE TABLE test.t2 (col_a CHAR(40)) ENGINE=MYISAM;
-CREATE TABLE bup_ddl_blocker.t3 (col_a CHAR(40)) ENGINE=MEMORY;
-con1: Loading data
-INSERT INTO bup_ddl_blocker.t1 VALUES ("01 Some data to test");
-INSERT INTO bup_ddl_blocker.t1 VALUES ("02 Some data to test");
-INSERT INTO bup_ddl_blocker.t1 VALUES ("03 Some data to test");
-INSERT INTO test.t2 VALUES ("01 Some data to test");
-INSERT INTO test.t2 VALUES ("02 Some data to test");
-INSERT INTO test.t2 VALUES ("03 Some data to test");
-INSERT INTO bup_ddl_blocker.t3 VALUES ("01 Some data to test");
-INSERT INTO bup_ddl_blocker.t3 VALUES ("02 Some data to test");
-INSERT INTO bup_ddl_blocker.t3 VALUES ("03 Some data to test");
-con1: Show that the new data doesn't exist before backup.
-SELECT * FROM bup_ddl_blocker.t1;
-col_a
-01 Some data to test
-02 Some data to test
-03 Some data to test
-SELECT * FROM test.t2;
-col_a
-01 Some data to test
-02 Some data to test
-03 Some data to test
-SELECT * FROM bup_ddl_blocker.t3;
-col_a
-01 Some data to test
-02 Some data to test
-03 Some data to test
-con2: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'after_start_ddl SIGNAL con2_started WAIT_FOR status_shown';
-con2: Get a DDL going and stop in the middle
-ALTER TABLE bup_ddl_blocker.t1 ADD COLUMN col_b int;
-con3: Wait for con2 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con2_started';
-con3: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'after_start_ddl SIGNAL con3_started WAIT_FOR status_shown';
-con3: Get a DDL going and stop in the middle
-ALTER TABLE test.t2 ADD COLUMN col_b int;
-con3: Wait for con3 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con3_started';
-con3: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'after_start_ddl SIGNAL con4_started WAIT_FOR status_shown';
-con4: Get a DDL going and stop in the middle
-ALTER TABLE bup_ddl_blocker.t3 ADD COLUMN col_b int;
-con5: Wait for con4 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con4_started';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "ALTER TABLE bup_ddl_blocker.t1%";
-state info
-debug sync point: after_start_ddl ALTER TABLE bup_ddl_blocker.t1 ADD COLUMN col_b int
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "ALTER TABLE test.t2%";
-state info
-debug sync point: after_start_ddl ALTER TABLE test.t2 ADD COLUMN col_b int
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE info LIKE "ALTER TABLE bup_ddl_blocker.t3%";
-state info
-debug sync point: after_start_ddl ALTER TABLE bup_ddl_blocker.t3 ADD COLUMN col_b int
-con5: Resume all.
-SET DEBUG_SYNC= 'now SIGNAL status_shown';
-con2: Completing DDL
-con3: Completing DDL
-con4: Completing DDL
-con1: Showing columns after updates and backup
-DESCRIBE bup_ddl_blocker.t1;
-Field Type Null Key Default Extra
-col_a char(40) YES NULL
-col_b int(11) YES NULL
-DESCRIBE test.t2;
-Field Type Null Key Default Extra
-col_a char(40) YES NULL
-col_b int(11) YES NULL
-DESCRIBE bup_ddl_blocker.t3;
-Field Type Null Key Default Extra
-col_a char(40) YES NULL
-col_b int(11) YES NULL
-
-Verifying Test 7 results:
-
-T1 should have the changes after backup - count(*) = 2
-SELECT count(*) FROM INFORMATION_SCHEMA.COLUMNS
-WHERE TABLE_NAME = 't1' AND TABLE_SCHEMA = 'bup_ddl_blocker';
-count(*)
-2
-T2 should the changes after backup - count(*) = 2
-SELECT count(*) FROM INFORMATION_SCHEMA.COLUMNS
-WHERE TABLE_NAME = 't2' AND TABLE_SCHEMA = 'test';
-count(*)
+== Checkpoint E ==
+#
+# DDL1= TRUNCATE t1
+# DDL2= TRUNCATE t2
+# DDL3= REPAIR TABLE t1
+# DDL4= OPTIMIZE TABLE t2
+#
+# Checking that DDL3 and DDL4 have executed.
+CALL test.check_results();
+Tables_in_bml_test
+t1
+t2
+rows_in_t1
2
-T3 should not have the changes after backup - count(*) = 2
-SELECT count(*) FROM INFORMATION_SCHEMA.COLUMNS
-WHERE TABLE_NAME = 't3' AND TABLE_SCHEMA = 'bup_ddl_blocker';
-count(*)
+rows_in_t2
2
-DROP TABLE test.t2;
-DROP DATABASE bup_ddl_blocker;
+Table Checksum
+bml_test.t1 2865344526
+bml_test.t2 1578680517
+==================
+
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+DROP DATABASE bml_test;
+DROP PROCEDURE test.check_results;
+
+########################################################
+#
+# Test BACKUP with statements not blocked by BML:
+# CREATE USER and CREATE SERVER
+#
+########################################################
+
+SET DEBUG_SYNC= 'reset';
+PURGE BACKUP LOGS;
+CREATE DATABASE bml_test;
+# con1: Start CREATE USER statement and make it stop after it has started.
+SET DEBUG_SYNC= 'before_execute_sql_command SIGNAL ddl1_started
+ WAIT_FOR continue_ddl';
+CREATE USER bml_usr;;
+# con5: Wait for DDL to reach its synchronization point.
+SET DEBUG_SYNC= 'now WAIT_FOR ddl1_started TIMEOUT 3';
+SET DEBUG_SYNC='before_execute_sql_command CLEAR';
+# con5: Start BACKUP command making it to stop in the middle.
+SET DEBUG_SYNC= 'after_backup_start_backup SIGNAL bup_started
+ WAIT_FOR finish_bup';
+SET SESSION debug="+d,set_backup_id";
+BACKUP DATABASE bml_test TO 'bml_test.bkp';;
+# Waiting for BACKUP to reach its synchronization point.
+SET DEBUG_SYNC= 'now WAIT_FOR bup_started TIMEOUT 3';
+# Check the state of both statements.
+SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
+WHERE info LIKE "BACKUP DATABASE%"
+ OR info LIKE "CREATE USER%";
+state info
+debug sync point: after_backup_start_backup BACKUP DATABASE bml_test TO 'bml_test.bkp'
+debug sync point: before_execute_sql_command CREATE USER bml_usr
+# Checking that CREATE USER has not executed yet.
+SELECT User, Password FROM mysql.user WHERE User like 'bml%';
+User Password
+# Checking that BACKUP is not blocked by DDL.
+SELECT object, notes, error_num FROM mysql.backup_progress WHERE backup_id=500;
+object notes error_num
+backup kernel starting 0
+backup kernel running 0
+backup kernel prepared 0
+# Resume and reap CREATE USER;
+SET DEBUG_SYNC= 'now SIGNAL continue_ddl';
+# Check that CREATE USER has executed.
+SELECT User, Password FROM mysql.user WHERE User like 'bml%';
+User Password
+bml_usr
+# See that bml_srv does not exist at this point.
+SELECT Server_name FROM mysql.servers WHERE Server_name like 'bml%';
+Server_name
+# Start CREATE SERVER while BACKUP is in progress.
+CREATE SERVER bml_srv FOREIGN DATA WRAPPER mysql OPTIONS (USER 'user');
+# See that it has executed.
+SELECT Server_name FROM mysql.servers WHERE Server_name like 'bml%';
+Server_name
+bml_srv
+# Let BACKUP finish its operation.
+SET DEBUG_SYNC= 'now SIGNAL finish_bup';
+# Reap BACKUP.
+backup_id
+500
+SET debug="-d";
+SET DEBUG_SYNC= 'reset';
+
+########################################################
+#
+# Test RESTORE with statements not blocked by BML:
+# DROP SERVER and SET PASSWORD
+#
+########################################################
+
+SET DEBUG_SYNC= 'reset';
+PURGE BACKUP LOGS;
+SET DEBUG_SYNC= 'reset';
+# con1: Start DROP SERVER statement and make it stop after it has started.
+SET DEBUG_SYNC= 'before_execute_sql_command SIGNAL ddl_started
+ WAIT_FOR continue_ddl';
+DROP SERVER bml_srv;;
+# con5: Wait for DDL to reach its synchronization point.
+SET DEBUG_SYNC= 'now WAIT_FOR ddl_started TIMEOUT 3';
+SET DEBUG_SYNC='before_execute_sql_command CLEAR';
+# con5: Start RESTORE command making it to stop in the middle.
+SET DEBUG_SYNC= 'after_backup_start_restore SIGNAL bup_started
+ WAIT_FOR finish_bup';
+SET SESSION debug="+d,set_backup_id";
+RESTORE FROM 'bml_test.bkp' OVERWRITE;;
+# Waiting for RESTORE to reach its synchronization point.
+SET DEBUG_SYNC= 'now WAIT_FOR bup_started TIMEOUT 3';
+# Check the state of both statements.
+SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
+WHERE info LIKE "RESTORE FROM%"
+ OR info LIKE "DROP SERVER%";
+state info
+debug sync point: after_backup_start_restore RESTORE FROM 'bml_test.bkp' OVERWRITE
+debug sync point: before_execute_sql_command DROP SERVER bml_srv
+# Checking that DROP SERVER has not executed yet.
+SELECT Server_name FROM mysql.servers WHERE Server_name like 'bml%';
+Server_name
+bml_srv
+# Checking that RESTORE is not blocked by DDL.
+SELECT object, notes, error_num FROM mysql.backup_progress WHERE backup_id=500;
+object notes error_num
+backup kernel starting 0
+backup kernel running 0
+backup kernel prepared 0
+# Resume and reap DROP SERVER;
+SET DEBUG_SYNC= 'now SIGNAL continue_ddl';
+# Check that DROP SERVER has executed.
+SELECT Server_name FROM mysql.servers WHERE Server_name like 'bml%';
+Server_name
+# Check current user's pasword.
+SELECT User, Password FROM mysql.user WHERE User like 'bml%';
+User Password
+bml_usr
+# Start SET PASSWORD while RESTORE is in progress.
+SET PASSWORD FOR bml_usr = PASSWORD('password');
+# See that password was set.
+SELECT User, Password FROM mysql.user WHERE User like 'bml%';
+User Password
+bml_usr *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19
+# Let RESTORE finish its operation.
+SET DEBUG_SYNC= 'now SIGNAL finish_bup';
+# Reap RESTORE.
+backup_id
+500
+SET debug="-d";
+SET DEBUG_SYNC= 'reset';
+SET DEBUG_SYNC= 'reset';
+DROP DATABASE bml_test;
+DROP USER bml_usr;
+PURGE BACKUP LOGS;
SET DEBUG_SYNC= 'reset';
=== modified file 'mysql-test/suite/backup/r/backup_logs.result'
--- a/mysql-test/suite/backup/r/backup_logs.result 2008-11-17 09:57:51 +0000
+++ b/mysql-test/suite/backup/r/backup_logs.result 2008-12-17 14:32:46 +0000
@@ -78,6 +78,7 @@ SELECT notes FROM mysql.backup_progress
notes
starting
running
+prepared
con1: Let backup do the backup phase1.
SET DEBUG_SYNC= 'now SIGNAL backup WAIT_FOR validated';
con1: Display progress
@@ -85,6 +86,7 @@ SELECT notes FROM mysql.backup_progress
notes
starting
running
+prepared
validity point
con1: Let backup do the backup phase2.
SET DEBUG_SYNC= 'now SIGNAL do_phase2 WAIT_FOR phase2';
@@ -93,6 +95,7 @@ SELECT notes FROM mysql.backup_progress
notes
starting
running
+prepared
validity point
vp time
running
@@ -128,6 +131,7 @@ SELECT * FROM mysql.backup_progress WHER
backup_id object start_time stop_time total_bytes progress error_num notes
# backup kernel # # 0 0 0 starting
# backup kernel # # 0 0 0 running
+# backup kernel # # 0 0 0 prepared
# backup kernel # # 0 0 0 validity point
# backup kernel # # 0 0 0 vp time
# backup kernel # # 0 0 0 running
@@ -151,6 +155,7 @@ SELECT notes FROM mysql.backup_progress
notes
starting
running
+prepared
con1: Let restore do its job and finish.
SET DEBUG_SYNC= 'now SIGNAL finish';
con2: Finish restore command
@@ -183,6 +188,7 @@ SELECT * FROM mysql.backup_progress WHER
backup_id object start_time stop_time total_bytes progress error_num notes
# backup kernel # # 0 0 0 starting
# backup kernel # # 0 0 0 running
+# backup kernel # # 0 0 0 prepared
# backup kernel # # 0 0 0 complete
SET DEBUG_SYNC= 'RESET';
The backup id for this command should be 502.
=== modified file 'mysql-test/suite/backup/r/backup_logs_output.result'
--- a/mysql-test/suite/backup/r/backup_logs_output.result 2008-11-17 11:17:59 +0000
+++ b/mysql-test/suite/backup/r/backup_logs_output.result 2008-12-17 14:32:46 +0000
@@ -102,7 +102,7 @@ count(*)
1
SELECT count(*) FROM mysql.backup_progress;
count(*)
-6
+7
FLUSH BACKUP LOGS;
'---Checking backup logs when log_backup_output is TABLE---'
'---and the progress log is turned off ---'
@@ -176,7 +176,7 @@ count(*)
0
SELECT count(*) FROM mysql.backup_progress;
count(*)
-6
+7
FLUSH BACKUP LOGS;
PURGE BACKUP LOGS;
Show the size of the logs
@@ -234,7 +234,7 @@ count(*)
1
SELECT count(*) FROM mysql.backup_progress;
count(*)
-6
+7
FLUSH BACKUP LOGS;
SET GLOBAL backup_history_log=0;
SET GLOBAL backup_progress_log=0;
=== modified file 'mysql-test/suite/backup/r/backup_logs_purge.result'
--- a/mysql-test/suite/backup/r/backup_logs_purge.result 2008-11-17 09:57:51 +0000
+++ b/mysql-test/suite/backup/r/backup_logs_purge.result 2008-12-17 14:32:46 +0000
@@ -86,7 +86,7 @@ count(*)
8
SELECT count(*) FROM mysql.backup_progress;
count(*)
-36
+44
Purge all backup log data prior to id = 502.
PURGE BACKUP LOGS TO 502;
Display results from backup logs
@@ -111,7 +111,7 @@ count(*)
6
SELECT count(*) FROM mysql.backup_progress;
count(*)
-24
+30
Purge all backup log data.
PURGE BACKUP LOGS;
Display results from backup logs
@@ -211,7 +211,7 @@ count(*)
1
SELECT count(*) FROM mysql.backup_progress;
count(*)
-6
+7
PURGE BACKUP LOGS TO 501;
SELECT count(*) FROM mysql.backup_history;
count(*)
@@ -249,7 +249,7 @@ count(*)
4
SELECT count(*) FROM mysql.backup_progress;
count(*)
-24
+28
SET SESSION debug="+d,set_backup_id";
con2: Activate sync points for the backup statement.
SET DEBUG_SYNC= 'before_backup_done SIGNAL ready WAIT_FOR proceed';
@@ -303,7 +303,7 @@ count(*)
5
SELECT count(*) FROM mysql.backup_progress;
count(*)
-13
+17
con2: Activate sync points for the backup statement.
SET DEBUG_SYNC= 'before_restore_done SIGNAL ready WAIT_FOR proceed';
RESTORE FROM 'backup5.bak' OVERWRITE;
@@ -359,28 +359,28 @@ count(*)
6
SELECT count(*) FROM mysql.backup_progress;
count(*)
-31
+36
PURGE BACKUP LOGS BEFORE '1988-10-12 12:00:00';
SELECT count(*) FROM mysql.backup_history;
count(*)
6
SELECT count(*) FROM mysql.backup_progress;
count(*)
-31
+36
PURGE BACKUP LOGS TO 0;
SELECT count(*) FROM mysql.backup_history;
count(*)
6
SELECT count(*) FROM mysql.backup_progress;
count(*)
-31
+36
Test empty logs (delete all entries).
SELECT count(*) FROM mysql.backup_history;
count(*)
6
SELECT count(*) FROM mysql.backup_progress;
count(*)
-31
+36
PURGE BACKUP LOGS TO 999999999;
Check to be sure backup logs are empty (count(*) = 0).
SELECT count(*) FROM mysql.backup_history;
@@ -411,7 +411,7 @@ count(*)
5
SELECT count(*) FROM mysql.backup_progress;
count(*)
-30
+35
PURGE BACKUP LOGS BEFORE '2024-10-12 12:00:00';
Test empty logs (delete all entries).
SELECT count(*) FROM mysql.backup_history;
=== modified file 'mysql-test/suite/backup/r/backup_timeout.result'
--- a/mysql-test/suite/backup/r/backup_timeout.result 2008-11-19 22:01:28 +0000
+++ b/mysql-test/suite/backup/r/backup_timeout.result 2008-12-17 14:32:46 +0000
@@ -1,29 +1,29 @@
SET DEBUG_SYNC= 'reset';
-DROP DATABASE IF EXISTS bup_ddl_blocker;
-CREATE DATABASE bup_ddl_blocker;
+DROP DATABASE IF EXISTS bup_bml;
+CREATE DATABASE bup_bml;
con1: Creating tables
-CREATE TABLE bup_ddl_blocker.t1 (col_a CHAR(40)) ENGINE=INNODB;
+CREATE TABLE bup_bml.t1 (col_a CHAR(40)) ENGINE=INNODB;
con1: Loading data
-INSERT INTO bup_ddl_blocker.t1 VALUES ("01 Some data to test");
-INSERT INTO bup_ddl_blocker.t1 VALUES ("02 Some data to test");
-INSERT INTO bup_ddl_blocker.t1 VALUES ("03 Some data to test");
+INSERT INTO bup_bml.t1 VALUES ("01 Some data to test");
+INSERT INTO bup_bml.t1 VALUES ("02 Some data to test");
+INSERT INTO bup_bml.t1 VALUES ("03 Some data to test");
SHOW VARIABLES LIKE 'backup_wait%';
Variable_name Value
backup_wait_timeout 50
Part A
con1: Activate synchronization points for backup.
-SET DEBUG_SYNC= 'after_block_ddl SIGNAL bup_blocked WAIT_FOR timeout_done';
-con1: Get a backup going and stop after the DDL blocker is fired.
-BACKUP DATABASE bup_ddl_blocker TO "bup_ddl_blocker.bak";
+SET DEBUG_SYNC= 'after_bml_activated SIGNAL bup_blocked WAIT_FOR timeout_done';
+con1: Get a backup going and stop after BML is activated.
+BACKUP DATABASE bup_bml TO "bup_bml.bak";
SET DEBUG_SYNC= 'now WAIT_FOR bup_blocked';
-Set ddl timeout to 1 second
+Set timeout to 1 second
SET backup_wait_timeout = 1;
SHOW VARIABLES LIKE 'backup_wait%';
Variable_name Value
backup_wait_timeout 1
con2: Try a ddl operation and watch it expire
-CREATE TABLE bup_ddl_blocker.t2 (col_a CHAR(40)) ENGINE=MEMORY;
-ERROR HY000: The backup wait timeout has expired for query 'CREATE TABLE bup_ddl_blocker.t2 (col_a CHAR(40)) ENGINE=MEMORY'.
+CREATE TABLE bup_bml.t2 (col_a CHAR(40)) ENGINE=MEMORY;
+ERROR HY000: The backup wait timeout has expired for query 'CREATE TABLE bup_bml.t2 (col_a CHAR(40)) ENGINE=MEMORY'.
release the lock.
con5: Resume all.
SET DEBUG_SYNC= 'now SIGNAL timeout_done';
@@ -31,32 +31,32 @@ backup_id
#
Part B
con1: Activate synchronization points for backup.
-SET DEBUG_SYNC= 'after_block_ddl SIGNAL bup_blocked WAIT_FOR timeout_done';
+SET DEBUG_SYNC= 'after_bml_activated SIGNAL bup_blocked WAIT_FOR timeout_done';
con1: Get a backup going and stop after the DDL blocker is fired.
-BACKUP DATABASE bup_ddl_blocker TO "bup_ddl_blocker.bak";
+BACKUP DATABASE bup_bml TO "bup_bml.bak";
SET DEBUG_SYNC= 'now WAIT_FOR bup_blocked';
-Set ddl timeout to 0 seconds
+Set timeout to 0 seconds
SET backup_wait_timeout = 0;
SHOW VARIABLES LIKE 'backup_wait%';
Variable_name Value
backup_wait_timeout 0
con2: Try a ddl operation and it should expire
-CREATE TABLE bup_ddl_blocker.t3 (col_a CHAR(40)) ENGINE=MEMORY;
-ERROR HY000: The backup wait timeout has expired for query 'CREATE TABLE bup_ddl_blocker.t3 (col_a CHAR(40)) ENGINE=MEMORY'.
+CREATE TABLE bup_bml.t3 (col_a CHAR(40)) ENGINE=MEMORY;
+ERROR HY000: The backup wait timeout has expired for query 'CREATE TABLE bup_bml.t3 (col_a CHAR(40)) ENGINE=MEMORY'.
SET backup_wait_timeout = 100;
SHOW VARIABLES LIKE 'backup_wait%';
Variable_name Value
backup_wait_timeout 100
con3: Try a ddl operation and it should not expire
-CREATE TABLE bup_ddl_blocker.t3 (col_a CHAR(40)) ENGINE=MEMORY;
+CREATE TABLE bup_bml.t3 (col_a CHAR(40)) ENGINE=MEMORY;
release the lock.
con5: Resume all.
SET DEBUG_SYNC= 'now SIGNAL timeout_done';
backup_id
#
-USE bup_ddl_blocker;
+USE bup_bml;
SHOW FULL TABLES;
-Tables_in_bup_ddl_blocker Table_type
+Tables_in_bup_bml Table_type
t1 BASE TABLE
t3 BASE TABLE
Part C
@@ -70,5 +70,5 @@ SET backup_wait_timeout = DEFAULT;
SHOW VARIABLES LIKE 'backup_wait%';
Variable_name Value
backup_wait_timeout 50
-DROP DATABASE bup_ddl_blocker;
+DROP DATABASE bup_bml;
SET DEBUG_SYNC= 'reset';
=== renamed file 'mysql-test/suite/backup/t/backup_ddl_blocker.test' => 'mysql-test/suite/backup/t/backup_bml.test'
--- a/mysql-test/suite/backup/t/backup_ddl_blocker.test 2008-11-20 14:07:23 +0000
+++ b/mysql-test/suite/backup/t/backup_bml.test 2008-12-17 14:32:46 +0000
@@ -1,72 +1,54 @@
#
-# This test is for the DDL blocker.
-# The goals of the test should be to ensure the following assumptions for
-# the behaviour of the DDL blocker hold true.
-#
-# a) DDL that are running are allowed to complete and backup blocks
-# b) backup blocks all DDL even if not part of backup
-# c) DDL operations do not block each other
-#
-# The results of the backup should show (based on statements above):
-#
-# a) Test result for this assumption: Included in backup
-# b) Test result for this assumption: Not included in backup
-#
-# The test shall run two sets of data definition statements.
-#
-# 1) test DDL in progress that block backup and while the backup in progress
-# check that DDLs that start after the backup are blocked
-# 2) DDL do not block each other
-#
-# These set of DDL statements to test include the following. The DDL
-# statements shall be run in sets with each set a separate test. These tests
-# will show the assumptions above to be true.
-#
-# Test DDL Tested
-# ---- ------------------
-# 1 CREATE TABLE
-# 1 ALTER TABLE
-# 2 RENAME TABLE
-# 2 REPAIR TABLE
-# 3 OPTIMIZE TABLE
-# 3 DROP TABLE
-# 4 CREATE DATABASE
-# 4 DROP DATABASE
-# 5 ALTER DATABASE
-# 5 TRUNCATE TABLE
-# 6 CREATE INDEX
-# 6 DROP INDEX
-# 7 DDL statements do not block each other
+# This test is for the Backup Metadata Lock.
#
-# The tests shall be run once for backup and again for restore.
+# Per WL#4644, BML blocks execution of the following statements.
#
-# TODO : Add a native driver to the test when one becomes available
+# DROP DATABASE/TABLE/VIEW/FUNCTION/PROCEDURE/EVENT/TRIGGER/INDEX
+# DROP USER/TABLESPACE
+# CREATE DATABASE/TABLE/VIEW/FUNCTION/PROCEDURE/EVENT/TRIGGER/INDEX
+# ALTER DATABASE/TABLE/VIEW/FUNCTION/PROCEDURE/EVENT/TABLESPACE
+# RENAME TABLE/USER
+# GRANT/REVOKE
+# TRUNCATE/OPTIMIZE/REPAIR TABLE
+#
+# This gives 32 statements which are blocked by DML.
+#
+# For each blocked statement the following requirements will be checked:
+#
+# a) Statement that is running when BACKUP/RESTORE starts is allowed to complete
+# and BACKUP/RESTORE blocks waiting for its completion.
+# b) Once BACKUP/RESTORE is started, the statement is blocked and waits for
+# the BACKUP/RESTORE statement to complete.
+# c) Statmenents blocked by BML do not block each other.
+#
+# Additionally:
+#
+# d) Statements not listed above should not be blocked by BML.
+#
+# The above assumptions will be tested using a "subroutine" ddl_blocker.inc.
+#
+# Note: the fact that blocked statement will timeout after specified time is
+# tested in backup_timeout test.
#
+--source include/not_embedded.inc
--source include/have_innodb.inc
+--source include/have_falcon.inc
+--source include/have_debug.inc
--source include/have_debug_sync.inc
---source include/not_embedded.inc
-
-SET DEBUG_SYNC= 'reset';
#
# Remove backup files (if they exist)
#
-# Note: More preparatory cleanup is done in
-# include/backup_ddl_create_data.inc
-#
+let $bdir=`select @@backupdir`;
--error 0,1
---remove_file $MYSQLTEST_VARDIR/master-data/bup_ddl_blocker_orig.bak;
+--remove_file $bdir/bml_test_orig.bkp;
--error 0,1
---remove_file $MYSQLTEST_VARDIR/master-data/bup_ddl_blocker.bak;
+--remove_file $bdir/bml_test.bkp;
#
-# Connections used in this test
-#
-# con1 used to create data, load data, and run the backup
-# con2-con5 used for DDL statements: 2 before backup and 2 during backup
-# con6 used to show status/processlist
+# Connections used by ddl_blocker_test.inc
#
connect (con1,localhost,root,,);
@@ -74,2007 +56,624 @@ connect (con2,localhost,root,,);
connect (con3,localhost,root,,);
connect (con4,localhost,root,,);
connect (con5,localhost,root,,);
-connect (con6,localhost,root,,);
-
-connection con1;
#
-# Backup test sequence diagram (not UML)
+# Create bml_test database
#
-# The included test files follow this pattern of execution
-# for backup or restore operations.
-#
-# Four DDL statements and a backup command are specified.
-# The first two DDL statements are run as "in progress" when
-# the backup starts. The other two DDL statements are run
-# when the backup or restore is already running. Tests results
-# show the realization of the assumptions above.
-#
-# con1 con2 con3 con4 con5 con6
-# (setup) | | | | |
-# | | | | | |
-# | | | | | |
-# | statememt 1 | | | |
-# | | statement 2 | | |
-# | | | | | show status
-# BACKUP/RESTORE | | | | |
-# | | | | | |
-# | | | | | |
-# | <...> <...> | | |
-# | | | statement 3 | |
-# | | | | statement 4 |
-# | | | | | show status
-# <...> | | <...> <...> |
-# (results) | | | | |
-#
-# Note: The resume of the commands is indicated with <...> and
-# may occur in any order.
-#
-# Note by Ingo: I wonder if the line above "(results)" is correct.
-# I understand the above explanations so that DDL3 and 4 cannot
-# resume before BACKUP/RESTORE finished. But the line indicates
-# that these can resume in any order.
-
-
-##############################################################
---echo
---echo Starting Test 1 - Backup
---echo
-##############################################################
-
-# Create data for this test and tailor it to the test.
---source include/backup_ddl_create_data.inc
-DROP TABLE bup_ddl_blocker.t1, bup_ddl_blocker.t3;
-
-connection con2;
-
---echo con2: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'after_start_ddl SIGNAL con2_started WAIT_FOR status_shown';
---echo con2: Get a DDL going and stop in the middle
-send CREATE TABLE bup_ddl_blocker.t1 (col_a CHAR(40)) ENGINE=INNODB;
-
-connection con3;
-
---echo con3: Wait for con2 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con2_started';
---echo con3: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'after_start_ddl SIGNAL con3_started WAIT_FOR status_shown';
---echo con3: Get a DDL going and stop in the middle
-send ALTER TABLE bup_ddl_blocker.t2 ADD COLUMN col_b int;
-
-# Start the backup and allow it to break on lock.
-
-connection con1;
-
---echo con1: Wait for con3 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con3_started';
---echo con1: Activate synchronization points for backup.
-SET DEBUG_SYNC= 'before_block_ddl SIGNAL bup_blocked WAIT_FOR status_shown';
-SET DEBUG_SYNC= 'after_block_ddl SIGNAL bup_started WAIT_FOR status_shown2';
---echo con1: Backing up database -- will block with lock
-send BACKUP DATABASE bup_ddl_blocker TO "bup_ddl_blocker.bak";
-
-connection con6;
-
---echo con6: Wait for con1 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR bup_blocked';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "BACKUP DATABASE%";
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "CREATE TABLE bup_ddl_blocker.t1%";
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "ALTER TABLE bup_ddl_blocker.t2%";
-
---echo con6: Resume all and wait for backup to start after DDL finish.
-SET DEBUG_SYNC= 'now SIGNAL status_shown WAIT_FOR bup_started';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "BACKUP DATABASE%";
-
-connection con4;
-
---echo con4: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'before_check_ddl_blocked SIGNAL con4_started
- WAIT_FOR status_shown2';
---echo con4: Try a DDL but it is blocked by backup -- will not be in backup
-send CREATE TABLE bup_ddl_blocker.t3 (col_a CHAR(40)) ENGINE=INNODB;
-
-connection con5;
-
---echo con5: Wait for con4 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con4_started';
---echo con5: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'before_check_ddl_blocked SIGNAL con5_started
- WAIT_FOR status_shown2';
---echo con5: Try a DDL but it is blocked by backup -- will not be in backup
-send ALTER TABLE bup_ddl_blocker.t4 ADD COLUMN col_b int;
-
-connection con6;
-
---echo con6: Wait for con5 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con5_started';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "CREATE TABLE bup_ddl_blocker.t3%";
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "ALTER TABLE bup_ddl_blocker.t4%";
-
---echo con6: Resume all.
-SET DEBUG_SYNC= 'now SIGNAL status_shown2';
-
-# Reconnect to connections and fetch their results.
-
-connection con2;
---echo con2: Completing DDL
-reap;
-
-connection con3;
---echo con3: Completing DDL
-reap;
-
-connection con4;
---echo con4: Completing DDL
-reap;
-
-connection con5;
---echo con5: Completing DDL
-reap;
-
-# Reconnect to con1 and fetch its result.
-
-connection con1;
---replace_column 1 #
-reap;
-
-##############################################################
---echo
---echo Verifying Test 1 results for backup.
---echo
-##############################################################
-
-# Show that all changes got applied.
---echo con1: Showing columns after updates and backup
-DESCRIBE bup_ddl_blocker.t1;
-DESCRIBE bup_ddl_blocker.t2;
-DESCRIBE bup_ddl_blocker.t3;
-DESCRIBE bup_ddl_blocker.t4;
-
---echo con1: Dropping the database tables
-DROP TABLE bup_ddl_blocker.t1, bup_ddl_blocker.t2,
- bup_ddl_blocker.t3, bup_ddl_blocker.t4;
-
---echo con1: Restoring the database
---replace_column 1 #
-RESTORE FROM "bup_ddl_blocker.bak" OVERWRITE;
-
---echo con1: Showing columns that were backed up
-
---echo con1: Table t3 should not be in restored data.
---echo con1: Table t4 should not have new column in restored data.
-DESCRIBE bup_ddl_blocker.t1;
-DESCRIBE bup_ddl_blocker.t2;
---error ER_NO_SUCH_TABLE
-DESCRIBE bup_ddl_blocker.t3;
-DESCRIBE bup_ddl_blocker.t4;
-
-
-
-##############################################################
---echo
---echo Starting Test 1 - Restore
---echo
-##############################################################
-
-# Create data for this test and tailor it to the test.
---source include/backup_ddl_create_data.inc
-DROP TABLE bup_ddl_blocker.t1, bup_ddl_blocker.t3;
-
-# Get a backup to work with.
---replace_column 1 #
-BACKUP DATABASE bup_ddl_blocker to 'bup_ddl_blocker_orig.bak';
-
-connection con2;
-
---echo con2: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'after_start_ddl SIGNAL con2_started WAIT_FOR status_shown';
---echo con2: Get a DDL going and stop in the middle
-send CREATE TABLE bup_ddl_blocker.t1 (col_a CHAR(40)) ENGINE=INNODB;
-
-connection con3;
-
---echo con3: Wait for con2 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con2_started';
---echo con3: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'after_start_ddl SIGNAL con3_started WAIT_FOR status_shown';
---echo con3: Get a DDL going and stop in the middle
-send ALTER TABLE bup_ddl_blocker.t2 ADD COLUMN col_b int;
-
-# Start the backup and allow it to break on lock.
-
-connection con1;
-
---echo con1: Wait for con3 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con3_started';
---echo con1: Activate synchronization points for restore.
-SET DEBUG_SYNC= 'before_block_ddl SIGNAL bup_blocked WAIT_FOR status_shown';
-SET DEBUG_SYNC= 'after_block_ddl SIGNAL bup_started WAIT_FOR status_shown2';
---echo con1: Restoring database -- will block with lock
-send RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE;
-
-connection con6;
-
---echo con6: Wait for con1 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR bup_blocked';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "RESTORE FROM%";
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "CREATE TABLE bup_ddl_blocker.t1%";
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "ALTER TABLE bup_ddl_blocker.t2%";
-
---echo con6: Resume all and wait for restore to start after DDL finish.
-SET DEBUG_SYNC= 'now SIGNAL status_shown WAIT_FOR bup_started';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "RESTORE FROM%";
-
-connection con4;
-
---echo con4: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'before_check_ddl_blocked SIGNAL con4_started
- WAIT_FOR status_shown2';
---echo con4: Try a DDL but it is blocked by backup -- will not be in backup
-send CREATE TABLE bup_ddl_blocker.t3 (col_a CHAR(40)) ENGINE=INNODB;
-
-connection con5;
-
---echo con5: Wait for con4 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con4_started';
---echo con5: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'before_check_ddl_blocked SIGNAL con5_started
- WAIT_FOR status_shown2';
---echo con5: Try a DDL but it is blocked by backup -- will not be in backup
-send ALTER TABLE bup_ddl_blocker.t4 ADD COLUMN col_b int;
-
-connection con6;
-
---echo con6: Wait for con5 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con5_started';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "CREATE TABLE bup_ddl_blocker.t3%";
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "ALTER TABLE bup_ddl_blocker.t4%";
-
---echo con6: Resume all.
-SET DEBUG_SYNC= 'now SIGNAL status_shown2';
-
-# Reconnect to connections and fetch their results.
-
-connection con2;
---echo con2: Completing DDL
-reap;
-
-connection con3;
---echo con3: Completing DDL
-reap;
-
-connection con4;
---echo con4: Completing DDL
-reap;
-
-connection con5;
---echo con5: Completing DDL
-reap;
-
-# Reconnect to con1 and fetch its result.
-
-connection con1;
---replace_column 1 #
-reap;
-
-##############################################################
---echo
---echo Verifying Test 1 results for restore.
---echo
-##############################################################
-
---echo con1: Table t1 should not be in restored data.
---echo con1: Table t2 should not have new column in restored data.
---echo con1: Table t3 should be in restored data.
---echo con1: Table t4 should have new column in restored data.
---error ER_NO_SUCH_TABLE
-DESCRIBE bup_ddl_blocker.t1;
-DESCRIBE bup_ddl_blocker.t2;
-DESCRIBE bup_ddl_blocker.t3;
-DESCRIBE bup_ddl_blocker.t4;
-
-# Cleanup
---remove_file $MYSQLTEST_VARDIR/master-data/bup_ddl_blocker.bak
-
-
-
-##############################################################
---echo
---echo Starting Test 2 - Backup
---echo
-##############################################################
-
-# Create data for this test and tailor it to the test.
---source include/backup_ddl_create_data.inc
-
-connection con2;
-
---echo con2: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'after_start_ddl SIGNAL con2_started WAIT_FOR status_shown';
---echo con2: Get a DDL going and stop in the middle
-send RENAME TABLE bup_ddl_blocker.t1 TO bup_ddl_blocker.t01;
-
-connection con3;
-
---echo con3: Wait for con2 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con2_started';
---echo con3: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'after_start_ddl SIGNAL con3_started WAIT_FOR status_shown';
---echo con3: Get a DDL going and stop in the middle
-send REPAIR TABLE bup_ddl_blocker.t2;
-
-# Start the backup and allow it to break on lock.
-
-connection con1;
-
---echo con1: Wait for con3 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con3_started';
---echo con1: Activate synchronization points for backup.
-SET DEBUG_SYNC= 'before_block_ddl SIGNAL bup_blocked WAIT_FOR status_shown';
-SET DEBUG_SYNC= 'after_block_ddl SIGNAL bup_started WAIT_FOR status_shown2';
---echo con1: Backing up database -- will block with lock
-send BACKUP DATABASE bup_ddl_blocker TO "bup_ddl_blocker.bak";
-
-connection con6;
-
---echo con6: Wait for con1 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR bup_blocked';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "BACKUP DATABASE%";
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "RENAME TABLE bup_ddl_blocker.t1%";
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "REPAIR TABLE bup_ddl_blocker.t2%";
-
---echo con6: Resume all and wait for backup to start after DDL finish.
-SET DEBUG_SYNC= 'now SIGNAL status_shown WAIT_FOR bup_started';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "BACKUP DATABASE%";
-
-connection con4;
-
---echo con4: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'before_check_ddl_blocked SIGNAL con4_started
- WAIT_FOR status_shown2';
---echo con4: Try a DDL but it is blocked by backup -- will not be in backup
-send RENAME TABLE bup_ddl_blocker.t3 TO bup_ddl_blocker.t03;
-
-connection con5;
-
---echo con5: Wait for con4 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con4_started';
---echo con5: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'before_check_ddl_blocked SIGNAL con5_started
- WAIT_FOR status_shown2';
---echo con5: Try a DDL but it is blocked by backup -- will not be in backup
-send REPAIR TABLE bup_ddl_blocker.t4;
-
-connection con6;
-
---echo con6: Wait for con5 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con5_started';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "RENAME TABLE bup_ddl_blocker.t3%";
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "REPAIR TABLE bup_ddl_blocker.t4%";
-
---echo con6: Resume all.
-SET DEBUG_SYNC= 'now SIGNAL status_shown2';
-
-# Reconnect to connections and fetch their results.
-
-connection con2;
---echo con2: Completing DDL
-reap;
-
-connection con3;
---echo con3: Completing DDL
-reap;
-
-connection con4;
---echo con4: Completing DDL
-reap;
-
-connection con5;
---echo con5: Completing DDL
-reap;
-
-# Reconnect to con1 and fetch its result.
-
-connection con1;
---replace_column 1 #
-reap;
-
-##############################################################
---echo
---echo Verifying Test 2 results for backup.
---echo
-##############################################################
-
-# Show that all changes got applied.
---echo con1: Showing columns after updates and backup
-use bup_ddl_blocker;
-SHOW TABLES;
-
---echo con1: Dropping the database tables
-DROP TABLE bup_ddl_blocker.t01, bup_ddl_blocker.t2,
- bup_ddl_blocker.t03, bup_ddl_blocker.t4;
-
---echo con1: Restoring the database
---replace_column 1 #
-RESTORE FROM "bup_ddl_blocker.bak" OVERWRITE;
-
---echo con1: Showing columns that were backed up
---echo con1: Table t01 should be in restore
---echo con1: Table t03 should not be in restore
-use bup_ddl_blocker;
-SHOW TABLES;
-
-
-
-##############################################################
---echo
---echo Starting Test 2 - Restore
---echo
-##############################################################
-
-# Create data for this test and tailor it to the test.
---source include/backup_ddl_create_data.inc
-
-# Get a backup to work with.
---remove_file $MYSQLTEST_VARDIR/master-data/bup_ddl_blocker_orig.bak
---replace_column 1 #
-BACKUP DATABASE bup_ddl_blocker to 'bup_ddl_blocker_orig.bak';
-
-connection con2;
-
---echo con2: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'after_start_ddl SIGNAL con2_started WAIT_FOR status_shown';
---echo con2: Get a DDL going and stop in the middle
-send RENAME TABLE bup_ddl_blocker.t1 TO bup_ddl_blocker.t01;
-
-connection con3;
-
---echo con3: Wait for con2 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con2_started';
---echo con3: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'after_start_ddl SIGNAL con3_started WAIT_FOR status_shown';
---echo con3: Get a DDL going and stop in the middle
-send REPAIR TABLE bup_ddl_blocker.t2;
-
-# Start the backup and allow it to break on lock.
-
-connection con1;
-
---echo con1: Wait for con3 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con3_started';
---echo con1: Activate synchronization points for restore.
-SET DEBUG_SYNC= 'before_block_ddl SIGNAL bup_blocked WAIT_FOR status_shown';
-SET DEBUG_SYNC= 'after_block_ddl SIGNAL bup_started WAIT_FOR status_shown2';
---echo con1: Restoring database -- will block with lock
-send RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE;
-
-connection con6;
-
---echo con6: Wait for con1 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR bup_blocked';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "RESTORE FROM%";
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "RENAME TABLE bup_ddl_blocker.t1%";
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "REPAIR TABLE bup_ddl_blocker.t2%";
-
---echo con6: Resume all and wait for restore to start after DDL finish.
-SET DEBUG_SYNC= 'now SIGNAL status_shown WAIT_FOR bup_started';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "RESTORE FROM%";
-
-connection con4;
-
---echo con4: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'before_check_ddl_blocked SIGNAL con4_started
- WAIT_FOR status_shown2';
---echo con4: Try a DDL but it is blocked by backup -- will not be in backup
-send RENAME TABLE bup_ddl_blocker.t3 TO bup_ddl_blocker.t03;
-
-connection con5;
-
---echo con5: Wait for con4 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con4_started';
---echo con5: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'before_check_ddl_blocked SIGNAL con5_started
- WAIT_FOR status_shown2';
---echo con5: Try a DDL but it is blocked by backup -- will not be in backup
-send REPAIR TABLE bup_ddl_blocker.t4;
-
-connection con6;
-
---echo con6: Wait for con5 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con5_started';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "RENAME TABLE bup_ddl_blocker.t3%";
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "REPAIR TABLE bup_ddl_blocker.t4%";
-
---echo con6: Resume all.
-SET DEBUG_SYNC= 'now SIGNAL status_shown2';
-
-# Reconnect to connections and fetch their results.
-
-connection con2;
---echo con2: Completing DDL
-reap;
-
-connection con3;
---echo con3: Completing DDL
-reap;
-
-connection con4;
---echo con4: Completing DDL
-reap;
-
-connection con5;
---echo con5: Completing DDL
-reap;
-
-# Reconnect to con1 and fetch its result.
-
-connection con1;
---replace_column 1 #
-reap;
-
-##############################################################
---echo
---echo Verifying Test 2 results for restore.
---echo
-##############################################################
-
---echo con1: Table t01 should not be in restored data.
-use bup_ddl_blocker;
-SHOW TABLES;
-
-# Cleanup
---remove_file $MYSQLTEST_VARDIR/master-data/bup_ddl_blocker.bak
-
-
-
-##############################################################
---echo
---echo Starting Test 3 - Backup
---echo
-##############################################################
-
-# Create data for this test and tailor it to the test.
---source include/backup_ddl_create_data.inc
-
-connection con2;
-
---echo con2: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'after_start_ddl SIGNAL con2_started WAIT_FOR status_shown';
---echo con2: Get a DDL going and stop in the middle
-send OPTIMIZE TABLE bup_ddl_blocker.t1;
-
-connection con3;
-
---echo con3: Wait for con2 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con2_started';
---echo con3: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'after_start_ddl SIGNAL con3_started WAIT_FOR status_shown';
---echo con3: Get a DDL going and stop in the middle
-send DROP TABLE bup_ddl_blocker.t2;
-
-# Start the backup and allow it to break on lock.
-
-connection con1;
-
---echo con1: Wait for con3 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con3_started';
---echo con1: Activate synchronization points for backup.
-SET DEBUG_SYNC= 'before_block_ddl SIGNAL bup_blocked WAIT_FOR status_shown';
-SET DEBUG_SYNC= 'after_block_ddl SIGNAL bup_started WAIT_FOR status_shown2';
---echo con1: Backing up database -- will block with lock
-send BACKUP DATABASE bup_ddl_blocker TO "bup_ddl_blocker.bak";
-
-connection con6;
-
---echo con6: Wait for con1 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR bup_blocked';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "BACKUP DATABASE%";
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "OPTIMIZE TABLE bup_ddl_blocker.t1%";
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "DROP TABLE bup_ddl_blocker.t2%";
-
---echo con6: Resume all and wait for backup to start after DDL finish.
-SET DEBUG_SYNC= 'now SIGNAL status_shown WAIT_FOR bup_started';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "BACKUP DATABASE%";
-
-connection con4;
-
---echo con4: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'before_check_ddl_blocked SIGNAL con4_started
- WAIT_FOR status_shown2';
---echo con4: Try a DDL but it is blocked by backup -- will not be in backup
-send OPTIMIZE TABLE bup_ddl_blocker.t3;
-
-connection con5;
-
---echo con5: Wait for con4 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con4_started';
---echo con5: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'before_check_ddl_blocked SIGNAL con5_started
- WAIT_FOR status_shown2';
---echo con5: Try a DDL but it is blocked by backup -- will not be in backup
-send DROP TABLE bup_ddl_blocker.t4;
-
-connection con6;
-
---echo con6: Wait for con5 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con5_started';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "OPTIMIZE TABLE bup_ddl_blocker.t3%";
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "DROP TABLE bup_ddl_blocker.t4%";
-
---echo con6: Resume all.
-SET DEBUG_SYNC= 'now SIGNAL status_shown2';
-
-# Reconnect to connections and fetch their results.
-
-connection con2;
---echo con2: Completing DDL
-reap;
-
-connection con3;
---echo con3: Completing DDL
-reap;
-
-connection con4;
---echo con4: Completing DDL
-reap;
-
-connection con5;
---echo con5: Completing DDL
-reap;
-
-# Reconnect to con1 and fetch its result.
-
-connection con1;
---replace_column 1 #
-reap;
-
-##############################################################
---echo
---echo Verifying Test 3 results for backup.
---echo
-##############################################################
-
-# Show that all changes got applied.
---echo con1: Showing columns after updates and backup
-use bup_ddl_blocker;
-SHOW TABLES;
-
---echo con1: Dropping the database tables
-DROP TABLE bup_ddl_blocker.t1, bup_ddl_blocker.t3;
-
---echo con1: Restoring the database
---replace_column 1 #
-RESTORE FROM "bup_ddl_blocker.bak" OVERWRITE;
-
---echo con1: Showing columns that were backed up
---echo con1: Table t2 should not be in restore
-use bup_ddl_blocker;
-SHOW TABLES;
-
-
-
-##############################################################
---echo
---echo Starting Test 3 - Restore
---echo
-##############################################################
-
-# Create data for this test and tailor it to the test.
---source include/backup_ddl_create_data.inc
-
-# Get a backup to work with.
---remove_file $MYSQLTEST_VARDIR/master-data/bup_ddl_blocker_orig.bak
---replace_column 1 #
-BACKUP DATABASE bup_ddl_blocker to 'bup_ddl_blocker_orig.bak';
-
-connection con2;
-
---echo con2: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'after_start_ddl SIGNAL con2_started WAIT_FOR status_shown';
---echo con2: Get a DDL going and stop in the middle
-send OPTIMIZE TABLE bup_ddl_blocker.t1;
-
-connection con3;
-
---echo con3: Wait for con2 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con2_started';
---echo con3: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'after_start_ddl SIGNAL con3_started WAIT_FOR status_shown';
---echo con3: Get a DDL going and stop in the middle
-send DROP TABLE bup_ddl_blocker.t2;
-
-# Start the backup and allow it to break on lock.
-
-connection con1;
-
---echo con1: Wait for con3 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con3_started';
---echo con1: Activate synchronization points for restore.
-SET DEBUG_SYNC= 'before_block_ddl SIGNAL bup_blocked WAIT_FOR status_shown';
-SET DEBUG_SYNC= 'after_block_ddl SIGNAL bup_started WAIT_FOR status_shown2';
---echo con1: Restoring database -- will block with lock
-send RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE;
-
-connection con6;
-
---echo con6: Wait for con1 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR bup_blocked';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "RESTORE FROM%";
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "OPTIMIZE TABLE bup_ddl_blocker.t1%";
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "DROP TABLE bup_ddl_blocker.t2%";
-
---echo con6: Resume all and wait for restore to start after DDL finish.
-SET DEBUG_SYNC= 'now SIGNAL status_shown WAIT_FOR bup_started';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "RESTORE FROM%";
-
-connection con4;
-
---echo con4: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'before_check_ddl_blocked SIGNAL con4_started
- WAIT_FOR status_shown2';
---echo con4: Try a DDL but it is blocked by backup -- will not be in backup
-send OPTIMIZE TABLE bup_ddl_blocker.t3;
-
-connection con5;
-
---echo con5: Wait for con4 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con4_started';
---echo con5: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'before_check_ddl_blocked SIGNAL con5_started
- WAIT_FOR status_shown2';
---echo con5: Try a DDL but it is blocked by backup -- will not be in backup
-send DROP TABLE bup_ddl_blocker.t4;
-
-connection con6;
-
---echo con6: Wait for con5 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con5_started';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "OPTIMIZE TABLE bup_ddl_blocker.t3%";
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "DROP TABLE bup_ddl_blocker.t4%";
-
---echo con6: Resume all.
-SET DEBUG_SYNC= 'now SIGNAL status_shown2';
-
-# Reconnect to connections and fetch their results.
-
-connection con2;
---echo con2: Completing DDL
-reap;
-
-connection con3;
---echo con3: Completing DDL
-reap;
-
-connection con4;
---echo con4: Completing DDL
-reap;
-
-connection con5;
---echo con5: Completing DDL
-reap;
-
-# Reconnect to con1 and fetch its result.
-
-connection con1;
---replace_column 1 #
-reap;
-
-##############################################################
---echo
---echo Verifying Test 3 results for restore.
---echo
-##############################################################
-
---echo con1: Table t4 should not be in restored data.
-use bup_ddl_blocker;
-SHOW TABLES;
-
-# Cleanup
---remove_file $MYSQLTEST_VARDIR/master-data/bup_ddl_blocker.bak
-
-
-
-##############################################################
---echo
---echo Starting Test 4 - Backup
---echo
-##############################################################
--disable_warnings
-DROP DATABASE IF EXISTS bup_ddl_blocker_1;
-DROP DATABASE IF EXISTS bup_ddl_blocker_2;
-DROP DATABASE IF EXISTS bup_ddl_blocker_3;
-DROP DATABASE IF EXISTS bup_ddl_blocker_4;
+DROP DATABASE IF EXISTS bml_test;
--enable_warnings
+CREATE DATABASE bml_test;
-# Create databases.
---echo con1: Creating databases
-CREATE DATABASE bup_ddl_blocker_2;
-CREATE DATABASE bup_ddl_blocker_4;
-
-# Create transaction tables and load them with data.
---echo con1: Creating tables
-CREATE TABLE bup_ddl_blocker_2.t1 (col_a CHAR(40)) ENGINE=INNODB;
-CREATE TABLE bup_ddl_blocker_4.t1 (col_a CHAR(40)) ENGINE=MYISAM;
-
---echo con1: Loading data
-INSERT INTO bup_ddl_blocker_2.t1 VALUES ("01 Some data to test");
-INSERT INTO bup_ddl_blocker_2.t1 VALUES ("02 Some data to test");
-INSERT INTO bup_ddl_blocker_2.t1 VALUES ("03 Some data to test");
-
-INSERT INTO bup_ddl_blocker_4.t1 VALUES ("01 Some data to test");
-INSERT INTO bup_ddl_blocker_4.t1 VALUES ("02 Some data to test");
-INSERT INTO bup_ddl_blocker_4.t1 VALUES ("03 Some data to test");
-
---echo con1: Show that the new data doesn't exist before backup.
-SHOW DATABASES LIKE 'bup_ddl_blocker_%';
-
-connection con2;
-
---echo con2: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'after_start_ddl SIGNAL con2_started WAIT_FOR status_shown';
---echo con2: Get a DDL going and stop in the middle
-send CREATE DATABASE bup_ddl_blocker_1;
-
-connection con3;
-
---echo con3: Wait for con2 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con2_started';
---echo con3: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'after_start_ddl SIGNAL con3_started WAIT_FOR status_shown';
---echo con3: Get a DDL going and stop in the middle
-send DROP DATABASE bup_ddl_blocker_2;
-
-# Start the backup and allow it to break on lock.
-
-connection con1;
-
---echo con1: Wait for con3 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con3_started';
---echo con1: Activate synchronization points for backup.
-SET DEBUG_SYNC= 'before_block_ddl SIGNAL bup_blocked WAIT_FOR status_shown';
-SET DEBUG_SYNC= 'after_block_ddl SIGNAL bup_started WAIT_FOR status_shown2';
---echo con1: Backing up database -- will block with lock
-send BACKUP DATABASE * TO "bup_ddl_blocker.bak";
-
-connection con6;
-
---echo con6: Wait for con1 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR bup_blocked';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "BACKUP DATABASE%";
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "CREATE DATABASE bup_ddl_blocker_1%";
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "DROP DATABASE bup_ddl_blocker_2%";
-
---echo con6: Resume all and wait for backup to start after DDL finish.
-SET DEBUG_SYNC= 'now SIGNAL status_shown WAIT_FOR bup_started';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "BACKUP DATABASE%";
-
-connection con4;
-
---echo con4: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'before_check_ddl_blocked SIGNAL con4_started
- WAIT_FOR status_shown2';
---echo con4: Try a DDL but it is blocked by backup -- will not be in backup
-send CREATE DATABASE bup_ddl_blocker_3;
-
-connection con5;
-
---echo con5: Wait for con4 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con4_started';
---echo con5: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'before_check_ddl_blocked SIGNAL con5_started
- WAIT_FOR status_shown2';
---echo con5: Try a DDL but it is blocked by backup -- will not be in backup
-send DROP DATABASE bup_ddl_blocker_4;
-
-connection con6;
-
---echo con6: Wait for con5 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con5_started';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "CREATE DATABASE bup_ddl_blocker_3%";
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "DROP DATABASE bup_ddl_blocker_4%";
-
---echo con6: Resume all.
-SET DEBUG_SYNC= 'now SIGNAL status_shown2';
-
-# Reconnect to connections and fetch their results.
-
-connection con2;
---echo con2: Completing DDL
-reap;
-
-connection con3;
---echo con3: Completing DDL
-reap;
-
-connection con4;
---echo con4: Completing DDL
-reap;
-
-connection con5;
---echo con5: Completing DDL
-reap;
-
-# Reconnect to con1 and fetch its result.
-
-connection con1;
---replace_column 1 #
-reap;
-
-##############################################################
---echo
---echo Verifying Test 4 results for backup.
---echo
-##############################################################
-
-# Show that all changes got applied.
---echo con1: Showing databases after updates and backup
---echo con1: bup_ddl_blocker_2 and bup_ddl_blocker_4 are not present
-SHOW DATABASES LIKE 'bup_ddl_blocker_%';
-
---echo con1: Dropping the database tables
-DROP DATABASE bup_ddl_blocker_1;
-DROP DATABASE bup_ddl_blocker_3;
-
---echo con1: Restoring the database
---replace_column 1 #
---disable_warnings
-RESTORE FROM "bup_ddl_blocker.bak" OVERWRITE;
---enable_warnings
-
---echo con1: Showing databases that were backed up
---echo con1: bup_ddl_blocker_2 and bup_ddl_blocker_3 are not present
-SHOW DATABASES LIKE 'bup_ddl_blocker_%';
-
---echo con1: Cleanup
-DROP DATABASE bup_ddl_blocker_1;
-DROP DATABASE bup_ddl_blocker_4;
-
-##############################################################
---echo
---echo Starting Test 4 - Restore
---echo
-##############################################################
---disable_warnings
-DROP DATABASE IF EXISTS bup_ddl_blocker_1;
-DROP DATABASE IF EXISTS bup_ddl_blocker_2;
-DROP DATABASE IF EXISTS bup_ddl_blocker_3;
-DROP DATABASE IF EXISTS bup_ddl_blocker_4;
---enable_warnings
-
-# Create databases.
---echo con1: Creating databases
-CREATE DATABASE bup_ddl_blocker_2;
-CREATE DATABASE bup_ddl_blocker_4;
-
-# Create transaction tables and load them with data.
---echo con1: Creating tables
-CREATE TABLE bup_ddl_blocker_2.t1 (col_a CHAR(40)) ENGINE=INNODB;
-CREATE TABLE bup_ddl_blocker_4.t1 (col_a CHAR(40)) ENGINE=MYISAM;
-
---echo con1: Loading data
-INSERT INTO bup_ddl_blocker_2.t1 VALUES ("01 Some data to test");
-INSERT INTO bup_ddl_blocker_2.t1 VALUES ("02 Some data to test");
-INSERT INTO bup_ddl_blocker_2.t1 VALUES ("03 Some data to test");
-
-INSERT INTO bup_ddl_blocker_4.t1 VALUES ("01 Some data to test");
-INSERT INTO bup_ddl_blocker_4.t1 VALUES ("02 Some data to test");
-INSERT INTO bup_ddl_blocker_4.t1 VALUES ("03 Some data to test");
-
---echo con1: Show that the new data doesn't exist before backup.
-SHOW DATABASES LIKE 'bup_ddl_blocker_%';
-
-# Get a backup to work with.
---remove_file $MYSQLTEST_VARDIR/master-data/bup_ddl_blocker_orig.bak
---replace_column 1 #
-BACKUP DATABASE bup_ddl_blocker_2, bup_ddl_blocker_4 to 'bup_ddl_blocker_orig.bak';
-
-connection con2;
-
---echo con2: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'after_start_ddl SIGNAL con2_started WAIT_FOR status_shown';
---echo con2: Get a DDL going and stop in the middle
-send CREATE DATABASE bup_ddl_blocker_1;
-
-connection con3;
-
---echo con3: Wait for con2 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con2_started';
---echo con3: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'after_start_ddl SIGNAL con3_started WAIT_FOR status_shown';
---echo con3: Get a DDL going and stop in the middle
-send DROP DATABASE bup_ddl_blocker_2;
-
-# Start the backup and allow it to break on lock.
-
-connection con1;
-
---echo con1: Wait for con3 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con3_started';
---echo con1: Activate synchronization points for restore.
-SET DEBUG_SYNC= 'before_block_ddl SIGNAL bup_blocked WAIT_FOR status_shown';
-SET DEBUG_SYNC= 'after_block_ddl SIGNAL bup_started WAIT_FOR status_shown2';
---echo con1: Restoring database -- will block with lock
-send RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE;
-
-connection con6;
-
---echo con6: Wait for con1 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR bup_blocked';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "RESTORE FROM%";
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "CREATE DATABASE bup_ddl_blocker_1%";
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "DROP DATABASE bup_ddl_blocker_2%";
-
---echo con6: Resume all and wait for restore to start after DDL finish.
-SET DEBUG_SYNC= 'now SIGNAL status_shown WAIT_FOR bup_started';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "RESTORE FROM%";
-
-connection con4;
-
---echo con4: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'before_check_ddl_blocked SIGNAL con4_started
- WAIT_FOR status_shown2';
---echo con4: Try a DDL but it is blocked by backup -- will not be in backup
-send CREATE DATABASE bup_ddl_blocker_3;
-
-connection con5;
-
---echo con5: Wait for con4 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con4_started';
---echo con5: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'before_check_ddl_blocked SIGNAL con5_started
- WAIT_FOR status_shown2';
---echo con5: Try a DDL but it is blocked by backup -- will not be in backup
-send DROP DATABASE bup_ddl_blocker_4;
-
-connection con6;
-
---echo con6: Wait for con5 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con5_started';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "CREATE DATABASE bup_ddl_blocker_3%";
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "DROP DATABASE bup_ddl_blocker_4%";
-
---echo con6: Resume all.
-SET DEBUG_SYNC= 'now SIGNAL status_shown2';
-
-# Reconnect to connections and fetch their results.
-
-connection con2;
---echo con2: Completing DDL
-reap;
-
-connection con3;
---echo con3: Completing DDL
-reap;
-
-connection con4;
---echo con4: Completing DDL
-reap;
-
-connection con5;
---echo con5: Completing DDL
-reap;
-
-# Reconnect to con1 and fetch its result.
-
-connection con1;
---replace_column 1 #
-reap;
+#
+# Infrastructure for automatic generation of DDL statements.
+#
-##############################################################
---echo
---echo Verifying Test 4 results for restore.
---echo
-##############################################################
+USE test;
---echo con1: Database bup_ddl_blocker_4 should not be in restored data.
-SHOW DATABASES LIKE 'bup_ddl_blocker_%';
+CREATE TABLE objects (pos int, type char(10), name char(16), args text);
+
+--delimiter \\
+
+CREATE FUNCTION drop_stmt(pos_arg int) RETURNS text
+BEGIN
+ DECLARE stmt text;
+ SELECT concat('DROP ', type, ' ', name)
+ INTO stmt
+ FROM test.objects WHERE pos=pos_arg;
+ RETURN stmt;
+END\\
+
+
+CREATE FUNCTION create_stmt(pos_arg int) RETURNS text
+BEGIN
+ DECLARE stmt text;
+ SELECT concat('CREATE ', type, ' ', name, args)
+ INTO stmt
+ FROM test.objects WHERE pos=pos_arg;
+ RETURN stmt;
+END\\
+
+CREATE FUNCTION alter_stmt(pos_arg int) RETURNS text
+BEGIN
+ DECLARE stmt text;
+ SELECT concat('ALTER ', type, ' ', name, args)
+ INTO stmt
+ FROM test.objects WHERE pos=pos_arg;
+ RETURN stmt;
+END\\
+
+--delimiter ;
+
+
+
+################################################################
+#
+# First group of statements.
+#
+# drop: DATABASE TABLE VIEW FUNCTION PROCEDURE EVENT TRIGGER INDEX
+# create: DATABASE TABLE VIEW FUNCTION PROCEDURE EVENT TRIGGER INDEX
+#
+################################################################
+
+USE test;
+
+TRUNCATE TABLE test.objects;
+INSERT INTO test.objects VALUES
+ (1, 'DATABASE', 'bml_test_db1', ''),
+ (2, 'TABLE', 't1', '(a int)'),
+ (3, 'VIEW', 'v1', ' AS SELECT * FROM t2'),
+ (4, 'FUNCTION', 'f1', '() RETURNS int RETURN 1'),
+ (5, 'PROCEDURE','p1', '() SET @foo=1'),
+ (6, 'EVENT', 'e1', ' ON SCHEDULE EVERY 1 YEAR DISABLE DO SET @foo=1'),
+ (7, 'TRIGGER', 'r1', ' AFTER UPDATE ON t2 FOR EACH ROW SET @foo=1'),
+ (8, 'INDEX', 'i1 ON t2', '(b)');
+
+--delimiter \\
+
+DROP PROCEDURE IF EXISTS test.check_results\\
+CREATE PROCEDURE test.check_results()
+BEGIN
+ # show databases
+ SHOW DATABASES LIKE 'bml%';
+ # show objects in bml_test database
+ SELECT table_name AS name, table_type AS type
+ FROM information_schema.tables
+ WHERE table_schema = 'bml_test'
+ UNION SELECT routine_name , routine_type
+ FROM information_schema.routines
+ WHERE routine_schema = 'bml_test'
+ UNION SELECT event_name, 'EVENT'
+ FROM information_schema.events
+ WHERE event_schema = 'bml_test'
+ UNION SELECT trigger_name, 'TRIGGER'
+ FROM information_schema.triggers
+ WHERE trigger_schema = 'bml_test';
+ # show definiton of t2 to see the index if created
+ SHOW CREATE TABLE bml_test.t2;
+END\\
+
+--delimiter ;
+
+#
+# Populate bml_test database
+#
+
+USE bml_test;
+
+# base table for the view
+CREATE TABLE t2 (b int);
+
+# all the objects specified in test.objects table
+let $count=`SELECT count(*) FROM test.objects`;
+let $iter= $count;
+while ($iter)
+{
+ let $pos= $count - $iter + 1;
+ # Create objects in correct order - starting from 1
+ let $stmt=`SELECT test.create_stmt($count - $iter + 1)`;
+ --eval $stmt
+ dec $iter;
+}
+
+# Show contents of the database and backup it for the future.
+CALL test.check_results();
+--replace_column 1 #
+BACKUP DATABASE bml_test, bml_test_db1 TO 'bml_test_orig.bkp';
+
+#
+# Test the statements:
+#
+# Let Ci be the CREATE statement for object i in table objects, Di be the
+# DELETE statement for that object. Statements will be tested in the following
+# order:
+#
+# DDL1 DDL2 DDL3 DDL4 backup or restore
+# ==================================================
+# C3 D4 D1 C2 BACKUP
+# C1 D2 D3 C4 RESTORE
+# C7 D8 D5 C6 BACKUP
+# C3 D4 D7 C8 RESTORE
+# and so on ...
+#
+# Note: The order *is* important. RESTORE is using the image created by previous
+# BACKUP and it is important that this image does not contain the object to be
+# created by DDL4.
+# For example, DDL2 drops object 4 before first BACKUP completes and thus this
+# object will not be included in the backup image. This, when DDL4 is executed
+# after RESTORE has completed, it will create object 4 without an error.
+#
+
+let $pos=0;
+while (`select $pos < $count`)
+{
+ let $pos1= 1 + (($pos+0) % $count); # position of obj1
+ let $pos2= 1 + (($pos+1) % $count); # position of obj2
+ let $pos3= 1 + (($pos+2) % $count); # position of obj3
+ let $pos4= 1 + (($pos+3) % $count); # position of obj4
+
+ let $C1= `select test.create_stmt($pos1)`;
+ let $D1= `select test.drop_stmt($pos1)`;
+ let $C2= `select test.create_stmt($pos2)`;
+ let $D2= `select test.drop_stmt($pos2)`;
+ let $C3= `select test.create_stmt($pos3)`;
+ let $D3= `select test.drop_stmt($pos3)`;
+ let $C4= `select test.create_stmt($pos4)`;
+ let $D4= `select test.drop_stmt($pos4)`;
+
+ #
+ # Testing BACKUP operation with DDLs on objects at pos ($pos, $pos+1)
+ #
+ # Note: obj4 will be deleted by DDL2 before BACKUP completes and thus
+ # will not be included in the backup image.
+ #
+
+ let $DDL1= $C3;
+ let $DDL2= $D4;
+ let $DDL3= $D1;
+ let $DDL4= $C2;
+
+ # drop obj3 and obj3 to be created by DDL1 and DDL4
+ --eval $D3
+ --eval $D2
+
+ # test BACKUP operation
+ let $backup_to= bml_test.bkp;
+ --source suite/backup/include/bml_test.inc
+
+ #
+ # Testing RESTORE operation with DDLs on objects at pos ($pos+2, $pos+3)
+ #
+
+ let $DDL1= $C1; # obj1 was dropped by DDL3 above
+ let $DDL2= $D2;
+ let $DDL3= $D3;
+ let $DDL4= $C4; # obj4 not present after RESTORE
+
+ # test RESTORE operation
+ let $restore_from= bml_test.bkp;
+ --source suite/backup/include/bml_test.inc
+
+ # re-create obj3 dropped by DDL3
+ --eval $C3
+
+ # prepare for next iteration
+
+ --remove_file $bdir/bml_test.bkp
+
+ inc $pos;
+ inc $pos;
+ inc $pos;
+ inc $pos;
+}
+
+
+################################################################
+#
+# Second group of statements.
+#
+# alter: DATABASE TABLE VIEW FUNCTION PROCEDURE EVENT (TABLESPACE)
+#
+################################################################
+
+RESTORE FROM 'bml_test_orig.bkp' OVERWRITE;
+
+TRUNCATE TABLE test.objects;
+INSERT INTO test.objects VALUES
+ (1, 'DATABASE', 'bml_test_db1', ' CHARACTER SET = utf8'),
+ (2, 'TABLE', 't1', ' ADD INDEX `i` (a)'),
+ (3, 'VIEW', 'v1', ' AS SELECT 1'),
+ (4, 'FUNCTION', 'f1', " COMMENT 'testing alter'"),
+ (5, 'PROCEDURE', 'p1', " COMMENT 'testing alter'"),
+ (6, 'EVENT', 'e1', ' RENAME TO e2');
+
+# Note: I could not get ALTER TABLESPACE to work - see Bug#41548
+# When the bug is fixed add the following line to objects table:
+# (7, 'TABLESPACE', 'bml_ts1', " ADD DATAFILE 'bml_ts1.dat' ENGINE=falcon");
+
+--delimiter \\
+
+DROP PROCEDURE IF EXISTS test.check_results\\
+CREATE PROCEDURE test.check_results()
+BEGIN
+ SHOW CREATE DATABASE bml_test_db1;
+ SHOW CREATE TABLE bml_test.t1;
+ SHOW CREATE VIEW bml_test.v1;
+ SHOW CREATE FUNCTION bml_test.f1;
+ SHOW CREATE PROCEDURE bml_test.p1;
+ SELECT event_name FROM information_schema.events
+ WHERE event_schema = 'bml_test';
+END\\
+
+--delimiter ;
+
+#
+# check situation before tests
+#
+
+CALL test.check_results();
+
+#
+# Test the statements
+#
+
+let $count= `select count(*) from test.objects`;
+let $pos= 0;
+while (`select $pos < $count`)
+{
+ #
+ # Testing BACKUP and DDLs for objects at positions: 0,1,2,3
+ #
+
+ let $DDL1= `select test.alter_stmt(1 + (($pos+0) % $count))`;
+ let $DDL2= `select test.alter_stmt(1 + (($pos+1) % $count))`;
+ let $DDL3= `select test.alter_stmt(1 + (($pos+2) % $count))`;
+ let $DDL4= `select test.alter_stmt(1 + (($pos+3) % $count))`;
+
+ # test BACKUP operation
+ let $backup_to= bml_test.bkp;
+ --source suite/backup/include/bml_test.inc
+
+ RESTORE FROM 'bml_test_orig.bkp' OVERWRITE;
+
+ #
+ # Testing RESTORE and DDLs for objects at positions: 2,3,4,5
+ #
+
+ inc $pos;
+ inc $pos;
+
+ let $DDL1= `select test.alter_stmt(1 + (($pos+0) % $count))`;
+ let $DDL2= `select test.alter_stmt(1 + (($pos+1) % $count))`;
+ let $DDL3= `select test.alter_stmt(1 + (($pos+2) % $count))`;
+ let $DDL4= `select test.alter_stmt(1 + (($pos+3) % $count))`;
+
+ # test RESTORE operation
+ let $restore_from= bml_test.bkp;
+ --source suite/backup/include/bml_test.inc
+
+ --remove_file $bdir/bml_test.bkp
+ RESTORE FROM 'bml_test_orig.bkp' OVERWRITE;
+
+ inc $pos;
+ inc $pos;
+}
+#
# Cleanup
---remove_file $MYSQLTEST_VARDIR/master-data/bup_ddl_blocker.bak
-
-
-
-##############################################################
---echo
---echo Starting Test 5 - Backup
---echo
-##############################################################
-
---disable_warnings
-DROP DATABASE IF EXISTS bup_ddl_blocker_1;
-DROP DATABASE IF EXISTS bup_ddl_blocker_2;
-DROP DATABASE IF EXISTS bup_ddl_blocker_3;
-DROP DATABASE IF EXISTS bup_ddl_blocker_4;
---enable_warnings
-
-# Create databases.
---echo con1: Creating databases
-CREATE DATABASE bup_ddl_blocker_2 CHARACTER SET latin1;
-CREATE DATABASE bup_ddl_blocker_4 CHARACTER SET latin1;
-
-# Create transaction tables and load them with data.
---echo con1: Creating tables
-CREATE TABLE bup_ddl_blocker_2.t1 (col_a CHAR(40)) ENGINE=INNODB;
-CREATE TABLE bup_ddl_blocker_4.t1 (col_a CHAR(40)) ENGINE=MYISAM;
-
---echo con1: Loading data
-
-INSERT INTO bup_ddl_blocker_2.t1 VALUES ("01 Some data to test");
-INSERT INTO bup_ddl_blocker_2.t1 VALUES ("02 Some data to test");
-INSERT INTO bup_ddl_blocker_2.t1 VALUES ("03 Some data to test");
-
-INSERT INTO bup_ddl_blocker_4.t1 VALUES ("01 Some data to test");
-INSERT INTO bup_ddl_blocker_4.t1 VALUES ("02 Some data to test");
-INSERT INTO bup_ddl_blocker_4.t1 VALUES ("03 Some data to test");
-
---echo con1: Show that the new data doesn't exist before backup.
-SHOW DATABASES LIKE 'bup_ddl_blocker_%';
-
-connection con2;
-
---echo con2: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'after_start_ddl SIGNAL con2_started WAIT_FOR status_shown';
---echo con2: Get a DDL going and stop in the middle
-send TRUNCATE TABLE bup_ddl_blocker_2.t1;
-
-connection con3;
-
---echo con3: Wait for con2 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con2_started';
---echo con3: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'after_start_ddl SIGNAL con3_started WAIT_FOR status_shown';
---echo con3: Get a DDL going and stop in the middle
-send ALTER DATABASE bup_ddl_blocker_2 CHARACTER SET latin2;
-
-# Start the backup and allow it to break on lock.
-
-connection con1;
-
---echo con1: Wait for con3 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con3_started';
---echo con1: Activate synchronization points for backup.
-SET DEBUG_SYNC= 'before_block_ddl SIGNAL bup_blocked WAIT_FOR status_shown';
-SET DEBUG_SYNC= 'after_block_ddl SIGNAL bup_started WAIT_FOR status_shown2';
---echo con1: Backing up database -- will block with lock
-send BACKUP DATABASE * TO "bup_ddl_blocker.bak";
-
-connection con6;
-
---echo con6: Wait for con1 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR bup_blocked';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "BACKUP DATABASE%";
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "TRUNCATE TABLE bup_ddl_blocker_2%";
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "ALTER DATABASE bup_ddl_blocker_2%";
-
---echo con6: Resume all and wait for backup to start after DDL finish.
-SET DEBUG_SYNC= 'now SIGNAL status_shown WAIT_FOR bup_started';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "BACKUP DATABASE%";
-
-connection con4;
-
---echo con4: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'before_check_ddl_blocked SIGNAL con4_started
- WAIT_FOR status_shown2';
---echo con4: Try a DDL but it is blocked by backup -- will not be in backup
-send TRUNCATE TABLE bup_ddl_blocker_4.t1;
-
-connection con5;
-
---echo con5: Wait for con4 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con4_started';
---echo con5: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'before_check_ddl_blocked SIGNAL con5_started
- WAIT_FOR status_shown2';
---echo con5: Try a DDL but it is blocked by backup -- will not be in backup
-send ALTER DATABASE bup_ddl_blocker_4 CHARACTER SET latin2;
-
-connection con6;
-
---echo con6: Wait for con5 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con5_started';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "ALTER DATABASE bup_ddl_blocker_4%";
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "TRUNCATE TABLE bup_ddl_blocker_4%";
-
---echo con6: Resume all.
-SET DEBUG_SYNC= 'now SIGNAL status_shown2';
-
-# Reconnect to connections and fetch their results.
-
-connection con2;
---echo con2: Completing DDL
-reap;
-
-connection con3;
---echo con3: Completing DDL
-reap;
-
-connection con4;
---echo con4: Completing DDL
-reap;
-
-connection con5;
---echo con5: Completing DDL
-reap;
+#
-# Reconnect to con1 and fetch its result.
+--remove_file $bdir/bml_test_orig.bkp
+DROP TABLE test.objects;
-connection con1;
---replace_column 1 #
-reap;
+################################################################
+#
+# Third group of statements.
+#
+# drop: USER TABLESPACE
+# privileges: GRANT REVOKE
+# rename: TABLE USER
+#
+################################################################
+
+DROP DATABASE bml_test;
+CREATE DATABASE bml_test;
+
+CREATE USER bml_u1;
+CREATE USER bml_u2;
+CREATE USER bml_u3;
+CREATE TABLESPACE bml_ts1 ADD DATAFILE 'bml_ts1.dat' ENGINE=falcon;
+CREATE TABLESPACE bml_ts2 ADD DATAFILE 'bml_ts2.dat' ENGINE=falcon;
+
+CREATE TABLE bml_test.t1 (a int);
+CREATE TABLE bml_test.t2 (b int);
+
+--delimiter \\
+
+DROP PROCEDURE IF EXISTS test.check_results\\
+CREATE PROCEDURE test.check_results()
+BEGIN
+ SHOW TABLES IN bml_test;
+ # show users
+ SELECT DISTINCT grantee AS user
+ FROM information_schema.user_privileges
+ WHERE grantee like '%bml%';
+ # show privileges
+ SELECT grantee, count(*) > 0 AS has_privileges
+ FROM information_schema.schema_privileges
+ WHERE grantee like '%bml%'
+ GROUP BY grantee;
+ # show tablespaces
+ SELECT tablespace_name, file_name
+ FROM information_schema.files
+ WHERE tablespace_name like 'bml%';
+END\\
+
+--delimiter ;
+
+#
+# Round 1
+#
+let $DDL1= RENAME TABLE t1 TO t1_renamed;
+let $DDL2= DROP USER bml_u1;
+let $DDL3= RENAME USER bml_u2 TO bml_u2_renamed;
+let $DDL4= DROP TABLESPACE bml_ts1 ENGINE=falcon;
+let $backup_to= bml_test.bkp;
+--source suite/backup/include/bml_test.inc
+
+
+#
+# Round 2
+#
+let $DDL1= RENAME USER bml_u2_renamed TO bml_u2;
+let $DDL2= GRANT ALL ON bml_test.* TO bml_u3;
+let $DDL3= RENAME TABLE t1_renamed TO t1;
+let $DDL4= GRANT ALL ON bml_test.* TO bml_u2;
+let $restore_from= bml_test.bkp;
+--source suite/backup/include/bml_test.inc
+
+--remove_file $bdir/bml_test.bkp
+
+#
+# Round 3
+#
+let $DDL1= DROP TABLESPACE bml_ts2 ENGINE=falcon;
+let $DDL2= REVOKE ALL ON bml_test.* FROM bml_u2;
+let $DDL3= DROP USER bml_u2;
+let $DDL4= REVOKE ALL ON bml_test.* FROM bml_u3;
+let $backup_to= bml_test.bkp;
+--source suite/backup/include/bml_test.inc
-##############################################################
---echo
---echo Verifying Test 5 results for backup.
---echo
-##############################################################
+#
+# Cleanup
+#
-# Show that all changes got applied.
---echo con1: Showing databases after updates and backup
---echo con1: bup_ddl_blocker_2.t1 has been truncated.
---echo con1: bup_ddl_blocker_1 and bup_ddl_blocker_3 are renamed
---echo con1: bup_ddl_blocker_4.t1 has been truncated.
---echo con1: bup_ddl_blocker_2 and bup_ddl_blocker_4 have had their charset changed.
-SHOW DATABASES LIKE 'bup_ddl_blocker_%';
-SHOW CREATE DATABASE bup_ddl_blocker_2;
-SHOW CREATE DATABASE bup_ddl_blocker_4;
-SELECT * FROM bup_ddl_blocker_2.t1;
-SELECT * FROM bup_ddl_blocker_4.t1;
-
---echo con1: Dropping the database tables
-DROP DATABASE bup_ddl_blocker_2;
-DROP DATABASE bup_ddl_blocker_4;
+--remove_file $bdir/bml_test.bkp
+DROP USER bml_u3;
+# check that no global objects are left-over
+CALL test.check_results();
---echo con1: Restoring the database
---replace_column 1 #
-RESTORE FROM "bup_ddl_blocker.bak" OVERWRITE;
---echo con1: Showing databases that were backed up
---echo con1: bup_ddl_blocker_1 has been renamed and
---echo con1: bup_ddl_blocker_2.t1 has been truncated.
---echo con1: bup_ddl_blocker_4 has not had its character set changed.
---echo con1: bup_ddl_blocker_4.t1 has not been truncated.
-SHOW DATABASES LIKE 'bup_ddl_blocker_%';
-SHOW CREATE DATABASE bup_ddl_blocker_2;
-SHOW CREATE DATABASE bup_ddl_blocker_4;
-SELECT * FROM bup_ddl_blocker_2.t1;
-SELECT * FROM bup_ddl_blocker_4.t1;
-
---echo con1: Cleanup
-DROP DATABASE bup_ddl_blocker_2;
-DROP DATABASE bup_ddl_blocker_4;
-
-##############################################################
---echo
---echo Starting Test 5 - Restore
---echo
-##############################################################
+################################################################
+#
+# Fourth group of statements.
+#
+# table maintenance: TRUNCATE OPTIMIZE REPAIR
+#
+################################################################
---disable_warnings
-DROP DATABASE IF EXISTS bup_ddl_blocker_1;
-DROP DATABASE IF EXISTS bup_ddl_blocker_2;
-DROP DATABASE IF EXISTS bup_ddl_blocker_3;
-DROP DATABASE IF EXISTS bup_ddl_blocker_4;
---enable_warnings
+DROP DATABASE bml_test;
+CREATE DATABASE bml_test;
-# Create databases.
---echo con1: Creating databases
-CREATE DATABASE bup_ddl_blocker_2 CHARACTER SET latin1;
-CREATE DATABASE bup_ddl_blocker_4 CHARACTER SET latin1;
-
-# Create transaction tables and load them with data.
---echo con1: Creating tables
-CREATE TABLE bup_ddl_blocker_2.t1 (col_a CHAR(40)) ENGINE=INNODB;
-CREATE TABLE bup_ddl_blocker_4.t1 (col_a CHAR(40)) ENGINE=MYISAM;
-
---echo con1: Loading data
-
-INSERT INTO bup_ddl_blocker_2.t1 VALUES ("01 Some data to test");
-INSERT INTO bup_ddl_blocker_2.t1 VALUES ("02 Some data to test");
-INSERT INTO bup_ddl_blocker_2.t1 VALUES ("03 Some data to test");
-
-INSERT INTO bup_ddl_blocker_4.t1 VALUES ("01 Some data to test");
-INSERT INTO bup_ddl_blocker_4.t1 VALUES ("02 Some data to test");
-INSERT INTO bup_ddl_blocker_4.t1 VALUES ("03 Some data to test");
+USE bml_test;
---echo con1: Show that the new data doesn't exist before backup.
-SHOW DATABASES LIKE 'bup_ddl_blocker_%';
+CREATE TABLE t1 (a int) ENGINE=myisam;
+CREATE TABLE t2 (a int) ENGINE=myisam;
-# Get a backup to work with.
---remove_file $MYSQLTEST_VARDIR/master-data/bup_ddl_blocker_orig.bak
---replace_column 1 #
-BACKUP DATABASE bup_ddl_blocker_2, bup_ddl_blocker_4 to 'bup_ddl_blocker_orig.bak';
+INSERT INTO t1 VALUES (1),(2);
+INSERT INTO t2 VALUES (3),(4);
-connection con2;
+--delimiter \\
---echo con2: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'after_start_ddl SIGNAL con2_started WAIT_FOR status_shown';
---echo con2: Get a DDL going and stop in the middle
-send TRUNCATE TABLE bup_ddl_blocker_2.t1;
-
-connection con3;
-
---echo con3: Wait for con2 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con2_started';
---echo con3: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'after_start_ddl SIGNAL con3_started WAIT_FOR status_shown';
---echo con3: Get a DDL going and stop in the middle
-send ALTER DATABASE bup_ddl_blocker_2 CHARACTER SET latin2;
-
-# Start the backup and allow it to break on lock.
-
-connection con1;
-
---echo con1: Wait for con3 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con3_started';
---echo con1: Activate synchronization points for restore.
-SET DEBUG_SYNC= 'before_block_ddl SIGNAL bup_blocked WAIT_FOR status_shown';
-SET DEBUG_SYNC= 'after_block_ddl SIGNAL bup_started WAIT_FOR status_shown2';
---echo con1: Restoring database -- will block with lock
-send RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE;
-
-connection con6;
-
---echo con6: Wait for con1 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR bup_blocked';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "RESTORE FROM%";
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "ALTER DATABASE bup_ddl_blocker_2%";
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "TRUNCATE TABLE bup_ddl_blocker_2%";
-
---echo con6: Resume all and wait for restore to start after DDL finish.
-SET DEBUG_SYNC= 'now SIGNAL status_shown WAIT_FOR bup_started';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "RESTORE FROM%";
-
-connection con4;
-
---echo con4: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'before_check_ddl_blocked SIGNAL con4_started
- WAIT_FOR status_shown2';
---echo con4: Try a DDL but it is blocked by backup -- will not be in backup
-send TRUNCATE TABLE bup_ddl_blocker_4.t1;
-
-connection con5;
-
---echo con5: Wait for con4 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con4_started';
---echo con5: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'before_check_ddl_blocked SIGNAL con5_started
- WAIT_FOR status_shown2';
---echo con5: Try a DDL but it is blocked by backup -- will not be in backup
-send ALTER DATABASE bup_ddl_blocker_4 CHARACTER SET latin2;
-
-connection con6;
-
---echo con6: Wait for con5 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con5_started';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "TRUNCATE TABLE bup_ddl_blocker_4%";
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "ALTER DATABASE bup_ddl_blocker_4%";
-
---echo con6: Resume all.
-SET DEBUG_SYNC= 'now SIGNAL status_shown2';
-
-# Reconnect to connections and fetch their results.
-
-connection con2;
---echo con2: Completing DDL
-reap;
-
-connection con3;
---echo con3: Completing DDL
-reap;
-
-connection con4;
---echo con4: Completing DDL
-reap;
-
-connection con5;
---echo con5: Completing DDL
-reap;
+DROP PROCEDURE IF EXISTS test.check_results\\
+CREATE PROCEDURE test.check_results()
+BEGIN
+ SHOW TABLES IN bml_test;
+ SELECT count(*) AS rows_in_t1 FROM bml_test.t1;
+ SELECT count(*) AS rows_in_t2 FROM bml_test.t2;
+ CHECKSUM TABLE bml_test.t1, bml_test.t2 EXTENDED;
+END\\
-# Reconnect to con1 and fetch its result.
+--delimiter ;
-connection con1;
---replace_column 1 #
-reap;
+#
+# Check with BACKUP
+#
+let $DDL1= OPTIMIZE TABLE t1;
+let $DDL2= REPAIR TABLE t2 USE_FRM;
+let $DDL3= TRUNCATE TABLE t1;
+let $DDL4= TRUNCATE TABLE t2;
+let $backup_to= bml_test.bkp;
+--source suite/backup/include/bml_test.inc
-##############################################################
---echo
---echo Verifying Test 5 results for restore.
---echo
-##############################################################
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (3);
---echo con1: bup_ddl_blocker_4 has had its character set changed.
---echo con1: bup_ddl_blocker_2.t1 has not been truncated.
---echo con1: bup_ddl_blocker_4.t1 has been truncated.
-SHOW DATABASES LIKE 'bup_ddl_blocker_%';
-SHOW CREATE DATABASE bup_ddl_blocker_2;
-SHOW CREATE DATABASE bup_ddl_blocker_4;
-SELECT * FROM bup_ddl_blocker_2.t1;
-SELECT * FROM bup_ddl_blocker_4.t1;
-
---echo con1: Cleanup
-DROP DATABASE bup_ddl_blocker_2;
-DROP DATABASE bup_ddl_blocker_4;
+#
+# Check with RESTORE
+#
+let $DDL1= TRUNCATE t1;
+let $DDL2= TRUNCATE t2;
+let $DDL3= REPAIR TABLE t1;
+let $DDL4= OPTIMIZE TABLE t2;
+let $restore_from= bml_test.bkp;
+--source suite/backup/include/bml_test.inc
+#
# Cleanup
---remove_file $MYSQLTEST_VARDIR/master-data/bup_ddl_blocker.bak
-
-
-
-##############################################################
---echo
---echo Starting Test 6 - Backup
---echo
-##############################################################
-
---disable_warnings
-DROP DATABASE IF EXISTS bup_ddl_blocker_1;
-DROP DATABASE IF EXISTS bup_ddl_blocker_2;
-DROP DATABASE IF EXISTS bup_ddl_blocker_3;
-DROP DATABASE IF EXISTS bup_ddl_blocker_4;
---enable_warnings
-
-# Create databases.
---echo con1: Creating databases
-CREATE DATABASE bup_ddl_blocker_1;
-CREATE DATABASE bup_ddl_blocker_2;
-CREATE DATABASE bup_ddl_blocker_3;
-CREATE DATABASE bup_ddl_blocker_4;
-
-# Create transaction tables and load them with data.
---echo con1: Creating tables
-CREATE TABLE bup_ddl_blocker_1.t1 (col_a CHAR(40), col_b int) ENGINE=INNODB;
-CREATE TABLE bup_ddl_blocker_2.t1 (col_a CHAR(40), col_b int) ENGINE=INNODB;
-CREATE TABLE bup_ddl_blocker_3.t1 (col_a CHAR(40), col_b int) ENGINE=INNODB;
-CREATE TABLE bup_ddl_blocker_4.t1 (col_a CHAR(40), col_b int) ENGINE=INNODB;
-
---echo con1: Loading data
-INSERT INTO bup_ddl_blocker_1.t1 VALUES ("01 Some data to test", 10);
-INSERT INTO bup_ddl_blocker_1.t1 VALUES ("02 Some data to test", 09);
-INSERT INTO bup_ddl_blocker_1.t1 VALUES ("03 Some data to test", 12);
-
-INSERT INTO bup_ddl_blocker_2.t1 VALUES ("01 Some data to test", 3);
-INSERT INTO bup_ddl_blocker_2.t1 VALUES ("02 Some data to test", 8);
-INSERT INTO bup_ddl_blocker_2.t1 VALUES ("03 Some data to test", 11);
-
-CREATE INDEX 2t1col_b ON bup_ddl_blocker_2.t1 (col_b);
-
-INSERT INTO bup_ddl_blocker_3.t1 VALUES ("01 Some data to test", 2);
-INSERT INTO bup_ddl_blocker_3.t1 VALUES ("02 Some data to test", 4);
-INSERT INTO bup_ddl_blocker_3.t1 VALUES ("03 Some data to test", 5);
-
-INSERT INTO bup_ddl_blocker_4.t1 VALUES ("01 Some data to test", 1);
-INSERT INTO bup_ddl_blocker_4.t1 VALUES ("02 Some data to test", 12);
-INSERT INTO bup_ddl_blocker_4.t1 VALUES ("03 Some data to test", 3);
-
-CREATE INDEX 4t1col_b ON bup_ddl_blocker_4.t1 (col_b);
-
-connection con2;
-
---echo con2: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'after_start_ddl SIGNAL con2_started WAIT_FOR status_shown';
---echo con2: Get a DDL going and stop in the middle
-send CREATE INDEX 1t1col_b ON bup_ddl_blocker_1.t1 (col_b);
-
-connection con3;
-
---echo con3: Wait for con2 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con2_started';
---echo con3: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'after_start_ddl SIGNAL con3_started WAIT_FOR status_shown';
---echo con3: Get a DDL going and stop in the middle
-send DROP INDEX 2t1col_b ON bup_ddl_blocker_2.t1;
-
-# Start the backup and allow it to break on lock.
-
-connection con1;
-
---echo con1: Wait for con3 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con3_started';
---echo con1: Activate synchronization points for backup.
-SET DEBUG_SYNC= 'before_block_ddl SIGNAL bup_blocked WAIT_FOR status_shown';
-SET DEBUG_SYNC= 'after_block_ddl SIGNAL bup_started WAIT_FOR status_shown2';
---echo con1: Backing up database -- will block with lock
-send BACKUP DATABASE bup_ddl_blocker_1, bup_ddl_blocker_2,
- bup_ddl_blocker_3, bup_ddl_blocker_4
- TO "bup_ddl_blocker.bak";
-
-connection con6;
-
---echo con6: Wait for con1 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR bup_blocked';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "BACKUP DATABASE%";
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "CREATE INDEX 1t1col_b%";
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "DROP INDEX 2t1col_b%";
-
---echo con6: Resume all and wait for backup to start after DDL finish.
-SET DEBUG_SYNC= 'now SIGNAL status_shown WAIT_FOR bup_started';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "BACKUP DATABASE%";
-
-connection con4;
-
---echo con4: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'before_check_ddl_blocked SIGNAL con4_started
- WAIT_FOR status_shown2';
---echo con4: Try a DDL but it is blocked by backup -- will not be in backup
-send CREATE INDEX 3t1col_b ON bup_ddl_blocker_3.t1 (col_b);
-
-connection con5;
-
---echo con5: Wait for con4 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con4_started';
---echo con5: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'before_check_ddl_blocked SIGNAL con5_started
- WAIT_FOR status_shown2';
---echo con5: Try a DDL but it is blocked by backup -- will not be in backup
-send DROP INDEX 4t1col_b ON bup_ddl_blocker_4.t1;
-
-connection con6;
-
---echo con6: Wait for con5 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con5_started';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "CREATE INDEX 3t1col_b%";
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "DROP INDEX 4t1col_b%";
-
---echo con6: Resume all.
-SET DEBUG_SYNC= 'now SIGNAL status_shown2';
-
-# Reconnect to connections and fetch their results.
-
-connection con2;
---echo con2: Completing DDL
-reap;
-
-connection con3;
---echo con3: Completing DDL
-reap;
-
-connection con4;
---echo con4: Completing DDL
-reap;
-
-connection con5;
---echo con5: Completing DDL
-reap;
-
-# Reconnect to con1 and fetch its result.
+#
-connection con1;
---replace_column 1 #
-reap;
+--remove_file $bdir/bml_test.bkp
+DROP DATABASE bml_test;
+DROP PROCEDURE test.check_results;
-##############################################################
--echo
---echo Verifying Test 6 results for backup.
+--echo ########################################################
+--echo #
+--echo # Test BACKUP with statements not blocked by BML:
+--echo # CREATE USER and CREATE SERVER
+--echo #
+--echo ########################################################
--echo
-##############################################################
-
-# Show that all changes got applied.
---echo con1: Showing database tables after updates and backup
---echo con1: bup_ddl_blocker_2 and bup_ddl_blocker_4 indexes are not present
---query_vertical SHOW INDEX FROM bup_ddl_blocker_1.t1
---query_vertical SHOW INDEX FROM bup_ddl_blocker_2.t1
---query_vertical SHOW INDEX FROM bup_ddl_blocker_3.t1
---query_vertical SHOW INDEX FROM bup_ddl_blocker_4.t1
-
---echo con1: Dropping the database tables
-DROP DATABASE bup_ddl_blocker_1;
-DROP DATABASE bup_ddl_blocker_2;
-DROP DATABASE bup_ddl_blocker_3;
-DROP DATABASE bup_ddl_blocker_4;
-
---echo con1: Restoring the database
---replace_column 1 #
---disable_warnings
-RESTORE FROM "bup_ddl_blocker.bak" OVERWRITE;
---enable_warnings
-
---echo con1: Showing databases that were backed up
---echo con1: bup_ddl_blocker_2 and bup_ddl_blocker_3 indexes are not present
---query_vertical SHOW INDEX FROM bup_ddl_blocker_1.t1
---query_vertical SHOW INDEX FROM bup_ddl_blocker_2.t1
---query_vertical SHOW INDEX FROM bup_ddl_blocker_3.t1
---query_vertical SHOW INDEX FROM bup_ddl_blocker_4.t1
-
---echo con1: Cleanup
-DROP DATABASE bup_ddl_blocker_1;
-DROP DATABASE bup_ddl_blocker_2;
-DROP DATABASE bup_ddl_blocker_3;
-DROP DATABASE bup_ddl_blocker_4;
-
-##############################################################
---echo
---echo Starting Test 6 - Restore
---echo
-##############################################################
-
---disable_warnings
-DROP DATABASE IF EXISTS bup_ddl_blocker_1;
-DROP DATABASE IF EXISTS bup_ddl_blocker_2;
-DROP DATABASE IF EXISTS bup_ddl_blocker_3;
-DROP DATABASE IF EXISTS bup_ddl_blocker_4;
---enable_warnings
-
-# Create databases.
---echo con1: Creating databases
-CREATE DATABASE bup_ddl_blocker_1;
-CREATE DATABASE bup_ddl_blocker_2;
-CREATE DATABASE bup_ddl_blocker_3;
-CREATE DATABASE bup_ddl_blocker_4;
-
-# Create transaction tables and load them with data.
---echo con1: Creating tables
-CREATE TABLE bup_ddl_blocker_1.t1 (col_a CHAR(40), col_b int) ENGINE=INNODB;
-CREATE TABLE bup_ddl_blocker_2.t1 (col_a CHAR(40), col_b int) ENGINE=INNODB;
-CREATE TABLE bup_ddl_blocker_3.t1 (col_a CHAR(40), col_b int) ENGINE=INNODB;
-CREATE TABLE bup_ddl_blocker_4.t1 (col_a CHAR(40), col_b int) ENGINE=INNODB;
-
---echo con1: Loading data
-INSERT INTO bup_ddl_blocker_1.t1 VALUES ("01 Some data to test", 10);
-INSERT INTO bup_ddl_blocker_1.t1 VALUES ("02 Some data to test", 09);
-INSERT INTO bup_ddl_blocker_1.t1 VALUES ("03 Some data to test", 12);
-
-INSERT INTO bup_ddl_blocker_2.t1 VALUES ("01 Some data to test", 3);
-INSERT INTO bup_ddl_blocker_2.t1 VALUES ("02 Some data to test", 8);
-INSERT INTO bup_ddl_blocker_2.t1 VALUES ("03 Some data to test", 11);
-
-CREATE INDEX 2t1col_b ON bup_ddl_blocker_2.t1 (col_b);
-
-INSERT INTO bup_ddl_blocker_3.t1 VALUES ("01 Some data to test", 2);
-INSERT INTO bup_ddl_blocker_3.t1 VALUES ("02 Some data to test", 4);
-INSERT INTO bup_ddl_blocker_3.t1 VALUES ("03 Some data to test", 5);
-
-INSERT INTO bup_ddl_blocker_4.t1 VALUES ("01 Some data to test", 1);
-INSERT INTO bup_ddl_blocker_4.t1 VALUES ("02 Some data to test", 12);
-INSERT INTO bup_ddl_blocker_4.t1 VALUES ("03 Some data to test", 3);
-
-CREATE INDEX 4t1col_b ON bup_ddl_blocker_4.t1 (col_b);
-# Get a backup to work with.
---remove_file $MYSQLTEST_VARDIR/master-data/bup_ddl_blocker_orig.bak
---replace_column 1 #
-BACKUP DATABASE bup_ddl_blocker_1, bup_ddl_blocker_2,
- bup_ddl_blocker_3, bup_ddl_blocker_4
- TO "bup_ddl_blocker_orig.bak";
-
-connection con2;
-
---echo con2: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'after_start_ddl SIGNAL con2_started WAIT_FOR status_shown';
---echo con2: Get a DDL going and stop in the middle
-send CREATE INDEX 1t1col_b ON bup_ddl_blocker_1.t1 (col_b);
-
-connection con3;
-
---echo con3: Wait for con2 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con2_started';
---echo con3: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'after_start_ddl SIGNAL con3_started WAIT_FOR status_shown';
---echo con3: Get a DDL going and stop in the middle
-send DROP INDEX 2t1col_b ON bup_ddl_blocker_2.t1;
-
-# Start the backup and allow it to break on lock.
-
-connection con1;
-
---echo con1: Wait for con3 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con3_started';
---echo con1: Activate synchronization points for restore.
-SET DEBUG_SYNC= 'before_block_ddl SIGNAL bup_blocked WAIT_FOR status_shown';
-SET DEBUG_SYNC= 'after_block_ddl SIGNAL bup_started WAIT_FOR status_shown2';
---echo con1: Restoring database -- will block with lock
-send RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE;
-
-connection con6;
-
---echo con6: Wait for con1 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR bup_blocked';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "RESTORE FROM%";
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "CREATE INDEX 1t1col_b%";
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "DROP INDEX 2t1col_b%";
-
---echo con6: Resume all and wait for restore to start after DDL finish.
-SET DEBUG_SYNC= 'now SIGNAL status_shown WAIT_FOR bup_started';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "RESTORE FROM%";
-
-connection con4;
-
---echo con4: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'before_check_ddl_blocked SIGNAL con4_started
- WAIT_FOR status_shown2';
---echo con4: Try a DDL but it is blocked by backup -- will not be in backup
-send CREATE INDEX 3t1col_b ON bup_ddl_blocker_3.t1 (col_b);
-
-connection con5;
-
---echo con5: Wait for con4 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con4_started';
---echo con5: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'before_check_ddl_blocked SIGNAL con5_started
- WAIT_FOR status_shown2';
---echo con5: Try a DDL but it is blocked by backup -- will not be in backup
-send DROP INDEX 4t1col_b ON bup_ddl_blocker_4.t1;
-
-connection con6;
-
---echo con6: Wait for con5 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con5_started';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "CREATE INDEX 3t1col_b%";
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "DROP INDEX 4t1col_b%";
-
---echo con6: Resume all.
-SET DEBUG_SYNC= 'now SIGNAL status_shown2';
-
-# Reconnect to connections and fetch their results.
-
-connection con2;
---echo con2: Completing DDL
-reap;
-
-connection con3;
---echo con3: Completing DDL
-reap;
-
-connection con4;
---echo con4: Completing DDL
-reap;
-
-connection con5;
---echo con5: Completing DDL
-reap;
-
-# Reconnect to con1 and fetch its result.
+connection default;
+SET DEBUG_SYNC= 'reset';
+PURGE BACKUP LOGS;
+CREATE DATABASE bml_test;
-connection con1;
---replace_column 1 #
-reap;
+ connection con1;
+ --echo # con1: Start CREATE USER statement and make it stop after it has started.
+ SET DEBUG_SYNC= 'before_execute_sql_command SIGNAL ddl1_started
+ WAIT_FOR continue_ddl';
+ --send CREATE USER bml_usr;
+
+# Start BACKUP
+
+ connection con5;
+ --echo # con5: Wait for DDL to reach its synchronization point.
+ SET DEBUG_SYNC= 'now WAIT_FOR ddl1_started TIMEOUT 3';
+ # To be safe clear before_execute_sql_command which is hit by
+ # every executed statement
+ SET DEBUG_SYNC='before_execute_sql_command CLEAR';
+
+ --echo # con5: Start BACKUP command making it to stop in the middle.
+ SET DEBUG_SYNC= 'after_backup_start_backup SIGNAL bup_started
+ WAIT_FOR finish_bup';
+ # arrange for deterministic backup_id = 500
+ SET SESSION debug="+d,set_backup_id";
+ --send BACKUP DATABASE bml_test TO 'bml_test.bkp';
+
+connection default;
+--echo # Waiting for BACKUP to reach its synchronization point.
+SET DEBUG_SYNC= 'now WAIT_FOR bup_started TIMEOUT 3';
-##############################################################
+--echo # Check the state of both statements.
+eval SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
+ WHERE info LIKE "BACKUP DATABASE%"
+ OR info LIKE "CREATE USER%";
+--echo # Checking that CREATE USER has not executed yet.
+SELECT User, Password FROM mysql.user WHERE User like 'bml%';
+--echo # Checking that BACKUP is not blocked by DDL.
+SELECT object, notes, error_num FROM mysql.backup_progress WHERE backup_id=500;
+
+--echo # Resume and reap CREATE USER;
+SET DEBUG_SYNC= 'now SIGNAL continue_ddl';
+
+ connection con1;
+ --reap
+ --echo # Check that CREATE USER has executed.
+ SELECT User, Password FROM mysql.user WHERE User like 'bml%';
+
+ --echo # See that bml_srv does not exist at this point.
+ SELECT Server_name FROM mysql.servers WHERE Server_name like 'bml%';
+ --echo # Start CREATE SERVER while BACKUP is in progress.
+ CREATE SERVER bml_srv FOREIGN DATA WRAPPER mysql OPTIONS (USER 'user');
+ --echo # See that it has executed.
+ SELECT Server_name FROM mysql.servers WHERE Server_name like 'bml%';
+
+ --echo # Let BACKUP finish its operation.
+ SET DEBUG_SYNC= 'now SIGNAL finish_bup';
+
+ connection con5;
+ --echo # Reap BACKUP.
+ --reap
+ SET debug="-d";
+ SET DEBUG_SYNC= 'reset';
+
+--echo
+--echo ########################################################
+--echo #
+--echo # Test RESTORE with statements not blocked by BML:
+--echo # DROP SERVER and SET PASSWORD
+--echo #
+--echo ########################################################
--echo
---echo Verifying Test 6 results for restore.
---echo
-##############################################################
-
---echo con1: Showing databases that were backed up
---echo con1: bup_ddl_blocker_1 and bup_ddl_blocker_4 indexes are not present
---query_vertical SHOW INDEX FROM bup_ddl_blocker_1.t1
---query_vertical SHOW INDEX FROM bup_ddl_blocker_2.t1
---query_vertical SHOW INDEX FROM bup_ddl_blocker_3.t1
---query_vertical SHOW INDEX FROM bup_ddl_blocker_4.t1
-
---echo con1: Cleanup
-DROP DATABASE bup_ddl_blocker_1;
-DROP DATABASE bup_ddl_blocker_2;
-DROP DATABASE bup_ddl_blocker_3;
-DROP DATABASE bup_ddl_blocker_4;
-# Cleanup
---remove_file $MYSQLTEST_VARDIR/master-data/bup_ddl_blocker.bak
+connection default;
+SET DEBUG_SYNC= 'reset';
+PURGE BACKUP LOGS;
+ connection con1;
+ SET DEBUG_SYNC= 'reset';
+ --echo # con1: Start DROP SERVER statement and make it stop after it has started.
+ SET DEBUG_SYNC= 'before_execute_sql_command SIGNAL ddl_started
+ WAIT_FOR continue_ddl';
+ --send DROP SERVER bml_srv;
+
+# Start RESTORE
+
+ connection con5;
+ --echo # con5: Wait for DDL to reach its synchronization point.
+ SET DEBUG_SYNC= 'now WAIT_FOR ddl_started TIMEOUT 3';
+ # To be safe clear before_execute_sql_command which is hit by
+ # every executed statement
+ SET DEBUG_SYNC='before_execute_sql_command CLEAR';
+
+ --echo # con5: Start RESTORE command making it to stop in the middle.
+ SET DEBUG_SYNC= 'after_backup_start_restore SIGNAL bup_started
+ WAIT_FOR finish_bup';
+ # arrange for deterministic backup_id = 500
+ SET SESSION debug="+d,set_backup_id";
+ --send RESTORE FROM 'bml_test.bkp' OVERWRITE;
+
+connection default;
+--echo # Waiting for RESTORE to reach its synchronization point.
+SET DEBUG_SYNC= 'now WAIT_FOR bup_started TIMEOUT 3';
+--echo # Check the state of both statements.
+eval SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
+ WHERE info LIKE "RESTORE FROM%"
+ OR info LIKE "DROP SERVER%";
+--echo # Checking that DROP SERVER has not executed yet.
+SELECT Server_name FROM mysql.servers WHERE Server_name like 'bml%';
+--echo # Checking that RESTORE is not blocked by DDL.
+SELECT object, notes, error_num FROM mysql.backup_progress WHERE backup_id=500;
+
+--echo # Resume and reap DROP SERVER;
+SET DEBUG_SYNC= 'now SIGNAL continue_ddl';
+
+ connection con1;
+ --reap
+ --echo # Check that DROP SERVER has executed.
+ SELECT Server_name FROM mysql.servers WHERE Server_name like 'bml%';
+
+ --echo # Check current user's pasword.
+ SELECT User, Password FROM mysql.user WHERE User like 'bml%';
+ --echo # Start SET PASSWORD while RESTORE is in progress.
+ SET PASSWORD FOR bml_usr = PASSWORD('password');
+ --echo # See that password was set.
+ SELECT User, Password FROM mysql.user WHERE User like 'bml%';
+
+ --echo # Let RESTORE finish its operation.
+ SET DEBUG_SYNC= 'now SIGNAL finish_bup';
+
+ connection con5;
+ --echo # Reap RESTORE.
+ --reap
+ SET debug="-d";
+ SET DEBUG_SYNC= 'reset';
-##############################################################
---echo
---echo Starting Test 7
---echo
-##############################################################
+ connection con1;
+ SET DEBUG_SYNC= 'reset';
#
-# Test 7 sequence diagram (not UML)
-#
-# con1 con2 con3 con4 con5
-# (setup) | | | |
-# | | | | |
-# | ALTER a.t1 | | |
-# | | ALTER b.t2 | |
-# | | | ALTER a.t3 |
-# | | | | lock("DDL_in_progress");
-# | | | | <wait for locks>
-# | | | | <release locks>
-# | <...> <...> <...> |
-# (results) | | | |
-#
-# Note: The resume of the commands is indicated with <...> and
-# may occur in any order.
+# Cleanup
#
---disable_warnings
-DROP TABLE IF EXISTS test.t2;
-DROP TABLE IF EXISTS bup_ddl_blocker.t1, bup_ddl_blocker.t3;
---enable_warnings
-
-# Create transaction tables and load them with data.
---echo con1: Creating tables
-CREATE TABLE bup_ddl_blocker.t1 (col_a CHAR(40)) ENGINE=INNODB;
-CREATE TABLE test.t2 (col_a CHAR(40)) ENGINE=MYISAM;
-CREATE TABLE bup_ddl_blocker.t3 (col_a CHAR(40)) ENGINE=MEMORY;
-
---echo con1: Loading data
-INSERT INTO bup_ddl_blocker.t1 VALUES ("01 Some data to test");
-INSERT INTO bup_ddl_blocker.t1 VALUES ("02 Some data to test");
-INSERT INTO bup_ddl_blocker.t1 VALUES ("03 Some data to test");
-
-INSERT INTO test.t2 VALUES ("01 Some data to test");
-INSERT INTO test.t2 VALUES ("02 Some data to test");
-INSERT INTO test.t2 VALUES ("03 Some data to test");
-
-INSERT INTO bup_ddl_blocker.t3 VALUES ("01 Some data to test");
-INSERT INTO bup_ddl_blocker.t3 VALUES ("02 Some data to test");
-INSERT INTO bup_ddl_blocker.t3 VALUES ("03 Some data to test");
-
---echo con1: Show that the new data doesn't exist before backup.
-SELECT * FROM bup_ddl_blocker.t1;
-SELECT * FROM test.t2;
-SELECT * FROM bup_ddl_blocker.t3;
-
-connection con2;
-
---echo con2: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'after_start_ddl SIGNAL con2_started WAIT_FOR status_shown';
---echo con2: Get a DDL going and stop in the middle
-send ALTER TABLE bup_ddl_blocker.t1 ADD COLUMN col_b int;
-
-connection con3;
-
---echo con3: Wait for con2 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con2_started';
---echo con3: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'after_start_ddl SIGNAL con3_started WAIT_FOR status_shown';
---echo con3: Get a DDL going and stop in the middle
-send ALTER TABLE test.t2 ADD COLUMN col_b int;
-
-connection con4;
-
---echo con3: Wait for con3 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con3_started';
---echo con3: Activate synchronization point for DDL.
-SET DEBUG_SYNC= 'after_start_ddl SIGNAL con4_started WAIT_FOR status_shown';
---echo con4: Get a DDL going and stop in the middle
-send ALTER TABLE bup_ddl_blocker.t3 ADD COLUMN col_b int;
-
-connection con5;
-
---echo con5: Wait for con4 to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR con4_started';
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "ALTER TABLE bup_ddl_blocker.t1%";
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "ALTER TABLE test.t2%";
-SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE info LIKE "ALTER TABLE bup_ddl_blocker.t3%";
-
---echo con5: Resume all.
-SET DEBUG_SYNC= 'now SIGNAL status_shown';
-
-# Reconnect to con2, con3, and con4 and fetch their results.
-
-connection con2;
---echo con2: Completing DDL
-reap;
-
-connection con3;
---echo con3: Completing DDL
-reap;
-
-connection con4;
---echo con4: Completing DDL
-reap;
-
-# Reconnect to con1 and show results
-
-connection con1;
-
-# Do selects to show that all changes got applied.
---echo con1: Showing columns after updates and backup
-DESCRIBE bup_ddl_blocker.t1;
-DESCRIBE test.t2;
-DESCRIBE bup_ddl_blocker.t3;
-##############################################################
---echo
---echo Verifying Test 7 results:
---echo
-##############################################################
-
---echo T1 should have the changes after backup - count(*) = 2
-SELECT count(*) FROM INFORMATION_SCHEMA.COLUMNS
-WHERE TABLE_NAME = 't1' AND TABLE_SCHEMA = 'bup_ddl_blocker';
-
---echo T2 should the changes after backup - count(*) = 2
-SELECT count(*) FROM INFORMATION_SCHEMA.COLUMNS
-WHERE TABLE_NAME = 't2' AND TABLE_SCHEMA = 'test';
-
---echo T3 should not have the changes after backup - count(*) = 2
-SELECT count(*) FROM INFORMATION_SCHEMA.COLUMNS
-WHERE TABLE_NAME = 't3' AND TABLE_SCHEMA = 'bup_ddl_blocker';
-
-DROP TABLE test.t2;
-DROP DATABASE bup_ddl_blocker;
-
-# Normally, when tests are run the test/ directory corresponding to the
-# test database is empty. In particular, it doesn't contain the db.opt
-# file storing database settings. Some tests rely on that, as they use
-# server options to determine these settings. If we backup test database
-# (e.g., with "BACKUP DATABASE * ...") and then restore it, then it will
-# be created using "CREATE DATABASE test" statement and this will create
-# the db.opt file. As a result, some tests run after that will fail. To
-# avoid this situation we remove the test/db.opt file as a part of
-# clean-up.
---error 0,1
---remove_file $MYSQLTEST_VARDIR/master-data/test/db.opt
---remove_file $MYSQLTEST_VARDIR/master-data/bup_ddl_blocker_orig.bak
+DROP DATABASE bml_test;
+DROP USER bml_usr;
connection default;
disconnect con1;
@@ -2082,7 +681,6 @@ disconnect con2;
disconnect con3;
disconnect con4;
disconnect con5;
-disconnect con6;
+PURGE BACKUP LOGS;
SET DEBUG_SYNC= 'reset';
-
=== modified file 'mysql-test/suite/backup/t/backup_timeout.test'
--- a/mysql-test/suite/backup/t/backup_timeout.test 2008-11-19 22:01:28 +0000
+++ b/mysql-test/suite/backup/t/backup_timeout.test 2008-12-17 14:32:46 +0000
@@ -1,5 +1,5 @@
#
-# This test is for the DDL blocker timeout feature.
+# This test is for the backup metadata lock (BML) timeout feature.
#
--source include/have_innodb.inc
@@ -14,7 +14,7 @@ SET DEBUG_SYNC= 'reset';
#
--error 0,1
---remove_file $MYSQLTEST_VARDIR/master-data/bup_ddl_blocker.bak;
+--remove_file $MYSQLTEST_VARDIR/master-data/bup_blocker.bak;
#
# Connections used in this test
@@ -34,19 +34,19 @@ connection con1;
# Create data for this test and tailor it to the test.
--disable_warnings
-DROP DATABASE IF EXISTS bup_ddl_blocker;
+DROP DATABASE IF EXISTS bup_bml;
--enable_warnings
-CREATE DATABASE bup_ddl_blocker;
+CREATE DATABASE bup_bml;
# Create a table and load it with data.
--echo con1: Creating tables
-CREATE TABLE bup_ddl_blocker.t1 (col_a CHAR(40)) ENGINE=INNODB;
+CREATE TABLE bup_bml.t1 (col_a CHAR(40)) ENGINE=INNODB;
--echo c