List:Commits« Previous MessageNext Message »
From:Chuck Bell Date:June 9 2008 7:52pm
Subject:RE: bk commit into 6.0 tree (istruewing:1.2623)
View as plain text  
Ingo,

A couple of things about this patch:

It doesn't apply correctly to the current branch (bzr) mysql-6.0-backup.
There are collisions/rejections in be_snapshot.cc, handler.cc and
debug_sync.cc. 

I get timeout errors on the backup_commit_blocker test on Windows. This may
be due to (what I fear) misplaced/misnamed breakpoints in commit blocker. I
have attached the log (if it helps). It never seems to get past the first
part of the test.

Question:
Is there any way we can add doxygen comments so that we can generate a list
of all breakpoints used in the code? This would be a real nice to have and a
great timesaver -- not to mention good for documentation. ;)

More comments below.

Chuck

> Below is the list of changes that have just been committed 
> into a local
> 6.0 repository of istruewing.  When istruewing does a push 
> these changes
> will be propagated to the main repository and, within 24 
> hours after the
> push, to the public repository.
> For information on how to access the public repository
> see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
> 
> ChangeSet@stripped, 2008-06-06 16:30:27+02:00, 
> istruewing@stripped +31 -0
>   Convert BACKUP_BREAKPOINT to DEBUG_SYNC.

Please specify WL#4259 in the patch comments. It would be easier to track it
there were.

>   
>   Changed synchronization point calls.
>   Adapted backup test cases and re-enabled them.
>   Removed all unused BACKUP_BREAKPOINTs. None is left.
>   Removed sql/backup/debug.h as it is now obsolete.
>   Removed inclusion of debug.h from many files.
>   Cleaned mysql-test/t/disabled.def.
>   
>   Fixed some random failures of wait_condition.inc with
>   information_schema.processlist.

I'd like to know how you did this. Was it just the new debug synch code or
have you fixed it some other way. I am suspicious only because I spent a
long time trying to fix it myself (and failed).

