List:Commits« Previous MessageNext Message »
From:Ingo Struewing Date:May 22 2008 3:03pm
Subject:bk commit into 6.0 tree (istruewing:1.2625)
View as plain text  
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-05-22 17:03:12+02:00, istruewing@stripped +5 -0
  Convert BACKUP_BREAKPOINT to DEBUG_SYNC.
  Changed synchronization point calls,
  adapted backup_snapshot.test and re-enabled it.

  mysql-test/r/backup_snapshot.result@stripped, 2008-05-22 17:03:10+02:00, istruewing@stripped +35 -23
    Convert BACKUP_BREAKPOINT to DEBUG_SYNC.
    Changed result.

  mysql-test/t/backup_snapshot.test@stripped, 2008-05-22 17:03:10+02:00, istruewing@stripped +59 -104
    Convert BACKUP_BREAKPOINT to DEBUG_SYNC.
    Changed test.

  mysql-test/t/disabled.def@stripped, 2008-05-22 17:03:10+02:00, istruewing@stripped +1 -1
    Convert BACKUP_BREAKPOINT to DEBUG_SYNC.
    Re-enabled the converted test case.

  sql/backup/be_snapshot.cc@stripped, 2008-05-22 17:03:10+02:00, istruewing@stripped +4 -2
    Convert BACKUP_BREAKPOINT to DEBUG_SYNC.
    Changed synchronization point calls.

  sql/lock.cc@stripped, 2008-05-22 17:03:10+02:00, istruewing@stripped +1 -0
    Convert BACKUP_BREAKPOINT to DEBUG_SYNC.
    Added a new synchronization point.

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-05-22 17:03:10 +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 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= '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_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_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-05-22 17:03:10 +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= '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%';
@@ -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-22 15:07:53 +02:00
+++ b/mysql-test/t/disabled.def	2008-05-22 17:03:10 +02:00
@@ -27,7 +27,7 @@ backup_commit_blocker :BUG#34235 pending
 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_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/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-05-22 17:03:10 +02:00
@@ -92,7 +92,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);
 }
 
@@ -108,7 +109,8 @@ result_t Backup::get_data(Buffer &buf)
   }
   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/lock.cc b/sql/lock.cc
--- a/sql/lock.cc	2008-04-29 11:27:23 +02:00
+++ b/sql/lock.cc	2008-05-22 17:03:10 +02:00
@@ -1497,6 +1497,7 @@ bool wait_if_global_read_lock(THD *thd, 
     deadlock.
   */
   safe_mutex_assert_not_owner(&LOCK_open);
+  DEBUG_SYNC(thd, "wait_if_global_read_lock");
 
   (void) pthread_mutex_lock(&LOCK_global_read_lock);
   if ((need_exit_cond= must_wait))
Thread
bk commit into 6.0 tree (istruewing:1.2625)Ingo Struewing22 May