>   
>   Small fixes of the Debug Sync Facility:
>   Added extern "C" to improve linkability on some platforms.
>   Fixed compiler warnings.
>   Moved locking of the mutex out of the SIGNAL and WAIT_FOR branches.
>   Made a more verbose proc_info.
> 
>   BitKeeper/deleted/.del-debug.h~bdd8a2cd3122ae80@stripped, 
> 2008-06-06 16:05:26+02:00, istruewing@stripped +0 -0
>     Rename: sql/backup/debug.h -> 
> BitKeeper/deleted/.del-debug.h~bdd8a2cd3122ae80
> 
>   mysql-test/lib/mtr_report.pl@stripped, 2008-06-06 
> 16:30:24+02:00, istruewing@stripped +2 -0
>     Bug#34235 - Random failure of wait_condition.inc
>                 with information_schema.processlist
>     Added intentionally provoked errors to the ignore list.
> 
>   mysql-test/r/backup.result@stripped, 2008-06-06 16:30:24+02:00, 
> istruewing@stripped +10 -12
>     Convert BACKUP_BREAKPOINT to DEBUG_SYNC.
>     Changed result.
> 
>   mysql-test/r/backup_commit_blocker.result@stripped, 2008-06-06 
> 16:30:24+02:00, istruewing@stripped +100 -80
>     Convert BACKUP_BREAKPOINT to DEBUG_SYNC.
>     Changed result.
> 
>   mysql-test/r/backup_ddl_blocker.result@stripped, 2008-06-06 
> 16:30:25+02:00, istruewing@stripped +415 -256
>     Convert BACKUP_BREAKPOINT to DEBUG_SYNC.
>     Changed result.
> 
>   mysql-test/r/backup_progress.result@stripped, 2008-06-06 
> 16:30:25+02:00, istruewing@stripped +32 -43
>     Convert BACKUP_BREAKPOINT to DEBUG_SYNC.
>     Changed result.
> 
>   mysql-test/r/backup_snapshot.result@stripped, 2008-06-06 
> 16:30:25+02:00, istruewing@stripped +35 -23
>     Convert BACKUP_BREAKPOINT to DEBUG_SYNC.
>     Changed result.
> 
>   mysql-test/t/backup.test@stripped, 2008-06-06 16:30:25+02:00, 
> istruewing@stripped +11 -18
>     Convert BACKUP_BREAKPOINT to DEBUG_SYNC.
>     Changed test case.
> 
>   mysql-test/t/backup_commit_blocker.test@stripped, 2008-06-06 
> 16:30:25+02:00, istruewing@stripped +150 -231
>     Convert BACKUP_BREAKPOINT to DEBUG_SYNC.
>     Changed test case.
> 
>   mysql-test/t/backup_ddl_blocker.test@stripped, 2008-06-06 
> 16:30:25+02:00, istruewing@stripped +490 -784
>     Convert BACKUP_BREAKPOINT to DEBUG_SYNC.
>     Changed test case.
> 
>   mysql-test/t/backup_no_be.test@stripped, 2008-06-06 
> 16:30:25+02:00, istruewing@stripped +1 -1
>     Fixed a typo.
> 
>   mysql-test/t/backup_progress.test@stripped, 2008-06-06 
> 16:30:25+02:00, istruewing@stripped +46 -113
>     Convert BACKUP_BREAKPOINT to DEBUG_SYNC.
>     Changed test case.
> 
>   mysql-test/t/backup_security.test@stripped, 2008-06-06 
> 16:30:25+02:00, istruewing@stripped +1 -24
>     Bug#34235 - Random failure of wait_condition.inc
>                 with information_schema.processlist
>     Removed unnecessary wait conditions.
>     Removed unnecessary connection selections.
>     Beautified test case by shifting lines.
> 
>   mysql-test/t/backup_snapshot.test@stripped, 2008-06-06 
> 16:30:25+02:00, istruewing@stripped +59 -104
>     Convert BACKUP_BREAKPOINT to DEBUG_SYNC.
>     Changed test case.
> 
>   mysql-test/t/disabled.def@stripped, 2008-06-06 16:30:25+02:00, 
> istruewing@stripped +0 -6
>     Convert BACKUP_BREAKPOINT to DEBUG_SYNC.
>     Removed all converted test cases from the disabled list.
> 
>   sql/backup/Makefile.am@stripped, 2008-06-06 16:30:25+02:00, 
> istruewing@stripped +0 -1
>     Convert BACKUP_BREAKPOINT to DEBUG_SYNC.
>     Removed obolete header file.
> 
>   sql/backup/backup_test.cc@stripped, 2008-06-06 16:30:25+02:00, 
> istruewing@stripped +1 -1
>     Bug#34235 - Random failure of wait_condition.inc
>                 with information_schema.processlist
>     Fixed a copy-n-paste slip.
> 
>   sql/backup/be_default.cc@stripped, 2008-06-06 16:30:25+02:00, 
> istruewing@stripped +1 -2
>     Convert BACKUP_BREAKPOINT to DEBUG_SYNC.
>     Removed inclusion of obsolete header file.
>     Changed a synchronization point call.
> 
>   sql/backup/be_snapshot.cc@stripped, 2008-06-06 16:30:25+02:00, 
> istruewing@stripped +4 -4
>     Convert BACKUP_BREAKPOINT to DEBUG_SYNC.
>     Removed inclusion of obsolete header file.
>     Removed unused breakpoint.
>     Changed synchronization point calls.
> 
>   sql/backup/data_backup.cc@stripped, 2008-06-06 16:30:25+02:00, 
> istruewing@stripped +5 -14
>     Convert BACKUP_BREAKPOINT to DEBUG_SYNC.
>     Removed inclusion of obsolete header file.
>     Removed unused breakpoints.
>     Changed synchronization point calls.
> 
>   sql/backup/kernel.cc@stripped, 2008-06-06 16:30:25+02:00, 
> istruewing@stripped +2 -11
>     Convert BACKUP_BREAKPOINT to DEBUG_SYNC.
>     Removed inclusion of obsolete header file.
>     Removed unused breakpoints.
>     Changed synchronization point calls.
> 
>   sql/backup/logger.h@stripped, 2008-06-06 16:30:25+02:00, 
> istruewing@stripped +2 -2
>     Convert BACKUP_BREAKPOINT to DEBUG_SYNC.
>     Added inclusion of the DEBUG_SYNC declaration.
>     Removed inclusion of obsolete header file.
>     Changed a synchronization point call.
> 
>   sql/backup/stream.h@stripped, 2008-06-06 16:30:25+02:00, 
> istruewing@stripped +0 -1
>     Convert BACKUP_BREAKPOINT to DEBUG_SYNC.
>     Removed inclusion of obsolete header file.
> 
>   sql/ddl_blocker.cc@stripped, 2008-06-06 16:30:25+02:00, 
> istruewing@stripped +4 -6
>     Convert BACKUP_BREAKPOINT to DEBUG_SYNC.
>     Changed synchronization point calls.
>     Removed unused breakpoint.
> 
>   sql/ddl_blocker.h@stripped, 2008-06-06 16:30:25+02:00, 
> istruewing@stripped +0 -1
>     Convert BACKUP_BREAKPOINT to DEBUG_SYNC.
>     Removed inclusion of obsolete header file.
> 
>   sql/debug_sync.cc@stripped, 2008-06-06 16:30:25+02:00, 
> istruewing@stripped +29 -14
>     WL#4259 - Debug Sync Facility
>     Added extern "C" to improve linkability on some platforms.
>     Fixed compiler warnings.
>     Moved locking of the mutex out of the SIGNAL and WAIT_FOR 
> branches.
>     Made a more verbose proc_info.
> 
>   sql/handler.cc@stripped, 2008-06-06 16:30:25+02:00, 
> istruewing@stripped +1 -2
>     Convert BACKUP_BREAKPOINT to DEBUG_SYNC.
>     Removed inclusion of obsolete header file.
>     Changed a synchronization point call.
> 
>   sql/lock.cc@stripped, 2008-06-06 16:30:25+02:00, 
> istruewing@stripped +57 -2
>     Convert BACKUP_BREAKPOINT to DEBUG_SYNC.
>     Added new synchronization points.
>     Added DBUG_PRINTs.
> 
>   sql/sql_delete.cc@stripped, 2008-06-06 16:30:25+02:00, 
> istruewing@stripped +1 -8
>     Convert BACKUP_BREAKPOINT to DEBUG_SYNC.
>     Removed inclusion of obsolete header file.
>     Changed a synchronization point call.
> 
>   sql/sql_insert.cc@stripped, 2008-06-06 16:30:25+02:00, 
> istruewing@stripped +1 -3
>     Convert BACKUP_BREAKPOINT to DEBUG_SYNC.
>     Removed inclusion of obsolete header file.
>     Changed a synchronization point call.
> 
>   sql/sql_parse.cc@stripped, 2008-06-06 16:30:25+02:00, 
> istruewing@stripped +2 -3
>     Convert BACKUP_BREAKPOINT to DEBUG_SYNC.
>     Removed inclusion of obsolete header file.
>     Changed synchronization point calls.
> 
> diff -Nrup a/mysql-test/lib/mtr_report.pl 
> b/mysql-test/lib/mtr_report.pl
> --- a/mysql-test/lib/mtr_report.pl	2008-05-05 21:33:22 +02:00
> +++ b/mysql-test/lib/mtr_report.pl	2008-06-06 16:30:24 +02:00
> @@ -341,6 +341,8 @@ sub mtr_report_stats ($) {
>  		
>  		# ignore warning generated when backup engine 
> selection algorithm is tested
>  		($testname eq 'main.backup_no_be') and /Backup: 
> Cannot create backup engine/ or
> +		# ignore warnings generated when backup 
> privilege is tested
> +		($testname eq 'main.backup_security') and 
> /(Backup|Restore): Access denied; you need the SUPER/ or
>  		
>  		/Sort aborted/ or
>  		/Time-out in NDB/ or
> diff -Nrup a/mysql-test/r/backup.result b/mysql-test/r/backup.result
> --- a/mysql-test/r/backup.result	2008-05-14 18:28:28 +02:00
> +++ b/mysql-test/r/backup.result	2008-06-06 16:30:24 +02:00
> @@ -1,4 +1,4 @@
> -SET GLOBAL debug="d,backup_debug:d,backup";
> +SET DEBUG_SYNC= 'RESET';
>  DROP DATABASE IF EXISTS db1;
>  DROP DATABASE IF EXISTS db2;
>  DROP DATABASE IF EXISTS db3;
> @@ -42,14 +42,13 @@ CREATE TABLE `tasking` (
>  LOCK TABLES `tasking` WRITE;
>  INSERT INTO `tasking` VALUES 
> ('333445555','405',23),('123763153','405',33.5),('921312388','
> 601',44),('800122337','300',13),('820123637','300',9.5),('8301
> 32335','401',8.5),('333445555','300',11),('921312388','500',13
> ),('800122337','300',44),('820123637','401',500.5),('830132335
> ','400',12),('333445665','600',300.25),('123654321','607',444.
> 75),('123456789','300',1000);
>  UNLOCK TABLES;
> -breakpoints: Getting lock "locking_thread_added"
> -SELECT get_lock("locking_thread_added", 100);
> -get_lock("locking_thread_added", 100)
> -1
> +backup: Activate synchronization points for BACKUP.
> +SET DEBUG_SYNC= 'locking_thread_added SIGNAL bup_thread_added
> +                 WAIT_FOR finish';
>  backup: Send the backup command.
>  BACKUP DATABASE db1,db2 TO 'test.ba';
> -breakpoints: Check for lock in process list.
> -breakpoints: Checking locks.
> +breakpoints: Wait for BACKUP to reach its synchronization point.
> +SET DEBUG_SYNC= 'now WAIT_FOR bup_thread_added';
>  SELECT id, command, state, info FROM INFORMATION_SCHEMA.PROCESSLIST
>  WHERE info LIKE "BACKUP DATABASE%" OR info LIKE "default 
> driver locking thread%";
>  id	#
> @@ -58,12 +57,10 @@ state	Locking thread: holding table lock
>  info	default driver locking thread
>  id	#
>  command	Query
> -state	debug_sync_point: locking_thread_added
> +state	debug sync point: locking_thread_added
>  info	BACKUP DATABASE db1,db2 TO 'test.ba'
> -breakpoints: Release lock
> -SELECT release_lock("locking_thread_added");
> -release_lock("locking_thread_added")
> -1
> +breakpoints: Sending finish signal to wake BACKUP.
> +SET DEBUG_SYNC= 'now SIGNAL finish';
>  backup_id
>  #
>  DROP DATABASE db1;
> @@ -134,6 +131,7 @@ tasking	CREATE TABLE `tasking` (
>  DROP DATABASE db1;
>  DROP DATABASE db2;
>  DROP DATABASE db3;
> +SET DEBUG_SYNC= 'RESET';
>  DROP DATABASE IF EXISTS bup_default;
>  CREATE DATABASE bup_default;
>  CREATE TABLE bup_default.wide (
> diff -Nrup a/mysql-test/r/backup_commit_blocker.result 
> b/mysql-test/r/backup_commit_blocker.result
> --- a/mysql-test/r/backup_commit_blocker.result	
> 2007-12-04 18:38:00 +01:00
> +++ b/mysql-test/r/backup_commit_blocker.result	
> 2008-06-06 16:30:24 +02:00
> @@ -1,6 +1,6 @@
> +SET DEBUG_SYNC= 'RESET';
>  DROP DATABASE IF EXISTS bup_commit_blocker;
>  CREATE DATABASE bup_commit_blocker;
> -SET GLOBAL debug="d,backup_debug:d,backup";
>  
>  Starting Test 1
>  
> @@ -55,62 +55,72 @@ Assumption (b): TRX in commit is include
>  BEGIN;
>  INSERT INTO bup_commit_blocker.t2 VALUES ("con3: 04 Some 
> data to test");
>  INSERT INTO bup_commit_blocker.t2 VALUES ("con3: 05 Some 
> data to test");
> -con5: Getting lock on commit blocker.
> -SELECT get_lock("commit_blocker_step_1", 0);
> -get_lock("commit_blocker_step_1", 0)
> -1
> +con1: Activate synchronization points for BACKUP.
> +SET DEBUG_SYNC= 'before_commit_block SIGNAL bup_commit_block
> +                 WAIT_FOR bup_go_read_lock';
> +SET DEBUG_SYNC= 'wait_lock_global_read_lock SIGNAL bup_read_lock';
> +SET DEBUG_SYNC= 'before_backup_unblock_commit WAIT_FOR finish';
>  con1: Backing up database -- will block with lock
>  BACKUP DATABASE bup_commit_blocker TO "bup_commit_blocker.bak";
> -con5: Checking lock
> +con5: Wait for BACKUP to reach its synchronization point.
> +SET DEBUG_SYNC= 'now WAIT_FOR bup_commit_block';
>  SELECT state, info FROM
>  INFORMATION_SCHEMA.PROCESSLIST
>  WHERE info LIKE "BACKUP DATABASE%";
>  state	info
> -debug_sync_point: commit_blocker_step_1	BACKUP DATABASE 
> bup_commit_blocker TO "bup_commit_blocker.bak"
> -con3: Starting commit -- will block with lock
> +debug sync point: before_commit_block	BACKUP DATABASE 
> bup_commit_blocker TO "bup_commit_blocker.bak"
> +con3: Activate synchronization points for COMMIT.
> +SET DEBUG_SYNC= 'within_ha_commit_trans SIGNAL commit_read_locked
> +                 WAIT_FOR commit_go_done';

I prefered the original names of these breakpoints over these descriptive
names. While I don't object to changing them, I think this one in particular
isn't intuitive. Perhaps the best way to rename them is to give them the
names related to the steps in the commit blocker which are (from
backup_data.cc):

   ALGORITHM
     The algortihm is implemented using five steps.

     1) Preventing new write locks on tables -- lock_global_read_lock()

        The idea is that non-transactional tables should not be modified.
        It is also a prerequisite of step 3.

     2) Wait for existing locks to unlock -- close_cached_tables()

        Ensures that no non-transactional table has any write lock. And thus
        no non-transactional engine can change any data (Note that the
global
        read lock from step 1 is still in effect).

     3) Prevents new commits and waits for running commits to finish --
        make_global_read_lock_block_commit()

        This will make it impossible to enter commit phase in any
transaction.
        This will also wait for any ongoing commit to finish.
        When the function returns, no transaction is in its commit phase.

     4) Read binlog position & do lock calls to all backup drivers

        This step will read the binlog position and save it in the
backup_info
        structure. This will occur between the lock() and unlock() calls in
        the kernel.

     5) unlock_global_read_lock()

        This step unlocks the global read lock and thereby terminating the
        commit blocker.

> +SET DEBUG_SYNC= 'after_commit SIGNAL commit_done
> +                 WAIT_FOR finish';
> +con3: Starting commit -- will block on sync point
>  COMMIT;
> -con5: Checking lock
> +con5: Wait for COMMIT to reach its synchronization point.
> +SET DEBUG_SYNC= 'now WAIT_FOR commit_read_locked';
>  SELECT state, info FROM
>  INFORMATION_SCHEMA.PROCESSLIST
>  WHERE info LIKE "COMMIT%";
>  state	info
> -debug_sync_point: commit_blocker_step_1	COMMIT
> -con5: Getting lock on commit blocker.
> -SELECT get_lock("backup_commit_blocker", 0);
> -get_lock("backup_commit_blocker", 0)
> -1
> -con5: Checking lock
> +debug sync point: within_ha_commit_trans	COMMIT
> +con5: Let BACKUP run until the next sync point.
> +SET DEBUG_SYNC= 'now SIGNAL bup_go_read_lock WAIT_FOR bup_read_lock';
>  SELECT state, info FROM
>  INFORMATION_SCHEMA.PROCESSLIST
>  WHERE info LIKE "BACKUP DATABASE%";
>  state	info
> -debug_sync_point: backup_commit_blocker	BACKUP DATABASE 
> bup_commit_blocker TO "bup_commit_blocker.bak"
> -con5: Checking lock
> +Waiting to get readlock	BACKUP DATABASE 
> bup_commit_blocker TO "bup_commit_blocker.bak"
> +con5: Let COMMIT continue until end of statement.
> +SET DEBUG_SYNC= 'now SIGNAL commit_go_done WAIT_FOR commit_done';
>  SELECT state, info FROM
>  INFORMATION_SCHEMA.PROCESSLIST
>  WHERE info LIKE "COMMIT%";
>  state	info
> -debug_sync_point: backup_commit_blocker	COMMIT
> -con4: Starting begin -- will block with lock
> +debug sync point: after_commit	COMMIT
> +con4: Activate synchronization point for BEGIN.
> +SET DEBUG_SYNC= 'before_begin_trans SIGNAL begin_starting
> +                 WAIT_FOR finish';
> +con4: Starting begin -- will block on sync point
>  Assumption (c): TRX not started is not included in backup
>  BEGIN;
> -con5: Checking lock
> +con5: Wait for BEGIN to reach its synchronization point.
> +SET DEBUG_SYNC= 'now WAIT_FOR begin_starting';
>  SELECT state, info FROM
>  INFORMATION_SCHEMA.PROCESSLIST
>  WHERE info LIKE "BEGIN%";
>  state	info
> -debug_sync_point: backup_commit_blocker	BEGIN
> -con5: Releasing lock
> -SELECT release_lock("backup_commit_blocker");
> -release_lock("backup_commit_blocker")
> -1
> +debug sync point: before_begin_trans	BEGIN
> +con5: Sending finish signal to wake them all.
> +SET DEBUG_SYNC= 'now SIGNAL finish';
>  con2: Completing transaction
>  DELETE FROM bup_commit_blocker.t1 WHERE col_a LIKE '02%';
>  COMMIT;
> -con3: Completing transaction
> +con3: Fetch COMMIT result
> +con4: Fetch BEGIN result and completing transaction
>  UPDATE bup_commit_blocker.t3 SET col_a = "con4: 05 CHANGED" 
> WHERE col_a LIKE '05%';
>  UPDATE bup_commit_blocker.t3 SET col_a = "con4: 06 CHANGED" 
> WHERE col_a LIKE '06%';
>  COMMIT;
> +con1: Fetch BACKUP result
>  backup_id
>  #
>  con1: Showing data after updates and backup
> @@ -185,6 +195,7 @@ count(*)
>  0
>  con1: Cleanup
>  DROP DATABASE bup_commit_blocker;
> +SET DEBUG_SYNC= 'RESET';
>  
>  Starting Test 2
>  
> @@ -201,23 +212,18 @@ col_a
>  30
>  40
>  50
> -con5: Getting lock on commit blocker.
> -SELECT get_lock("backup_commit_blocker", 0);
> -get_lock("backup_commit_blocker", 0)
> -1
> -con5: Checking lock
> +con1: Activate synchronization point for BACKUP.
> +SET DEBUG_SYNC= 'before_backup_data_unlock SIGNAL bup_data_unlock
> +                 WAIT_FOR finish';
>  con1: Backing up database -- will block with lock
>  BACKUP DATABASE bup_commit_blocker TO "bup_commit_blocker.bak";
> -con5: Getting lock on commit blocker.
> -SELECT get_lock("commit_blocker_step_4", 0);
> -get_lock("commit_blocker_step_4", 0)
> -1
> -con5: Checking lock
> +con5: Wait for BACKUP to reach its synchronization point.
> +SET DEBUG_SYNC= 'now WAIT_FOR bup_data_unlock';
>  SELECT state, info FROM
>  INFORMATION_SCHEMA.PROCESSLIST
>  WHERE info LIKE "BACKUP DATABASE%";
>  state	info
> -debug_sync_point: commit_blocker_step_4	BACKUP DATABASE 
> bup_commit_blocker TO "bup_commit_blocker.bak"
> +debug sync point: before_backup_data_unlock	BACKUP DATABASE 
> bup_commit_blocker TO "bup_commit_blocker.bak"
>  con7: Show that the statement in progress has executed before backup.
>  SELECT * FROM bup_commit_blocker.t5;
>  col_a
> @@ -226,24 +232,22 @@ col_a
>  30
>  40
>  50
> -con7: Starting non-trx about to start -- will block with lock
> +con7: Activate synchronization point for UPDATE.
> +SET DEBUG_SYNC= 'wait_if_global_read_lock SIGNAL upd_read_lock';
> +con7: Starting non-trx about to start
>  Assumption (e): non-TRX not started is not included in backup
>  UPDATE bup_commit_blocker.t5 SET col_a = 333 WHERE col_a = 30;
> -con5: Checking lock
> +con5: Wait for UPDATE to reach its synchronization point.
> +SET DEBUG_SYNC= 'now WAIT_FOR upd_read_lock';
>  SELECT state, info FROM
>  INFORMATION_SCHEMA.PROCESSLIST
>  WHERE info LIKE "UPDATE%";
>  state	info
>  Waiting for release of readlock	UPDATE 
> bup_commit_blocker.t5 SET col_a = 333 WHERE col_a = 30
> -con5: Releasing locks
> -SELECT release_lock("commit_blocker_step_4");
> -release_lock("commit_blocker_step_4")
> -1
> -SELECT release_lock("backup_commit_blocker");
> -release_lock("backup_commit_blocker")
> -NULL
> -con6: Completing statement
> -con7: Completing statement
> +con5: Sending finish signal to wake them all.
> +SET DEBUG_SYNC= 'now SIGNAL finish';
> +con7: Fetch UPDATE result
> +con1: Fetch BACKUP result
>  backup_id
>  #
>  con1: Showing data after updates and backup
> @@ -277,6 +281,7 @@ count(*)
>  0
>  con1: Cleanup
>  DROP DATABASE bup_commit_blocker;
> +SET DEBUG_SYNC= 'RESET';
>  
>  Starting Test 3
>  
> @@ -341,57 +346,68 @@ Assumption (b): TRX in commit is include
>  BEGIN;
>  INSERT INTO bup_commit_blocker.t2 VALUES ("con3: 04 Some 
> data to test");
>  INSERT INTO bup_commit_blocker.t2 VALUES ("con3: 05 Some 
> data to test");
> -con5: Getting lock on commit blocker.
> -SELECT get_lock("commit_blocker_step_1", 0);
> -get_lock("commit_blocker_step_1", 0)
> -1
> +con1: Activate synchronization points for BACKUP.
> +SET DEBUG_SYNC= 'before_commit_block SIGNAL bup_commit_block
> +                 WAIT_FOR bup_go_read_lock';
> +SET DEBUG_SYNC= 'wait_lock_global_read_lock SIGNAL bup_read_lock';
> +SET DEBUG_SYNC= 'before_backup_unblock_commit SIGNAL bup_unblocking
> +                 WAIT_FOR finish';
>  con1: Backing up database -- will block with lock
>  BACKUP DATABASE bup_commit_blocker TO "bup_commit_blocker.bak";
> -con5: Checking lock
> +con5: Wait for BACKUP to reach its synchronization point.
> +SET DEBUG_SYNC= 'now WAIT_FOR bup_commit_block';
>  SELECT state, info FROM
>  INFORMATION_SCHEMA.PROCESSLIST
>  WHERE info LIKE "BACKUP DATABASE%";
>  state	info
> -debug_sync_point: commit_blocker_step_1	BACKUP DATABASE 
> bup_commit_blocker TO "bup_commit_blocker.bak"
> -con3: Starting commit -- will block with lock
> +debug sync point: before_commit_block	BACKUP DATABASE 
> bup_commit_blocker TO "bup_commit_blocker.bak"
> +con3: Activate synchronization points for COMMIT.
> +SET DEBUG_SYNC= 'within_ha_commit_trans SIGNAL commit_read_locked
> +                 WAIT_FOR commit_go_done';
> +SET DEBUG_SYNC= 'after_commit WAIT_FOR finish';
> +con3: Starting commit -- will block on sync point
>  COMMIT;
> -con5: Checking lock
> +con5: Wait for COMMIT to reach its synchronization point.
> +SET DEBUG_SYNC= 'now WAIT_FOR commit_read_locked';
>  SELECT state, info FROM
>  INFORMATION_SCHEMA.PROCESSLIST
>  WHERE info LIKE "COMMIT%";
>  state	info
> -debug_sync_point: commit_blocker_step_1	COMMIT
> -con5: Getting lock on commit blocker.
> -SELECT get_lock("backup_commit_blocker", 0);
> -get_lock("backup_commit_blocker", 0)
> -1
> -con5: Checking lock
> +debug sync point: within_ha_commit_trans	COMMIT
> +con5: Let BACKUP run until the next sync point.
> +SET DEBUG_SYNC= 'now SIGNAL bup_go_read_lock WAIT_FOR bup_read_lock';
>  SELECT state, info FROM
>  INFORMATION_SCHEMA.PROCESSLIST
>  WHERE info LIKE "BACKUP DATABASE%";
>  state	info
> -debug_sync_point: backup_commit_blocker	BACKUP DATABASE 
> bup_commit_blocker TO "bup_commit_blocker.bak"
> -con5: Checking lock
> +Waiting to get readlock	BACKUP DATABASE 
> bup_commit_blocker TO "bup_commit_blocker.bak"
> +con5: Let COMMIT continue until the sync point at its end.
> +con5: The completed COMMIT implicitly wakes BACKUP.
> +con5: So wait for BACKUP to reach the next synchronization point.
> +SET DEBUG_SYNC= 'now SIGNAL commit_go_done WAIT_FOR bup_unblocking';
>  SELECT state, info FROM
>  INFORMATION_SCHEMA.PROCESSLIST
>  WHERE info LIKE "COMMIT%";
>  state	info
> -debug_sync_point: backup_commit_blocker	COMMIT
> +debug sync point: after_commit	COMMIT
> +SELECT state, info FROM
> +INFORMATION_SCHEMA.PROCESSLIST
> +WHERE info LIKE "BACKUP DATABASE%";
> +state	info
> +debug sync point: before_backup_unblock_commit	BACKUP 
> DATABASE bup_commit_blocker TO "bup_commit_blocker.bak"
> +con4: Activate synchronization point for BEGIN.
> +SET DEBUG_SYNC= 'before_begin_trans SIGNAL begin_starting
> +                 WAIT_FOR finish';
>  con4: Starting begin -- will block with lock
>  Assumption (c): TRX not started is not included in backup
>  BEGIN;
> -con5: Checking lock
> +con5: Wait for BEGIN to reach its synchronization point.
> +SET DEBUG_SYNC= 'now WAIT_FOR begin_starting';
>  SELECT state, info FROM
>  INFORMATION_SCHEMA.PROCESSLIST
>  WHERE info LIKE "BEGIN%";
>  state	info
> -debug_sync_point: backup_commit_blocker	BEGIN
> -con5: Checking lock
> -SELECT state, info FROM
> -INFORMATION_SCHEMA.PROCESSLIST
> -WHERE info LIKE "BACKUP DATABASE%";
> -state	info
> -debug_sync_point: backup_commit_blocker	BACKUP DATABASE 
> bup_commit_blocker TO "bup_commit_blocker.bak"
> +debug sync point: before_begin_trans	BEGIN
>  con7: Show that the statement in progress has executed before backup.
>  SELECT * FROM bup_commit_blocker.t5;
>  col_a
> @@ -400,27 +416,30 @@ col_a
>  30
>  40
>  50
> +con7: Activate synchronization point for DELETE.
> +SET DEBUG_SYNC= 'wait_if_global_read_lock SIGNAL del_read_lock';
>  con7: Starting non-trx about to start -- will block with lock
>  Assumption (e): non-TRX not started is not included in backup
>  DELETE FROM bup_commit_blocker.t5 WHERE col_a = 50;
> -con5: Checking lock
> +con5: Wait for DELETE to reach its synchronization point.
> +SET DEBUG_SYNC= 'now WAIT_FOR del_read_lock';
>  SELECT state, info FROM
>  INFORMATION_SCHEMA.PROCESSLIST
>  WHERE info LIKE "DELETE%";
>  state	info
>  Waiting for release of readlock	DELETE FROM 
> bup_commit_blocker.t5 WHERE col_a = 50
> -con5: Releasing lock
> -SELECT release_lock("backup_commit_blocker");
> -release_lock("backup_commit_blocker")
> -1
> +con5: Sending finish signal to wake them all.
> +SET DEBUG_SYNC= 'now SIGNAL finish';
>  con2: Completing transaction
>  DELETE FROM bup_commit_blocker.t2 WHERE col_a LIKE '02%';
>  COMMIT;
> -con3: Completing transaction
> +con3: Fetch COMMIT result
> +con4: Fetch BEGIN result and completing transaction
>  UPDATE bup_commit_blocker.t3 SET col_a = "con4: 05 CHANGED" 
> WHERE col_a LIKE '05%';
>  UPDATE bup_commit_blocker.t3 SET col_a = "con4: 06 CHANGED" 
> WHERE col_a LIKE '06%';
>  COMMIT;
> -con7: Completing statement
> +con7: Fetch DELETE result
> +con1: Fetch BACKUP result
>  backup_id
>  #
>  con1: Showing data after updates and backup
> @@ -513,3 +532,4 @@ count(*)
>  1
>  con1: Cleanup
>  DROP DATABASE bup_commit_blocker;
> +SET DEBUG_SYNC= 'RESET';
> diff -Nrup a/mysql-test/r/backup_ddl_blocker.result 
> b/mysql-test/r/backup_ddl_blocker.result
> --- a/mysql-test/r/backup_ddl_blocker.result	2007-12-20 
> 21:32:15 +01:00
> +++ b/mysql-test/r/backup_ddl_blocker.result	2008-06-06 
> 16:30:25 +02:00
> @@ -1,4 +1,4 @@
> -SET GLOBAL debug="d,backup_debug:d,backup";
> +SET DEBUG_SYNC= 'reset';
>  
>  Starting Test 1 - Backup
>  
> @@ -23,54 +23,67 @@ INSERT INTO bup_ddl_blocker.t4 VALUES ("
>  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;
> -con6: Getting lock on DDL in progress.
> -SELECT get_lock("DDL_in_progress", 0);
> -get_lock("DDL_in_progress", 0)
> -1
> +con2: Activate synchronization point for DDL.
> +SET DEBUG_SYNC= 'after_start_ddl SIGNAL con2_started 

Why was DDL_blocked and DDL_in_progress changed to be the same breakpoint?
That seems suspicious.

> 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: Checking locks
> +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: DDL_in_progress	BACKUP DATABASE 
> bup_ddl_blocker TO "bup_ddl_blocker.bak"
> +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: DDL_in_progress	CREATE TABLE 
> bup_ddl_blocker.t1 (col_a CHAR(40)) ENGINE=INNODB
> +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: DDL_in_progress	ALTER TABLE 
> bup_ddl_blocker.t2 ADD COLUMN col_b int
> -con6: Getting lock on DDL blocker.
> -SELECT get_lock("DDL_blocked", 0);
> -get_lock("DDL_blocked", 0)
> -1
> -con6: Checking locks
> +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: DDL_blocked	BACKUP DATABASE 
> bup_ddl_blocker TO "bup_ddl_blocker.bak"
> +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
> -DDL blocker: DDL is blocked	CREATE TABLE bup_ddl_blocker.t3 
> (col_a CHAR(40)) ENGINE=INNODB
> +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
> -DDL blocker: DDL is blocked	ALTER TABLE bup_ddl_blocker.t4 
> ADD COLUMN col_b int
> -con6: Releasing lock
> -SELECT release_lock("DDL_blocked");
> -release_lock("DDL_blocked")
> -1
> +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
> @@ -144,54 +157,67 @@ DROP TABLE bup_ddl_blocker.t1, bup_ddl_b
>  BACKUP DATABASE bup_ddl_blocker to 'bup_ddl_blocker_orig.bak';
>  backup_id
>  #
> -con6: Getting lock on DDL in progress.
> -SELECT get_lock("DDL_in_progress", 0);
> -get_lock("DDL_in_progress", 0)
> -1
> +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";
> -con6: Checking locks
> +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: DDL_in_progress	RESTORE FROM 
> "bup_ddl_blocker_orig.bak"
> +debug sync point: before_block_ddl	RESTORE FROM 
> "bup_ddl_blocker_orig.bak"
>  SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
>  WHERE info LIKE "CREATE TABLE bup_ddl_blocker.t1%";
>  state	info
> -debug_sync_point: DDL_in_progress	CREATE TABLE 
> bup_ddl_blocker.t1 (col_a CHAR(40)) ENGINE=INNODB
> +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: DDL_in_progress	ALTER TABLE 
> bup_ddl_blocker.t2 ADD COLUMN col_b int
> -con6: Getting lock on DDL blocker.
> -SELECT get_lock("DDL_blocked", 0);
> -get_lock("DDL_blocked", 0)
> -1
> -con6: Checking locks
> +debug sync point: after_start_ddl	ALTER TABLE 

Is this really using the same breakpoint as DDL_in_progress? I find that
hard to believe it still works. Perhaps I am missing a point or don't
understand how the conversion works. Please enlighten me.

> 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: DDL_blocked	RESTORE FROM 
> "bup_ddl_blocker_orig.bak"
> +debug sync point: after_block_ddl	RESTORE FROM 
> "bup_ddl_blocker_orig.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
> -DDL blocker: DDL is blocked	CREATE TABLE bup_ddl_blocker.t3 
> (col_a CHAR(40)) ENGINE=INNODB
> +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
> -DDL blocker: DDL is blocked	ALTER TABLE bup_ddl_blocker.t4 
> ADD COLUMN col_b int
> -con6: Releasing lock
> -SELECT release_lock("DDL_blocked");
> -release_lock("DDL_blocked")
> -1
> +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
> @@ -240,54 +266,67 @@ INSERT INTO bup_ddl_blocker.t3 VALUES ("
>  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");
> -con6: Getting lock on DDL in progress.
> -SELECT get_lock("DDL_in_progress", 0);
> -get_lock("DDL_in_progress", 0)
> -1
> +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: Checking locks
> +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: DDL_in_progress	BACKUP DATABASE 
> bup_ddl_blocker TO "bup_ddl_blocker.bak"
> +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: DDL_in_progress	RENAME TABLE 
> bup_ddl_blocker.t1 TO bup_ddl_blocker.t01
> +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: DDL_in_progress	REPAIR TABLE bup_ddl_blocker.t2
> -con6: Getting lock on DDL blocker.
> -SELECT get_lock("DDL_blocked", 0);
> -get_lock("DDL_blocked", 0)
> -1
> -con6: Checking locks
> +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: DDL_blocked	BACKUP DATABASE 
> bup_ddl_blocker TO "bup_ddl_blocker.bak"
> +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
> -DDL blocker: DDL is blocked	RENAME TABLE bup_ddl_blocker.t3 
> TO bup_ddl_blocker.t03
> +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
> -DDL blocker: DDL is blocked	REPAIR TABLE bup_ddl_blocker.t4
> -con6: Releasing lock
> -SELECT release_lock("DDL_blocked");
> -release_lock("DDL_blocked")
> -1
> +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
> @@ -352,54 +391,67 @@ INSERT INTO bup_ddl_blocker.t4 VALUES ("
>  BACKUP DATABASE bup_ddl_blocker to 'bup_ddl_blocker_orig.bak';
>  backup_id
>  #
> -con6: Getting lock on DDL in progress.
> -SELECT get_lock("DDL_in_progress", 0);
> -get_lock("DDL_in_progress", 0)
> -1
> +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";
> -con6: Checking locks
> +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: DDL_in_progress	RESTORE FROM 
> "bup_ddl_blocker_orig.bak"
> +debug sync point: before_block_ddl	RESTORE FROM 
> "bup_ddl_blocker_orig.bak"
>  SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
>  WHERE info LIKE "RENAME TABLE bup_ddl_blocker.t1%";
>  state	info
> -debug_sync_point: DDL_in_progress	RENAME TABLE 
> bup_ddl_blocker.t1 TO bup_ddl_blocker.t01
> +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: DDL_in_progress	REPAIR TABLE bup_ddl_blocker.t2
> -con6: Getting lock on DDL blocker.
> -SELECT get_lock("DDL_blocked", 0);
> -get_lock("DDL_blocked", 0)
> -1
> -con6: Checking locks
> +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: DDL_blocked	RESTORE FROM 
> "bup_ddl_blocker_orig.bak"
> +debug sync point: after_block_ddl	RESTORE FROM 
> "bup_ddl_blocker_orig.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
> -DDL blocker: DDL is blocked	RENAME TABLE bup_ddl_blocker.t3 
> TO bup_ddl_blocker.t03
> +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
> -DDL blocker: DDL is blocked	REPAIR TABLE bup_ddl_blocker.t4
> -con6: Releasing lock
> -SELECT release_lock("DDL_blocked");
> -release_lock("DDL_blocked")
> -1
> +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
> @@ -444,54 +496,67 @@ INSERT INTO bup_ddl_blocker.t3 VALUES ("
>  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");
> -con6: Getting lock on DDL in progress.
> -SELECT get_lock("DDL_in_progress", 0);
> -get_lock("DDL_in_progress", 0)
> -1
> +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: Checking locks
> +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: DDL_in_progress	BACKUP DATABASE 
> bup_ddl_blocker TO "bup_ddl_blocker.bak"
> +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: DDL_in_progress	OPTIMIZE TABLE 
> bup_ddl_blocker.t1
> +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: DDL_in_progress	DROP TABLE bup_ddl_blocker.t2
> -con6: Getting lock on DDL blocker.
> -SELECT get_lock("DDL_blocked", 0);
> -get_lock("DDL_blocked", 0)
> -1
> -con6: Checking locks
> +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: DDL_blocked	BACKUP DATABASE 
> bup_ddl_blocker TO "bup_ddl_blocker.bak"
> +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
> -DDL blocker: DDL is blocked	OPTIMIZE TABLE bup_ddl_blocker.t3
> +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
> -DDL blocker: DDL is blocked	DROP TABLE bup_ddl_blocker.t4
> -con6: Releasing lock
> -SELECT release_lock("DDL_blocked");
> -release_lock("DDL_blocked")
> -1
> +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	status	OK
> @@ -551,54 +616,67 @@ INSERT INTO bup_ddl_blocker.t4 VALUES ("
>  BACKUP DATABASE bup_ddl_blocker to 'bup_ddl_blocker_orig.bak';
>  backup_id
>  #
> -con6: Getting lock on DDL in progress.
> -SELECT get_lock("DDL_in_progress", 0);
> -get_lock("DDL_in_progress", 0)
> -1
> +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";
> -con6: Checking locks
> +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: DDL_in_progress	RESTORE FROM 
> "bup_ddl_blocker_orig.bak"
> +debug sync point: before_block_ddl	RESTORE FROM 
> "bup_ddl_blocker_orig.bak"
>  SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
>  WHERE info LIKE "OPTIMIZE TABLE bup_ddl_blocker.t1%";
>  state	info
> -debug_sync_point: DDL_in_progress	OPTIMIZE TABLE 
> bup_ddl_blocker.t1
> +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: DDL_in_progress	DROP TABLE bup_ddl_blocker.t2
> -con6: Getting lock on DDL blocker.
> -SELECT get_lock("DDL_blocked", 0);
> -get_lock("DDL_blocked", 0)
> -1
> -con6: Checking locks
> +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: DDL_blocked	RESTORE FROM 
> "bup_ddl_blocker_orig.bak"
> +debug sync point: after_block_ddl	RESTORE FROM 
> "bup_ddl_blocker_orig.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
> -DDL blocker: DDL is blocked	OPTIMIZE TABLE bup_ddl_blocker.t3
> +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
> -DDL blocker: DDL is blocked	DROP TABLE bup_ddl_blocker.t4
> -con6: Releasing lock
> -SELECT release_lock("DDL_blocked");
> -release_lock("DDL_blocked")
> -1
> +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	status	OK
> @@ -644,54 +722,67 @@ SHOW DATABASES LIKE 'bup_ddl_blocker_%';
>  Database (bup_ddl_blocker_%)
>  bup_ddl_blocker_2
>  bup_ddl_blocker_4
> -con6: Getting lock on DDL in progress.
> -SELECT get_lock("DDL_in_progress", 0);
> -get_lock("DDL_in_progress", 0)
> -1
> +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: Checking locks
> +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: DDL_in_progress	BACKUP DATABASE * TO 
> "bup_ddl_blocker.bak"
> +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: DDL_in_progress	CREATE DATABASE 
> bup_ddl_blocker_1
> +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: DDL_in_progress	DROP DATABASE bup_ddl_blocker_2
> -con6: Getting lock on DDL blocker.
> -SELECT get_lock("DDL_blocked", 0);
> -get_lock("DDL_blocked", 0)
> -1
> -con6: Checking locks
> +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: DDL_blocked	BACKUP DATABASE * TO 
> "bup_ddl_blocker.bak"
> +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
> -DDL blocker: DDL is blocked	CREATE DATABASE bup_ddl_blocker_3
> +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
> -DDL blocker: DDL is blocked	DROP DATABASE bup_ddl_blocker_4
> -con6: Releasing lock
> -SELECT release_lock("DDL_blocked");
> -release_lock("DDL_blocked")
> -1
> +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
> @@ -751,54 +842,67 @@ bup_ddl_blocker_4
>  BACKUP DATABASE bup_ddl_blocker_2, bup_ddl_blocker_4 to 
> 'bup_ddl_blocker_orig.bak';
>  backup_id
>  #
> -con6: Getting lock on DDL in progress.
> -SELECT get_lock("DDL_in_progress", 0);
> -get_lock("DDL_in_progress", 0)
> -1
> +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";
> -con6: Checking locks
> +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: DDL_in_progress	RESTORE FROM 
> "bup_ddl_blocker_orig.bak"
> +debug sync point: before_block_ddl	RESTORE FROM 
> "bup_ddl_blocker_orig.bak"
>  SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
>  WHERE info LIKE "CREATE DATABASE bup_ddl_blocker_1%";
>  state	info
> -debug_sync_point: DDL_in_progress	CREATE DATABASE 
> bup_ddl_blocker_1
> +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: DDL_in_progress	DROP DATABASE bup_ddl_blocker_2
> -con6: Getting lock on DDL blocker.
> -SELECT get_lock("DDL_blocked", 0);
> -get_lock("DDL_blocked", 0)
> -1
> -con6: Checking locks
> +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: DDL_blocked	RESTORE FROM 
> "bup_ddl_blocker_orig.bak"
> +debug sync point: after_block_ddl	RESTORE FROM 
> "bup_ddl_blocker_orig.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
> -DDL blocker: DDL is blocked	CREATE DATABASE bup_ddl_blocker_3
> +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
> -DDL blocker: DDL is blocked	DROP DATABASE bup_ddl_blocker_4
> -con6: Releasing lock
> -SELECT release_lock("DDL_blocked");
> -release_lock("DDL_blocked")
> -1
> +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
> @@ -839,54 +943,67 @@ SHOW DATABASES LIKE 'bup_ddl_blocker_%';
>  Database (bup_ddl_blocker_%)
>  bup_ddl_blocker_2
>  bup_ddl_blocker_4
> -con6: Getting lock on DDL in progress.
> -SELECT get_lock("DDL_in_progress", 0);
> -get_lock("DDL_in_progress", 0)
> -1
> +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: Checking locks
> +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: DDL_in_progress	BACKUP DATABASE * TO 
> "bup_ddl_blocker.bak"
> +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: DDL_in_progress	TRUNCATE TABLE 
> bup_ddl_blocker_2.t1
> +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: DDL_in_progress	ALTER DATABASE 
> bup_ddl_blocker_2 CHARACTER SET latin2
> -con6: Getting lock on DDL blocker.
> -SELECT get_lock("DDL_blocked", 0);
> -get_lock("DDL_blocked", 0)
> -1
> -con6: Checking locks
> +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: DDL_blocked	BACKUP DATABASE * TO 
> "bup_ddl_blocker.bak"
> +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
> -DDL blocker: DDL is blocked	ALTER DATABASE 
> bup_ddl_blocker_4 CHARACTER SET latin2
> +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
> -DDL blocker: DDL is blocked	TRUNCATE TABLE bup_ddl_blocker_4.t1
> -con6: Releasing lock
> -SELECT release_lock("DDL_blocked");
> -release_lock("DDL_blocked")
> -1
> +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
> @@ -975,54 +1092,67 @@ bup_ddl_blocker_4
>  BACKUP DATABASE bup_ddl_blocker_2, bup_ddl_blocker_4 to 
> 'bup_ddl_blocker_orig.bak';
>  backup_id
>  #
> -con6: Getting lock on DDL in progress.
> -SELECT get_lock("DDL_in_progress", 0);
> -get_lock("DDL_in_progress", 0)
> -1
> +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";
> -con6: Checking locks
> +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: DDL_in_progress	RESTORE FROM 
> "bup_ddl_blocker_orig.bak"
> +debug sync point: before_block_ddl	RESTORE FROM 
> "bup_ddl_blocker_orig.bak"
>  SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
>  WHERE info LIKE "ALTER DATABASE bup_ddl_blocker_2%";
>  state	info
> -debug_sync_point: DDL_in_progress	ALTER DATABASE 
> bup_ddl_blocker_2 CHARACTER SET latin2
> +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: DDL_in_progress	TRUNCATE TABLE 
> bup_ddl_blocker_2.t1
> -con6: Getting lock on DDL blocker.
> -SELECT get_lock("DDL_blocked", 0);
> -get_lock("DDL_blocked", 0)
> -1
> -con6: Checking locks
> +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: DDL_blocked	RESTORE FROM 
> "bup_ddl_blocker_orig.bak"
> +debug sync point: after_block_ddl	RESTORE FROM 
> "bup_ddl_blocker_orig.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 "TRUNCATE TABLE bup_ddl_blocker_4%";
>  state	info
> -DDL blocker: DDL is blocked	TRUNCATE TABLE bup_ddl_blocker_4.t1
> +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
> -DDL blocker: DDL is blocked	ALTER DATABASE 
> bup_ddl_blocker_4 CHARACTER SET latin2
> -con6: Releasing lock
> -SELECT release_lock("DDL_blocked");
> -release_lock("DDL_blocked")
> -1
> +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
> @@ -1087,60 +1217,73 @@ INSERT INTO bup_ddl_blocker_4.t1 VALUES 
>  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);
> -con6: Getting lock on DDL in progress.
> -SELECT get_lock("DDL_in_progress", 0);
> -get_lock("DDL_in_progress", 0)
> -1
> +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: Checking locks
> +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: DDL_in_progress	BACKUP DATABASE 
> bup_ddl_blocker_1, bup_ddl_blocker_2,
> +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: DDL_in_progress	CREATE INDEX 1t1col_b 
> ON bup_ddl_blocker_1.t1 (col_b)
> +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: DDL_in_progress	DROP INDEX 2t1col_b ON 
> bup_ddl_blocker_2.t1
> -con6: Getting lock on DDL blocker.
> -SELECT get_lock("DDL_blocked", 0);
> -get_lock("DDL_blocked", 0)
> -1
> -con6: Checking locks
> +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: DDL_blocked	BACKUP DATABASE 
> bup_ddl_blocker_1, bup_ddl_blocker_2,
> +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
> -DDL blocker: DDL is blocked	CREATE INDEX 3t1col_b ON 
> bup_ddl_blocker_3.t1 (col_b)
> +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
> -DDL blocker: DDL is blocked	DROP INDEX 4t1col_b ON 
> bup_ddl_blocker_4.t1
> -con6: Releasing lock
> -SELECT release_lock("DDL_blocked");
> -release_lock("DDL_blocked")
> -1
> +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
> @@ -1265,57 +1408,67 @@ bup_ddl_blocker_3, bup_ddl_blocker_4
>  TO "bup_ddl_blocker_orig.bak";
>  backup_id
>  #
> -con6: Getting lock on DDL in progress.
> -SELECT get_lock("DDL_in_progress", 0);
> -get_lock("DDL_in_progress", 0)
> -1
> +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";
> -con6: Checking locks
> +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: DDL_in_progress	RESTORE FROM 
> "bup_ddl_blocker_orig.bak"
> +debug sync point: before_block_ddl	RESTORE FROM 
> "bup_ddl_blocker_orig.bak"
>  SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
>  WHERE info LIKE "CREATE INDEX 1t1col_b%";
>  state	info
> -debug_sync_point: DDL_in_progress	CREATE INDEX 1t1col_b 
> ON bup_ddl_blocker_1.t1 (col_b)
> +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: DDL_in_progress	DROP INDEX 2t1col_b ON 
> bup_ddl_blocker_2.t1
> -con6: Getting lock on DDL blocker.
> -SELECT get_lock("DDL_blocked", 0);
> -get_lock("DDL_blocked", 0)
> -1
> -con6: Checking locks
> +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: DDL_blocked	RESTORE FROM 
> "bup_ddl_blocker_orig.bak"
> +debug sync point: after_block_ddl	RESTORE FROM 
> "bup_ddl_blocker_orig.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
> -DDL blocker: DDL is blocked	CREATE INDEX 3t1col_b ON 
> bup_ddl_blocker_3.t1 (col_b)
> -Timeout in wait_condition.inc for SELECT state = "DDL 
> blocker: DDL is blocked"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -WHERE info LIKE "DDROP INDEX 4t1col_b%"
> +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
> -DDL blocker: DDL is blocked	DROP INDEX 4t1col_b ON 
> bup_ddl_blocker_4.t1
> -con6: Releasing lock
> -SELECT release_lock("DDL_blocked");
> -release_lock("DDL_blocked")
> -1
> +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
> @@ -1397,33 +1550,38 @@ col_a
>  01 Some data to test
>  02 Some data to test
>  03 Some data to test
> -con5: Getting lock on DDL in progress.
> -SELECT get_lock("DDL_not_blocked", 0);
> -get_lock("DDL_not_blocked", 0)
> -1
> +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: Checking locks
> +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: DDL_not_blocked	ALTER TABLE 
> bup_ddl_blocker.t1 ADD COLUMN col_b int
> +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: DDL_not_blocked	ALTER TABLE test.t2 ADD 
> COLUMN col_b int
> +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: DDL_not_blocked	ALTER TABLE 
> bup_ddl_blocker.t3 ADD COLUMN col_b int
> -con5: Releasing lock
> -SELECT release_lock("DDL_not_blocked");
> -release_lock("DDL_not_blocked")
> -1
> +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
> @@ -1460,3 +1618,4 @@ count(*)
>  2
>  DROP TABLE test.t2;
>  DROP DATABASE bup_ddl_blocker;
> +SET DEBUG_SYNC= 'reset';
> diff -Nrup a/mysql-test/r/backup_progress.result 
> b/mysql-test/r/backup_progress.result
> --- a/mysql-test/r/backup_progress.result	2008-03-20 
> 15:53:06 +01:00
> +++ b/mysql-test/r/backup_progress.result	2008-06-06 
> 16:30:25 +02:00
> @@ -1,6 +1,6 @@
> +SET DEBUG_SYNC= 'reset';
>  DROP DATABASE IF EXISTS backup_progress;
>  DROP TABLE IF EXISTS backup_progress.t1_res;
> -SET GLOBAL debug="d,backup_debug:d,backup";
>  CREATE DATABASE backup_progress;
>  con1: Create table and new users.
>  CREATE TABLE backup_progress.t1 (a char(30)) ENGINE=MYISAM;
> @@ -25,49 +25,41 @@ INSERT INTO backup_progress.t3 VALUES ("
>  INSERT INTO backup_progress.t3 VALUES ("03 Test #1 - progress");
>  INSERT INTO backup_progress.t3 VALUES ("04 Test #1 - progress");
>  Do backup of database
> -SELECT get_lock("bp_starting_state", 0);
> -get_lock("bp_starting_state", 0)
> -1
> +con2: Activate sync points for the backup statement.
> +SET DEBUG_SYNC= 'after_backup_log_init     SIGNAL started   
> WAIT_FOR do_run';
> +SET DEBUG_SYNC= 'after_backup_start_backup SIGNAL phase1    
> WAIT_FOR backup';
> +SET DEBUG_SYNC= 'after_backup_validated    SIGNAL validated 
> WAIT_FOR do_phase2';
> +SET DEBUG_SYNC= 'after_backup_binlog       SIGNAL phase2    
> WAIT_FOR finish';
>  con2: Send backup command.
>  BACKUP DATABASE backup_progress to 'backup_progress_orig.bak';
> -con1: Checking locks.
> -con1: Checking progress.
> +con1: Wait for the backup to be started.
> +SET DEBUG_SYNC= 'now WAIT_FOR started';
> +con1: Display progress
>  SELECT MAX(backup_id) INTO @bup_id FROM mysql.online_backup 
> WHERE command LIKE "BACKUP DATABASE backup_progress%";
>  INSERT INTO backup_progress.t1_res (id) VALUES (@bup_id);
>  SELECT backup_state FROM mysql.online_backup AS ob JOIN 
> backup_progress.t1_res as t1 ON ob.backup_id = t1.id;
>  backup_state
>  starting
> -con1: Advance the lock.
> -SELECT get_lock("bp_running_state", 0);
> -get_lock("bp_running_state", 0)
> -1
> -con1: Checking locks.
> -con1: Checking progress.
> +con1: Let backup step to running state.
> +SET DEBUG_SYNC= 'now SIGNAL do_run WAIT_FOR phase1';
> +con1: Display progress
>  SELECT backup_state FROM mysql.online_backup AS ob JOIN 
> backup_progress.t1_res as t1 ON ob.backup_id = t1.id;
>  backup_state
>  running
> -con1: Advance the lock.
> -SELECT get_lock("bp_vp_state", 0);
> -get_lock("bp_vp_state", 0)
> -1
> -con1: Checking locks.
> -con1: Checking progress.
> +con1: Let backup do the backup phase1.
> +SET DEBUG_SYNC= 'now SIGNAL backup WAIT_FOR validated';
> +con1: Display progress
>  SELECT backup_state FROM mysql.online_backup AS ob JOIN 
> backup_progress.t1_res as t1 ON ob.backup_id = t1.id;
>  backup_state
>  validity point
> -con1: Advance the lock.
> -SELECT get_lock("bp_running_state", 0);
> -get_lock("bp_running_state", 0)
> -1
> -con1: Checking locks.
> -con1: Checking progress.
> +con1: Let backup do the backup phase2.
> +SET DEBUG_SYNC= 'now SIGNAL do_phase2 WAIT_FOR phase2';
> +con1: Display progress
>  SELECT backup_state FROM mysql.online_backup AS ob JOIN 
> backup_progress.t1_res as t1 ON ob.backup_id = t1.id;
>  backup_state
>  running
> -con1: Advance the lock.
> -SELECT release_lock("bp_running_state");
> -release_lock("bp_running_state")
> -1
> +con1: Let backup finish.
> +SET DEBUG_SYNC= 'now SIGNAL finish';
>  con2: Finish backup command
>  backup_id
>  #
> @@ -98,14 +90,15 @@ backup_id	object	start_time	
> stop_time	to
>  #	backup kernel	#	#	0	0	0	running
>  #	backup kernel	#	#	0	0	0	complete
>  Do restore of database
> -SELECT get_lock("bp_starting_state", 0);
> -get_lock("bp_starting_state", 0)
> -1
>  DELETE FROM backup_progress.t1_res;
> +con2: Activate sync points for the backup statement.
> +SET DEBUG_SYNC= 'after_backup_log_init      SIGNAL started 
> WAIT_FOR do_run';
> +SET DEBUG_SYNC= 'after_backup_start_restore SIGNAL running 
> WAIT_FOR finish';
>  con2: Send restore command.
>  RESTORE FROM 'backup_progress_orig.bak';
> -con1: Checking locks.
> -con1: Checking progress.
> +con1: Wait for the restore to be started.
> +SET DEBUG_SYNC= 'now WAIT_FOR started';
> +con1: Display progress
>  select * from backup_progress.t1_res;
>  id
>  SELECT MAX(backup_id) INTO @bup_id FROM mysql.online_backup 
> WHERE command LIKE "RESTORE FROM%";
> @@ -113,19 +106,14 @@ INSERT INTO backup_progress.t1_res (id) 
>  SELECT backup_state FROM mysql.online_backup AS ob JOIN 
> backup_progress.t1_res as t1 ON ob.backup_id = t1.id;
>  backup_state
>  starting
> -con1: Advance the lock.
> -SELECT get_lock("bp_running_state", 0);
> -get_lock("bp_running_state", 0)
> -1
> -con1: Checking locks.
> -con1: Checking progress.
> +con1: Let restore step to running state.
> +SET DEBUG_SYNC= 'now SIGNAL do_run WAIT_FOR running';
> +con1: Display progress
>  SELECT backup_state FROM mysql.online_backup AS ob JOIN 
> backup_progress.t1_res as t1 ON ob.backup_id = t1.id;
>  backup_state
>  running
> -con1: Advance the lock.
> -SELECT release_lock("bp_running_state");
> -release_lock("bp_running_state")
> -1
> +con1: Let restore do its job and finish.
> +SET DEBUG_SYNC= 'now SIGNAL finish';
>  con2: Finish restore command
>  backup_id
>  #
> @@ -156,4 +144,5 @@ backup_id	object	start_time	
> stop_time	to
>  #	backup kernel	#	#	0	0	0	starting
>  #	backup kernel	#	#	0	0	0	running
>  #	backup kernel	#	#	0	0	0	complete
> +SET DEBUG_SYNC= 'reset';
>  DROP DATABASE backup_progress;
> diff -Nrup a/mysql-test/r/backup_snapshot.result 
> b/mysql-test/r/backup_snapshot.result
> --- a/mysql-test/r/backup_snapshot.result	2007-12-04 
> 18:38:02 +01:00
> +++ b/mysql-test/r/backup_snapshot.result	2008-06-06 
> 16:30:25 +02:00
> @@ -1,6 +1,9 @@
> +SET DEBUG_SYNC= 'reset';
>  DROP DATABASE IF EXISTS bup_snapshot;
> +#
> +# Setup for tests.
> +#
>  CREATE DATABASE bup_snapshot;
> -SET GLOBAL debug="d,backup_debug:d,backup";
>  CREATE TABLE bup_snapshot.t1 (word CHAR(20)) ENGINE=INNODB;
>  INSERT INTO bup_snapshot.t1 VALUES ("01 Some data to test");
>  INSERT INTO bup_snapshot.t1 VALUES ("02 Some data to test");
> @@ -23,21 +26,20 @@ COUNT(*)
>  SELECT COUNT(*) FROM bup_snapshot.t2;
>  COUNT(*)
>  5
> -con3: Getting lock on driver.
> -SELECT get_lock("backup_cs_locked", 100);
> -get_lock("backup_cs_locked", 100)
> -1
> +#
> +# Test 1: Check for consistent read prior to open and lock tables
> +#
> +con1: Activate sync points for the backup statement.
> +SET DEBUG_SYNC= 'after_backup_cs_locked SIGNAL locked 
> WAIT_FOR inserting';
>  con1: Backing up database. Spawn this and continue...
>  BACKUP DATABASE bup_snapshot TO "bup_snapshot.bak";
> -con3: Checking locks.
> +con2: Wait for backup to have locked the transaction.
> +SET DEBUG_SYNC= 'now WAIT_FOR locked';
> +con2: Start an insert now that CS has a transaction 
> +con2: Activate sync points for the insert statement.
> +SET DEBUG_SYNC= 'wait_if_global_read_lock SIGNAL inserting';
>  INSERT INTO bup_snapshot.t1 VALUES("- Dave Mathews");
> -con3: Checking locks.
> -con3: Release lock on driver.
> -SELECT release_lock("backup_cs_locked");
> -release_lock("backup_cs_locked")
> -1
> -backup_id
> -#
> +con2: insert additional rows.
>  INSERT INTO bup_snapshot.t1 VALUES("- Yes");
>  INSERT INTO bup_snapshot.t1 VALUES("- Jethro Tull");
>  DELETE FROM bup_snapshot.t1 WHERE word LIKE '10%';
> @@ -50,6 +52,11 @@ word
>  SELECT COUNT(*) FROM bup_snapshot.t1;
>  COUNT(*)
>  12
> +con1: retrieve backup result.
> +backup_id
> +#
> +# Now restore the database and then check to make sure the new rows
> +# were not backed up.
>  con1: Dropping the database
>  DROP TABLE bup_snapshot.t1;
>  con1: Restoring the database
> @@ -65,19 +72,20 @@ COUNT(*)
>  SELECT COUNT(*) FROM bup_snapshot.t2;
>  COUNT(*)
>  5
> -con3: Getting lock on driver.
> -SELECT get_lock("backup_cs_reading", 100);
> -get_lock("backup_cs_reading", 100)
> -1
> +#
> +# Test 2: Check for consistent read after open and lock tables
> +#
> +con1: Activate sync points for the backup statement.
> +SET DEBUG_SYNC= 'when_backup_cs_reading SIGNAL reading 

I like this naming scheme -- it matches the originals much better and is
easy to understand. ;)

> WAIT_FOR inserting';
>  con1: Backing up database. Spawn this and continue...
>  BACKUP DATABASE bup_snapshot TO "bup_snapshot.bak";
> -con3: Checking locks.
> +con2: Wait for backup to start reading.
> +SET DEBUG_SYNC= 'now WAIT_FOR reading';
> +con2: Start an insert now that CS has a transaction 
> +con2: Activate sync points for the insert statement.
> +SET DEBUG_SYNC= 'after_insert_locked_tables SIGNAL inserting';
>  INSERT INTO bup_snapshot.t1 VALUES("- Dave Mathews");
> -con3: Checking locks.
> -con3: Release lock on driver.
> -SELECT release_lock("backup_cs_reading");
> -release_lock("backup_cs_reading")
> -1
> +con2: insert additional rows.
>  INSERT INTO bup_snapshot.t1 VALUES("- Yes");
>  INSERT INTO bup_snapshot.t1 VALUES("- Jethro Tull");
>  DELETE FROM bup_snapshot.t1 WHERE word LIKE '10%';
> @@ -90,8 +98,11 @@ word
>  SELECT COUNT(*) FROM bup_snapshot.t1;
>  COUNT(*)
>  12
> +con1: retrieve backup result.
>  backup_id
>  #
> +# Now restore the database and then check to make sure the new rows
> +# were not backed up.
>  con1: Dropping the database
>  DROP TABLE bup_snapshot.t1;
>  con1: Restoring the database
> @@ -107,4 +118,5 @@ COUNT(*)
>  SELECT COUNT(*) FROM bup_snapshot.t2;
>  COUNT(*)
>  5
> +SET DEBUG_SYNC= 'reset';
>  DROP DATABASE bup_snapshot;
> diff -Nrup a/mysql-test/t/backup.test b/mysql-test/t/backup.test
> --- a/mysql-test/t/backup.test	2008-05-14 18:28:29 +02:00
> +++ b/mysql-test/t/backup.test	2008-06-06 16:30:25 +02:00
> @@ -1,15 +1,14 @@
>  --source include/have_innodb.inc
>  --source include/not_embedded.inc
> ---source include/have_debug.inc
> +--source include/have_debug_sync.inc
> +
> +SET DEBUG_SYNC= 'RESET';
>  
>  connect (backup,localhost,root,,);
>  connect (breakpoints,localhost,root,,);
>  
>  connection backup;
>  
> -# Setup the server to use the backup breakpoints
> -SET GLOBAL debug="d,backup_debug:d,backup";
> -
>  --disable_warnings
>  DROP DATABASE IF EXISTS db1;
>  DROP DATABASE IF EXISTS db2;
> @@ -105,31 +104,24 @@ UNLOCK TABLES;
>  # in the process list and not a complete test of the locking
>  # thread code.
>  #
> -connection breakpoints;
> ---echo breakpoints: Getting lock "locking_thread_added"
> -SELECT get_lock("locking_thread_added", 100);
> -
>  connection backup;
> +--echo backup: Activate synchronization points for BACKUP.
> +SET DEBUG_SYNC= 'locking_thread_added SIGNAL bup_thread_added
> +                 WAIT_FOR finish';
>  --echo backup: Send the backup command.
>  send BACKUP DATABASE db1,db2 TO 'test.ba';
>  
>  # get the lock and wait until lock is identified in process list
>  connection breakpoints;
> ---echo breakpoints: Check for lock in process list.
> -
> -# Wait for lock to be acquired and execution to reach breakpoint
> ---echo breakpoints: Checking locks.
> -let $wait_condition = SELECT count(*) = 1
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "default driver 
> locking thread%";
> ---source include/wait_condition.inc
> +--echo breakpoints: Wait for BACKUP to reach its 
> synchronization point.
> +SET DEBUG_SYNC= 'now WAIT_FOR bup_thread_added';
>  
>  --replace_column 1 #
>  query_vertical SELECT id, command, state, info FROM 
> INFORMATION_SCHEMA.PROCESSLIST
>  WHERE info LIKE "BACKUP DATABASE%" OR info LIKE "default 
> driver locking thread%";
>  
> ---echo breakpoints: Release lock
> -SELECT release_lock("locking_thread_added");
> +--echo breakpoints: Sending finish signal to wake BACKUP.
> +SET DEBUG_SYNC= 'now SIGNAL finish';
>  
>  # reattach to backup job
>  connection backup;
> @@ -174,6 +166,7 @@ SHOW CREATE TABLE tasking;
>  DROP DATABASE db1;
>  DROP DATABASE db2;
>  DROP DATABASE db3;
> +SET DEBUG_SYNC= 'RESET';
>  
>  #
>  # This test is for the default and snapshot online backup drivers
> diff -Nrup a/mysql-test/t/backup_commit_blocker.test 
> b/mysql-test/t/backup_commit_blocker.test
> --- a/mysql-test/t/backup_commit_blocker.test	2007-12-20 
> 21:32:16 +01:00
> +++ b/mysql-test/t/backup_commit_blocker.test	2008-06-06 
> 16:30:25 +02:00
> @@ -27,24 +27,13 @@
>  #
>  # TODO : Add a native driver to the test when one becomes available
>  #
> -# We use a breakpoint named "backup_commit_blocker" which is placed
> -# strategically in the code to allow the threads to pause at the 
> -# corresponding location for those goals above.
> -#
> -# Notes
> -#   You must use a dedicated connection for getting and 
> releasing locks.
> -# Do not issue a get_lock() or release_lock() in the same connection
> -# (thread) as code that calls BACKUP_BREAKPOINT(). Using the 
> same connection
> -# to get/release locks and run code that issues 
> BACKUP_BREAKPOINTs will result
> -# in an assertion using DEBUG_ASSERT(thd->ull == NULL) from 
> debug_sync_point()
> -# in item_func.cc.
> -#
>  
>  --source include/have_innodb.inc
> ---source include/have_debug.inc
> +--source include/have_debug_sync.inc
>  --source include/not_embedded.inc
>  
>  --disable_warnings
> +SET DEBUG_SYNC= 'RESET';
>  DROP DATABASE IF EXISTS bup_commit_blocker;
>  --error 0,1
>  --remove_file $MYSQLTEST_VARDIR/master-data/bup_commit_blocker.bak;
> @@ -59,7 +48,7 @@ CREATE DATABASE bup_commit_blocker;
>  # con2 - used for setting up transactions in progress
>  # con3 - used for setting up transactions in commit
>  # con4 - used for setting up transactions about to start
> -# con5 - used for setting and releasing breakpoints
> +# con5 - used to show status
>  # con6 - used for setting up non-transactions in progress
>  # con7 - used for setting up non-transactions about to start
>  #
> @@ -74,9 +63,6 @@ connect (con7,localhost,root,,);
>  
>  connection con1;
>  
> -# Setup the server to use the backup breakpoints
> -SET GLOBAL debug="d,backup_debug:d,backup";
> -
>  #
>  # Test 1 - transactional statements only
>  #
> @@ -96,16 +82,12 @@ SET GLOBAL debug="d,backup_debug:d,backu
>  #     |       |      BEGIN      |        |
>  #     |       |     INSERT t2   |        |
>  #     |       |     INSERT t2   |        |
> -#     |       |        |        |  lock("commit_blocker_step_1");
> +#     |       |        |        |    show status
>  #   BACKUP    |        |        |        |
> -#     |       |        |        |  <wait for locks>
>  #     |       |      COMMIT     |        |
> -#     |       |        |        |  <wait for locks>
> -#     |       |        |        |  lock("backup_commit_blocker");
> -#     |       |        |        |  <wait for locks>
> +#     |       |        |        |    show status
>  #     |       |        |      BEGIN      |
> -#     |       |        |        |  <wait for locks>
> -#     |       |        |        |  <release locks>
> +#     |       |        |        |    show status
>  #     |    DELETE t1   |        |        |
>  #     |     COMMIT     |        |        |
>  #     |       |      <...>      |        |
> @@ -163,14 +145,6 @@ BEGIN;
>    INSERT INTO bup_commit_blocker.t2 VALUES ("con3: 04 Some 
> data to test");
>    INSERT INTO bup_commit_blocker.t2 VALUES ("con3: 05 Some 
> data to test");
>  
> -connection con5;
> -
> -# Set the breakpoint for the commit blocker.
> ---echo con5: Getting lock on commit blocker.
> -SELECT get_lock("commit_blocker_step_1", 0);
> -
> -# Start the backup and allow it to break on lock.
> -
>  connection con1;
>  
>  #
> @@ -178,89 +152,73 @@ connection con1;
>  # We stop (with the lock) the backup after the metadata but 
> before the
>  # commit blocker.
>  #
> +--echo con1: Activate synchronization points for BACKUP.
> +SET DEBUG_SYNC= 'before_commit_block SIGNAL bup_commit_block
> +                 WAIT_FOR bup_go_read_lock';
> +SET DEBUG_SYNC= 'wait_lock_global_read_lock SIGNAL bup_read_lock';
> +SET DEBUG_SYNC= 'before_backup_unblock_commit WAIT_FOR finish';
>  --echo con1: Backing up database -- will block with lock
>  send BACKUP DATABASE bup_commit_blocker TO "bup_commit_blocker.bak";
>  
>  connection con5;
>  
> -# Wait for lock to be acquired and execution to reach breakpoint
> ---echo con5: Checking lock
> -let $wait_condition = SELECT state = "debug_sync_point: 
> commit_blocker_step_1"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "BACKUP DATABASE%";
> ---source include/wait_condition.inc
> -
> +--echo con5: Wait for BACKUP to reach its synchronization point.
> +SET DEBUG_SYNC= 'now WAIT_FOR bup_commit_block';
>  SELECT state, info FROM
>  INFORMATION_SCHEMA.PROCESSLIST
>  WHERE info LIKE "BACKUP DATABASE%";
>  
>  connection con3;
>  
> ---echo con3: Starting commit -- will block with lock
> +--echo con3: Activate synchronization points for COMMIT.
> +SET DEBUG_SYNC= 'within_ha_commit_trans SIGNAL commit_read_locked
> +                 WAIT_FOR commit_go_done';
> +SET DEBUG_SYNC= 'after_commit SIGNAL commit_done
> +                 WAIT_FOR finish';
> +--echo con3: Starting commit -- will block on sync point
>  send COMMIT;
>  
>  connection con5;
>  
> -# Wait for lock to be acquired and execution to reach breakpoint
> ---echo con5: Checking lock
> -let $wait_condition = SELECT state = "debug_sync_point: 
> commit_blocker_step_1"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "COMMIT%";
> ---source include/wait_condition.inc
> -
> +--echo con5: Wait for COMMIT to reach its synchronization point.
> +SET DEBUG_SYNC= 'now WAIT_FOR commit_read_locked';
>  SELECT state, info FROM
>  INFORMATION_SCHEMA.PROCESSLIST
>  WHERE info LIKE "COMMIT%";
>  
> -# Set the breakpoint for the commit blocker.
> ---echo con5: Getting lock on commit blocker.
> -SELECT get_lock("backup_commit_blocker", 0);
> -
> -# Wait for lock to be acquired and execution to reach breakpoint
> ---echo con5: Checking lock
> -let $wait_condition = SELECT state = "debug_sync_point: 
> backup_commit_blocker"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "BACKUP DATABASE%";
> ---source include/wait_condition.inc
> -
> +--echo con5: Let BACKUP run until the next sync point.
> +SET DEBUG_SYNC= 'now SIGNAL bup_go_read_lock WAIT_FOR bup_read_lock';
>  SELECT state, info FROM
>  INFORMATION_SCHEMA.PROCESSLIST
>  WHERE info LIKE "BACKUP DATABASE%";
>  
> -# Wait for lock to be acquired and execution to reach breakpoint
> ---echo con5: Checking lock
> -let $wait_condition = SELECT state = "debug_sync_point: 
> backup_commit_blocker"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "COMMIT%";
> ---source include/wait_condition.inc
> -
> +--echo con5: Let COMMIT continue until end of statement.
> +SET DEBUG_SYNC= 'now SIGNAL commit_go_done WAIT_FOR commit_done';
>  SELECT state, info FROM
>  INFORMATION_SCHEMA.PROCESSLIST
>  WHERE info LIKE "COMMIT%";
>  
>  connection con4;
>  
> ---echo con4: Starting begin -- will block with lock
> +--echo con4: Activate synchronization point for BEGIN.
> +SET DEBUG_SYNC= 'before_begin_trans SIGNAL begin_starting
> +                 WAIT_FOR finish';
> +--echo con4: Starting begin -- will block on sync point
>  --echo Assumption (c): TRX not started is not included in backup
>  send BEGIN;
>  
>  connection con5;
>  
> -# Wait for lock to be acquired and execution to reach breakpoint
> ---echo con5: Checking lock
> -let $wait_condition = SELECT state = "debug_sync_point: 
> backup_commit_blocker"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "BEGIN%";
> ---source include/wait_condition.inc
> -
> +--echo con5: Wait for BEGIN to reach its synchronization point.
> +SET DEBUG_SYNC= 'now WAIT_FOR begin_starting';
>  SELECT state, info FROM
>  INFORMATION_SCHEMA.PROCESSLIST
>  WHERE info LIKE "BEGIN%";
>  
> ---echo con5: Releasing lock
> -SELECT release_lock("backup_commit_blocker");
> +--echo con5: Sending finish signal to wake them all.
> +SET DEBUG_SYNC= 'now SIGNAL finish';
>  
> -# Reconnect to con2, con3, and con4 and allow them to finish.
> +# Reconnect to connections and fetch their results.
>  
>  connection con2;
>  
> @@ -269,18 +227,21 @@ connection con2;
>  COMMIT;
>  
>  connection con3;
> ---echo con3: Completing transaction
> +
> +--echo con3: Fetch COMMIT result
>  reap;
>  
>  connection con4;
> +
> +--echo con4: Fetch BEGIN result and completing transaction
>  reap;
>    UPDATE bup_commit_blocker.t3 SET col_a = "con4: 05 
> CHANGED" WHERE col_a LIKE '05%';
>    UPDATE bup_commit_blocker.t3 SET col_a = "con4: 06 
> CHANGED" WHERE col_a LIKE '06%';
>  COMMIT;
>  
> -# Reconnect to con1 and let backup finish.
> -
>  connection con1;
> +
> +--echo con1: Fetch BACKUP result
>  --replace_column 1 #
>  reap;
>  
> @@ -324,6 +285,7 @@ SELECT count(*) FROM bup_commit_blocker.
>  DROP DATABASE bup_commit_blocker;
>  
>  remove_file $MYSQLTEST_VARDIR/master-data/bup_commit_blocker.bak;
> +SET DEBUG_SYNC= 'RESET';
>  
>  #
>  # Test 2 - non-transactional statements only
> @@ -333,23 +295,29 @@ remove_file $MYSQLTEST_VARDIR/master-dat
>  --echo Starting Test 2
>  --echo 
>  
> +# Ingo: DELETE was disabled before converting the test from
> +#       BACKUP_BREAKPOINT to DEBUG_SYNC. I left it disabled
> +#       as an attempt to enable it made an infinite loop in
> +#       write_table_data() in the loop:
> +#    while (sch.prepare_count > 0)
> +#    if (sch.step())
> +#      goto error;
> +#        sch.prepare_count did not change from being 1.
> +#        When this is fixed, please remove this comment.
> +
>  #
>  # Test 2 sequence diagram (not UML)
>  #
>  #   con1     con2     con3     con4     con5     con6       con7
>  #  (setup)    |        |        |        |        |          |
>  #     |       |        |        |        |        |          |
> -#     |       |        |        |  lock("backup_commit_blocker");
> -#     |       |        |        |        |    DELETE t4      |
> -#     |       |        |        |  <wait for locks>          |
> +#     |       |        |        |        |   #DELETE t4      |
> +#     |       |        |        |   #show status  |          |
>  #   BACKUP    |        |        |        |        |          |
> -#     |       |        |        |  <wait for locks>          |
> -#     |       |        |        |  lock("commit_blocker_step_4");
> -#     |       |        |        |  <wait for locks>          |
> -#     |       |        |        |    (results)    |          |
> +#     |       |        |        |    show status  |          |
> +#     |       |        |        |        |        |       (results)
>  #     |       |        |        |        |        |       UPDATE t5
> -#     |       |        |        |  <wait for locks>          |
> -#     |       |        |        |  <release locks>|          |
> +#     |       |        |        |    show status  |          |
>  #   <...>     |        |        |        |      <...>      <...>
>  # (results)   |        |        |        |        |          |
>  #
> @@ -372,49 +340,34 @@ INSERT INTO bup_commit_blocker.t5 VALUES
>  #SELECT * FROM bup_commit_blocker.t4;
>  SELECT * FROM bup_commit_blocker.t5;
>  
> -connection con5;
> -
> -# Set the breakpoint for the commit blocker.
> ---echo con5: Getting lock on commit blocker.
> -SELECT get_lock("backup_commit_blocker", 0);
> -
> -connection con6;
> -
> +#connection con6;
> +#
> +#--echo con6: Activate synchronization point for DELETE.
> +#SET DEBUG_SYNC= 'at_delete_end SIGNAL del_at_end WAIT_FOR finish';
>  #--echo con6: Starting non-trx in progress -- will block with lock
>  #--echo Assumption (d): non-TRX in progress is included in backup
>  #send DELETE FROM bup_commit_blocker.t4 WHERE col_a <= 2;
> -
> -connection con5;
> -
> -# Wait for lock to be acquired and execution to reach breakpoint
> ---echo con5: Checking lock
> -#let $wait_condition = SELECT state = "debug_sync_point: 
> backup_commit_blocker"
> -#                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -#                      WHERE info LIKE "DELETE%";
> -#--source include/wait_condition.inc
> +#
> +#connection con5;
> +#
> +#--echo con5: Wait for DELETE to reach its synchronization point.
> +#SET DEBUG_SYNC= 'now WAIT_FOR del_at_end';
> +#SELECT state, info FROM
> +#INFORMATION_SCHEMA.PROCESSLIST
> +#WHERE info LIKE "DELETE%";
>  
>  connection con1;
>  
> +--echo con1: Activate synchronization point for BACKUP.
> +SET DEBUG_SYNC= 'before_backup_data_unlock SIGNAL bup_data_unlock
> +                 WAIT_FOR finish';
>  --echo con1: Backing up database -- will block with lock
>  send BACKUP DATABASE bup_commit_blocker TO "bup_commit_blocker.bak";
>  
>  connection con5;
>  
> -# Set the breakpoint for the commit blocker.
> -#
> -# This allows the statement that was inprogress to finish 
> and unblock the 
> -# backup which is waiting on open_and_lock_tables.
> -#
> ---echo con5: Getting lock on commit blocker.
> -SELECT get_lock("commit_blocker_step_4", 0);
> -
> -# Wait for lock to be acquired and execution to reach breakpoint
> ---echo con5: Checking lock
> -let $wait_condition = SELECT state = "debug_sync_point: 
> commit_blocker_step_4"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "BACKUP DATABASE%";
> ---source include/wait_condition.inc
> -
> +--echo con5: Wait for BACKUP to reach its synchronization point.
> +SET DEBUG_SYNC= 'now WAIT_FOR bup_data_unlock';
>  SELECT state, info FROM
>  INFORMATION_SCHEMA.PROCESSLIST
>  WHERE info LIKE "BACKUP DATABASE%";
> @@ -425,41 +378,38 @@ connection con7;
>  #SELECT * FROM bup_commit_blocker.t4;
>  SELECT * FROM bup_commit_blocker.t5;
>  
> ---echo con7: Starting non-trx about to start -- will block with lock
> +--echo con7: Activate synchronization point for UPDATE.
> +SET DEBUG_SYNC= 'wait_if_global_read_lock SIGNAL upd_read_lock';
> +--echo con7: Starting non-trx about to start
>  --echo Assumption (e): non-TRX not started is not included in backup
>  send UPDATE bup_commit_blocker.t5 SET col_a = 333 WHERE col_a = 30;
>  
>  connection con5;
>  
> -# Wait for lock to be acquired and execution to reach breakpoint
> ---echo con5: Checking lock
> -let $wait_condition = SELECT state = "Waiting for release of 
> readlock"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "UPDATE%";
> ---source include/wait_condition.inc
> -
> +--echo con5: Wait for UPDATE to reach its synchronization point.
> +SET DEBUG_SYNC= 'now WAIT_FOR upd_read_lock';
>  SELECT state, info FROM
>  INFORMATION_SCHEMA.PROCESSLIST
>  WHERE info LIKE "UPDATE%";
>  
> ---echo con5: Releasing locks
> -SELECT release_lock("commit_blocker_step_4");
> -SELECT release_lock("backup_commit_blocker");
> +--echo con5: Sending finish signal to wake them all.
> +SET DEBUG_SYNC= 'now SIGNAL finish';
>  
> -# Reconnect to con6 and con7 and allow them to finish.
> +# Reconnect to con6 and con7 and fetch their results.
>  
> -connection con6;
> -
> ---echo con6: Completing statement
> +#connection con6;
> +#
> +#--echo con6: Fetch DELETE result
>  #reap;
>  
>  connection con7;
> ---echo con7: Completing statement
> -reap;
>  
> -# Reconnect to con1 and let backup finish.
> +--echo con7: Fetch UPDATE result
> +reap;
>  
>  connection con1;
> +
> +--echo con1: Fetch BACKUP result
>  --replace_column 1 #
>  reap;
>  
> @@ -497,6 +447,7 @@ SELECT count(*) FROM bup_commit_blocker.
>  DROP DATABASE bup_commit_blocker;
>  
>  remove_file $MYSQLTEST_VARDIR/master-data/bup_commit_blocker.bak;
> +SET DEBUG_SYNC= 'RESET';
>  
>  #
>  # Test 3 - mix of both transactional and non-transactional statements
> @@ -517,20 +468,17 @@ remove_file $MYSQLTEST_VARDIR/master-dat
>  #     |       |      BEGIN      |        |        |          |
>  #     |       |     INSERT t2   |        |        |          |
>  #     |       |     INSERT t2   |        |        |          |
> -#     |       |        |        |  lock("commit_blocker_step_1");
>  #   BACKUP    |        |        |        |        |          |
> -#     |       |        |        |        |     INSERT t4     |
> -#     |       |        |        |  <wait for locks>          |
> +#     |       |        |        |        |    #INSERT t4     |
> +#     |       |        |        |    show status  |          |
>  #     |       |      COMMIT     |        |        |          |
> -#     |       |        |        |  <wait for locks>          |
> -#     |       |        |        |  lock("backup_commit_blocker");
> -#     |       |        |        |  <wait for locks>          |
> +#     |       |        |        |    show status  |          |
>  #     |       |        |      BEGIN      |        |          |
> -#     |       |        |        |  <wait for locks>          |
> +#     |       |        |        |    show status  |          |
>  #     |       |        |        |        |        |      (results)
>  #     |       |        |        |        |        |       DELETE t5
> -#     |       |        |        |  <wait for locks>          |
> -#     |       |        |        |  <release locks>|          |
> +#     |       |        |        |    show status  |          |
> +#     |       |        |        |     wake all    |          |
>  #     |    DELETE t1   |        |        |        |          |
>  #     |     COMMIT     |        |        |        |          |
>  #     |       |      <...>      |        |        |          |
> @@ -598,14 +546,6 @@ BEGIN;
>    INSERT INTO bup_commit_blocker.t2 VALUES ("con3: 04 Some 
> data to test");
>    INSERT INTO bup_commit_blocker.t2 VALUES ("con3: 05 Some 
> data to test");
>  
> -connection con5;
> -
> -# Set the breakpoint for the commit blocker.
> ---echo con5: Getting lock on commit blocker.
> -SELECT get_lock("commit_blocker_step_1", 0);
> -
> -# Start the backup and allow it to break on lock.
> -
>  connection con1;
>  
>  #
> @@ -613,137 +553,113 @@ connection con1;
>  # We stop (with the lock) the backup after the metadata but 
> before the
>  # commit blocker.
>  #
> +--echo con1: Activate synchronization points for BACKUP.
> +SET DEBUG_SYNC= 'before_commit_block SIGNAL bup_commit_block
> +                 WAIT_FOR bup_go_read_lock';
> +SET DEBUG_SYNC= 'wait_lock_global_read_lock SIGNAL bup_read_lock';
> +SET DEBUG_SYNC= 'before_backup_unblock_commit SIGNAL bup_unblocking
> +                 WAIT_FOR finish';
>  --echo con1: Backing up database -- will block with lock
>  send BACKUP DATABASE bup_commit_blocker TO "bup_commit_blocker.bak";
>  
> -connection con6;
> -
> +#connection con6;
> +#
> +#--echo con6: Activate synchronization point for INSERT.
> +#SET DEBUG_SYNC= 'after_insert_locked_tables SIGNAL 
> insert_table_locked
> +#                 WAIT_FOR finish';
>  #--echo con6: Starting non-trx in progress -- will block
>  #--echo Assumption (d): non-TRX in progress is included in backup
>  #send INSERT INTO bup_commit_blocker.t4 VALUES (31), (32), (33);
>  
>  connection con5;
>  
> -# Wait for lock to be acquired and execution to reach breakpoint
> ---echo con5: Checking lock
> -let $wait_condition = SELECT state = "debug_sync_point: 
> commit_blocker_step_1"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "BACKUP DATABASE%";
> ---source include/wait_condition.inc
> -
> +--echo con5: Wait for BACKUP to reach its synchronization point.
> +SET DEBUG_SYNC= 'now WAIT_FOR bup_commit_block';
>  SELECT state, info FROM
>  INFORMATION_SCHEMA.PROCESSLIST
>  WHERE info LIKE "BACKUP DATABASE%";
>  
> -# Wait for lock to be acquired and execution to reach breakpoint
> -#--echo con5: Checking lock
> -#let $wait_condition = SELECT state = "debug_sync_point: 
> commit_blocker_step_1"
> -#                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -#                      WHERE info LIKE "INSERT INTO 
> bup_commit_blocker.t4%";
> -#--source include/wait_condition.inc
> +#--echo con5: Wait for INSERT to reach its synchronization point.
> +#SET DEBUG_SYNC= 'now WAIT_FOR insert_table_locked';
> +#SELECT state, info FROM
> +#INFORMATION_SCHEMA.PROCESSLIST
> +#WHERE info LIKE "BACKUP DATABASE%";
>  
>  connection con3;
>  
> ---echo con3: Starting commit -- will block with lock
> +--echo con3: Activate synchronization points for COMMIT.
> +SET DEBUG_SYNC= 'within_ha_commit_trans SIGNAL commit_read_locked
> +                 WAIT_FOR commit_go_done';
> +SET DEBUG_SYNC= 'after_commit WAIT_FOR finish';
> +--echo con3: Starting commit -- will block on sync point
>  send COMMIT;
>  
>  connection con5;
>  
> -# Wait for lock to be acquired and execution to reach breakpoint
> ---echo con5: Checking lock
> -let $wait_condition = SELECT state = "debug_sync_point: 
> commit_blocker_step_1"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "COMMIT%";
> ---source include/wait_condition.inc
> -
> +--echo con5: Wait for COMMIT to reach its synchronization point.
> +SET DEBUG_SYNC= 'now WAIT_FOR commit_read_locked';
>  SELECT state, info FROM
>  INFORMATION_SCHEMA.PROCESSLIST
>  WHERE info LIKE "COMMIT%";
>  
> -# Set the breakpoint for the commit blocker.
> ---echo con5: Getting lock on commit blocker.
> -SELECT get_lock("backup_commit_blocker", 0);
> -
> -# Wait for lock to be acquired and execution to reach breakpoint
> ---echo con5: Checking lock
> -let $wait_condition = SELECT state = "debug_sync_point: 
> backup_commit_blocker"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "BACKUP DATABASE%";
> ---source include/wait_condition.inc
> -
> +--echo con5: Let BACKUP run until the next sync point.
> +SET DEBUG_SYNC= 'now SIGNAL bup_go_read_lock WAIT_FOR bup_read_lock';
>  SELECT state, info FROM
>  INFORMATION_SCHEMA.PROCESSLIST
>  WHERE info LIKE "BACKUP DATABASE%";
>  
> -# Wait for lock to be acquired and execution to reach breakpoint
> ---echo con5: Checking lock
> -let $wait_condition = SELECT state = "debug_sync_point: 
> backup_commit_blocker"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "COMMIT%";
> ---source include/wait_condition.inc
> -
> +--echo con5: Let COMMIT continue until the sync point at its end.
> +--echo con5: The completed COMMIT implicitly wakes BACKUP.
> +--echo con5: So wait for BACKUP to reach the next 
> synchronization point.
> +SET DEBUG_SYNC= 'now SIGNAL commit_go_done WAIT_FOR bup_unblocking';
>  SELECT state, info FROM
>  INFORMATION_SCHEMA.PROCESSLIST
>  WHERE info LIKE "COMMIT%";
> +SELECT state, info FROM
> +INFORMATION_SCHEMA.PROCESSLIST
> +WHERE info LIKE "BACKUP DATABASE%";
>  
>  connection con4;
>  
> +--echo con4: Activate synchronization point for BEGIN.
> +SET DEBUG_SYNC= 'before_begin_trans SIGNAL begin_starting
> +                 WAIT_FOR finish';
>  --echo con4: Starting begin -- will block with lock
>  --echo Assumption (c): TRX not started is not included in backup
>  send BEGIN;
>  
>  connection con5;
>  
> -# Wait for lock to be acquired and execution to reach breakpoint
> ---echo con5: Checking lock
> -let $wait_condition = SELECT state = "debug_sync_point: 
> backup_commit_blocker"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "BEGIN%";
> ---source include/wait_condition.inc
> -
> +--echo con5: Wait for BEGIN to reach its synchronization point.
> +SET DEBUG_SYNC= 'now WAIT_FOR begin_starting';
>  SELECT state, info FROM
>  INFORMATION_SCHEMA.PROCESSLIST
>  WHERE info LIKE "BEGIN%";
>  
> -# Wait for lock to be acquired and execution to reach breakpoint
> ---echo con5: Checking lock
> -
> -let $wait_condition = SELECT state = "debug_sync_point: 
> backup_commit_blocker"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "BACKUP DATABASE%";
> ---source include/wait_condition.inc
> -
> -SELECT state, info FROM
> -INFORMATION_SCHEMA.PROCESSLIST
> -WHERE info LIKE "BACKUP DATABASE%";
> -
>  connection con7;
>  
>  --echo con7: Show that the statement in progress has 
> executed before backup.
>  #SELECT * FROM bup_commit_blocker.t4;
>  SELECT * FROM bup_commit_blocker.t5;
>  
> +--echo con7: Activate synchronization point for DELETE.
> +SET DEBUG_SYNC= 'wait_if_global_read_lock SIGNAL del_read_lock';
>  --echo con7: Starting non-trx about to start -- will block with lock
>  --echo Assumption (e): non-TRX not started is not included in backup
>  send DELETE FROM bup_commit_blocker.t5 WHERE col_a = 50;
>  
>  connection con5;
>  
> -# Wait for lock to be acquired and execution to reach breakpoint
> ---echo con5: Checking lock
> -let $wait_condition = SELECT state = "Waiting for release of 
> readlock"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "DELETE%";
> ---source include/wait_condition.inc
> -
> +--echo con5: Wait for DELETE to reach its synchronization point.
> +SET DEBUG_SYNC= 'now WAIT_FOR del_read_lock';
>  SELECT state, info FROM
>  INFORMATION_SCHEMA.PROCESSLIST
>  WHERE info LIKE "DELETE%";
>  
> ---echo con5: Releasing lock
> -SELECT release_lock("backup_commit_blocker");
> +--echo con5: Sending finish signal to wake them all.
> +SET DEBUG_SYNC= 'now SIGNAL finish';
>  
> -# Reconnect to con2, con3, con4, con6, and con7 and allow 
> them to finish.
> +# Reconnect to con2, con3, con4, con6, and con7 and fetch 
> their results.
>  
>  connection con2;
>  
> @@ -752,10 +668,13 @@ connection con2;
>  COMMIT;
>  
>  connection con3;
> ---echo con3: Completing transaction
> +
> +--echo con3: Fetch COMMIT result
>  reap;
>  
>  connection con4;
> +
> +--echo con4: Fetch BEGIN result and completing transaction
>  reap;
>    UPDATE bup_commit_blocker.t3 SET col_a = "con4: 05 
> CHANGED" WHERE col_a LIKE '05%';
>    UPDATE bup_commit_blocker.t3 SET col_a = "con4: 06 
> CHANGED" WHERE col_a LIKE '06%';
> @@ -763,17 +682,17 @@ COMMIT;
>  
>  connection con6;
>  
> -#--echo con6: Completing statement
> +#--echo con6: Fetch INSERT result
>  #reap;
>  
>  connection con7;
>  
> ---echo con7: Completing statement
> +--echo con7: Fetch DELETE result
>  reap;
>  
> -# Reconnect to con1 and let backup finish.
> -
>  connection con1;
> +
> +--echo con1: Fetch BACKUP result
>  --replace_column 1 #
>  reap;
>  
> @@ -829,5 +748,5 @@ SELECT count(*) FROM bup_commit_blocker.
>  DROP DATABASE bup_commit_blocker;
>  
>  remove_file $MYSQLTEST_VARDIR/master-data/bup_commit_blocker.bak;
> -
> +SET DEBUG_SYNC= 'RESET';
>  
> diff -Nrup a/mysql-test/t/backup_ddl_blocker.test 
> b/mysql-test/t/backup_ddl_blocker.test
> --- a/mysql-test/t/backup_ddl_blocker.test	2008-02-14 
> 21:57:14 +01:00
> +++ b/mysql-test/t/backup_ddl_blocker.test	2008-06-06 
> 16:30:25 +02:00
> @@ -1,5 +1,5 @@
>  #
> -# This test is for the DDL blocker
> +# 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.
>  #
> @@ -42,22 +42,19 @@
>  #
>  # TODO : Add a native driver to the test when one becomes available
>  #
> -# Notes
> -#   You must use a dedicated connection for getting and 
> releasing locks.
> -# Do not issue a get_lock() or release_lock() in the same connection
> -# (thread) as code that calls BACKUP_BREAKPOINT(). Using the 
> same connection
> -# to get/release locks and run code that issues 
> BACKUP_BREAKPOINTs will result
> -# in an assertion using DEBUG_ASSERT(thd->ull == NULL) from 
> debug_sync_point()
> -# in item_func.cc.
> -#
>  
>  --source include/have_innodb.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
> +#
>  
>  --error 0,1
>  --remove_file $MYSQLTEST_VARDIR/master-data/bup_ddl_blocker_orig.bak;
> @@ -69,7 +66,7 @@
>  #
>  # 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 for setting and releasing breakpoints
> +# con6       used to show status/processlist 
>  #
>  
>  connect (con1,localhost,root,,);
> @@ -81,9 +78,6 @@ connect (con6,localhost,root,,);
>  
>  connection con1;
>  
> -# Setup the server to use the backup breakpoints
> -SET GLOBAL debug="d,backup_debug:d,backup";
> -
>  #
>  # Backup test sequence diagram (not UML)
>  #
> @@ -96,27 +90,30 @@ SET GLOBAL debug="d,backup_debug:d,backu
>  # when the backup or restore is already running. Tests results
>  # show the realization of the assumptions above.
>  #
> -#     con1      con2     con3     con4     con6
> +#     con1      con2     con3     con4     con5     con6
>  #    (setup)     |        |        |        |        |
>  #       |        |        |        |        |        |
> -#       |        |        |        |        | 
> lock("DDL_in_progress");
> +#       |        |        |        |        |        |
>  #       |   statememt 1   |        |        |        |
>  #       |        |   statement 2   |        |        |
> -#       |        |        |        |        |  <wait for locks>
> +#       |        |        |        |        |    show status
>  # BACKUP/RESTORE |        |        |        |        |
> -#       |        |        |        |        | lock("DDL_blocked");
> -#       |        |        |        |        | <wait for locks>
> +#       |        |        |        |        |        |
> +#       |        |        |        |        |        |
>  #       |      <...>    <...>      |        |        |
>  #       |        |        |   statement 3   |        |
>  #       |        |        |        |   statement 4   |
> -#       |        |        |        |        | <wait for DDL blocker>
> -#       |        |        |        |        |  <release locks>
> +#       |        |        |        |        |    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.
>  
>  
>  ##############################################################
> @@ -129,19 +126,19 @@ SET GLOBAL debug="d,backup_debug:d,backu
>  --source include/backup_ddl_create_data.inc
>  DROP TABLE bup_ddl_blocker.t1, bup_ddl_blocker.t3;
>  
> -connection con6;
> -
> -# Set the breakpoint for DDL in progress.
> ---echo con6: Getting lock on DDL in progress.
> -SELECT get_lock("DDL_in_progress", 0);
> -
>  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;
>  
> @@ -149,85 +146,61 @@ send ALTER TABLE bup_ddl_blocker.t2 ADD 
>  
>  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;
>  
> -# Wait for lock to be acquired and execution to reach breakpoint
> ---echo con6: Checking locks
> -let $wait_condition = SELECT state = "debug_sync_point: 
> DDL_in_progress"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "BACKUP DATABASE%";
> ---source include/wait_condition.inc
> -
> +--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%";
> -
> -let $wait_condition = SELECT state = "debug_sync_point: 
> DDL_in_progress"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "CREATE TABLE 
> bup_ddl_blocker.t1%";
> ---source include/wait_condition.inc
> -
> +  WHERE info LIKE "BACKUP DATABASE%";
>  SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
> -WHERE info LIKE "CREATE TABLE bup_ddl_blocker.t1%";
> -
> -let $wait_condition = SELECT state = "debug_sync_point: 
> DDL_in_progress"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "ALTER TABLE 
> bup_ddl_blocker.t2%";
> ---source include/wait_condition.inc
> -
> +  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%";
> -
> -# Now set the breakpoint for DDL blocker.
> -# This releases lock on DDL_in_progress stopping all DDLs.
> ---echo con6: Getting lock on DDL blocker.
> -SELECT get_lock("DDL_blocked", 0);
> -
> -connection con6;
> -
> ---echo con6: Checking locks
> -let $wait_condition = SELECT state = "debug_sync_point: DDL_blocked"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "BACKUP DATABASE%";
> ---source include/wait_condition.inc
> +  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%";
> +  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;
>  
> -let $wait_condition = SELECT state = "DDL blocker: DDL is blocked"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "CREATE TABLE 
> bup_ddl_blocker.t3%";
> ---source include/wait_condition.inc
> -
> +--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%";
> -
> -let $wait_condition = SELECT state = "DDL blocker: DDL is blocked"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "ALTER TABLE 
> bup_ddl_blocker.t4%";
> ---source include/wait_condition.inc
> -
> +  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%";
> +  WHERE info LIKE "ALTER TABLE bup_ddl_blocker.t4%";
>  
> ---echo con6: Releasing lock
> -SELECT release_lock("DDL_blocked");
> +--echo con6: Resume all.
> +SET DEBUG_SYNC= 'now SIGNAL status_shown2';
>  
> -# Reconnect to connections and allow them to finish.
> +# Reconnect to connections and fetch their results.
>  
>  connection con2;
>  --echo con2: Completing DDL
> @@ -245,7 +218,7 @@ connection con5;
>  --echo con5: Completing DDL
>  reap;
>  
> -# Reconnect to con1 and let backup finish.
> +# Reconnect to con1 and fetch its result.
>  
>  connection con1;
>  --replace_column 1 #
> @@ -298,19 +271,19 @@ DROP TABLE bup_ddl_blocker.t1, bup_ddl_b
>  --replace_column 1 #
>  BACKUP DATABASE bup_ddl_blocker to 'bup_ddl_blocker_orig.bak';
>  
> -connection con6;
> -
> -# Set the breakpoint for DDL in progress.
> ---echo con6: Getting lock on DDL in progress.
> -SELECT get_lock("DDL_in_progress", 0);
> -
>  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;
>  
> @@ -318,85 +291,61 @@ send ALTER TABLE bup_ddl_blocker.t2 ADD 
>  
>  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";
>  
>  connection con6;
>  
> -# Wait for lock to be acquired and execution to reach breakpoint
> ---echo con6: Checking locks
> -let $wait_condition = SELECT state = "debug_sync_point: 
> DDL_in_progress"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "RESTORE FROM%";
> ---source include/wait_condition.inc
> -
> +--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%";
> -
> -let $wait_condition = SELECT state = "debug_sync_point: 
> DDL_in_progress"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "CREATE TABLE 
> bup_ddl_blocker.t1%";
> ---source include/wait_condition.inc
> -
> +  WHERE info LIKE "RESTORE FROM%";
>  SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
> -WHERE info LIKE "CREATE TABLE bup_ddl_blocker.t1%";
> -
> -let $wait_condition = SELECT state = "debug_sync_point: 
> DDL_in_progress"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "ALTER TABLE 
> bup_ddl_blocker.t2%";
> ---source include/wait_condition.inc
> -
> +  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%";
> -
> -# Now set the breakpoint for DDL blocker.
> -# This releases lock on DDL_in_progress stopping all DDLs.
> ---echo con6: Getting lock on DDL blocker.
> -SELECT get_lock("DDL_blocked", 0);
> -
> -connection con6;
> -
> ---echo con6: Checking locks
> -let $wait_condition = SELECT state = "debug_sync_point: DDL_blocked"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "RESTORE FROM%";
> ---source include/wait_condition.inc
> +  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%";
> +  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;
>  
> -let $wait_condition = SELECT state = "DDL blocker: DDL is blocked"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "CREATE TABLE 
> bup_ddl_blocker.t3%";
> ---source include/wait_condition.inc
> -
> +--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%";
> -
> -let $wait_condition = SELECT state = "DDL blocker: DDL is blocked"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "ALTER TABLE 
> bup_ddl_blocker.t4%";
> ---source include/wait_condition.inc
> -
> +  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%";
> +  WHERE info LIKE "ALTER TABLE bup_ddl_blocker.t4%";
>  
> ---echo con6: Releasing lock
> -SELECT release_lock("DDL_blocked");
> +--echo con6: Resume all.
> +SET DEBUG_SYNC= 'now SIGNAL status_shown2';
>  
> -# Reconnect to connections and allow them to finish.
> +# Reconnect to connections and fetch their results.
>  
>  connection con2;
>  --echo con2: Completing DDL
> @@ -414,15 +363,17 @@ connection con5;
>  --echo con5: Completing DDL
>  reap;
>  
> -# Reconnect to con1 and let backup finish.
> +# 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.
> @@ -434,6 +385,9 @@ 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
> +
>  
>  
>  ##############################################################
> @@ -445,19 +399,19 @@ DESCRIBE bup_ddl_blocker.t4;
>  # Create data for this test and tailor it to the test.
>  --source include/backup_ddl_create_data.inc
>  
> -connection con6;
> -
> -# Set the breakpoint for DDL in progress.
> ---echo con6: Getting lock on DDL in progress.
> -SELECT get_lock("DDL_in_progress", 0);
> -
>  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;
>  
> @@ -465,87 +419,61 @@ send REPAIR TABLE bup_ddl_blocker.t2;
>  
>  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
> ---remove_file $MYSQLTEST_VARDIR/master-data/bup_ddl_blocker.bak
>  send BACKUP DATABASE bup_ddl_blocker TO "bup_ddl_blocker.bak";
>  
>  connection con6;
>  
> -# Wait for lock to be acquired and execution to reach breakpoint
> ---echo con6: Checking locks
> -let $wait_condition = SELECT state = "debug_sync_point: 
> DDL_in_progress"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "BACKUP DATABASE%";
> ---source include/wait_condition.inc
> -
> +--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%";
> -
> -let $wait_condition = SELECT state = "debug_sync_point: 
> DDL_in_progress"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "RENAME TABLE 
> bup_ddl_blocker.t1%";
> ---source include/wait_condition.inc
> -
> +  WHERE info LIKE "BACKUP DATABASE%";
>  SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
> -WHERE info LIKE "RENAME TABLE bup_ddl_blocker.t1%";
> -
> -let $wait_condition = SELECT state = "debug_sync_point: 
> DDL_in_progress"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "REPAIR TABLE 
> bup_ddl_blocker.t2%";
> ---source include/wait_condition.inc
> -
> +  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%";
> -
> -
> -# Now set the breakpoint for DDL blocker.
> -# This releases lock on DDL_in_progress stopping all DDLs.
> ---echo con6: Getting lock on DDL blocker.
> -SELECT get_lock("DDL_blocked", 0);
> -
> -connection con6;
> -
> ---echo con6: Checking locks
> -let $wait_condition = SELECT state = "debug_sync_point: DDL_blocked"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "BACKUP DATABASE%";
> ---source include/wait_condition.inc
> +  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%";
> +  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;
>  
> -let $wait_condition = SELECT state = "DDL blocker: DDL is blocked"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "RENAME TABLE 
> bup_ddl_blocker.t3%";
> ---source include/wait_condition.inc
> -
> +--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%";
> -
> -let $wait_condition = SELECT state = "DDL blocker: DDL is blocked"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "REPAIR TABLE 
> bup_ddl_blocker.t4%";
> ---source include/wait_condition.inc
> -
> +  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%";
> +  WHERE info LIKE "REPAIR TABLE bup_ddl_blocker.t4%";
>  
> ---echo con6: Releasing lock
> -SELECT release_lock("DDL_blocked");
> +--echo con6: Resume all.
> +SET DEBUG_SYNC= 'now SIGNAL status_shown2';
>  
> -# Reconnect to connections and allow them to finish.
> +# Reconnect to connections and fetch their results.
>  
>  connection con2;
>  --echo con2: Completing DDL
> @@ -563,7 +491,7 @@ connection con5;
>  --echo con5: Completing DDL
>  reap;
>  
> -# Reconnect to con1 and let backup finish.
> +# Reconnect to con1 and fetch its result.
>  
>  connection con1;
>  --replace_column 1 #
> @@ -610,19 +538,19 @@ SHOW TABLES;
>  --replace_column 1 #
>  BACKUP DATABASE bup_ddl_blocker to 'bup_ddl_blocker_orig.bak';
>  
> -connection con6;
> -
> -# Set the breakpoint for DDL in progress.
> ---echo con6: Getting lock on DDL in progress.
> -SELECT get_lock("DDL_in_progress", 0);
> -
>  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;
>  
> @@ -630,85 +558,61 @@ send REPAIR TABLE bup_ddl_blocker.t2;
>  
>  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";
>  
>  connection con6;
>  
> -# Wait for lock to be acquired and execution to reach breakpoint
> ---echo con6: Checking locks
> -let $wait_condition = SELECT state = "debug_sync_point: 
> DDL_in_progress"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "RESTORE FROM%";
> ---source include/wait_condition.inc
> -
> +--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%";
> -
> -let $wait_condition = SELECT state = "debug_sync_point: 
> DDL_in_progress"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "RENAME TABLE 
> bup_ddl_blocker.t1%";
> ---source include/wait_condition.inc
> -
> +  WHERE info LIKE "RESTORE FROM%";
>  SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
> -WHERE info LIKE "RENAME TABLE bup_ddl_blocker.t1%";
> -
> -let $wait_condition = SELECT state = "debug_sync_point: 
> DDL_in_progress"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "REPAIR TABLE 
> bup_ddl_blocker.t2%";
> ---source include/wait_condition.inc
> -
> +  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%";
> -
> -# Now set the breakpoint for DDL blocker.
> -# This releases lock on DDL_in_progress stopping all DDLs.
> ---echo con6: Getting lock on DDL blocker.
> -SELECT get_lock("DDL_blocked", 0);
> -
> -connection con6;
> -
> ---echo con6: Checking locks
> -let $wait_condition = SELECT state = "debug_sync_point: DDL_blocked"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "RESTORE FROM%";
> ---source include/wait_condition.inc
> +  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%";
> +  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;
>  
> -let $wait_condition = SELECT state = "DDL blocker: DDL is blocked"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "RENAME TABLE 
> bup_ddl_blocker.t3%";
> ---source include/wait_condition.inc
> -
> +--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%";
> -
> -let $wait_condition = SELECT state = "DDL blocker: DDL is blocked"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "REPAIR TABLE 
> bup_ddl_blocker.t4%";
> ---source include/wait_condition.inc
> -
> +  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%";
> +  WHERE info LIKE "REPAIR TABLE bup_ddl_blocker.t4%";
>  
> ---echo con6: Releasing lock
> -SELECT release_lock("DDL_blocked");
> +--echo con6: Resume all.
> +SET DEBUG_SYNC= 'now SIGNAL status_shown2';
>  
> -# Reconnect to connections and allow them to finish.
> +# Reconnect to connections and fetch their results.
>  
>  connection con2;
>  --echo con2: Completing DDL
> @@ -726,7 +630,7 @@ connection con5;
>  --echo con5: Completing DDL
>  reap;
>  
> -# Reconnect to con1 and let backup finish.
> +# Reconnect to con1 and fetch its result.
>  
>  connection con1;
>  --replace_column 1 #
> @@ -742,7 +646,8 @@ reap;
>  use bup_ddl_blocker;
>  SHOW TABLES;
>  
> -
> +# Cleanup
> +--remove_file $MYSQLTEST_VARDIR/master-data/bup_ddl_blocker.bak
>  
>  
>  
> @@ -755,19 +660,19 @@ SHOW TABLES;
>  # Create data for this test and tailor it to the test.
>  --source include/backup_ddl_create_data.inc
>  
> -connection con6;
> -
> -# Set the breakpoint for DDL in progress.
> ---echo con6: Getting lock on DDL in progress.
> -SELECT get_lock("DDL_in_progress", 0);
> -
>  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;
>  
> @@ -775,86 +680,61 @@ send DROP TABLE bup_ddl_blocker.t2;
>  
>  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
> ---remove_file $MYSQLTEST_VARDIR/master-data/bup_ddl_blocker.bak
>  send BACKUP DATABASE bup_ddl_blocker TO "bup_ddl_blocker.bak";
>  
>  connection con6;
>  
> -# Wait for lock to be acquired and execution to reach breakpoint
> ---echo con6: Checking locks
> -let $wait_condition = SELECT state = "debug_sync_point: 
> DDL_in_progress"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "BACKUP DATABASE%";
> ---source include/wait_condition.inc
> -
> +--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%";
> -
> -let $wait_condition = SELECT state = "debug_sync_point: 
> DDL_in_progress"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "OPTIMIZE TABLE 
> bup_ddl_blocker.t1%";
> ---source include/wait_condition.inc
> -
> +  WHERE info LIKE "BACKUP DATABASE%";
>  SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
> -WHERE info LIKE "OPTIMIZE TABLE bup_ddl_blocker.t1%";
> -
> -let $wait_condition = SELECT state = "debug_sync_point: 
> DDL_in_progress"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "DROP TABLE 
> bup_ddl_blocker.t2%";
> ---source include/wait_condition.inc
> -
> +  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%";
> -
> -# Now set the breakpoint for DDL blocker.
> -# This releases lock on DDL_in_progress stopping all DDLs.
> ---echo con6: Getting lock on DDL blocker.
> -SELECT get_lock("DDL_blocked", 0);
> -
> -connection con6;
> -
> ---echo con6: Checking locks
> -let $wait_condition = SELECT state = "debug_sync_point: DDL_blocked"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "BACKUP DATABASE%";
> ---source include/wait_condition.inc
> +  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%";
> +  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;
>  
> -let $wait_condition = SELECT state = "DDL blocker: DDL is blocked"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "OPTIMIZE TABLE 
> bup_ddl_blocker.t3%";
> ---source include/wait_condition.inc
> -
> +--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%";
> -
> -let $wait_condition = SELECT state = "DDL blocker: DDL is blocked"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "DROP TABLE 
> bup_ddl_blocker.t4%";
> ---source include/wait_condition.inc
> -
> +  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%";
> +  WHERE info LIKE "DROP TABLE bup_ddl_blocker.t4%";
>  
> ---echo con6: Releasing lock
> -SELECT release_lock("DDL_blocked");
> +--echo con6: Resume all.
> +SET DEBUG_SYNC= 'now SIGNAL status_shown2';
>  
> -# Reconnect to connections and allow them to finish.
> +# Reconnect to connections and fetch their results.
>  
>  connection con2;
>  --echo con2: Completing DDL
> @@ -872,7 +752,7 @@ connection con5;
>  --echo con5: Completing DDL
>  reap;
>  
> -# Reconnect to con1 and let backup finish.
> +# Reconnect to con1 and fetch its result.
>  
>  connection con1;
>  --replace_column 1 #
> @@ -917,19 +797,19 @@ SHOW TABLES;
>  --replace_column 1 #
>  BACKUP DATABASE bup_ddl_blocker to 'bup_ddl_blocker_orig.bak';
>  
> -connection con6;
> -
> -# Set the breakpoint for DDL in progress.
> ---echo con6: Getting lock on DDL in progress.
> -SELECT get_lock("DDL_in_progress", 0);
> -
>  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;
>  
> @@ -937,85 +817,61 @@ send DROP TABLE bup_ddl_blocker.t2;
>  
>  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";
>  
>  connection con6;
>  
> -# Wait for lock to be acquired and execution to reach breakpoint
> ---echo con6: Checking locks
> -let $wait_condition = SELECT state = "debug_sync_point: 
> DDL_in_progress"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "RESTORE FROM%";
> ---source include/wait_condition.inc
> -
> +--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%";
> -
> -let $wait_condition = SELECT state = "debug_sync_point: 
> DDL_in_progress"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "OPTIMIZE TABLE 
> bup_ddl_blocker.t1%";
> ---source include/wait_condition.inc
> -
> +  WHERE info LIKE "RESTORE FROM%";
>  SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
> -WHERE info LIKE "OPTIMIZE TABLE bup_ddl_blocker.t1%";
> -
> -let $wait_condition = SELECT state = "debug_sync_point: 
> DDL_in_progress"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "DROP TABLE 
> bup_ddl_blocker.t2%";
> ---source include/wait_condition.inc
> -
> +  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%";
> -
> -# Now set the breakpoint for DDL blocker.
> -# This releases lock on DDL_in_progress stopping all DDLs.
> ---echo con6: Getting lock on DDL blocker.
> -SELECT get_lock("DDL_blocked", 0);
> -
> -connection con6;
> -
> ---echo con6: Checking locks
> -let $wait_condition = SELECT state = "debug_sync_point: DDL_blocked"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "RESTORE FROM%";
> ---source include/wait_condition.inc
> +  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%";
> +  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;
>  
> -let $wait_condition = SELECT state = "DDL blocker: DDL is blocked"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "OPTIMIZE TABLE 
> bup_ddl_blocker.t3%";
> ---source include/wait_condition.inc
> -
> +--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%";
> -
> -let $wait_condition = SELECT state = "DDL blocker: DDL is blocked"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "DROP TABLE 
> bup_ddl_blocker.t4%";
> ---source include/wait_condition.inc
> -
> +  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%";
> +  WHERE info LIKE "DROP TABLE bup_ddl_blocker.t4%";
>  
> ---echo con6: Releasing lock
> -SELECT release_lock("DDL_blocked");
> +--echo con6: Resume all.
> +SET DEBUG_SYNC= 'now SIGNAL status_shown2';
>  
> -# Reconnect to connections and allow them to finish.
> +# Reconnect to connections and fetch their results.
>  
>  connection con2;
>  --echo con2: Completing DDL
> @@ -1033,7 +889,7 @@ connection con5;
>  --echo con5: Completing DDL
>  reap;
>  
> -# Reconnect to con1 and let backup finish.
> +# Reconnect to con1 and fetch its result.
>  
>  connection con1;
>  --replace_column 1 #
> @@ -1049,7 +905,8 @@ reap;
>  use bup_ddl_blocker;
>  SHOW TABLES;
>  
> -
> +# Cleanup
> +--remove_file $MYSQLTEST_VARDIR/master-data/bup_ddl_blocker.bak
>  
>  
>  
> @@ -1088,19 +945,19 @@ INSERT INTO bup_ddl_blocker_4.t1 VALUES 
>  --echo con1: Show that the new data doesn't exist before backup.
>  SHOW DATABASES LIKE 'bup_ddl_blocker_%';
>  
> -connection con6;
> -
> -# Set the breakpoint for DDL in progress.
> ---echo con6: Getting lock on DDL in progress.
> -SELECT get_lock("DDL_in_progress", 0);
> -
>  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;
>  
> @@ -1108,86 +965,61 @@ send DROP DATABASE bup_ddl_blocker_2;
>  
>  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
> ---remove_file $MYSQLTEST_VARDIR/master-data/bup_ddl_blocker.bak
>  send BACKUP DATABASE * TO "bup_ddl_blocker.bak";
>  
>  connection con6;
>  
> -# Wait for lock to be acquired and execution to reach breakpoint
> ---echo con6: Checking locks
> -let $wait_condition = SELECT state = "debug_sync_point: 
> DDL_in_progress"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "BACKUP DATABASE%";
> ---source include/wait_condition.inc
> -
> +--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%";
> -
> -let $wait_condition = SELECT state = "debug_sync_point: 
> DDL_in_progress"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "CREATE DATABASE 
> bup_ddl_blocker_1%";
> ---source include/wait_condition.inc
> -
> +  WHERE info LIKE "BACKUP DATABASE%";
>  SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
> -WHERE info LIKE "CREATE DATABASE bup_ddl_blocker_1%";
> -
> -let $wait_condition = SELECT state = "debug_sync_point: 
> DDL_in_progress"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "DROP DATABASE 
> bup_ddl_blocker_2%";
> ---source include/wait_condition.inc
> -
> +  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%";
> -
> -# Now set the breakpoint for DDL blocker.
> -# This releases lock on DDL_in_progress stopping all DDLs.
> ---echo con6: Getting lock on DDL blocker.
> -SELECT get_lock("DDL_blocked", 0);
> -
> -connection con6;
> -
> ---echo con6: Checking locks
> -let $wait_condition = SELECT state = "debug_sync_point: DDL_blocked"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "BACKUP DATABASE%";
> ---source include/wait_condition.inc
> +  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%";
> +  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;
>  
> -let $wait_condition = SELECT state = "DDL blocker: DDL is blocked"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "CREATE DATABASE 
> bup_ddl_blocker_3%";
> ---source include/wait_condition.inc
> -
> +--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%";
> -
> -let $wait_condition = SELECT state = "DDL blocker: DDL is blocked"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "DROP DATABASE 
> bup_ddl_blocker_4%";
> ---source include/wait_condition.inc
> -
> +  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%";
> +  WHERE info LIKE "DROP DATABASE bup_ddl_blocker_4%";
>  
> ---echo con6: Releasing lock
> -SELECT release_lock("DDL_blocked");
> +--echo con6: Resume all.
> +SET DEBUG_SYNC= 'now SIGNAL status_shown2';
>  
> -# Reconnect to connections and allow them to finish.
> +# Reconnect to connections and fetch their results.
>  
>  connection con2;
>  --echo con2: Completing DDL
> @@ -1205,7 +1037,7 @@ connection con5;
>  --echo con5: Completing DDL
>  reap;
>  
> -# Reconnect to con1 and let backup finish.
> +# Reconnect to con1 and fetch its result.
>  
>  connection con1;
>  --replace_column 1 #
> @@ -1279,19 +1111,19 @@ SHOW DATABASES LIKE 'bup_ddl_blocker_%';
>  --replace_column 1 #
>  BACKUP DATABASE bup_ddl_blocker_2, bup_ddl_blocker_4 to 
> 'bup_ddl_blocker_orig.bak';
>  
> -connection con6;
> -
> -# Set the breakpoint for DDL in progress.
> ---echo con6: Getting lock on DDL in progress.
> -SELECT get_lock("DDL_in_progress", 0);
> -
>  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;
>  
> @@ -1299,85 +1131,61 @@ send DROP DATABASE bup_ddl_blocker_2;
>  
>  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";
>  
>  connection con6;
>  
> -# Wait for lock to be acquired and execution to reach breakpoint
> ---echo con6: Checking locks
> -let $wait_condition = SELECT state = "debug_sync_point: 
> DDL_in_progress"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "RESTORE FROM%";
> ---source include/wait_condition.inc
> -
> +--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%";
> -
> -let $wait_condition = SELECT state = "debug_sync_point: 
> DDL_in_progress"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "CREATE DATABASE 
> bup_ddl_blocker_1%";
> ---source include/wait_condition.inc
> -
> +  WHERE info LIKE "RESTORE FROM%";
>  SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
> -WHERE info LIKE "CREATE DATABASE bup_ddl_blocker_1%";
> -
> -let $wait_condition = SELECT state = "debug_sync_point: 
> DDL_in_progress"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "DROP DATABASE 
> bup_ddl_blocker_2%";
> ---source include/wait_condition.inc
> -
> +  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%";
> -
> -# Now set the breakpoint for DDL blocker.
> -# This releases lock on DDL_in_progress stopping all DDLs.
> ---echo con6: Getting lock on DDL blocker.
> -SELECT get_lock("DDL_blocked", 0);
> -
> -connection con6;
> -
> ---echo con6: Checking locks
> -let $wait_condition = SELECT state = "debug_sync_point: DDL_blocked"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "RESTORE FROM%";
> ---source include/wait_condition.inc
> +  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%";
> +  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;
>  
> -let $wait_condition = SELECT state = "DDL blocker: DDL is blocked"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "CREATE DATABASE 
> bup_ddl_blocker_3%";
> ---source include/wait_condition.inc
> -
> +--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%";
> -
> -let $wait_condition = SELECT state = "DDL blocker: DDL is blocked"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "DROP DATABASE 
> bup_ddl_blocker_4%";
> ---source include/wait_condition.inc
> -
> +  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%";
> +  WHERE info LIKE "DROP DATABASE bup_ddl_blocker_4%";
>  
> ---echo con6: Releasing lock
> -SELECT release_lock("DDL_blocked");
> +--echo con6: Resume all.
> +SET DEBUG_SYNC= 'now SIGNAL status_shown2';
>  
> -# Reconnect to connections and allow them to finish.
> +# Reconnect to connections and fetch their results.
>  
>  connection con2;
>  --echo con2: Completing DDL
> @@ -1395,7 +1203,7 @@ connection con5;
>  --echo con5: Completing DDL
>  reap;
>  
> -# Reconnect to con1 and let backup finish.
> +# Reconnect to con1 and fetch its result.
>  
>  connection con1;
>  --replace_column 1 #
> @@ -1410,7 +1218,8 @@ reap;
>  --echo con1: Database bup_ddl_blocker_4 should not be in 
> restored data.
>  SHOW DATABASES LIKE 'bup_ddl_blocker_%';
>  
> -
> +# Cleanup
> +--remove_file $MYSQLTEST_VARDIR/master-data/bup_ddl_blocker.bak
>  
>  
>  
> @@ -1450,19 +1259,19 @@ INSERT INTO bup_ddl_blocker_4.t1 VALUES 
>  --echo con1: Show that the new data doesn't exist before backup.
>  SHOW DATABASES LIKE 'bup_ddl_blocker_%';
>  
> -connection con6;
> -
> -# Set the breakpoint for DDL in progress.
> ---echo con6: Getting lock on DDL in progress.
> -SELECT get_lock("DDL_in_progress", 0);
> -
>  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;
>  
> @@ -1470,85 +1279,61 @@ send ALTER DATABASE bup_ddl_blocker_2 CH
>  
>  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
> ---remove_file $MYSQLTEST_VARDIR/master-data/bup_ddl_blocker.bak
>  send BACKUP DATABASE * TO "bup_ddl_blocker.bak";
>  
>  connection con6;
>  
> -# Wait for lock to be acquired and execution to reach breakpoint
> ---echo con6: Checking locks
> -let $wait_condition = SELECT state = "debug_sync_point: 
> DDL_in_progress"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "BACKUP DATABASE%";
> ---source include/wait_condition.inc
> -
> +--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%";
> -
> -let $wait_condition = SELECT state = "debug_sync_point: 
> DDL_in_progress"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "TRUNCATE TABLE 
> bup_ddl_blocker_2%";
> ---source include/wait_condition.inc
> -
> +  WHERE info LIKE "BACKUP DATABASE%";
>  SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
> -WHERE info LIKE "TRUNCATE TABLE bup_ddl_blocker_2%";
> -
> -let $wait_condition = SELECT state = "debug_sync_point: 
> DDL_in_progress"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "ALTER DATABASE 
> bup_ddl_blocker_2%";
> ---source include/wait_condition.inc
> -
> +  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%";
> -
> -# Now set the breakpoint for DDL blocker.
> -# This releases lock on DDL_in_progress stopping all DDLs.
> ---echo con6: Getting lock on DDL blocker.
> -SELECT get_lock("DDL_blocked", 0);
> -
> -connection con6;
> -
> ---echo con6: Checking locks
> -let $wait_condition = SELECT state = "debug_sync_point: DDL_blocked"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "BACKUP DATABASE%";
> ---source include/wait_condition.inc
> +  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%";
> +  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;
>  
> -let $wait_condition = SELECT state = "DDL blocker: DDL is blocked"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "ALTER DATABASE 
> bup_ddl_blocker_4%";
> ---source include/wait_condition.inc
> +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%";
> -
> -let $wait_condition = SELECT state = "DDL blocker: DDL is blocked"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "TRUNCATE TABLE 
> bup_ddl_blocker_4%";
> ---source include/wait_condition.inc
> -
> +  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%";
> +  WHERE info LIKE "TRUNCATE TABLE bup_ddl_blocker_4%";
>  
> ---echo con6: Releasing lock
> -SELECT release_lock("DDL_blocked");
> +--echo con6: Resume all.
> +SET DEBUG_SYNC= 'now SIGNAL status_shown2';
>  
> -# Reconnect to connections and allow them to finish.
> +# Reconnect to connections and fetch their results.
>  
>  connection con2;
>  --echo con2: Completing DDL
> @@ -1566,7 +1351,7 @@ connection con5;
>  --echo con5: Completing DDL
>  reap;
>  
> -# Reconnect to con1 and let backup finish.
> +# Reconnect to con1 and fetch its result.
>  
>  connection con1;
>  --replace_column 1 #
> @@ -1613,7 +1398,6 @@ SELECT * FROM bup_ddl_blocker_4.t1;
>  DROP DATABASE bup_ddl_blocker_2;
>  DROP DATABASE bup_ddl_blocker_4;
>  
> -
>  ##############################################################
>  --echo 
>  --echo Starting Test 5 - Restore
> @@ -1655,19 +1439,19 @@ SHOW DATABASES LIKE 'bup_ddl_blocker_%';
>  --replace_column 1 #
>  BACKUP DATABASE bup_ddl_blocker_2, bup_ddl_blocker_4 to 
> 'bup_ddl_blocker_orig.bak';
>  
> -connection con6;
> -
> -# Set the breakpoint for DDL in progress.
> ---echo con6: Getting lock on DDL in progress.
> -SELECT get_lock("DDL_in_progress", 0);
> -
>  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;
>  
> @@ -1675,85 +1459,61 @@ send ALTER DATABASE bup_ddl_blocker_2 CH
>  
>  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";
>  
>  connection con6;
>  
> -# Wait for lock to be acquired and execution to reach breakpoint
> ---echo con6: Checking locks
> -let $wait_condition = SELECT state = "debug_sync_point: 
> DDL_in_progress"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "RESTORE FROM%";
> ---source include/wait_condition.inc
> -
> +--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%";
> -
> -let $wait_condition = SELECT state = "debug_sync_point: 
> DDL_in_progress"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "ALTER DATABASE 
> bup_ddl_blocker_2%";
> ---source include/wait_condition.inc
> -
> +  WHERE info LIKE "RESTORE FROM%";
>  SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
> -WHERE info LIKE "ALTER DATABASE bup_ddl_blocker_2%";
> -
> -let $wait_condition = SELECT state = "debug_sync_point: 
> DDL_in_progress"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "TRUNCATE TABLE 
> bup_ddl_blocker_2%";
> ---source include/wait_condition.inc
> -
> +  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%";
> -
> -# Now set the breakpoint for DDL blocker.
> -# This releases lock on DDL_in_progress stopping all DDLs.
> ---echo con6: Getting lock on DDL blocker.
> -SELECT get_lock("DDL_blocked", 0);
> -
> -connection con6;
> -
> ---echo con6: Checking locks
> -let $wait_condition = SELECT state = "debug_sync_point: DDL_blocked"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "RESTORE FROM%";
> ---source include/wait_condition.inc
> +  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%";
> +  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;
>  
> -let $wait_condition = SELECT state = "DDL blocker: DDL is blocked"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "TRUNCATE TABLE 
> bup_ddl_blocker_4%";
> ---source include/wait_condition.inc
> -
> +--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%";
> -
> -let $wait_condition = SELECT state = "DDL blocker: DDL is blocked"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "ALTER DATABASE 
> bup_ddl_blocker_4%";
> ---source include/wait_condition.inc
> -
> +  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%";
> +  WHERE info LIKE "ALTER DATABASE bup_ddl_blocker_4%";
>  
> ---echo con6: Releasing lock
> -SELECT release_lock("DDL_blocked");
> +--echo con6: Resume all.
> +SET DEBUG_SYNC= 'now SIGNAL status_shown2';
>  
> -# Reconnect to connections and allow them to finish.
> +# Reconnect to connections and fetch their results.
>  
>  connection con2;
>  --echo con2: Completing DDL
> @@ -1771,7 +1531,7 @@ connection con5;
>  --echo con5: Completing DDL
>  reap;
>  
> -# Reconnect to con1 and let backup finish.
> +# Reconnect to con1 and fetch its result.
>  
>  connection con1;
>  --replace_column 1 #
> @@ -1796,7 +1556,8 @@ SELECT * FROM bup_ddl_blocker_4.t1;
>  DROP DATABASE bup_ddl_blocker_2;
>  DROP DATABASE bup_ddl_blocker_4;
>  
> -
> +# Cleanup
> +--remove_file $MYSQLTEST_VARDIR/master-data/bup_ddl_blocker.bak
>  
>  
>  
> @@ -1848,19 +1609,19 @@ INSERT INTO bup_ddl_blocker_4.t1 VALUES 
>  
>  CREATE INDEX 4t1col_b ON bup_ddl_blocker_4.t1 (col_b); 
>  
> -connection con6;
> -
> -# Set the breakpoint for DDL in progress.
> ---echo con6: Getting lock on DDL in progress.
> -SELECT get_lock("DDL_in_progress", 0);
> -
>  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;
>  
> @@ -1868,7 +1629,11 @@ send DROP INDEX 2t1col_b ON bup_ddl_bloc
>  
>  connection con1;
>  
> ---remove_file $MYSQLTEST_VARDIR/master-data/bup_ddl_blocker.bak
> +--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
> @@ -1876,80 +1641,51 @@ send BACKUP DATABASE bup_ddl_blocker_1, 
>  
>  connection con6;
>  
> -# Wait for lock to be acquired and execution to reach breakpoint
> ---echo con6: Checking locks
> -let $wait_condition = SELECT state = "debug_sync_point: 
> DDL_in_progress"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "BACKUP DATABASE%";
> ---source include/wait_condition.inc
> -
> +--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%";
> -
> -let $wait_condition = SELECT state = "debug_sync_point: 
> DDL_in_progress"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "CREATE INDEX 1t1col_b%";
> ---source include/wait_condition.inc
> -
> +  WHERE info LIKE "BACKUP DATABASE%";
>  SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
> -WHERE info LIKE "CREATE INDEX 1t1col_b%";
> -
> -let $wait_condition = SELECT state = "debug_sync_point: 
> DDL_in_progress"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "DROP INDEX 2t1col_b%";
> ---source include/wait_condition.inc
> -
> +  WHERE info LIKE "CREATE INDEX 1t1col_b%";
>  SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
> -WHERE info LIKE "DROP INDEX 2t1col_b%";
> -
> -# Now set the breakpoint for DDL blocker.
> -# This releases lock on DDL_in_progress stopping all DDLs.
> ---echo con6: Getting lock on DDL blocker.
> -SELECT get_lock("DDL_blocked", 0);
> -
> -connection con6;
> -
> ---echo con6: Checking locks
> -let $wait_condition = SELECT state = "debug_sync_point: DDL_blocked"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "BACKUP DATABASE%";
> ---source include/wait_condition.inc
> +  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%";
> +  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;
>  
> -let $wait_condition = SELECT state = "DDL blocker: DDL is blocked"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "CREATE INDEX 3t1col_b%";
> ---source include/wait_condition.inc
> -
> +--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%";
> -
> -let $wait_condition = SELECT state = "DDL blocker: DDL is blocked"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "DROP INDEX 4t1col_b%";
> ---source include/wait_condition.inc
> -
> +  WHERE info LIKE "CREATE INDEX 3t1col_b%";
>  SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
> -WHERE info LIKE "DROP INDEX 4t1col_b%";
> +  WHERE info LIKE "DROP INDEX 4t1col_b%";
>  
> ---echo con6: Releasing lock
> -SELECT release_lock("DDL_blocked");
> +--echo con6: Resume all.
> +SET DEBUG_SYNC= 'now SIGNAL status_shown2';
>  
> -# Reconnect to connections and allow them to finish.
> +# Reconnect to connections and fetch their results.
>  
>  connection con2;
>  --echo con2: Completing DDL
> @@ -1967,7 +1703,7 @@ connection con5;
>  --echo con5: Completing DDL
>  reap;
>  
> -# Reconnect to con1 and let backup finish.
> +# Reconnect to con1 and fetch its result.
>  
>  connection con1;
>  --replace_column 1 #
> @@ -2017,6 +1753,7 @@ DROP DATABASE bup_ddl_blocker_4;
>  --echo Starting Test 6 - Restore
>  --echo 
>  ##############################################################
> +
>  --disable_warnings
>  DROP DATABASE IF EXISTS bup_ddl_blocker_1;
>  DROP DATABASE IF EXISTS bup_ddl_blocker_2;
> @@ -2066,19 +1803,19 @@ BACKUP DATABASE bup_ddl_blocker_1, bup_d
>                  bup_ddl_blocker_3, bup_ddl_blocker_4
>                  TO "bup_ddl_blocker_orig.bak";
>  
> -connection con6;
> -
> -# Set the breakpoint for DDL in progress.
> ---echo con6: Getting lock on DDL in progress.
> -SELECT get_lock("DDL_in_progress", 0);
> -
>  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;
>  
> @@ -2086,85 +1823,61 @@ send DROP INDEX 2t1col_b ON bup_ddl_bloc
>  
>  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";
>  
>  connection con6;
>  
> -# Wait for lock to be acquired and execution to reach breakpoint
> ---echo con6: Checking locks
> -let $wait_condition = SELECT state = "debug_sync_point: 
> DDL_in_progress"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "RESTORE FROM%";
> ---source include/wait_condition.inc
> -
> +--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%";
> -
> -let $wait_condition = SELECT state = "debug_sync_point: 
> DDL_in_progress"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "CREATE INDEX 1t1col_b%";
> ---source include/wait_condition.inc
> -
> +  WHERE info LIKE "RESTORE FROM%";
>  SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
> -WHERE info LIKE "CREATE INDEX 1t1col_b%";
> -
> -let $wait_condition = SELECT state = "debug_sync_point: 
> DDL_in_progress"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "DROP INDEX 2t1col_b%";
> ---source include/wait_condition.inc
> -
> +  WHERE info LIKE "CREATE INDEX 1t1col_b%";
>  SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
> -WHERE info LIKE "DROP INDEX 2t1col_b%";
> -
> -# Now set the breakpoint for DDL blocker.
> -# This releases lock on DDL_in_progress stopping all DDLs.
> ---echo con6: Getting lock on DDL blocker.
> -SELECT get_lock("DDL_blocked", 0);
> -
> -connection con6;
> -
> ---echo con6: Checking locks
> -let $wait_condition = SELECT state = "debug_sync_point: DDL_blocked"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "RESTORE FROM%";
> ---source include/wait_condition.inc
> +  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%";
> +  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;
>  
> -let $wait_condition = SELECT state = "DDL blocker: DDL is blocked"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "CREATE INDEX 3t1col_b%";
> ---source include/wait_condition.inc
> -
> +--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%";
> -
> -let $wait_condition = SELECT state = "DDL blocker: DDL is blocked"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "DDROP INDEX 4t1col_b%";
> ---source include/wait_condition.inc
> -
> +  WHERE info LIKE "CREATE INDEX 3t1col_b%";
>  SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
> -WHERE info LIKE "DROP INDEX 4t1col_b%";
> +  WHERE info LIKE "DROP INDEX 4t1col_b%";
>  
> ---echo con6: Releasing lock
> -SELECT release_lock("DDL_blocked");
> +--echo con6: Resume all.
> +SET DEBUG_SYNC= 'now SIGNAL status_shown2';
>  
> -# Reconnect to connections and allow them to finish.
> +# Reconnect to connections and fetch their results.
>  
>  connection con2;
>  --echo con2: Completing DDL
> @@ -2182,7 +1895,7 @@ connection con5;
>  --echo con5: Completing DDL
>  reap;
>  
> -# Reconnect to con1 and let backup finish.
> +# Reconnect to con1 and fetch its result.
>  
>  connection con1;
>  --replace_column 1 #
> @@ -2207,7 +1920,8 @@ 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
>  
>  
>  
> @@ -2265,59 +1979,46 @@ SELECT * FROM bup_ddl_blocker.t1;
>  SELECT * FROM test.t2;
>  SELECT * FROM bup_ddl_blocker.t3;
>  
> -connection con5;
> -
> -# Set the breakpoint for DDL in progress.
> ---echo con5: Getting lock on DDL in progress.
> -SELECT get_lock("DDL_not_blocked", 0);
> -
>  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;
>  
> -# Wait for lock to be acquired and execution to reach breakpoint
> ---echo con5: Checking locks
> -let $wait_condition = SELECT state = "debug_sync_point: 
> DDL_not_blocked"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "ALTER TABLE 
> bup_ddl_blocker.t1%";
> ---source include/wait_condition.inc
> -
> +--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%";
> -
> -let $wait_condition = SELECT state = "debug_sync_point: 
> DDL_not_blocked"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "ALTER TABLE test.t2%";
> ---source include/wait_condition.inc
> -
> +  WHERE info LIKE "ALTER TABLE bup_ddl_blocker.t1%";
>  SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
> -WHERE info LIKE "ALTER TABLE test.t2%";
> -
> -let $wait_condition = SELECT state = "debug_sync_point: 
> DDL_not_blocked"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "ALTER TABLE 
> bup_ddl_blocker.t3%";
> ---source include/wait_condition.inc
> -
> +  WHERE info LIKE "ALTER TABLE test.t2%";
>  SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
> -WHERE info LIKE "ALTER TABLE bup_ddl_blocker.t3%";
> +  WHERE info LIKE "ALTER TABLE bup_ddl_blocker.t3%";
>  
> ---echo con5: Releasing lock
> -SELECT release_lock("DDL_not_blocked");
> +--echo con5: Resume all.
> +SET DEBUG_SYNC= 'now SIGNAL status_shown';
>  
> -# Reconnect to con2, con3, and con4 and allow them to finish.
> +# Reconnect to con2, con3, and con4 and fetch their results.
>  
>  connection con2;
>  --echo con2: Completing DDL
> @@ -2362,21 +2063,26 @@ WHERE TABLE_NAME = 't3' AND TABLE_SCHEMA
>  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.
> -#
> +# 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
> ---remove_file $MYSQLTEST_VARDIR/master-data/bup_ddl_blocker.bak
> -
> -
>  
> +connection default;
> +disconnect con1;
> +disconnect con2;
> +disconnect con3;
> +disconnect con4;
> +disconnect con5;
> +disconnect con6;
>  
> +SET DEBUG_SYNC= 'reset';
>  
> diff -Nrup a/mysql-test/t/backup_no_be.test 
> b/mysql-test/t/backup_no_be.test
> --- a/mysql-test/t/backup_no_be.test	2008-05-10 10:42:45 +02:00
> +++ b/mysql-test/t/backup_no_be.test	2008-06-06 16:30:25 +02:00
> @@ -67,7 +67,7 @@ SELECT @@debug;
>  --remove_file $MYSQLTEST_VARDIR/master-data/db1.bak
>  --replace_column 1 #
>  BACKUP DATABASE db1 TO 'db1.bak';
> ---enable_warings
> +--enable_warnings
>  
>  # Don't show warning message code
>  --replace_column 2 #
> diff -Nrup a/mysql-test/t/backup_progress.test 
> b/mysql-test/t/backup_progress.test
> --- a/mysql-test/t/backup_progress.test	2008-03-20 
> 15:53:07 +01:00
> +++ b/mysql-test/t/backup_progress.test	2008-06-06 
> 16:30:25 +02:00
> @@ -4,11 +4,15 @@
>  #
>  
>  --source include/have_log_bin.inc
> ---source include/have_debug.inc
> +--source include/have_debug_sync.inc
>  --source include/have_innodb.inc
>  --source include/not_embedded.inc
>  
> +#
> +# Preparative cleanup.
> +#
>  --disable_warnings
> +SET DEBUG_SYNC= 'reset';
>  DROP DATABASE IF EXISTS backup_progress;
>  DROP TABLE IF EXISTS backup_progress.t1_res;
>  --error 0,1
> @@ -18,9 +22,6 @@ DROP TABLE IF EXISTS backup_progress.t1_
>  connect (con1,localhost,root,,);
>  connect (con2,localhost,root,,);
>  
> -# Setup the server to use the backup breakpoints
> -SET GLOBAL debug="d,backup_debug:d,backup";
> -
>  #
>  # Test 1 - Check output of backup.
>  #
> @@ -58,96 +59,47 @@ INSERT INTO backup_progress.t3 VALUES ("
>  
>  --echo Do backup of database
>  
> -SELECT get_lock("bp_starting_state", 0);
> -
>  connection con2;
>  
> +--echo con2: Activate sync points for the backup statement.
> +SET DEBUG_SYNC= 'after_backup_log_init     SIGNAL started   
> WAIT_FOR do_run';
> +SET DEBUG_SYNC= 'after_backup_start_backup SIGNAL phase1    
> WAIT_FOR backup';
> +SET DEBUG_SYNC= 'after_backup_validated    SIGNAL validated 
> WAIT_FOR do_phase2';
> +SET DEBUG_SYNC= 'after_backup_binlog       SIGNAL phase2    
> WAIT_FOR finish';
> +
>  --echo con2: Send backup command.
>  send BACKUP DATABASE backup_progress to 'backup_progress_orig.bak';
>  
>  connection con1;
>  
> -# Wait for lock to be acquired and execution to reach breakpoint
> ---echo con1: Checking locks.
> -let $wait_condition = SELECT state = "debug_sync_point: 
> bp_starting_state"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "BACKUP DATABASE %";
> ---source include/wait_condition.inc
> -
> -# Wait for row to be written to progress table.
> ---echo con1: Checking progress.
> -let $wait_condition = SELECT backup_state = "starting"
> -                      FROM mysql.online_backup
> -                      WHERE command LIKE "BACKUP DATABASE 
> backup_progress%";
> ---source include/wait_condition.inc
> +--echo con1: Wait for the backup to be started.
> +SET DEBUG_SYNC= 'now WAIT_FOR started';
>  
> ---echo: Display progress
> +--echo con1: Display progress
>  SELECT MAX(backup_id) INTO @bup_id FROM mysql.online_backup 
> WHERE command LIKE "BACKUP DATABASE backup_progress%";
>  INSERT INTO backup_progress.t1_res (id) VALUES (@bup_id);
>  SELECT backup_state FROM mysql.online_backup AS ob JOIN 
> backup_progress.t1_res as t1 ON ob.backup_id = t1.id;
>  
> ---echo con1: Advance the lock.
> -SELECT get_lock("bp_running_state", 0);
> +--echo con1: Let backup step to running state.
> +SET DEBUG_SYNC= 'now SIGNAL do_run WAIT_FOR phase1';
> +
> +--echo con1: Display progress
> +SELECT backup_state FROM mysql.online_backup AS ob JOIN 
> backup_progress.t1_res as t1 ON ob.backup_id = t1.id;
> +
> +--echo con1: Let backup do the backup phase1.
> +SET DEBUG_SYNC= 'now SIGNAL backup WAIT_FOR validated';
> +
> +--echo con1: Display progress
> +SELECT backup_state FROM mysql.online_backup AS ob JOIN 
> backup_progress.t1_res as t1 ON ob.backup_id = t1.id;
>  
> -# Wait for lock to be acquired and execution to reach breakpoint
> ---echo con1: Checking locks.
> -let $wait_condition = SELECT state = "debug_sync_point: 
> bp_running_state"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "BACKUP DATABASE %";
> ---source include/wait_condition.inc
> -
> -# Wait for row to be written to progress table.
> ---echo con1: Checking progress.
> -let $wait_condition = SELECT backup_state = "running"
> -                      FROM mysql.online_backup
> -                      WHERE command LIKE "BACKUP DATABASE 
> backup_progress%";
> ---source include/wait_condition.inc
> -
> ---echo: Display progress
> -SELECT backup_state FROM mysql.online_backup AS ob JOIN 
> backup_progress.t1_res as t1 ON ob.backup_id = t1.id;
> -
> ---echo con1: Advance the lock.
> -SELECT get_lock("bp_vp_state", 0);
> -
> -# Wait for lock to be acquired and execution to reach breakpoint
> ---echo con1: Checking locks.
> -let $wait_condition = SELECT state = "debug_sync_point: bp_vp_state"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "BACKUP DATABASE %";
> ---source include/wait_condition.inc
> -
> -# Wait for row to be written to progress table.
> ---echo con1: Checking progress.
> -let $wait_condition = SELECT backup_state = "validity point"
> -                      FROM mysql.online_backup
> -                      WHERE command LIKE "BACKUP DATABASE 
> backup_progress%";
> ---source include/wait_condition.inc
> -
> ---echo: Display progress
> -SELECT backup_state FROM mysql.online_backup AS ob JOIN 
> backup_progress.t1_res as t1 ON ob.backup_id = t1.id;
> -
> ---echo con1: Advance the lock.
> -SELECT get_lock("bp_running_state", 0);
> -
> -# Wait for lock to be acquired and execution to reach breakpoint
> ---echo con1: Checking locks.
> -let $wait_condition = SELECT state = "debug_sync_point: 
> bp_running_state"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "BACKUP DATABASE %";
> ---source include/wait_condition.inc
> -
> -# Wait for row to be written to progress table.
> ---echo con1: Checking progress.
> -let $wait_condition = SELECT backup_state = "running"
> -                      FROM mysql.online_backup
> -                      WHERE command LIKE "BACKUP DATABASE 
> backup_progress%";
> ---source include/wait_condition.inc
> +--echo con1: Let backup do the backup phase2.
> +SET DEBUG_SYNC= 'now SIGNAL do_phase2 WAIT_FOR phase2';
>  
> ---echo: Display progress
> +--echo con1: Display progress
>  SELECT backup_state FROM mysql.online_backup AS ob JOIN 
> backup_progress.t1_res as t1 ON ob.backup_id = t1.id;
>  
> ---echo con1: Advance the lock.
> -SELECT release_lock("bp_running_state");
> +--echo con1: Let backup finish.
> +SET DEBUG_SYNC= 'now SIGNAL finish';
>  
>  connection con2;
>  --echo con2: Finish backup command
> @@ -164,59 +116,36 @@ connection con1;
>  
>  --echo Do restore of database
>  
> -SELECT get_lock("bp_starting_state", 0);
> -
>  connection con2;
>  
>  DELETE FROM backup_progress.t1_res;
> + 
> +--echo con2: Activate sync points for the backup statement.
> +SET DEBUG_SYNC= 'after_backup_log_init      SIGNAL started 
> WAIT_FOR do_run';
> +SET DEBUG_SYNC= 'after_backup_start_restore SIGNAL running 
> WAIT_FOR finish';
>  
>  --echo con2: Send restore command.
>  send RESTORE FROM 'backup_progress_orig.bak';
>  
>  connection con1;
>  
> -# Wait for lock to be acquired and execution to reach breakpoint
> ---echo con1: Checking locks.
> -let $wait_condition = SELECT state = "debug_sync_point: 
> bp_starting_state"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "RESTORE FROM 
> 'backup_progress_orig.bak'%";
> ---source include/wait_condition.inc
> -
> -# Wait for row to be written to progress table.
> ---echo con1: Checking progress.
> -let $wait_condition = SELECT backup_state = "starting"
> -                      FROM mysql.online_backup
> -                      WHERE command LIKE "RESTORE FROM 
> 'backup_progress_orig.bak'%";
> ---source include/wait_condition.inc
> +--echo con1: Wait for the restore to be started.
> +SET DEBUG_SYNC= 'now WAIT_FOR started';
>  
> ---echo: Display progress
> +--echo con1: Display progress
>  select * from backup_progress.t1_res;
>  SELECT MAX(backup_id) INTO @bup_id FROM mysql.online_backup 
> WHERE command LIKE "RESTORE FROM%";
>  INSERT INTO backup_progress.t1_res (id) VALUES (@bup_id);
>  SELECT backup_state FROM mysql.online_backup AS ob JOIN 
> backup_progress.t1_res as t1 ON ob.backup_id = t1.id;
>  
> ---echo con1: Advance the lock.
> -SELECT get_lock("bp_running_state", 0);
> +--echo con1: Let restore step to running state.
> +SET DEBUG_SYNC= 'now SIGNAL do_run WAIT_FOR running';
>  
> -# Wait for lock to be acquired and execution to reach breakpoint
> ---echo con1: Checking locks.
> -let $wait_condition = SELECT state = "debug_sync_point: 
> bp_running_state"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "RESTORE FROM 
> 'backup_progress_orig.bak'%";
> ---source include/wait_condition.inc
> -
> -# Wait for row to be written to progress table.
> ---echo con1: Checking progress.
> -let $wait_condition = SELECT backup_state = "running"
> -                      FROM mysql.online_backup
> -                      WHERE command LIKE "RESTORE FROM 
> 'backup_progress_orig.bak'%";
> ---source include/wait_condition.inc
> -
> ---echo: Display progress
> +--echo con1: Display progress
>  SELECT backup_state FROM mysql.online_backup AS ob JOIN 
> backup_progress.t1_res as t1 ON ob.backup_id = t1.id;
>  
> ---echo con1: Advance the lock.
> -SELECT release_lock("bp_running_state");
> +--echo con1: Let restore do its job and finish.
> +SET DEBUG_SYNC= 'now SIGNAL finish';
>  
>  connection con2;
>  --echo con2: Finish restore command
> @@ -234,6 +163,10 @@ SELECT obp.* FROM mysql.online_backup_pr
>  
>  connection con1;
>  
> +#
> +# Cleanup.
> +#
> +SET DEBUG_SYNC= 'reset';
>  DROP DATABASE backup_progress;
>  --remove_file $MYSQLTEST_VARDIR/master-data/backup_progress_orig.bak
>  
> diff -Nrup a/mysql-test/t/backup_security.test 
> b/mysql-test/t/backup_security.test
> --- a/mysql-test/t/backup_security.test	2007-12-04 
> 18:38:05 +01:00
> +++ b/mysql-test/t/backup_security.test	2008-06-06 
> 16:30:25 +02:00
> @@ -45,15 +45,7 @@ FLUSH PRIVILEGES;
>  BACKUP DATABASE backup_test to 'backup_test_orig.bak';
>  
>  --echo default: Connect as user with no rights and attempt 
> backup and restore.
> -
>  connect (no_rights,localhost,bup_no_rights,,backup_test);
> -connection no_rights;
> -
> -# Checking processes
> -let $wait_condition = SELECT count(*) = 0
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "BACKUP DATABASE%";
> ---source include/wait_condition.inc
>  
>  --echo no_rights: Attempting backup. Should fail with error 1227
>  --replace_column 1 #
> @@ -72,15 +64,7 @@ SELECT * FROM backup_test.t1;
>  disconnect no_rights;
>  
>  --echo Connect as user with rights and attempt backup and restore.
> -
>  connect (with_rights,localhost,bup_with_rights,,backup_test);
> -connection with_rights;
> -
> -# Checking processes
> -let $wait_condition = SELECT count(*) = 0
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "RESTORE FROM%";
> ---source include/wait_condition.inc
>  
>  --echo no_rights: Attempting backup. Should succeed
>  --replace_column 1 #
> @@ -94,15 +78,8 @@ SELECT * FROM backup_test.t1;
>  
>  disconnect with_rights;
>  
> -connection default;
> -
> -# Checking processes
> -let $wait_condition = SELECT count(*) = 0
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "RESTORE FROM%";
> ---source include/wait_condition.inc
> -
>  --echo default: Do restore to ensure it still works with 
> default test user.
> +connection default;
>  
>  --replace_column 1 #
>  RESTORE FROM 'backup_test_orig.bak';
> diff -Nrup a/mysql-test/t/backup_snapshot.test 
> b/mysql-test/t/backup_snapshot.test
> --- a/mysql-test/t/backup_snapshot.test	2007-12-20 
> 21:32:17 +01:00
> +++ b/mysql-test/t/backup_snapshot.test	2008-06-06 
> 16:30:25 +02:00
> @@ -1,55 +1,47 @@
>  #
> -# This test is for the consistent snapshot online backup driver
> +# This test is for the consistent snapshot online backup driver.
>  # The test is designed to show that a consistent snapshot
>  # backup can be taken while data is being inserted and deleted.
>  #
>  # The test is testing the driver to ensure it is entering a 
>  # consistent read state during the backup. There are several
> -# breakpoints in the code that can be used. The two most 
> -# useful ones are:
> +# synchronization points in the code that can be used.
> +# The two most useful ones are:
>  #
> -#   backup_cs_unlock - occurs after consistent read 
> +#   after_backup_cs_locked - occurs after consistent read 
>  #     transaction has been started and before the open and
>  #     lock tables.
>  #
> -#   backup_cs_reading - occurs after the open and lock
> +#   when_backup_cs_reading - occurs after the open and lock
>  #     tables during the read tables portion.
>  #
>  # The following tests test these conditions.
>  #
> -# Notes
> -#   You must use a dedicated connection for getting and 
> releasing locks.
> -# Do not issue a get_lock() or release_lock() in the same connection
> -# (thread) as code that calls BACKUP_BREAKPOINT(). Using the 
> same connection
> -# to get/release locks and run code that issues 
> BACKUP_BREAKPOINTs will result
> -# in an assertion using DEBUG_ASSERT(thd->ull == NULL) from 
> debug_sync_point()
> -# in item_func.cc.
> -#
>  
>  --source include/have_innodb.inc
> ---source include/have_debug.inc
> +--source include/have_debug_sync.inc
>  --source include/not_embedded.inc
>  
> +#
> +# Preparative cleanup.
> +#
>  --disable_warnings
> +SET DEBUG_SYNC= 'reset';
>  DROP DATABASE IF EXISTS bup_snapshot;
>  --error 0,1
>  --remove_file $MYSQLTEST_VARDIR/master-data/bup_snapshot.bak;
>  --enable_warnings
>  
> -CREATE DATABASE bup_snapshot;
> +--echo #
> +--echo # Setup for tests.
> +--echo #
>  
>  connect (con1,localhost,root,,);
>  connect (con2,localhost,root,,);
> -connect (con3,localhost,root,,);
>  
>  connection con1;
>  
> -# Setup the server to use the backup breakpoints
> -SET GLOBAL debug="d,backup_debug:d,backup";
> -
> -#
> -# Setup for tests.
> -#
> +CREATE DATABASE bup_snapshot;
>  
>  # Create a table and load it with lots of data.
>  CREATE TABLE bup_snapshot.t1 (word CHAR(20)) ENGINE=INNODB;
> @@ -74,59 +66,34 @@ SELECT * FROM bup_snapshot.t1 WHERE word
>  SELECT COUNT(*) FROM bup_snapshot.t1;
>  SELECT COUNT(*) FROM bup_snapshot.t2;
>  
> -connection con3;
> -
> -#
> -# Test 1: Check for consistent read prior to open and lock tables
> -#
> -
> ---echo con3: Getting lock on driver.
> -SELECT get_lock("backup_cs_locked", 100);
> -
> +--echo #
> +--echo # Test 1: Check for consistent read prior to open and 
> lock tables
> +--echo #
>  # While a consistent snapshot backup is executed,
>  # no external inserts should be visible to the transaction.
>  
> -connection con1;
> +--echo con1: Activate sync points for the backup statement.
> +SET DEBUG_SYNC= 'after_backup_cs_locked SIGNAL locked 
> WAIT_FOR inserting';
>  
>  --echo con1: Backing up database. Spawn this and continue...
>  send BACKUP DATABASE bup_snapshot TO "bup_snapshot.bak";
>  
> -connection con3;
> -
> -# Wait for lock to be acquired and execution to reach breakpoint
> ---echo con3: Checking locks.
> -let $wait_condition = SELECT state = "debug_sync_point: 
> backup_cs_locked"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "BACKUP DATABASE %";
> ---source include/wait_condition.inc
> +connection con2;
>  
> -# Start an insert now that CS has a transaction 
> +--echo con2: Wait for backup to have locked the transaction.
> +SET DEBUG_SYNC= 'now WAIT_FOR locked';
> + 
> +--echo con2: Start an insert now that CS has a transaction 
>  # The commit blocker will block this until the read lock of 
>  # the backup is released.
>  
> -connection con2;
> -
> -send INSERT INTO bup_snapshot.t1 VALUES("- Dave Mathews");
> -
> -connection con3;
> -
> -# Wait for lock to be acquired and execution to reach breakpoint
> ---echo con3: Checking locks.
> -let $wait_condition = SELECT count(*) = 1
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "INSERT INTO bup_snapshot.t1%";
> ---source include/wait_condition.inc
> -
> ---echo con3: Release lock on driver.
> -SELECT release_lock("backup_cs_locked");
> -
> -connection con1;
> ---replace_column 1 #
> -reap;
> +--echo con2: Activate sync points for the insert statement.
> +SET DEBUG_SYNC= 'wait_if_global_read_lock SIGNAL inserting';
>  
> -connection con2;
> +# Insert will wait in wait_if_global_read_lock() until 
> backup is done.
> +INSERT INTO bup_snapshot.t1 VALUES("- Dave Mathews");
>  
> -reap;
> +--echo con2: insert additional rows.
>  INSERT INTO bup_snapshot.t1 VALUES("- Yes");
>  INSERT INTO bup_snapshot.t1 VALUES("- Jethro Tull");
>  DELETE FROM bup_snapshot.t1 WHERE word LIKE '10%';
> @@ -135,10 +102,14 @@ DELETE FROM bup_snapshot.t1 WHERE word L
>  SELECT * FROM bup_snapshot.t1 WHERE word LIKE '-%';
>  SELECT COUNT(*) FROM bup_snapshot.t1;
>  
> -# Now restore the database and then check to make sure the new rows
> -# were not backed up.
> +connection con1;
>  
> -connection con1; 
> +--echo con1: retrieve backup result.
> +--replace_column 1 #
> +reap;
> +
> +--echo # Now restore the database and then check to make 
> sure the new rows
> +--echo # were not backed up.
>  
>  --echo con1: Dropping the database
>  DROP TABLE bup_snapshot.t1;
> @@ -154,55 +125,34 @@ SELECT COUNT(*) FROM bup_snapshot.t2;
>  
>  remove_file $MYSQLTEST_VARDIR/master-data/bup_snapshot.bak;
>  
> -#
> -# Test 2: Check for consistent read after open and lock tables
> -#
> -
> -connection con3;
> -
> ---echo con3: Getting lock on driver.
> -SELECT get_lock("backup_cs_reading", 100);
> -
> +--echo #
> +--echo # Test 2: Check for consistent read after open and lock tables
> +--echo #
>  # While a consistent snapshot backup is executed,
>  # no external inserts should be visible to the transaction.
>  
> -connection con1;
> +--echo con1: Activate sync points for the backup statement.
> +SET DEBUG_SYNC= 'when_backup_cs_reading SIGNAL reading 
> WAIT_FOR inserting';
>  
>  --echo con1: Backing up database. Spawn this and continue...
>  send BACKUP DATABASE bup_snapshot TO "bup_snapshot.bak";
>  
> -connection con3;
> -
> -# Wait for lock to be acquired and execution to reach breakpoint
> ---echo con3: Checking locks.
> -let $wait_condition = SELECT state = "debug_sync_point: 
> backup_cs_reading"
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "BACKUP DATABASE%";
> ---source include/wait_condition.inc
> +connection con2;
>  
> -# Start an insert now that CS has a transaction 
> +--echo con2: Wait for backup to start reading.
> +SET DEBUG_SYNC= 'now WAIT_FOR reading';
> + 
> +--echo con2: Start an insert now that CS has a transaction 
>  # The commit blocker will block this until the read lock of 
>  # the backup is released.
>  
> -connection con2;
> -
> -send INSERT INTO bup_snapshot.t1 VALUES("- Dave Mathews");
> -
> -connection con3;
> -
> -# Wait for lock to be acquired and execution to reach breakpoint
> ---echo con3: Checking locks.
> -let $wait_condition = SELECT count(*) = 1
> -                      FROM INFORMATION_SCHEMA.PROCESSLIST
> -                      WHERE info LIKE "INSERT INTO bup_snapshot.t1%";
> ---source include/wait_condition.inc
> -
> ---echo con3: Release lock on driver.
> -SELECT release_lock("backup_cs_reading");
> +--echo con2: Activate sync points for the insert statement.
> +SET DEBUG_SYNC= 'after_insert_locked_tables SIGNAL inserting';
>  
> -connection con2;
> +# Insert will wait in wait_if_global_read_lock() until 
> backup is done.
> +INSERT INTO bup_snapshot.t1 VALUES("- Dave Mathews");
>  
> -reap;
> +--echo con2: insert additional rows.
>  INSERT INTO bup_snapshot.t1 VALUES("- Yes");
>  INSERT INTO bup_snapshot.t1 VALUES("- Jethro Tull");
>  DELETE FROM bup_snapshot.t1 WHERE word LIKE '10%';
> @@ -212,11 +162,13 @@ SELECT * FROM bup_snapshot.t1 WHERE word
>  SELECT COUNT(*) FROM bup_snapshot.t1;
>  
>  connection con1;
> +
> +--echo con1: retrieve backup result.
>  --replace_column 1 #
>  reap;
>  
> -# Now restore the database and then check to make sure the new rows
> -# were not backed up.
> +--echo # Now restore the database and then check to make 
> sure the new rows
> +--echo # were not backed up.
>  
>  --echo con1: Dropping the database
>  DROP TABLE bup_snapshot.t1;
> @@ -230,7 +182,10 @@ SELECT * FROM bup_snapshot.t1 WHERE word
>  SELECT COUNT(*) FROM bup_snapshot.t1;
>  SELECT COUNT(*) FROM bup_snapshot.t2;
>  
> +#
> +# Cleanup
> +#
> +SET DEBUG_SYNC= 'reset';
>  DROP DATABASE bup_snapshot;
> -
>  remove_file $MYSQLTEST_VARDIR/master-data/bup_snapshot.bak;
>  
> diff -Nrup a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def
> --- a/mysql-test/t/disabled.def	2008-05-05 21:33:23 +02:00
> +++ b/mysql-test/t/disabled.def	2008-06-06 16:30:25 +02:00
> @@ -22,12 +22,6 @@ ctype_create         : Bug#32965 main.ct
>  status               : Bug#32966 main.status fails
>  ps_ddl               : Bug#12093 2007-12-14 pending WL#4165 / WL#4166
>  user_limits          : Bug#23921 2007-12-16 random failure 
> of user_limits.test
> -backup                :BUG#34235 pending replacement of test 
> facility with WL#4259
> -backup_commit_blocker :BUG#34235 pending replacement of test 
> facility with WL#4259
> -backup_ddl_blocker    :BUG#34235 pending replacement of test 
> facility with WL#4259
> -backup_progress       :BUG#34235 pending replacement of test 
> facility with WL#4259
> -backup_security       :BUG#34235 pending replacement of test 
> facility with WL#4259
> -backup_snapshot       :BUG#34235 pending replacement of test 
> facility with WL#4259
>  backup_no_engine     : Bug#36021 2008-04-13 rsomla server 
> crashes when openning table with unknown storage engine
>  csv_alter_table      : Bug#33696 2008-01-21 pcrews no 
> .result file - bug allows NULL columns in CSV tables
>  ctype_latin2_ch      : BUG #33791 2008-01-18 mats Wrong 
> ORDER BY with latin2_czech_cs
> diff -Nrup a/sql/backup/Makefile.am b/sql/backup/Makefile.am
> --- a/sql/backup/Makefile.am	2008-05-14 02:23:54 +02:00
> +++ b/sql/backup/Makefile.am	2008-06-06 16:30:25 +02:00
> @@ -52,7 +52,6 @@ noinst_HEADERS = \
>    backup_kernel.h \
>    backup_stream.h \
>    stream_services.h \
> -  debug.h \
>    error.h \
>    stream.h \
>    backup_aux.h \
> diff -Nrup a/sql/backup/backup_test.cc b/sql/backup/backup_test.cc
> --- a/sql/backup/backup_test.cc	2008-03-17 13:38:17 +01:00
> +++ b/sql/backup/backup_test.cc	2008-06-06 16:30:25 +02:00
> @@ -22,7 +22,7 @@ int execute_backup_test_command(THD *thd
>  {
>    int res= 0;
>  
> -  DBUG_ENTER("execute_backup_command");
> +  DBUG_ENTER("execute_backup_test_command");
>    DBUG_ASSERT(thd);
>  
>    Protocol *protocol= thd->protocol;    // client comms
> diff -Nrup a/sql/backup/be_default.cc b/sql/backup/be_default.cc
> --- a/sql/backup/be_default.cc	2008-05-14 18:28:30 +02:00
> +++ b/sql/backup/be_default.cc	2008-06-06 16:30:25 +02:00
> @@ -68,7 +68,6 @@
>  #include "be_default.h"
>  #include "backup_aux.h"
>  #include "rpl_record.h"
> -#include "debug.h"
>  
>  namespace default_backup {
>  
> @@ -298,7 +297,7 @@ result_t Backup::get_data(Buffer &buf)
>      case LOCK_ACQUIRED:          // First time lock ready 
> for validity point
>      {
>        locks_acquired= TRUE;
> -      BACKUP_BREAKPOINT("locking_thread_added");
> +      DEBUG_SYNC(locking_thd->m_thd, "locking_thread_added");
>        DBUG_RETURN(READY);
>      }
>      default:                     // If first call, signal 
> end of init phase
> diff -Nrup a/sql/backup/be_snapshot.cc b/sql/backup/be_snapshot.cc
> --- a/sql/backup/be_snapshot.cc	2008-03-21 09:55:41 +01:00
> +++ b/sql/backup/be_snapshot.cc	2008-06-06 16:30:25 +02:00
> @@ -44,7 +44,6 @@
>  #include "backup_engine.h"
>  #include "be_snapshot.h"
>  #include "backup_aux.h"
> -#include "debug.h"
>  
>  namespace snapshot_backup {
>  
> @@ -92,7 +91,8 @@ result_t Backup::lock()
>    if (res)
>      DBUG_RETURN(ERROR);
>    locking_thd->lock_state= LOCK_ACQUIRED;
> -  BACKUP_BREAKPOINT("backup_cs_locked");
> +  DBUG_ASSERT(locking_thd->m_thd == current_thd);
> +  DEBUG_SYNC(locking_thd->m_thd, "after_backup_cs_locked");
>    DBUG_RETURN(OK);
>  }
>  
> @@ -102,13 +102,13 @@ result_t Backup::get_data(Buffer &buf)
>  
>    if (!tables_open && (locking_thd->lock_state == LOCK_ACQUIRED))
>    {
> -    BACKUP_BREAKPOINT("backup_cs_open_tables");
>      open_and_lock_tables(locking_thd->m_thd, 
> locking_thd->tables_in_backup);
>      tables_open= TRUE;
>    }
>    if (locking_thd->lock_state == LOCK_ACQUIRED)
>    {
> -    BACKUP_BREAKPOINT("backup_cs_reading");
> +    DBUG_ASSERT(locking_thd->m_thd == current_thd);
> +    DEBUG_SYNC(locking_thd->m_thd, "when_backup_cs_reading");
>    }
>  
>    res= default_backup::Backup::get_data(buf);
> diff -Nrup a/sql/backup/data_backup.cc b/sql/backup/data_backup.cc
> --- a/sql/backup/data_backup.cc	2008-05-05 17:03:15 +02:00
> +++ b/sql/backup/data_backup.cc	2008-06-06 16:30:25 +02:00
> @@ -19,7 +19,6 @@
>  #include "backup_engine.h"
>  #include "stream.h"
>  #include "backup_progress.h"
> -#include "debug.h"
>  #include "be_default.h"  // needed for table locking code
>  
>  /***********************************************
> @@ -409,7 +408,7 @@ int block_commits(THD *thd, TABLE_LIST *
>    /*
>      Step 1 - global read lock.
>    */
> -  BACKUP_BREAKPOINT("commit_blocker_step_1");
> +  DEBUG_SYNC(thd, "before_commit_block");
>    if (lock_global_read_lock(thd))
>      DBUG_RETURN(1);
>  
> @@ -425,14 +424,12 @@ int block_commits(THD *thd, TABLE_LIST *
>      that do not take lock tables. Thus, it should apply to 
> write locked
>      tables only and only to non-transactional engines.
>  
> -    BACKUP_BREAKPOINT("commit_blocker_step_2");
>      result= close_cached_tables(thd, 0, tables);
>    */
>  
>    /*
>      Step 3 - make the global read lock to block commits.
>    */
> -  BACKUP_BREAKPOINT("commit_blocker_step_3");
>    if (make_global_read_lock_block_commit(thd))
>    {
>      /* Don't leave things in a half-locked state */
> @@ -455,7 +452,6 @@ int block_commits(THD *thd, TABLE_LIST *
>  int unblock_commits(THD *thd)
>  {
>    DBUG_ENTER("unblock_commits()");
> -  BACKUP_BREAKPOINT("commit_blocker_step_5");
>    unlock_global_read_lock(thd);
>    DBUG_RETURN(0);
>  }
> @@ -529,7 +525,6 @@ int write_table_data(THD* thd, Backup_in
>                              inactive.elements));
>  
>    DBUG_PRINT("backup_data",("-- INIT PHASE --"));
> -  BACKUP_BREAKPOINT("data_init");
>  
>    /*
>     Poll "at end" drivers activating inactive ones on the way.
> @@ -592,7 +587,6 @@ int write_table_data(THD* thd, Backup_in
>  
>      // prepare for VP
>      DBUG_PRINT("backup_data",("-- PREPARE PHASE --"));
> -    BACKUP_BREAKPOINT("data_prepare");
>  
>      if (sch.prepare())
>        goto error;
> @@ -613,7 +607,7 @@ int write_table_data(THD* thd, Backup_in
>        the backup progress. It is not to be used to indicate actual
>        timing of the validity point.
>      */
> -    BACKUP_BREAKPOINT("bp_vp_state");
> +    DEBUG_SYNC(thd, "after_backup_validated");
>      
>      /*
>        Block commits.
> @@ -627,7 +621,6 @@ int write_table_data(THD* thd, Backup_in
>      if (error)
>        goto error;
>  
> -    BACKUP_BREAKPOINT("data_lock");
>      if (sch.lock())
>        goto error;
>  
> @@ -642,15 +635,14 @@ int write_table_data(THD* thd, Backup_in
>      */
>      vp_time= my_time(0);
>  
> -    BACKUP_BREAKPOINT("commit_blocker_step_4");
> -    BACKUP_BREAKPOINT("data_unlock");
> +    DEBUG_SYNC(thd, "before_backup_data_unlock");
>      if (sch.unlock())
>        goto error;
>  
>      /*
>        Unblock commits.
>      */
> -    BACKUP_BREAKPOINT("backup_commit_blocker");
> +    DEBUG_SYNC(thd, "before_backup_unblock_commit");
>      error= unblock_commits(thd);
>      if (error)
>        goto error;
> @@ -667,13 +659,12 @@ int write_table_data(THD* thd, Backup_in
>      }
>  
>      info.m_ctx.report_state(BUP_RUNNING);
> -    BACKUP_BREAKPOINT("bp_running_state");
> +    DEBUG_SYNC(thd, "after_backup_binlog");
>  
>      /**** VP creation (end) 
> ********************************************/
>  
>      // get final data from drivers
>      DBUG_PRINT("backup_data",("-- FINISH PHASE --"));
> -    BACKUP_BREAKPOINT("data_finish");
>  
>      while (sch.finish_count > 0)
>      if (sch.step())
> diff -Nrup a/sql/backup/debug.h b/sql/backup/debug.h
> --- a/sql/backup/debug.h	2008-03-19 10:18:54 +01:00
> +++ /dev/null	Wed Dec 31 16:00:00 196900
> @@ -1,231 +0,0 @@
> -#ifndef _BACKUP_DEBUG_H
> -#define _BACKUP_DEBUG_H
> -
> -#define BACKUP_BREAKPOINT_TIMEOUT 300
> -
> -/*
> -  TODO
> -  - decide how to configure DEBUG_BACKUP
> - */
> -
> -#ifndef DBUG_OFF
> -# define DBUG_BACKUP
> -#endif
> -
> -
> -/**
> -  @page BACKUP_BREAKPOINT Online Backup Breakpoints
> -  Macros for creating breakpoints during testing.
> -
> -  @section WHAT What are breakpoints?
> -  Breakpoints are devices used to pause the execution of the 
> backup system
> -  at a certain point in the code. There is a timeout that 
> you can specify
> -  when you set the lock for the breakpoint (from get_lock() 
> see below)
> -  which will enable execution to continue after the period in seconds
> -  expires.
> -
> -  The best use of these breakpoints is for pausing execution 
> at critical
> -  points in the backup code to allow proper testing of 
> certain features.
> -  For example, suppose you wanted to ensure the Consistent 
> Snapshot driver
> -  was working properly. To do so, you would need to ensure 
> no new @INSERT
> -  statements are executed while the data is being backed up. 
> If you use
> -  a breakpoint, you can set the breakpoint to pause the 
> backup kernel at
> -  the point where it has set the consistent read and is reading rows.
> -  You can then insert some rows and release the breakpoint. 
> The result
> -  should contain all of the rows in the table except those that were
> -  inserted once the consistent read was set.
> -
> -  @section USAGE How to use breakpoints.
> -  To make a breakpoint available, you must add a macro call 
> to the code.
> -  Simply insert the macro call as follows. The @c 
> breakpoint_name is a 
> -  text string that must be unique among the breakpoints. It 
> is used in 
> -  the macro as a means of tagging the code for pausing and resuming
> -  execution. Once the code is compiled, you can use a client 
> connection
> -  to set and release the breakpoint. Be sure to use a 
> separate connection
> -  for getting, checking, and releasing locks. 
> -
> - 
> <b><c>BACKUP_BREAKPOINT("<breakpoint_name>");</c></b>
> -  
> -  Breakpoints use the user-defined locking functions @c 
> get_lock() to set
> -  the breakpoint and @c release_lock() to release it.
> -
> -  @subsection SET Setting breakpoints.
> -  To set an existing breakpoint, issue the following command where @c
> -  timeout is the number of seconds execution will pause once 
> the breakpoint
> -  is reached before continuing execution.
> -
> -  <b><c>SELECT
> get_lock("<breakpoint_name>",<timeout>);</c></b>
> -
> -  @subsection RELEASE Releasing breakpoints.
> -  To release an existing breakpoint, issue the following 
> command. This
> -  releases execution allow the system to continue.
> -
> -  <b><c>SELECT
> release_lock("<breakpoint_name>");</c></b>
> -
> -  @subsection EXAMPLE Example - Testing the Consistent 
> Snapshot Driver
> -  To test the consistent snapshot driver, we can make use of the @c
> -  backup_cs_locked breakpoint to pause execution after the 
> consistent read
> -  is initiated and before all of the rows from the table 
> have been read.
> -  Consider an InnoDB table with the following structure as 
> our test table.
> -
> -  <c>CREATE TABLE t1 (a INT) ENGINE=INNODB;</c>
> -
> -  To perform this test using breakpoints, we need two client 
> connections.
> -  One will be used to execute the backup command and another 
> to set and
> -  release the breakpoint. In the first client, we set the 
> breakpoint with
> -  the <c>SELECT get_lock("backup_cs_locked", 100);</c> 
> command. In the 
> -  second client, we start the execution of the backup. We 
> can return to
> -  the first client and issue several @INSERT statements then 
> issue the
> -  <c>SELECT release_lock("backup_cs_locked");</c> command to 
> release the
> -  breakpoint.
> -
> -  We can then return to the second client, select all of the 
> rows from the
> -  table to verify the rows were inserted. We can verify that 
> the consistent
> -  snapshot worked by restoring the database (which is a 
> destructive restore)
> -  and then select all of the rows. This will show that the new rows 
> -  inserted while the backup was running were not inserted 
> into the table.
> -  The following shows the output of the commands as described.
> -
> -  <b>First Client</b>
> -  @code mysql> SELECT * FROM t1;
> -  +---+
> -  | a |
> -  +---+
> -  | 1 |
> -  | 2 |
> -  | 3 |
> -  +---+
> -  3 rows in set (0.00 sec)
> -
> -  mysql> SELECT get_lock("backup_cs_locked", 100);
> -  +-----------------------------------+
> -  | get_lock("backup_cs_locked", 100) |
> -  +-----------------------------------+
> -  |                                 1 |
> -  +-----------------------------------+
> -  1 row in set (0.00 sec) @endcode
> -
> -  <b>Second Client</b>
> -  @code mysql> BACKUP DATABASE test TO 'test.bak'; @endcode
> -
> -  Note: The backup will pause while the breakpoint is set 
> (the lock is held).
> -
> -  <b>First Client</b>
> -  @code mysql> INSERT INTO t1 VALUES (101), (102), (103);
> -  Query OK, 3 rows affected (0.02 sec)
> -  Records: 3  Duplicates: 0  Warnings: 0
> -
> -  mysql> SELECT * FROM t1;
> -  +-----+
> -  | a   |
> -  +-----+
> -  |   1 |
> -  |   2 |
> -  |   3 |
> -  | 101 |
> -  | 102 |
> -  | 103 |
> -  +-----+
> -  6 rows in set (0.00 sec)
> -  
> -  mysql> SELECT release_lock("backup_cs_locked");
> -  +----------------------------------+
> -  | release_lock("backup_cs_locked") |
> -  +----------------------------------+
> -  |                                1 |
> -  +----------------------------------+
> -  1 row in set (0.01 sec) @endcode
> -
> -  <b>Second Client</b>
> -  @code +------------------------------+
> -  | Backup Summary               |
> -  +------------------------------+
> -  |  header     =       14 bytes |
> -  |  meta-data  =      120 bytes |
> -  |  data       =       30 bytes |
> -  |               -------------- |
> -  |  total             164 bytes |
> -  +------------------------------+
> -  5 rows in set (33.45 sec)
> -
> -  mysql> SELECT * FROM t1;
> -  +-----+
> -  | a   |
> -  +-----+
> -  |   1 |
> -  |   2 |
> -  |   3 |
> -  | 101 |
> -  | 102 |
> -  | 103 |
> -  +-----+
> -  6 rows in set (0.00 sec)
> -  
> -  mysql> RESTORE FROM 'test.bak';
> -  +------------------------------+
> -  | Restore Summary              |
> -  +------------------------------+
> -  |  header     =       14 bytes |
> -  |  meta-data  =      120 bytes |
> -  |  data       =       30 bytes |
> -  |               -------------- |
> -  |  total             164 bytes |
> -  +------------------------------+
> -  5 rows in set (0.08 sec)
> -  
> -  mysql> SELECT * FROM t1;
> -  +---+
> -  | a |
> -  +---+
> -  | 1 |
> -  | 2 |
> -  | 3 |
> -  +---+
> -  3 rows in set (0.00 sec)@endcode
> -
> -  Note: The backup will complete once breakpoint is released 
> (the lock is
> -  released).
> -
> -  @section BREAKPOINTS Breakpoints
> -  The following are the available breakpoints included in the code.
> -
> -  - <b>backup_command</b>  Occurs at the start of the backup 
> operation.
> -  - <b>data_init</b>  Occurs at the start of the 
> <b>INITIALIZE PHASE</b>.
> -  - <b>data_prepare</b>  Occurs at the start of the 
> <b>PREPARE PHASE</b>.
> -  - <b>data_lock</b>  Occurs at the start of the <b>SYNC
> PHASE</b>.
> -  - <b>data_unlock</b>  Occurs before the unlock calls.
> -  - <b>data_finish</b>  Occurs at the start of the <b>FINISH 
> PHASE</b>.
> -  - <b>backup_meta</b>  Occurs before the call to write_meta_data().
> -  - <b>backup_data</b>  Occurs before the call to write_table_data().
> -  - <b>backup_done</b>  Occurs after the call to 
> write_table_data() returns.
> -  - <b>backup_cs_locked</b>  Consistent Snapshot - after the 
> consistent
> -                             read has been initiated but 
> before rows are read.
> -  - <b>backup_cs_open_tables</b>  Consistent Snapshot - 
> before the call to
> -                             open and lock tables.
> -  - <b>backup_cs_reading</b>  Consistent Snapshot - occurs 
> during read.
> -
> -  @section NOTES Developer Notes
> -  - Breakpoints can be used in debug builds only. You must compile
> -  the code using the @c DEBUG_EXTRA preprocessor directive. 
> -  - When adding breakpoints, you must add a list item for 
> each breakpoint
> -  to the documentation for breakpoints. See the code for the macro
> -  definition in @ref debug.h for details.
> -  - You must use a dedicated connection for getting and 
> releasing locks. Do
> -  not issue a get_lock() or release_lock() in the same 
> connection (thread) as
> -  code that calls BACKUP_BREAKPOINT(). Using the same 
> connection to get/release
> -  locks and run code that issues BACKUP_BREAKPOINTs will result in an
> -  assertion using DEBUG_ASSERT(thd->ull == NULL) from 
> debug_sync_point() in
> -  item_func.cc.
> -
> - */
> -
> -/*
> -  Consider: set thd->proc_info when waiting on lock
> -*/
> -#define BACKUP_BREAKPOINT(S) \
> - do { \
> -  DBUG_PRINT("backup",("== breakpoint on '%s' ==",(S))); \
> -  DBUG_EXECUTE_IF("backup_debug", 
> DBUG_SYNC_POINT((S),BACKUP_BREAKPOINT_TIMEOUT);); \
> - } while (0)
> -
> -#endif
> diff -Nrup a/sql/backup/kernel.cc b/sql/backup/kernel.cc
> --- a/sql/backup/kernel.cc	2008-05-21 12:45:50 +02:00
> +++ b/sql/backup/kernel.cc	2008-06-06 16:30:25 +02:00
> @@ -69,7 +69,6 @@
>  #include "restore_info.h"
>  #include "logger.h"
>  #include "stream.h"
> -#include "debug.h"
>  #include "be_native.h"
>  #include "be_default.h"
>  #include "be_snapshot.h"
> @@ -127,8 +126,6 @@ execute_backup_command(THD *thd, LEX *le
>    DBUG_ENTER("execute_backup_command");
>    DBUG_ASSERT(thd && lex);
>  
> -  BACKUP_BREAKPOINT("backup_command");
> -
>    using namespace backup;
>  
>    Backup_restore_ctx context(thd); // reports errors
> @@ -148,7 +145,7 @@ execute_backup_command(THD *thd, LEX *le
>      if (!info || !info->is_valid())
>        DBUG_RETURN(send_error(context, ER_BACKUP_BACKUP_PREPARE));
>  
> -    BACKUP_BREAKPOINT("bp_running_state");
> +    DEBUG_SYNC(thd, "after_backup_start_backup");
>  
>      // select objects to backup
>  
> @@ -181,7 +178,6 @@ execute_backup_command(THD *thd, LEX *le
>      if (res)
>        DBUG_RETURN(send_error(context, ER_BACKUP_BACKUP));
>  
> -    BACKUP_BREAKPOINT("bp_complete_state");
>      break;
>    }
>  
> @@ -192,7 +188,7 @@ execute_backup_command(THD *thd, LEX *le
>      if (!info || !info->is_valid())
>        DBUG_RETURN(send_error(context, ER_BACKUP_RESTORE_PREPARE));
>      
> -    BACKUP_BREAKPOINT("bp_running_state");
> +    DEBUG_SYNC(thd, "after_backup_start_restore");
>  
>      res= context.do_restore();      
>  
> @@ -734,8 +730,6 @@ int Backup_restore_ctx::do_backup()
>    Output_stream &s= *static_cast<Output_stream*>(m_stream);
>    Backup_info   &info= *static_cast<Backup_info*>(m_catalog);
>  
> -  BACKUP_BREAKPOINT("backup_meta");
> -
>    report_stats_pre(info);
>  
>    DBUG_PRINT("backup",("Writing preamble"));
> @@ -748,8 +742,6 @@ int Backup_restore_ctx::do_backup()
>  
>    DBUG_PRINT("backup",("Writing table data"));
>  
> -  BACKUP_BREAKPOINT("backup_data");
> -
>    if (write_table_data(m_thd, info, s)) // reports errors
>      DBUG_RETURN(send_error(*this, ER_BACKUP_BACKUP));
>  
> @@ -764,7 +756,6 @@ int Backup_restore_ctx::do_backup()
>    report_stats_post(info);
>  
>    DBUG_PRINT("backup",("Backup done."));
> -  BACKUP_BREAKPOINT("backup_done");
>  
>    DBUG_RETURN(0);
>  }
> diff -Nrup a/sql/backup/logger.h b/sql/backup/logger.h
> --- a/sql/backup/logger.h	2008-03-21 10:57:37 +01:00
> +++ b/sql/backup/logger.h	2008-06-06 16:30:25 +02:00
> @@ -1,9 +1,9 @@
>  #ifndef _BACKUP_LOGGER_H
>  #define _BACKUP_LOGGER_H
>  
> +#include "mysql_priv.h"
>  #include <backup_stream.h>
>  #include <backup/error.h>
> -#include <backup/debug.h>
>  #include <backup/backup_progress.h>
>  
>  
> @@ -130,7 +130,7 @@ int Logger::init(enum_type type, const L
>    m_op_id= report_ob_init(m_thd, m_thd->id, BUP_STARTING, 
>                            type == BACKUP ? OP_BACKUP : OP_RESTORE, 
>                            0, "", path.str, query);  
> -  BACKUP_BREAKPOINT("bp_starting_state");
> +  DEBUG_SYNC(m_thd, "after_backup_log_init");
>    return 0;
>  }
>  
> diff -Nrup a/sql/backup/stream.h b/sql/backup/stream.h
> --- a/sql/backup/stream.h	2008-03-04 17:06:24 +01:00
> +++ b/sql/backup/stream.h	2008-06-06 16:30:25 +02:00
> @@ -5,7 +5,6 @@
>  
>  #include <backup/api_types.h>    // for Buffer definition
>  #include <backup/image_info.h>
> -#include <backup/debug.h>        // for definition of DBUG_BACKUP
>  #include <backup/logger.h>
>  
>  /**
> diff -Nrup a/sql/ddl_blocker.cc b/sql/ddl_blocker.cc
> --- a/sql/ddl_blocker.cc	2007-12-12 21:13:23 +01:00
> +++ b/sql/ddl_blocker.cc	2008-06-06 16:30:25 +02:00
> @@ -110,7 +110,7 @@ void DDL_blocker_class::end_DDL()
>  my_bool DDL_blocker_class::check_DDL_blocker(THD *thd)
>  {
>    DBUG_ENTER("check_DDL_blocker()");
> -  BACKUP_BREAKPOINT("DDL_not_blocked");
> +  DEBUG_SYNC(thd, "before_check_ddl_blocked");
>  
>    /*
>      Check the ddl blocker condition. Rest until ddl blocker 
> is released.
> @@ -122,7 +122,7 @@ my_bool DDL_blocker_class::check_DDL_blo
>      pthread_cond_wait(&COND_DDL_blocker, &THR_LOCK_DDL_is_blocked);
>    start_DDL();
>    thd->exit_cond("DDL blocker: Ok to run DDL");
> -  BACKUP_BREAKPOINT("DDL_in_progress");
> +  DEBUG_SYNC(thd, "after_start_ddl");
>    DBUG_RETURN(TRUE);
>  }
>  
> @@ -143,7 +143,7 @@ my_bool DDL_blocker_class::block_DDL(THD
>  {
>    DBUG_ENTER("block_DDL()");
>  
> -  BACKUP_BREAKPOINT("DDL_in_progress");
> +  DEBUG_SYNC(thd, "before_block_ddl");
>  
>    /*
>      Only 1 DDL blocking operation can run at a time.
> @@ -159,8 +159,6 @@ my_bool DDL_blocker_class::block_DDL(THD
>    DDL_blocked= TRUE;
>    thd->exit_cond("DDL blocker: Ok to block DDL");
>  
> -  BACKUP_BREAKPOINT("DDL_blocker_blocked");
> -
>    /*
>      Check the ddl blocker condition. Rest until ddl blocker 
> is released.
>    */
> @@ -171,7 +169,7 @@ my_bool DDL_blocker_class::block_DDL(THD
>      pthread_cond_wait(&COND_process_blocked, &THR_LOCK_DDL_blocker);
>    thd->exit_cond("DDL blocker: DDL is now blocked");
>  
> -  BACKUP_BREAKPOINT("DDL_blocked");
> +  DEBUG_SYNC(thd, "after_block_ddl");
>    DBUG_RETURN(TRUE);
>  }
>  
> diff -Nrup a/sql/ddl_blocker.h b/sql/ddl_blocker.h
> --- a/sql/ddl_blocker.h	2007-12-12 21:13:24 +01:00
> +++ b/sql/ddl_blocker.h	2008-06-06 16:30:25 +02:00
> @@ -4,7 +4,6 @@
>    Header file for DDL blocker code.
>   */
>  #include "mysql_priv.h"
> -#include "backup/debug.h"
>  
>  /**
>     @class DDL_blocker_class
> diff -Nrup a/sql/debug_sync.cc b/sql/debug_sync.cc
> --- a/sql/debug_sync.cc	2008-04-29 11:22:02 +02:00
> +++ b/sql/debug_sync.cc	2008-06-06 16:30:25 +02:00
> @@ -259,9 +259,9 @@ struct st_debug_sync_globals
>  static st_debug_sync_globals debug_sync_global; /* All 
> globals in one object */
>  
>  /**
> -  Callback pointer from thr_lock.cc
> +  Callback pointer from thr_lock.c
>  */
> -extern void (*debug_sync_wait_for_lock_callback_ptr)(void);
> +extern "C" void (*debug_sync_wait_for_lock_callback_ptr)(void);
>  
>  
>  /**
> @@ -815,7 +815,7 @@ static st_debug_sync_action *debug_sync_
>    DBUG_ASSERT(name_len);
>    DBUG_ASSERT(ds_control);
>    DBUG_PRINT("debug_sync", ("sync_point: '%.*s'", (int) 
> name_len, dsp_name));
> -  DBUG_PRINT("debug_sync", ("active: %lu  allocated: %lu",
> +  DBUG_PRINT("debug_sync", ("active: %u  allocated: %u",
>                              ds_control->ds_active, 
> ds_control->ds_allocated));
>  
>    /* There cannot be more active actions than allocated. */
> @@ -1562,15 +1562,24 @@ static void debug_sync_execute(THD *thd,
>    {
>      action->execute--;
>  
> +    /*
> +      Protect copying of the signal string to the global string
> +      to avoid race conditions during test case development.
> +      After approaching a clean test case it should not happen
> +      that two threads try to signal at the same time.
> +
> +      Do also acquire the mutex for a WAIT_FOR action. The 
> sense is to
> +      clamp SIGNAL and WAIT_FOR in the mutex. If we wake 
> another thread
> +      with the signal, it should not run until we set PROC_INFO in
> +      enter_cond().
> +
> +      Note. When 'execute' is non-zero, at least one of 
> SIGNAL, WAIT_FOR
> +      is set.
> +    */
> +    pthread_mutex_lock(&debug_sync_global.ds_mutex);
> +
>      if (action->signal.length())
>      {
> -      /*
> -        Protect copying of the signal string to the global string
> -        to avoid race conditions during test case development.
> -        After approaching a clean test case it should not happen
> -        that two threads try to signal at the same time.
> -      */
> -      pthread_mutex_lock(&debug_sync_global.ds_mutex);
>        /* Copy the signal to the global variable. */
>        if (debug_sync_global.ds_signal.copy(action->signal))
>        {
> @@ -1585,8 +1594,6 @@ static void debug_sync_execute(THD *thd,
>        DBUG_PRINT("debug_sync_exec", ("signal '%s'  at: '%s'",
>                                       action->signal.c_ptr(),
>                                       action->sync_point.c_ptr()));
> -      pthread_mutex_unlock(&debug_sync_global.ds_mutex);
> -
>      } /* end if (action->signal.length()) */
>  
>      if (action->wait_for.length())
> @@ -1594,11 +1601,13 @@ static void debug_sync_execute(THD *thd,
>        const char      *old_proc_info;
>        int             error= 0;
>        struct timespec abstime;
> +      String          proc_info;
>  
> -      pthread_mutex_lock(&debug_sync_global.ds_mutex);
> +      proc_info.set("debug sync point: ", 18, system_charset_info);
> +      proc_info.append(action->sync_point);
>        old_proc_info= thd->enter_cond(&debug_sync_global.ds_cond,
>                                       &debug_sync_global.ds_mutex,
> -                                     action->sync_point.c_ptr());
> +                                     proc_info.c_ptr());
>  
>        set_timespec(abstime, action->timeout);
>        DBUG_PRINT("debug_sync_exec", ("wait for '%s'  at: 
> '%s'  curr: '%s'",
> @@ -1631,9 +1640,15 @@ static void debug_sync_execute(THD *thd,
>                                       action->wait_for.c_ptr(),
>                                       action->sync_point.c_ptr()));
>  
> +      /* exit_cond() does also unlock the mutex. */
>        thd->exit_cond(old_proc_info);
>  
>      } /* end if (action->wait_for.length()) */
> +    else
> +    {
> +      /* Need explicit unlock of mutex as we don't use 
> exit_cond() here. */
> +      pthread_mutex_unlock(&debug_sync_global.ds_mutex);
> +    }
>  
>    } /* end if (action->execute) */
>  
> diff -Nrup a/sql/handler.cc b/sql/handler.cc
> --- a/sql/handler.cc	2008-04-07 17:26:37 +02:00
> +++ b/sql/handler.cc	2008-06-06 16:30:25 +02:00
> @@ -27,7 +27,6 @@
>  #include "rpl_filter.h"
>  #include <myisampack.h>
>  #include <errno.h>
> -#include "backup/debug.h"
>  
>  #ifdef WITH_PARTITION_STORAGE_ENGINE
>  #include "ha_partition.h"
> @@ -1091,7 +1090,7 @@ int ha_commit_trans(THD *thd, bool all)
>      /*
>        Breakpoints for backup testing.
>      */
> -    BACKUP_BREAKPOINT("commit_blocker_step_1");
> +    DEBUG_SYNC(thd, "within_ha_commit_trans");
>      DBUG_EXECUTE_IF("crash_commit_before", abort(););
>  
>      /* Close all cursors that can not survive COMMIT */
> diff -Nrup a/sql/lock.cc b/sql/lock.cc
> --- a/sql/lock.cc	2008-04-29 11:27:23 +02:00
> +++ b/sql/lock.cc	2008-06-06 16:30:25 +02:00
> @@ -1423,9 +1423,33 @@ bool lock_global_read_lock(THD *thd)
>    if (!thd->global_read_lock)
>    {
>      const char *old_message;
> +    const char *new_message= "Waiting to get readlock";
>      (void) pthread_mutex_lock(&LOCK_global_read_lock);
> +
> +#if defined(ENABLED_DEBUG_SYNC)
> +    /*
> +      The below sync point fires if we have to wait for
> +      protect_against_global_read_lock.
> +
> +      WARNING: Beware to use WAIT_FOR with this sync point. We hold
> +      LOCK_global_read_lock here.
> +
> +      Call the sync point before calling enter_cond() as it does use
> +      enter_cond() and exit_cond() itself if a WAIT_FOR action is
> +      executed in spite of the above warning.
> +
> +      Pre-set proc_info so that it is available immediately after the
> +      sync point sends a SIGNAL. This makes tests more reliable.
> +    */
> +    if (protect_against_global_read_lock)
> +    {
> +      thd_proc_info(thd, new_message);
> +      DEBUG_SYNC(thd, "wait_lock_global_read_lock");
> +    }
> +#endif /* defined(ENABLED_DEBUG_SYNC) */
> +
>      old_message=thd->enter_cond(&COND_global_read_lock, 
> &LOCK_global_read_lock,
> -                                "Waiting to get readlock");
> +                                new_message);
>      DBUG_PRINT("info",
>  	       ("waiting_for: %d  protect_against: %d",
>  		waiting_for_read_lock, 
> protect_against_global_read_lock));
> @@ -1501,6 +1525,8 @@ bool wait_if_global_read_lock(THD *thd, 
>    (void) pthread_mutex_lock(&LOCK_global_read_lock);
>    if ((need_exit_cond= must_wait))
>    {
> +    const char *new_message= "Waiting for release of readlock";
> +

Can you explain why moving the comment to here was needed? I don't see the
significance or why we need to do that. Or this just an addition to fix an
omission?

>      if (thd->global_read_lock)		// This thread 
> had the read locks
>      {
>        if (is_not_commit)
> @@ -1514,8 +1540,31 @@ bool wait_if_global_read_lock(THD *thd, 
>        */
>        DBUG_RETURN(is_not_commit);
>      }
> +
> +#if defined(ENABLED_DEBUG_SYNC)
> +    /*
> +      The below sync point fires if we have to wait for
> +      global_read_lock.
> +
> +      WARNING: Beware to use WAIT_FOR with this sync point. We hold
> +      LOCK_global_read_lock here.
> +
> +      Call the sync point before calling enter_cond() as it does use
> +      enter_cond() and exit_cond() itself if a WAIT_FOR action is
> +      executed in spite of the above warning.
> +
> +      Pre-set proc_info so that it is available immediately after the
> +      sync point sends a SIGNAL. This makes tests more reliable.
> +    */
> +    if (must_wait)
> +    {
> +      thd_proc_info(thd, new_message);
> +      DEBUG_SYNC(thd, "wait_if_global_read_lock");
> +    }
> +#endif /* defined(ENABLED_DEBUG_SYNC) */
> +
>      old_message=thd->enter_cond(&COND_global_read_lock, 
> &LOCK_global_read_lock,
> -				"Waiting for release of readlock");
> +                                new_message);
>      while (must_wait && ! thd->killed &&
>  	   (!abort_on_refresh || thd->version == refresh_version))
>      {
> @@ -1527,7 +1576,11 @@ bool wait_if_global_read_lock(THD *thd, 
>        result=1;
>    }
>    if (!abort_on_refresh && !result)
> +  {
>      protect_against_global_read_lock++;
> +    DBUG_PRINT("sql_lock", 
> ("protect_against_global_read_lock incr: %u",
> +                            protect_against_global_read_lock));
> +  }
>    /*
>      The following is only true in case of a global read 
> locks (which is rare)
>      and if old_message is set
> @@ -1549,6 +1602,8 @@ void start_waiting_global_read_lock(THD 
>    (void) pthread_mutex_lock(&LOCK_global_read_lock);
>    tmp= (!--protect_against_global_read_lock &&
>          (waiting_for_read_lock || global_read_lock_blocks_commit));
> +  DBUG_PRINT("sql_lock", ("protect_against_global_read_lock 
> decr: %u",
> +                          protect_against_global_read_lock));
>    (void) pthread_mutex_unlock(&LOCK_global_read_lock);
>    if (tmp)
>      pthread_cond_broadcast(&COND_global_read_lock);
> diff -Nrup a/sql/sql_delete.cc b/sql/sql_delete.cc
> --- a/sql/sql_delete.cc	2008-04-14 12:10:01 +02:00
> +++ b/sql/sql_delete.cc	2008-06-06 16:30:25 +02:00
> @@ -23,7 +23,6 @@
>  #include "sql_select.h"
>  #include "sp_head.h"
>  #include "sql_trigger.h"
> -#include "backup/debug.h"
>  
>  /**
>    Implement DELETE SQL word.
> @@ -400,13 +399,7 @@ cleanup:
>    DBUG_ASSERT(transactional_table || !deleted || 
> thd->transaction.stmt.modified_non_trans_table);
>    free_underlaid_joins(thd, select_lex);
>  
> -  /*
> -    Breakpoints for backup testing.
> -  */
> -  if (!table->file->has_transactions())
> -  {
> -    BACKUP_BREAKPOINT("backup_commit_blocker");
> -  }
> +  DEBUG_SYNC(thd, "at_delete_end");
>  
>    MYSQL_DELETE_END();
>    if (error < 0 || (thd->lex->ignore && !thd->is_fatal_error))
> diff -Nrup a/sql/sql_insert.cc b/sql/sql_insert.cc
> --- a/sql/sql_insert.cc	2008-04-21 12:20:17 +02:00
> +++ b/sql/sql_insert.cc	2008-06-06 16:30:25 +02:00
> @@ -61,7 +61,6 @@
>  #include "sql_show.h"
>  #include "slave.h"
>  #include "rpl_mi.h"
> -#include "backup/debug.h"
>  #include "sql_audit.h"
>  
>  #ifndef EMBEDDED_LIBRARY
> @@ -620,8 +619,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *t
>    /*
>      Breakpoints for backup testing.
>    */
> -  BACKUP_BREAKPOINT("backup_cs_reading");
> -  BACKUP_BREAKPOINT("commit_blocker_step_1");
> +  DEBUG_SYNC(thd, "after_insert_locked_tables");
>    thd_proc_info(thd, "init");
>    thd->used_tables=0;
>    values= its++;
> diff -Nrup a/sql/sql_parse.cc b/sql/sql_parse.cc
> --- a/sql/sql_parse.cc	2008-05-05 21:33:24 +02:00
> +++ b/sql/sql_parse.cc	2008-06-06 16:30:25 +02:00
> @@ -28,7 +28,6 @@
>  #include "events.h"
>  #include "sql_trigger.h"
>  #include <ddl_blocker.h>
> -#include "backup/debug.h"
>  #include "sql_audit.h"
>  
>  #ifdef BACKUP_TEST
> @@ -3849,7 +3848,7 @@ end_with_restore_list:
>      /*
>        Breakpoints for backup testing.
>      */
> -    BACKUP_BREAKPOINT("backup_commit_blocker");
> +    DEBUG_SYNC(thd, "before_begin_trans");
>      if (begin_trans(thd))
>        goto error;
>      my_ok(thd);
> @@ -3861,7 +3860,7 @@ end_with_restore_list:
>      /*
>        Breakpoints for backup testing.
>      */
> -    BACKUP_BREAKPOINT("backup_commit_blocker");
> +    DEBUG_SYNC(thd, "after_commit");
>      my_ok(thd);
>      break;
>    case SQLCOM_ROLLBACK:
> 
> -- 
> MySQL Code Commits Mailing List
> For list archives: http://lists.mysql.com/commits
> To unsubscribe:    
> http://lists.mysql.com/commits?unsub=1
> 

Thread
bk commit into 6.0 tree (istruewing:1.2623)Ingo Struewing6 Jun
  • RE: bk commit into 6.0 tree (istruewing:1.2623)Chuck Bell9 Jun
    • Re: bk commit into 6.0 tree (istruewing:1.2623)Ingo Strüwing11 Jun
      • RE: bk commit into 6.0 tree (istruewing:1.2623)Chuck Bell11 Jun
      • RE: bk commit into 6.0 tree (istruewing:1.2623)Chuck Bell12 Jun
        • Re: bk commit into 6.0 tree (istruewing:1.2623)Ingo Strüwing13 Jun
  • Re: bk commit into 6.0 tree (istruewing:1.2623)Rafal Somla12 Jun