#At file:///work/bzr/mysql-6.0/
2921 Horst Hunger 2008-11-26 [merge]
due to merge.
removed:
mysql-test/suite/backup/r/backup_commit_blocker.result
mysql-test/suite/backup/t/backup_commit_blocker.test
added:
mysql-test/suite/backup/r/backup_vp_nontx.result
mysql-test/suite/backup/r/backup_vp_tx.result
mysql-test/suite/backup/t/backup_nodata_driver-master.opt
mysql-test/suite/backup/t/backup_vp_nontx.test
mysql-test/suite/backup/t/backup_vp_tx.test
modified:
mysql-test/lib/mtr_report.pl
mysql-test/r/implicit_commit.result
mysql-test/suite/backup/r/backup.result
mysql-test/suite/backup/r/backup_backupdir.result
mysql-test/suite/backup/r/backup_commit_backup.result
mysql-test/suite/backup/r/backup_commit_restore.result
mysql-test/suite/backup/r/backup_compression.result
mysql-test/suite/backup/r/backup_concurrent.result
mysql-test/suite/backup/r/backup_db_grants.result
mysql-test/suite/backup/r/backup_ddl_blocker.result
mysql-test/suite/backup/r/backup_errors.result
mysql-test/suite/backup/r/backup_fkey.result
mysql-test/suite/backup/r/backup_lock_myisam.result
mysql-test/suite/backup/r/backup_logs.result
mysql-test/suite/backup/r/backup_logs_output.result
mysql-test/suite/backup/r/backup_logs_purge.result
mysql-test/suite/backup/r/backup_no_be.result
mysql-test/suite/backup/r/backup_no_data.result
mysql-test/suite/backup/r/backup_nodata_driver.result
mysql-test/suite/backup/r/backup_security.result
mysql-test/suite/backup/r/backup_snapshot.result
mysql-test/suite/backup/r/backup_timeout.result
mysql-test/suite/backup/t/backup.test
mysql-test/suite/backup/t/backup_backupdir.test
mysql-test/suite/backup/t/backup_commit_backup.test
mysql-test/suite/backup/t/backup_commit_restore.test
mysql-test/suite/backup/t/backup_compression.test
mysql-test/suite/backup/t/backup_concurrent.test
mysql-test/suite/backup/t/backup_db_grants.test
mysql-test/suite/backup/t/backup_ddl_blocker.test
mysql-test/suite/backup/t/backup_errors.test
mysql-test/suite/backup/t/backup_fkey.test
mysql-test/suite/backup/t/backup_lock_myisam.test
mysql-test/suite/backup/t/backup_logs.test
mysql-test/suite/backup/t/backup_logs_output-master.opt
mysql-test/suite/backup/t/backup_logs_purge.test
mysql-test/suite/backup/t/backup_no_be.test
mysql-test/suite/backup/t/backup_no_data.test
mysql-test/suite/backup/t/backup_nodata_driver.test
mysql-test/suite/backup/t/backup_security.test
mysql-test/suite/backup/t/backup_snapshot.test
mysql-test/suite/backup/t/backup_timeout.test
mysql-test/suite/backup_engines/include/backup_ptr_commit.inc
mysql-test/suite/backup_engines/r/backup_online_testing.result
mysql-test/suite/backup_engines/r/backup_ptr_commit_mixed.result
mysql-test/suite/backup_engines/r/backup_ptr_commit_row.result
mysql-test/suite/backup_engines/r/backup_ptr_commit_stmt.result
mysql-test/suite/backup_engines/r/backup_tmp_tables.result
mysql-test/suite/backup_engines/t/backup_online_testing.test
mysql-test/suite/backup_engines/t/backup_tmp_tables.test
mysql-test/suite/rpl/r/rpl_backup.result
mysql-test/suite/rpl/t/rpl_backup.test
mysql-test/t/implicit_commit.test
sql/backup/backup_info.h
sql/backup/backup_kernel.h
sql/backup/kernel.cc
sql/backup/logger.h
sql/backup/restore_info.h
sql/backup/stream.h
sql/backup/stream_v1.c
sql/lex.h
sql/mysqld.cc
sql/share/errmsg.txt
sql/sql_parse.cc
sql/sql_yacc.yy
=== modified file 'mysql-test/lib/mtr_report.pl'
--- a/mysql-test/lib/mtr_report.pl 2008-10-27 13:06:21 +0000
+++ b/mysql-test/lib/mtr_report.pl 2008-11-21 15:02:34 +0000
@@ -352,6 +352,19 @@ sub mtr_report_stats ($) {
/Restore:/ or /was skipped because the user does not exist/
) or
+ # backup_logs_output has warning because --log-backup-output option does
+ # not have argument
+ ($testname eq 'backup.backup_logs_output') and
+ (
+ /Although a path was specified for the/
+ ) or
+
+ # backup_nodata_driver intentionally provokes an error in opening a MERGE table
+ ($testname eq 'backup.backup_nodata_driver') and
+ (
+ /Restore: Open and lock tables failed in RESTORE/
+ ) or
+
# The tablespace test triggers error below on purpose
($testname eq 'backup.backup_tablespace') and
(
=== modified file 'mysql-test/r/implicit_commit.result'
--- a/mysql-test/r/implicit_commit.result 2008-07-26 16:38:20 +0000
+++ b/mysql-test/r/implicit_commit.result 2008-11-20 14:03:27 +0000
@@ -1035,7 +1035,7 @@ YES
# SQLCOM_RESTORE
#
INSERT INTO db1.trans (a) VALUES (1);
-restore from 'backup_db1.ba';
+restore from 'backup_db1.ba' overwrite;
CALL db1.test_if_commit();
IMPLICIT COMMIT
YES
=== modified file 'mysql-test/suite/backup/r/backup.result'
--- a/mysql-test/suite/backup/r/backup.result 2008-10-07 17:15:44 +0000
+++ b/mysql-test/suite/backup/r/backup.result 2008-11-17 09:57:51 +0000
@@ -562,7 +562,7 @@ id ccode
2 bb
4 dd
do restore
-RESTORE FROM 'bup_delete.bak';
+RESTORE FROM 'bup_delete.bak' OVERWRITE;
backup_id
#
show the data
@@ -597,7 +597,7 @@ BACKUP DATABASE bup_default TO 'bup_defa
backup_id
#
Restore the database.
-RESTORE FROM 'bup_default_timestamp.bak';
+RESTORE FROM 'bup_default_timestamp.bak' OVERWRITE;
backup_id
#
Show data after restore (timestamp should be same as above).
=== modified file 'mysql-test/suite/backup/r/backup_backupdir.result'
--- a/mysql-test/suite/backup/r/backup_backupdir.result 2008-10-24 15:37:11 +0000
+++ b/mysql-test/suite/backup/r/backup_backupdir.result 2008-11-17 09:57:51 +0000
@@ -15,7 +15,7 @@ backup_id
Ensure backup image file went to the correct location
/backup/bup_backupdir.bak
Perform restore
-RESTORE FROM 'bup_backupdir1.bak';
+RESTORE FROM 'bup_backupdir1.bak' OVERWRITE;
backup_id
#
Now do the backup and restore by specifying a path.
@@ -25,7 +25,7 @@ backup_id
#
Ensure backup image file went to the correct location
Perform restore
-RESTORE FROM '../bup_backupdir2.bak';
+RESTORE FROM '../bup_backupdir2.bak' OVERWRITE;
backup_id
#
Perform backup
=== modified file 'mysql-test/suite/backup/r/backup_commit_backup.result'
--- a/mysql-test/suite/backup/r/backup_commit_backup.result 2008-10-07 17:15:44 +0000
+++ b/mysql-test/suite/backup/r/backup_commit_backup.result 2008-11-17 09:57:51 +0000
@@ -299,7 +299,7 @@ SELECT release_lock("sync");
release_lock("sync")
1
Checking contents of the backup image
-RESTORE FROM 'db1.bak';
+RESTORE FROM 'db1.bak' OVERWRITE;
backup_id
#
SELECT * FROM db1.t1;
=== removed file 'mysql-test/suite/backup/r/backup_commit_blocker.result'
--- a/mysql-test/suite/backup/r/backup_commit_blocker.result 2008-10-07 17:15:44 +0000
+++ b/mysql-test/suite/backup/r/backup_commit_blocker.result 1970-01-01 00:00:00 +0000
@@ -1,469 +0,0 @@
-SET DEBUG_SYNC= 'RESET';
-DROP DATABASE IF EXISTS bup_commit_blocker;
-CREATE DATABASE bup_commit_blocker;
-
-Starting Test 1
-
-con1: Creating tables
-CREATE TABLE bup_commit_blocker.t1 (col_a CHAR(40)) ENGINE=INNODB;
-CREATE TABLE bup_commit_blocker.t2 (col_a CHAR(40)) ENGINE=INNODB;
-CREATE TABLE bup_commit_blocker.t3 (col_a CHAR(40)) ENGINE=INNODB;
-con1: Loading data
-INSERT INTO bup_commit_blocker.t1 VALUES ("01 Some data to test");
-INSERT INTO bup_commit_blocker.t1 VALUES ("02 Some data to test");
-INSERT INTO bup_commit_blocker.t1 VALUES ("03 Some data to test");
-INSERT INTO bup_commit_blocker.t1 VALUES ("04 Some data to test");
-INSERT INTO bup_commit_blocker.t1 VALUES ("05 Some data to test");
-INSERT INTO bup_commit_blocker.t2 VALUES ("01 Some data to test");
-INSERT INTO bup_commit_blocker.t2 VALUES ("02 Some data to test");
-INSERT INTO bup_commit_blocker.t2 VALUES ("03 Some data to test");
-INSERT INTO bup_commit_blocker.t2 VALUES ("04 Some data to test");
-INSERT INTO bup_commit_blocker.t2 VALUES ("05 Some data to test");
-INSERT INTO bup_commit_blocker.t3 VALUES ("01 Some data to test");
-INSERT INTO bup_commit_blocker.t3 VALUES ("02 Some data to test");
-INSERT INTO bup_commit_blocker.t3 VALUES ("03 Some data to test");
-INSERT INTO bup_commit_blocker.t3 VALUES ("04 Some data to test");
-INSERT INTO bup_commit_blocker.t3 VALUES ("05 Some data to test");
-con1: Show that the new data doesn't exist before backup.
-SELECT * FROM bup_commit_blocker.t1;
-col_a
-01 Some data to test
-02 Some data to test
-03 Some data to test
-04 Some data to test
-05 Some data to test
-SELECT * FROM bup_commit_blocker.t2;
-col_a
-01 Some data to test
-02 Some data to test
-03 Some data to test
-04 Some data to test
-05 Some data to test
-SELECT * FROM bup_commit_blocker.t3;
-col_a
-01 Some data to test
-02 Some data to test
-03 Some data to test
-04 Some data to test
-05 Some data to test
-con2: Get a transaction going and stop in the middle
-Assumption (a): TRX in progress is not included in backup
-BEGIN;
-UPDATE bup_commit_blocker.t1 SET col_a = "con2: CHANGED" WHERE col_a LIKE '01%';
-con3: Start a transaction and send commit after lock is taken
-Assumption (b): TRX in commit is included in backup
-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");
-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_data_lock WAIT_FOR commit_done';
-SET DEBUG_SYNC= 'before_backup_unblock_commit SIGNAL bup_read_locked
- WAIT_FOR finish';
-con1: Backing up database -- will block with lock
-BACKUP DATABASE bup_commit_blocker TO "bup_commit_blocker.bak";
-con5: Wait for BACKUP to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR bup_commit_block';
-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';
-con3: Starting commit -- will block on sync point
-COMMIT;
-con5: Wait for COMMIT to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR commit_read_locked';
-con5: Let BACKUP run until the next sync point.
-SET DEBUG_SYNC= 'now SIGNAL bup_go_read_lock WAIT_FOR bup_read_lock';
-con5: Let COMMIT continue until end of statement.
-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_read_locked';
-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: Wait for BEGIN to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR begin_starting';
-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: 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
-SELECT * FROM bup_commit_blocker.t1;
-col_a
-con2: CHANGED
-03 Some data to test
-04 Some data to test
-05 Some data to test
-SELECT * FROM bup_commit_blocker.t2;
-col_a
-01 Some data to test
-02 Some data to test
-03 Some data to test
-04 Some data to test
-05 Some data to test
-con3: 04 Some data to test
-con3: 05 Some data to test
-SELECT * FROM bup_commit_blocker.t3;
-col_a
-01 Some data to test
-02 Some data to test
-03 Some data to test
-04 Some data to test
-con4: 05 CHANGED
-con1: Dropping the database
-DROP TABLE bup_commit_blocker.t1;
-DROP TABLE bup_commit_blocker.t2;
-DROP TABLE bup_commit_blocker.t3;
-con1: Restoring the database
-RESTORE FROM "bup_commit_blocker.bak";
-backup_id
-#
-con1: Showing the data (no new data should be here).
-SELECT * FROM bup_commit_blocker.t1;
-col_a
-01 Some data to test
-02 Some data to test
-03 Some data to test
-04 Some data to test
-05 Some data to test
-SELECT * FROM bup_commit_blocker.t2;
-col_a
-01 Some data to test
-02 Some data to test
-03 Some data to test
-04 Some data to test
-05 Some data to test
-con3: 04 Some data to test
-con3: 05 Some data to test
-SELECT * FROM bup_commit_blocker.t3;
-col_a
-01 Some data to test
-02 Some data to test
-03 Some data to test
-04 Some data to test
-05 Some data to test
-
-Verifying test 1 results:
-
-T1 should not have the changes after backup - count(*) = 0
-SELECT count(*) FROM bup_commit_blocker.t1 WHERE col_a like 'con2%';
-count(*)
-0
-T2 should have the changes after backup - count(*) = 2
-SELECT count(*) FROM bup_commit_blocker.t2 WHERE col_a like 'con3%';
-count(*)
-2
-T3 should not have the changes after backup - count(*) = 0
-SELECT count(*) FROM bup_commit_blocker.t3 WHERE col_a like 'con4%';
-count(*)
-0
-con1: Cleanup
-DROP DATABASE bup_commit_blocker;
-SET DEBUG_SYNC= 'RESET';
-
-Starting Test 2
-
-CREATE DATABASE bup_commit_blocker;
-con1: Creating tables
-CREATE TABLE bup_commit_blocker.t5 (col_a int) ENGINE=MEMORY;
-con1: Loading data
-INSERT INTO bup_commit_blocker.t5 VALUES (10), (20), (30), (40), (50);
-con1: Show that the new data doesn't exist before backup.
-SELECT * FROM bup_commit_blocker.t5;
-col_a
-10
-20
-30
-40
-50
-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: Wait for BACKUP to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR bup_data_unlock';
-con7: Show that the statement in progress has executed before backup.
-SELECT * FROM bup_commit_blocker.t5;
-col_a
-10
-20
-30
-40
-50
-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: Wait for UPDATE to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR upd_read_lock';
-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
-SELECT * FROM bup_commit_blocker.t5;
-col_a
-10
-20
-333
-40
-50
-con1: Dropping the database
-DROP TABLE bup_commit_blocker.t5;
-con1: Restoring the database
-RESTORE FROM "bup_commit_blocker.bak";
-backup_id
-#
-con1: Showing the data (no new data should be here).
-SELECT * FROM bup_commit_blocker.t5;
-col_a
-10
-20
-30
-40
-50
-
-Verifying test 2 results:
-
-T5 should not have the changes after backup - count(*) = 0
-SELECT count(*) FROM bup_commit_blocker.t5 WHERE col_a = 333;
-count(*)
-0
-con1: Cleanup
-DROP DATABASE bup_commit_blocker;
-SET DEBUG_SYNC= 'RESET';
-
-Starting Test 3
-
-CREATE DATABASE bup_commit_blocker;
-con1: Creating tables
-CREATE TABLE bup_commit_blocker.t1 (col_a CHAR(40)) ENGINE=INNODB;
-CREATE TABLE bup_commit_blocker.t2 (col_a CHAR(40)) ENGINE=INNODB;
-CREATE TABLE bup_commit_blocker.t3 (col_a CHAR(40)) ENGINE=INNODB;
-CREATE TABLE bup_commit_blocker.t5 (col_a int) ENGINE=MEMORY;
-con1: Loading data
-INSERT INTO bup_commit_blocker.t1 VALUES ("01 Some data to test");
-INSERT INTO bup_commit_blocker.t1 VALUES ("02 Some data to test");
-INSERT INTO bup_commit_blocker.t1 VALUES ("03 Some data to test");
-INSERT INTO bup_commit_blocker.t1 VALUES ("04 Some data to test");
-INSERT INTO bup_commit_blocker.t1 VALUES ("05 Some data to test");
-INSERT INTO bup_commit_blocker.t2 VALUES ("01 Some data to test");
-INSERT INTO bup_commit_blocker.t2 VALUES ("02 Some data to test");
-INSERT INTO bup_commit_blocker.t2 VALUES ("03 Some data to test");
-INSERT INTO bup_commit_blocker.t2 VALUES ("04 Some data to test");
-INSERT INTO bup_commit_blocker.t2 VALUES ("05 Some data to test");
-INSERT INTO bup_commit_blocker.t3 VALUES ("01 Some data to test");
-INSERT INTO bup_commit_blocker.t3 VALUES ("02 Some data to test");
-INSERT INTO bup_commit_blocker.t3 VALUES ("03 Some data to test");
-INSERT INTO bup_commit_blocker.t3 VALUES ("04 Some data to test");
-INSERT INTO bup_commit_blocker.t3 VALUES ("05 Some data to test");
-INSERT INTO bup_commit_blocker.t5 VALUES (10), (20), (30), (40), (50);
-con1: Show that the new data doesn't exist before backup.
-SELECT * FROM bup_commit_blocker.t1;
-col_a
-01 Some data to test
-02 Some data to test
-03 Some data to test
-04 Some data to test
-05 Some data to test
-SELECT * FROM bup_commit_blocker.t2;
-col_a
-01 Some data to test
-02 Some data to test
-03 Some data to test
-04 Some data to test
-05 Some data to test
-SELECT * FROM bup_commit_blocker.t3;
-col_a
-01 Some data to test
-02 Some data to test
-03 Some data to test
-04 Some data to test
-05 Some data to test
-SELECT * FROM bup_commit_blocker.t5;
-col_a
-10
-20
-30
-40
-50
-con2: Get a transaction going and stop in the middle
-Assumption (a): TRX in progress is not included in backup
-BEGIN;
-UPDATE bup_commit_blocker.t1 SET col_a = "con2: CHANGED" WHERE col_a LIKE '01%';
-con3: Start a transaction and send commit after lock is taken
-Assumption (b): TRX in commit is included in backup
-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");
-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_data_lock WAIT_FOR commit_done';
-SET DEBUG_SYNC= 'before_backup_unblock_commit SIGNAL bup_read_locked
- WAIT_FOR finish';
-con1: Backing up database -- will block with lock
-BACKUP DATABASE bup_commit_blocker TO "bup_commit_blocker.bak";
-con5: Wait for BACKUP to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR bup_commit_block';
-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';
-con3: Starting commit -- will block on sync point
-COMMIT;
-con5: Wait for COMMIT to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR commit_read_locked';
-con5: Let BACKUP run until the next sync point.
-SET DEBUG_SYNC= 'now SIGNAL bup_go_read_lock WAIT_FOR bup_read_lock';
-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_read_locked';
-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: Wait for BEGIN to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR begin_starting';
-con7: Show that the statement in progress has executed before backup.
-SELECT * FROM bup_commit_blocker.t5;
-col_a
-10
-20
-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: Wait for DELETE to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR del_read_lock';
-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: 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: Fetch DELETE result
-con1: Fetch BACKUP result
-backup_id
-#
-con1: Showing data after updates and backup
-SELECT * FROM bup_commit_blocker.t1;
-col_a
-con2: CHANGED
-02 Some data to test
-03 Some data to test
-04 Some data to test
-05 Some data to test
-SELECT * FROM bup_commit_blocker.t2;
-col_a
-01 Some data to test
-03 Some data to test
-04 Some data to test
-05 Some data to test
-con3: 04 Some data to test
-con3: 05 Some data to test
-SELECT * FROM bup_commit_blocker.t3;
-col_a
-01 Some data to test
-02 Some data to test
-03 Some data to test
-04 Some data to test
-con4: 05 CHANGED
-SELECT * FROM bup_commit_blocker.t5;
-col_a
-10
-20
-30
-40
-con1: Dropping the database
-DROP TABLE bup_commit_blocker.t1;
-DROP TABLE bup_commit_blocker.t2;
-DROP TABLE bup_commit_blocker.t3;
-DROP TABLE bup_commit_blocker.t5;
-con1: Restoring the database
-RESTORE FROM "bup_commit_blocker.bak";
-backup_id
-#
-con1: Showing the data (no new data should be here).
-SELECT * FROM bup_commit_blocker.t1;
-col_a
-01 Some data to test
-02 Some data to test
-03 Some data to test
-04 Some data to test
-05 Some data to test
-SELECT * FROM bup_commit_blocker.t2;
-col_a
-01 Some data to test
-02 Some data to test
-03 Some data to test
-04 Some data to test
-05 Some data to test
-con3: 04 Some data to test
-con3: 05 Some data to test
-SELECT * FROM bup_commit_blocker.t3;
-col_a
-01 Some data to test
-02 Some data to test
-03 Some data to test
-04 Some data to test
-05 Some data to test
-SELECT * FROM bup_commit_blocker.t5;
-col_a
-10
-20
-30
-40
-50
-
-Verifying test 3 results:
-
-T1 should not have the changes after backup - count(*) = 0
-SELECT count(*) FROM bup_commit_blocker.t1 WHERE col_a like 'con2%';
-count(*)
-0
-T2 should have the changes after backup - count(*) = 2
-SELECT count(*) FROM bup_commit_blocker.t2 WHERE col_a like 'con3%';
-count(*)
-2
-T3 should not have the changes after backup - count(*) = 0
-SELECT count(*) FROM bup_commit_blocker.t3 WHERE col_a like 'con4%';
-count(*)
-0
-T5 should not have the changes after backup - count(*) = 1
-SELECT count(*) FROM bup_commit_blocker.t5 WHERE col_a >= 50;
-count(*)
-1
-con1: Cleanup
-DROP DATABASE bup_commit_blocker;
-SET DEBUG_SYNC= 'RESET';
=== modified file 'mysql-test/suite/backup/r/backup_commit_restore.result'
--- a/mysql-test/suite/backup/r/backup_commit_restore.result 2008-10-23 08:13:54 +0000
+++ b/mysql-test/suite/backup/r/backup_commit_restore.result 2008-11-17 09:57:51 +0000
@@ -6,7 +6,7 @@ INSERT INTO t1 VALUES ('a1');
BACKUP DATABASE commit_test TO '81';
backup_id
#
-RESTORE FROM '81';
+RESTORE FROM '81' OVERWRITE;
backup_id
#
SELECT * FROM t1;
@@ -24,7 +24,7 @@ INSERT INTO t2 VALUES ('a2');
BACKUP DATABASE commit_test TO '82';
backup_id
#
-RESTORE FROM '82';
+RESTORE FROM '82' OVERWRITE;
backup_id
#
SELECT * FROM t1;
@@ -51,7 +51,7 @@ INSERT INTO t3 VALUES ('a3');
BACKUP DATABASE commit_test TO '83';
backup_id
#
-RESTORE FROM '83';
+RESTORE FROM '83' OVERWRITE;
backup_id
#
SELECT * FROM t1;
@@ -89,7 +89,7 @@ INSERT INTO t4 VALUES ('a4');
BACKUP DATABASE commit_test TO '84';
backup_id
#
-RESTORE FROM '84';
+RESTORE FROM '84' OVERWRITE;
backup_id
#
SELECT * FROM t1;
@@ -138,7 +138,7 @@ INSERT INTO t4 VALUES ('a5');
BACKUP DATABASE commit_test TO '85';
backup_id
#
-RESTORE FROM '85';
+RESTORE FROM '85' OVERWRITE;
backup_id
#
SELECT * FROM t1;
@@ -198,7 +198,7 @@ BACKUP DATABASE commit_test TO '86';
backup_id
#
SET @@autocommit=0;
-RESTORE FROM '86';
+RESTORE FROM '86' OVERWRITE;
backup_id
#
DROP TABLE t5;
@@ -265,7 +265,7 @@ BACKUP DATABASE commit_test TO '87';
backup_id
#
SET @@autocommit=1;
-RESTORE FROM '87';
+RESTORE FROM '87' OVERWRITE;
backup_id
#
SELECT * FROM t1;
=== modified file 'mysql-test/suite/backup/r/backup_compression.result'
--- a/mysql-test/suite/backup/r/backup_compression.result 2008-10-07 17:15:44 +0000
+++ b/mysql-test/suite/backup/r/backup_compression.result 2008-11-17 09:57:51 +0000
@@ -7,13 +7,13 @@ CREATE TABLE db1.t2(a INT);
BACKUP DATABASE db1 TO 'db2.bak.gz' WITH COMPRESSION COMPRESSION_ALGORITHM=gzip;
backup_id
#
-RESTORE FROM 'db1.bak.gz';
+RESTORE FROM 'db1.bak.gz' OVERWRITE;
backup_id
#
SHOW TABLES FROM db1;
Tables_in_db1
t1
-RESTORE FROM 'db2.bak.gz';
+RESTORE FROM 'db2.bak.gz' OVERWRITE;
backup_id
#
SHOW TABLES FROM db1;
=== modified file 'mysql-test/suite/backup/r/backup_concurrent.result'
--- a/mysql-test/suite/backup/r/backup_concurrent.result 2008-10-07 17:15:44 +0000
+++ b/mysql-test/suite/backup/r/backup_concurrent.result 2008-11-17 09:57:51 +0000
@@ -49,7 +49,7 @@ Testing starting backup/restore restore
---------------------------------------------------
Starting restore
SET DEBUG_SYNC= 'after_backup_start_restore SIGNAL running WAIT_FOR restore';
-RESTORE FROM 'backup1';
+RESTORE FROM 'backup1' OVERWRITE;
Waiting for restore to get going
SET DEBUG_SYNC= 'now WAIT_FOR running';
Starting backup in another connection.
=== modified file 'mysql-test/suite/backup/r/backup_db_grants.result'
--- a/mysql-test/suite/backup/r/backup_db_grants.result 2008-10-07 17:15:44 +0000
+++ b/mysql-test/suite/backup/r/backup_db_grants.result 2008-11-17 09:57:51 +0000
@@ -64,7 +64,7 @@ SHOW GRANTS FOR 'bup_user3'@'%';
Grants for bup_user3@%
GRANT USAGE ON *.* TO 'bup_user3'@'%'
Run Restore
-RESTORE FROM 'bup_db_grants.bak';
+RESTORE FROM 'bup_db_grants.bak' OVERWRITE;
backup_id
#
SHOW TABLES FROM bup_db_grants;
@@ -96,7 +96,7 @@ FLUSH PRIVILEGES;
CREATE USER 'bup_user1'@'%';
CREATE USER 'bup_user1'@'nosuchhost';
Run Restore
-RESTORE FROM 'bup_db_grants.bak';
+RESTORE FROM 'bup_db_grants.bak' OVERWRITE;
backup_id
#
SHOW TABLES FROM bup_db_grants;
@@ -166,7 +166,7 @@ EXECUTE stmt3;
Grants for �@@%
GRANT USAGE ON *.* TO '�@'@'%'
Run restore.
-RESTORE FROM 'bup_db_grants.bak';
+RESTORE FROM 'bup_db_grants.bak' OVERWRITE;
backup_id
#
FLUSH PRIVILEGES;
=== modified file 'mysql-test/suite/backup/r/backup_ddl_blocker.result'
--- a/mysql-test/suite/backup/r/backup_ddl_blocker.result 2008-10-07 17:15:44 +0000
+++ b/mysql-test/suite/backup/r/backup_ddl_blocker.result 2008-11-20 14:07:23 +0000
@@ -112,7 +112,7 @@ con1: Dropping the database tables
DROP TABLE bup_ddl_blocker.t1, bup_ddl_blocker.t2,
bup_ddl_blocker.t3, bup_ddl_blocker.t4;
con1: Restoring the database
-RESTORE FROM "bup_ddl_blocker.bak";
+RESTORE FROM "bup_ddl_blocker.bak" OVERWRITE;
backup_id
#
con1: Showing columns that were backed up
@@ -173,13 +173,13 @@ con1: Activate synchronization points fo
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";
+RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE;
con6: Wait for con1 to reach its synchronization point.
SET DEBUG_SYNC= 'now WAIT_FOR bup_blocked';
SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE info LIKE "RESTORE FROM%";
state info
-debug sync point: before_block_ddl RESTORE FROM "bup_ddl_blocker_orig.bak"
+debug sync point: before_block_ddl RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE
SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE info LIKE "CREATE TABLE bup_ddl_blocker.t1%";
state info
@@ -193,7 +193,7 @@ SET DEBUG_SYNC= 'now SIGNAL status_shown
SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE info LIKE "RESTORE FROM%";
state info
-debug sync point: after_block_ddl RESTORE FROM "bup_ddl_blocker_orig.bak"
+debug sync point: after_block_ddl RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE
con4: Activate synchronization point for DDL.
SET DEBUG_SYNC= 'before_check_ddl_blocked SIGNAL con4_started
WAIT_FOR status_shown2';
@@ -352,7 +352,7 @@ con1: Dropping the database tables
DROP TABLE bup_ddl_blocker.t01, bup_ddl_blocker.t2,
bup_ddl_blocker.t03, bup_ddl_blocker.t4;
con1: Restoring the database
-RESTORE FROM "bup_ddl_blocker.bak";
+RESTORE FROM "bup_ddl_blocker.bak" OVERWRITE;
backup_id
#
con1: Showing columns that were backed up
@@ -407,13 +407,13 @@ con1: Activate synchronization points fo
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";
+RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE;
con6: Wait for con1 to reach its synchronization point.
SET DEBUG_SYNC= 'now WAIT_FOR bup_blocked';
SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE info LIKE "RESTORE FROM%";
state info
-debug sync point: before_block_ddl RESTORE FROM "bup_ddl_blocker_orig.bak"
+debug sync point: before_block_ddl RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE
SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE info LIKE "RENAME TABLE bup_ddl_blocker.t1%";
state info
@@ -427,7 +427,7 @@ SET DEBUG_SYNC= 'now SIGNAL status_shown
SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE info LIKE "RESTORE FROM%";
state info
-debug sync point: after_block_ddl RESTORE FROM "bup_ddl_blocker_orig.bak"
+debug sync point: after_block_ddl RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE
con4: Activate synchronization point for DDL.
SET DEBUG_SYNC= 'before_check_ddl_blocked SIGNAL con4_started
WAIT_FOR status_shown2';
@@ -581,7 +581,7 @@ t3
con1: Dropping the database tables
DROP TABLE bup_ddl_blocker.t1, bup_ddl_blocker.t3;
con1: Restoring the database
-RESTORE FROM "bup_ddl_blocker.bak";
+RESTORE FROM "bup_ddl_blocker.bak" OVERWRITE;
backup_id
#
con1: Showing columns that were backed up
@@ -634,13 +634,13 @@ con1: Activate synchronization points fo
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";
+RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE;
con6: Wait for con1 to reach its synchronization point.
SET DEBUG_SYNC= 'now WAIT_FOR bup_blocked';
SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE info LIKE "RESTORE FROM%";
state info
-debug sync point: before_block_ddl RESTORE FROM "bup_ddl_blocker_orig.bak"
+debug sync point: before_block_ddl RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE
SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE info LIKE "OPTIMIZE TABLE bup_ddl_blocker.t1%";
state info
@@ -654,7 +654,7 @@ SET DEBUG_SYNC= 'now SIGNAL status_shown
SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE info LIKE "RESTORE FROM%";
state info
-debug sync point: after_block_ddl RESTORE FROM "bup_ddl_blocker_orig.bak"
+debug sync point: after_block_ddl RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE
con4: Activate synchronization point for DDL.
SET DEBUG_SYNC= 'before_check_ddl_blocked SIGNAL con4_started
WAIT_FOR status_shown2';
@@ -806,7 +806,7 @@ con1: Dropping the database tables
DROP DATABASE bup_ddl_blocker_1;
DROP DATABASE bup_ddl_blocker_3;
con1: Restoring the database
-RESTORE FROM "bup_ddl_blocker.bak";
+RESTORE FROM "bup_ddl_blocker.bak" OVERWRITE;
backup_id
#
con1: Showing databases that were backed up
@@ -862,13 +862,13 @@ con1: Activate synchronization points fo
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";
+RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE;
con6: Wait for con1 to reach its synchronization point.
SET DEBUG_SYNC= 'now WAIT_FOR bup_blocked';
SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE info LIKE "RESTORE FROM%";
state info
-debug sync point: before_block_ddl RESTORE FROM "bup_ddl_blocker_orig.bak"
+debug sync point: before_block_ddl RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE
SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE info LIKE "CREATE DATABASE bup_ddl_blocker_1%";
state info
@@ -882,7 +882,7 @@ SET DEBUG_SYNC= 'now SIGNAL status_shown
SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE info LIKE "RESTORE FROM%";
state info
-debug sync point: after_block_ddl RESTORE FROM "bup_ddl_blocker_orig.bak"
+debug sync point: after_block_ddl RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE
con4: Activate synchronization point for DDL.
SET DEBUG_SYNC= 'before_check_ddl_blocked SIGNAL con4_started
WAIT_FOR status_shown2';
@@ -1040,7 +1040,7 @@ con1: Dropping the database tables
DROP DATABASE bup_ddl_blocker_2;
DROP DATABASE bup_ddl_blocker_4;
con1: Restoring the database
-RESTORE FROM "bup_ddl_blocker.bak";
+RESTORE FROM "bup_ddl_blocker.bak" OVERWRITE;
backup_id
#
con1: Showing databases that were backed up
@@ -1112,13 +1112,13 @@ con1: Activate synchronization points fo
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";
+RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE;
con6: Wait for con1 to reach its synchronization point.
SET DEBUG_SYNC= 'now WAIT_FOR bup_blocked';
SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE info LIKE "RESTORE FROM%";
state info
-debug sync point: before_block_ddl RESTORE FROM "bup_ddl_blocker_orig.bak"
+debug sync point: before_block_ddl RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE
SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE info LIKE "ALTER DATABASE bup_ddl_blocker_2%";
state info
@@ -1132,7 +1132,7 @@ SET DEBUG_SYNC= 'now SIGNAL status_shown
SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE info LIKE "RESTORE FROM%";
state info
-debug sync point: after_block_ddl RESTORE FROM "bup_ddl_blocker_orig.bak"
+debug sync point: after_block_ddl RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE
con4: Activate synchronization point for DDL.
SET DEBUG_SYNC= 'before_check_ddl_blocked SIGNAL con4_started
WAIT_FOR status_shown2';
@@ -1335,7 +1335,7 @@ DROP DATABASE bup_ddl_blocker_2;
DROP DATABASE bup_ddl_blocker_3;
DROP DATABASE bup_ddl_blocker_4;
con1: Restoring the database
-RESTORE FROM "bup_ddl_blocker.bak";
+RESTORE FROM "bup_ddl_blocker.bak" OVERWRITE;
backup_id
#
con1: Showing databases that were backed up
@@ -1428,13 +1428,13 @@ con1: Activate synchronization points fo
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";
+RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE;
con6: Wait for con1 to reach its synchronization point.
SET DEBUG_SYNC= 'now WAIT_FOR bup_blocked';
SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE info LIKE "RESTORE FROM%";
state info
-debug sync point: before_block_ddl RESTORE FROM "bup_ddl_blocker_orig.bak"
+debug sync point: before_block_ddl RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE
SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE info LIKE "CREATE INDEX 1t1col_b%";
state info
@@ -1448,7 +1448,7 @@ SET DEBUG_SYNC= 'now SIGNAL status_shown
SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE info LIKE "RESTORE FROM%";
state info
-debug sync point: after_block_ddl RESTORE FROM "bup_ddl_blocker_orig.bak"
+debug sync point: after_block_ddl RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE
con4: Activate synchronization point for DDL.
SET DEBUG_SYNC= 'before_check_ddl_blocked SIGNAL con4_started
WAIT_FOR status_shown2';
=== modified file 'mysql-test/suite/backup/r/backup_errors.result'
--- a/mysql-test/suite/backup/r/backup_errors.result 2008-11-05 09:41:15 +0000
+++ b/mysql-test/suite/backup/r/backup_errors.result 2008-11-17 09:57:51 +0000
@@ -135,3 +135,50 @@ SET DEBUG_SYNC= 'reset';
DROP DATABASE db1;
Done testing for Bug#38624
+
+Testing RESTORE ... OVERWRITE functionality
+See bug#34579
+
+Initialize
+CREATE DATABASE db1;
+USE db1;
+CREATE TABLE table1 (text VARCHAR(20));
+INSERT INTO table1 VALUES ('Inserted before');
+
+Backup database
+BACKUP DATABASE db1 TO 'overwrite.bak';
+backup_id
+#
+
+Insert more data and display
+INSERT INTO table1 VALUES ('Inserted after');
+SELECT * FROM table1;
+text
+Inserted before
+Inserted after
+
+Restore without OVERWRITE flag; will fail
+RESTORE FROM 'overwrite.bak';
+ERROR HY000: Database 'db1' already exists. Use OVERWRITE flag to overwrite.
+
+Restore with OVERWRITE flag; will succeed
+RESTORE FROM 'overwrite.bak' OVERWRITE;
+backup_id
+#
+
+Show that inserted value 2 is not there
+SELECT * FROM table1;
+text
+Inserted before
+DROP DATABASE db1;
+
+Restore after deleting db; will succeed
+RESTORE FROM 'overwrite.bak';
+backup_id
+#
+
+Show that inserted value 2 is not there
+SELECT * FROM table1;
+text
+Inserted before
+DROP DATABASE db1;
=== modified file 'mysql-test/suite/backup/r/backup_fkey.result'
--- a/mysql-test/suite/backup/r/backup_fkey.result 2008-10-07 17:15:44 +0000
+++ b/mysql-test/suite/backup/r/backup_fkey.result 2008-11-17 09:57:51 +0000
@@ -43,10 +43,10 @@ SHOW VARIABLES LIKE 'foreign_key_checks%
Variable_name Value
foreign_key_checks ON
Now restore the database.
-RESTORE FROM 'backup_fkey.bak';
+RESTORE FROM 'backup_fkey.bak' OVERWRITE;
backup_id
#
-RESTORE FROM 'backup_fkey_orig.bak';
+RESTORE FROM 'backup_fkey_orig.bak' OVERWRITE;
backup_id
#
Show data
@@ -84,7 +84,7 @@ SHOW VARIABLES LIKE 'foreign_key_checks%
Variable_name Value
foreign_key_checks ON
Restoring data
-RESTORE FROM 'backup_fkey.bak';
+RESTORE FROM 'backup_fkey.bak' OVERWRITE;
backup_id
#
Verify foreign_key_checks = ON
@@ -97,7 +97,7 @@ SHOW VARIABLES LIKE 'foreign_key_checks%
Variable_name Value
foreign_key_checks OFF
Restoring data
-RESTORE FROM 'backup_fkey.bak';
+RESTORE FROM 'backup_fkey.bak' OVERWRITE;
backup_id
#
Verify foreign_key_checks = OFF
=== modified file 'mysql-test/suite/backup/r/backup_lock_myisam.result'
--- a/mysql-test/suite/backup/r/backup_lock_myisam.result 2008-10-07 17:15:44 +0000
+++ b/mysql-test/suite/backup/r/backup_lock_myisam.result 2008-11-17 09:57:51 +0000
@@ -54,7 +54,7 @@ DROP DATABASE db1;
now start the restore and while the restore is running, fire the trigger
activate synchronization points for restore.
SET DEBUG_SYNC= 'restore_in_progress SIGNAL wait_for_restore WAIT_FOR finish';
-RESTORE FROM 'db1.bak';
+RESTORE FROM 'db1.bak' OVERWRITE;;
From breakpoints:
Wait for restore to reach its synchronization point.
SET DEBUG_SYNC= 'now WAIT_FOR wait_for_restore';
@@ -92,7 +92,7 @@ DELETE FROM db2.t2;
now start the restore and while the restore is running, fire the trigger
activate synchronization points for restore.
SET DEBUG_SYNC= 'restore_in_progress SIGNAL wait_for_restore WAIT_FOR finish';
-RESTORE FROM 'db1.bak';
+RESTORE FROM 'db1.bak' OVERWRITE;;
From breakpoints:
Wait for restore to reach its synchronization point.
SET DEBUG_SYNC= 'now WAIT_FOR wait_for_restore';
=== modified file 'mysql-test/suite/backup/r/backup_logs.result'
--- a/mysql-test/suite/backup/r/backup_logs.result 2008-11-07 10:40:48 +0000
+++ b/mysql-test/suite/backup/r/backup_logs.result 2008-11-17 09:57:51 +0000
@@ -137,7 +137,7 @@ SET DEBUG_SYNC= 'after_backup_log_init
SET DEBUG_SYNC= 'after_backup_start_restore SIGNAL running WAIT_FOR finish';
con2: Send restore command.
con2: Backup id = 501.
-RESTORE FROM 'backup_logs_orig.bak';
+RESTORE FROM 'backup_logs_orig.bak' OVERWRITE;
con1: Wait for the restore to be started.
SET DEBUG_SYNC= 'now WAIT_FOR started';
con1: Display progress
@@ -177,7 +177,7 @@ username root
backup_file #
backup_file_path #
user_comment
-command RESTORE FROM 'backup_logs_orig.bak'
+command RESTORE FROM 'backup_logs_orig.bak' OVERWRITE
drivers MyISAM, Snapshot, Default
SELECT * FROM mysql.backup_progress WHERE backup_id = 501;
backup_id object start_time stop_time total_bytes progress error_num notes
=== modified file 'mysql-test/suite/backup/r/backup_logs_output.result'
--- a/mysql-test/suite/backup/r/backup_logs_output.result 2008-11-10 16:49:10 +0000
+++ b/mysql-test/suite/backup/r/backup_logs_output.result 2008-11-17 11:17:59 +0000
@@ -13,7 +13,7 @@ backup_progress_log ON
backup_progress_log_file MYSQLTEST_VARDIR/master-data/progress.txt
SHOW VARIABLES LIKE 'log_backup_output';
Variable_name Value
-log_backup_output FILE
+log_backup_output TABLE
Set the backup log file names to default values.
SET @@global.backup_history_log_file = DEFAULT;
SET @@global.backup_progress_log_file = DEFAULT;
=== modified file 'mysql-test/suite/backup/r/backup_logs_purge.result'
--- a/mysql-test/suite/backup/r/backup_logs_purge.result 2008-10-28 14:17:05 +0000
+++ b/mysql-test/suite/backup/r/backup_logs_purge.result 2008-11-17 09:57:51 +0000
@@ -45,19 +45,19 @@ BACKUP DATABASE backup_logs to 'backup4.
backup_id
503
Do restore of database
-RESTORE from 'backup1.bak';
+RESTORE from 'backup1.bak' OVERWRITE;
backup_id
504
Do restore of database
-RESTORE from 'backup2.bak';
+RESTORE from 'backup2.bak' OVERWRITE;
backup_id
505
Do restore of database
-RESTORE from 'backup3.bak';
+RESTORE from 'backup3.bak' OVERWRITE;
backup_id
506
Do restore of database
-RESTORE from 'backup4.bak';
+RESTORE from 'backup4.bak' OVERWRITE;
backup_id
507
Display results from backup logs
@@ -149,20 +149,20 @@ backup_id
503
SET SESSION debug="-d";
Do restore of database
-RESTORE from 'backup1.bak';
+RESTORE from 'backup1.bak' OVERWRITE;
backup_id
504
Do restore of database
-RESTORE from 'backup2.bak';
+RESTORE from 'backup2.bak' OVERWRITE;
backup_id
505
Do restore of database
-RESTORE from 'backup3.bak';
+RESTORE from 'backup3.bak' OVERWRITE;
backup_id
506
SET SESSION debug="+d,set_log_time";
Do restore of database
-RESTORE from 'backup4.bak';
+RESTORE from 'backup4.bak' OVERWRITE;
backup_id
507
SET SESSION debug="-d";
@@ -286,16 +286,16 @@ progress 0
error_num 0
notes complete
Now do the same test for restore.
-RESTORE FROM 'backup1.bak';
+RESTORE FROM 'backup1.bak' OVERWRITE;
backup_id
#
-RESTORE FROM 'backup2.bak';
+RESTORE FROM 'backup2.bak' OVERWRITE;
backup_id
#
-RESTORE FROM 'backup3.bak';
+RESTORE FROM 'backup3.bak' OVERWRITE;
backup_id
#
-RESTORE FROM 'backup4.bak';
+RESTORE FROM 'backup4.bak' OVERWRITE;
backup_id
#
SELECT count(*) FROM mysql.backup_history;
@@ -306,7 +306,7 @@ count(*)
13
con2: Activate sync points for the backup statement.
SET DEBUG_SYNC= 'before_restore_done SIGNAL ready WAIT_FOR proceed';
-RESTORE FROM 'backup5.bak';
+RESTORE FROM 'backup5.bak' OVERWRITE;
con1: Wait for the backup to be ready.
SET DEBUG_SYNC= 'now WAIT_FOR ready';
PURGE BACKUP LOGS;
@@ -320,7 +320,7 @@ count(*)
1
SELECT backup_id, command FROM mysql.backup_history;
backup_id command
-505 RESTORE FROM 'backup5.bak'
+505 RESTORE FROM 'backup5.bak' OVERWRITE
There should be one row in this table: the backup id from last
restore (505). We should only see the complete progress
statement because all others were deleted while restore was
=== modified file 'mysql-test/suite/backup/r/backup_no_be.result'
--- a/mysql-test/suite/backup/r/backup_no_be.result 2008-10-30 10:41:48 +0000
+++ b/mysql-test/suite/backup/r/backup_no_be.result 2008-11-17 09:57:51 +0000
@@ -32,7 +32,7 @@ WHERE command LIKE 'BACKUP DATABASE db1
SELECT drivers FROM mysql.backup_history WHERE backup_id=@id;
drivers
Default
-RESTORE FROM 'db1.bak';
+RESTORE FROM 'db1.bak' OVERWRITE;
backup_id
#
SHOW TABLES IN db1;
=== modified file 'mysql-test/suite/backup/r/backup_no_data.result'
--- a/mysql-test/suite/backup/r/backup_no_data.result 2008-10-07 17:15:44 +0000
+++ b/mysql-test/suite/backup/r/backup_no_data.result 2008-11-20 14:07:23 +0000
@@ -15,7 +15,7 @@ Database
information_schema
mysql
test
-RESTORE FROM 'all.bak';
+RESTORE FROM 'all.bak' OVERWRITE;
backup_id
#
SHOW DATABASES;
@@ -38,7 +38,7 @@ mysql
test
SHOW TABLES IN empty_db;
Tables_in_empty_db
-RESTORE FROM 'all.bak';
+RESTORE FROM 'all.bak' OVERWRITE;
backup_id
#
SHOW DATABASES;
@@ -66,7 +66,7 @@ empty_db
mysql
other_db
test
-RESTORE FROM 'empty_db.bak';
+RESTORE FROM 'empty_db.bak' OVERWRITE;
backup_id
#
USE empty_db;
=== modified file 'mysql-test/suite/backup/r/backup_nodata_driver.result'
--- a/mysql-test/suite/backup/r/backup_nodata_driver.result 2008-10-07 17:15:44 +0000
+++ b/mysql-test/suite/backup/r/backup_nodata_driver.result 2008-11-21 15:02:34 +0000
@@ -1,7 +1,10 @@
+INSTALL PLUGIN example SONAME 'ha_example.so';
DROP DATABASE IF EXISTS bup_nodata;
DROP DATABASE IF EXISTS bup_data;
-Creating tables
-CREATE DATABASE bup_nodata;
+#
+# Create a database with tables that can work as
+# base tables for MERGE and FEDERATED.
+#
CREATE DATABASE bup_data;
CREATE TABLE bup_data.myisam1 (a int, b char(30)) ENGINE=MYISAM;
CREATE TABLE bup_data.myisam2 (a int, b char(30)) ENGINE=MYISAM;
@@ -14,6 +17,10 @@ CREATE TABLE bup_data.f1 (
`name` varchar(32) NOT NULL default ''
)
DEFAULT CHARSET=latin1;
+#
+# Create a database with tables from no-data engines.
+#
+CREATE DATABASE bup_nodata;
CREATE TABLE bup_nodata.merge1 (a int, b char(30))
ENGINE=MERGE UNION=(bup_data.myisam1, bup_data.myisam2, bup_data.myisam3);
CREATE TABLE bup_nodata.f1 (
@@ -30,7 +37,9 @@ CREATE TABLE bup_nodata.e1 (
Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL,
Vapor_period smallint(4) unsigned DEFAULT '0' NOT NULL
) ENGINE=example;
-Inserting data
+#
+# Insert some data.
+#
INSERT INTO bup_data.myisam1 VALUES (11, 'table 1');
INSERT INTO bup_data.myisam1 VALUES (12, 'table 1');
INSERT INTO bup_data.myisam1 VALUES (13, 'table 1');
@@ -45,7 +54,9 @@ INSERT INTO bup_data.f1 (id, name) VALUE
INSERT INTO bup_data.f1 (id, `group`) VALUES (3, 42);
INSERT INTO bup_data.f1 (id, `batch`) VALUES (4, 23);
INSERT INTO bup_data.f1 (id, `qty`) VALUES (5, 1);
-show data
+#
+# Show the data.
+#
SHOW FULL TABLES FROM bup_data;
Tables_in_bup_data Table_type
f1 BASE TABLE
@@ -80,13 +91,21 @@ SELECT * FROM bup_nodata.b1;
a b c
SELECT * FROM bup_nodata.e1;
Period Vapor_period
+#
+# Backup the bup_data DB, which tables contain data.
+#
BACKUP DATABASE bup_data TO 'bup_data.bak';
backup_id
#
+#
+# Backup the bup_nodata DB, which tables do not contain data.
+#
BACKUP DATABASE bup_nodata TO 'bup_nodata.bak';
backup_id
#
-show data
+#
+# Show the data again. Backup did not modify them.
+#
SHOW FULL TABLES FROM bup_data;
Tables_in_bup_data Table_type
f1 BASE TABLE
@@ -121,8 +140,15 @@ SELECT * FROM bup_nodata.b1;
a b c
SELECT * FROM bup_nodata.e1;
Period Vapor_period
+#
+# Now drop the bup_data database.
+#
DROP DATABASE bup_data;
-show data
+#
+# Show that the data have gone.
+# The MERGE and FEDERATED tables have errors since
+# their base tables have been dropped with bup_data.
+#
SHOW FULL TABLES FROM bup_nodata;
Tables_in_bup_nodata Table_type
b1 BASE TABLE
@@ -130,19 +156,34 @@ e1 BASE TABLE
f1 BASE TABLE
merge1 BASE TABLE
SELECT * FROM bup_nodata.merge1;
-ERROR 42S02: Table 'bup_data.myisam1' doesn't exist
+ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
SELECT * FROM bup_nodata.f1;
Got one of the listed errors
SELECT * FROM bup_nodata.b1;
a b c
SELECT * FROM bup_nodata.e1;
Period Vapor_period
+#
+# Now drop the bup_nodata database too.
+#
DROP DATABASE bup_nodata;
-Restoring nodata database.
-RESTORE FROM 'bup_nodata.bak';
-backup_id
#
-show data
+# Now try to restore the bup_nodata database. This fails because
+# restore opens the tables for filling them with data, even when
+# they were empty on backup. 'bup_nodata.bak' does not contain
+# the base tables for the MERGE and FEDERATED tables.
+# NOTE: Since restore fails after restoring the meta data,
+# after creating the tables that is, we have the same
+# situation as before. The tables exist, but the base
+# tables for MERGE and FEDERATED do not exist.
+#
+RESTORE FROM 'bup_nodata.bak' OVERWRITE;
+Got one of the listed errors
+#
+# Show what we have.
+# NOTE: If restore would work as all or nothing,
+# all of the SHOW and SELECT statements in this section would fail.
+#
SHOW FULL TABLES FROM bup_nodata;
Tables_in_bup_nodata Table_type
b1 BASE TABLE
@@ -150,18 +191,24 @@ e1 BASE TABLE
f1 BASE TABLE
merge1 BASE TABLE
SELECT * FROM bup_nodata.merge1;
-ERROR 42S02: Table 'bup_data.myisam1' doesn't exist
+ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
SELECT * FROM bup_nodata.f1;
Got one of the listed errors
SELECT * FROM bup_nodata.b1;
a b c
SELECT * FROM bup_nodata.e1;
Period Vapor_period
-Restoring data database.
+#
+# Now restore the bup_data database as well.
+#
RESTORE FROM 'bup_data.bak';
backup_id
#
-show data
+#
+# Show that everything is well.
+# NOTE: If restore would work as all or nothing,
+# the bup_nodata tables would not exist here.
+#
SHOW FULL TABLES FROM bup_data;
Tables_in_bup_data Table_type
f1 BASE TABLE
@@ -196,5 +243,72 @@ SELECT * FROM bup_nodata.b1;
a b c
SELECT * FROM bup_nodata.e1;
Period Vapor_period
+#
+# Now restore the bup_nodata database and see if it is the same
+# as above. Note that this step would not be required here
+# because all bup_nodata tables have no data and were created
+# by the failed restore. Anyway, the correct approach is to do a
+# succeeding restore before assuming that everything exists again.
+#
+RESTORE FROM 'bup_nodata.bak' OVERWRITE;
+backup_id
+#
+#
+# Show that everything is well.
+#
+SHOW FULL TABLES FROM bup_nodata;
+Tables_in_bup_nodata Table_type
+b1 BASE TABLE
+e1 BASE TABLE
+f1 BASE TABLE
+merge1 BASE TABLE
+SELECT * FROM bup_nodata.merge1;
+a b
+11 table 1
+12 table 1
+13 table 1
+21 table 2
+22 table 2
+23 table 2
+31 table 3
+32 table 3
+33 table 3
+SELECT * FROM bup_nodata.f1;
+id group batch qty name
+1 0 0 0 foo
+2 0 0 0 fee
+3 42 0 0
+4 0 23 0
+5 0 0 1
+SELECT * FROM bup_nodata.b1;
+a b c
+SELECT * FROM bup_nodata.e1;
+Period Vapor_period
+#
+# Now drop the bup_data database with the base tables again.
+#
DROP DATABASE bup_data;
+#
+# Show that the data have gone.
+# The MERGE and FEDERATED tables have errors since
+# their base tables have been dropped with bup_data.
+#
+SHOW FULL TABLES FROM bup_nodata;
+Tables_in_bup_nodata Table_type
+b1 BASE TABLE
+e1 BASE TABLE
+f1 BASE TABLE
+merge1 BASE TABLE
+SELECT * FROM bup_nodata.merge1;
+ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
+SELECT * FROM bup_nodata.f1;
+Got one of the listed errors
+SELECT * FROM bup_nodata.b1;
+a b c
+SELECT * FROM bup_nodata.e1;
+Period Vapor_period
+#
+# Cleanup.
+#
DROP DATABASE bup_nodata;
+UNINSTALL PLUGIN example;
=== modified file 'mysql-test/suite/backup/r/backup_security.result'
--- a/mysql-test/suite/backup/r/backup_security.result 2008-10-07 17:15:44 +0000
+++ b/mysql-test/suite/backup/r/backup_security.result 2008-11-17 09:57:51 +0000
@@ -49,7 +49,7 @@ BACKUP DATABASE backup_test to 'bup_with
backup_id
#
no_rights: Attempting restore. Should succeed
-RESTORE FROM 'bup_with_rights.bak';
+RESTORE FROM 'bup_with_rights.bak' OVERWRITE;
backup_id
#
SELECT * FROM backup_test.t1;
@@ -62,7 +62,7 @@ a
06 Test #1 - super privilege
07 Test #1 - super privilege
default: Do restore to ensure it still works with default test user.
-RESTORE FROM 'backup_test_orig.bak';
+RESTORE FROM 'backup_test_orig.bak' OVERWRITE;
backup_id
#
SELECT * FROM backup_test.t1;
=== modified file 'mysql-test/suite/backup/r/backup_snapshot.result'
--- a/mysql-test/suite/backup/r/backup_snapshot.result 2008-10-07 17:15:44 +0000
+++ b/mysql-test/suite/backup/r/backup_snapshot.result 2008-11-17 09:57:51 +0000
@@ -60,7 +60,7 @@ backup_id
con1: Dropping the database
DROP TABLE bup_snapshot.t1;
con1: Restoring the database
-RESTORE FROM "bup_snapshot.bak";
+RESTORE FROM "bup_snapshot.bak" OVERWRITE;
backup_id
#
con1: Showing the data (no new data should be here).
@@ -106,7 +106,7 @@ backup_id
con1: Dropping the database
DROP TABLE bup_snapshot.t1;
con1: Restoring the database
-RESTORE FROM "bup_snapshot.bak";
+RESTORE FROM "bup_snapshot.bak" OVERWRITE;
backup_id
#
con1: Showing the data (no new data should be here).
=== modified file 'mysql-test/suite/backup/r/backup_timeout.result'
--- a/mysql-test/suite/backup/r/backup_timeout.result 2008-10-07 17:15:44 +0000
+++ b/mysql-test/suite/backup/r/backup_timeout.result 2008-11-19 22:01:28 +0000
@@ -71,3 +71,4 @@ SHOW VARIABLES LIKE 'backup_wait%';
Variable_name Value
backup_wait_timeout 50
DROP DATABASE bup_ddl_blocker;
+SET DEBUG_SYNC= 'reset';
=== added file 'mysql-test/suite/backup/r/backup_vp_nontx.result'
--- a/mysql-test/suite/backup/r/backup_vp_nontx.result 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/backup/r/backup_vp_nontx.result 2008-11-20 09:49:34 +0000
@@ -0,0 +1,115 @@
+SET DEBUG_SYNC= 'RESET';
+DROP DATABASE IF EXISTS bup_vp;
+CREATE DATABASE bup_vp;
+
+Starting Test
+
+con_bup: Creating tables
+CREATE TABLE bup_vp.t1 (col_a CHAR(40)) ENGINE=MEMORY;
+con_bup: Loading data
+con_bup: Scenario a) - commited before backup
+INSERT INTO bup_vp.t1 VALUES ("01 Some data to test");
+INSERT INTO bup_vp.t1 VALUES ("02 Some data to test");
+INSERT INTO bup_vp.t1 VALUES ("03 Some data to test");
+INSERT INTO bup_vp.t1 VALUES ("04 Some data to test");
+INSERT INTO bup_vp.t1 VALUES ("05 Some data to test");
+
+con_bup: Show the data before we start backup
+SELECT * FROM bup_vp.t1;
+col_a
+01 Some data to test
+02 Some data to test
+03 Some data to test
+04 Some data to test
+05 Some data to test
+
+Scenario (b): Insert in progress blocks CB and is included in backup
+con_ntx1: Start insert and stop it in the middle of processing
+con_ntx1: Make insert stop in the middle of execution
+SET DEBUG_SYNC= 'after_insert_locked_tables SIGNAL insert_started
+ WAIT_FOR complete_insert';
+INSERT INTO bup_vp.t1 VALUES ("ntx1: 06 Some data to test");
+
+con_bup: Activate synchronization points for BACKUP.
+SET DEBUG_SYNC= 'wait_lock_global_read_lock SIGNAL sync_complete_insert';
+SET DEBUG_SYNC= 'before_backup_data_lock SIGNAL try_insert
+ WAIT_FOR insert_blocked';
+SET DEBUG_SYNC= 'after_backup_binlog SIGNAL commit_unblocked
+ WAIT_FOR finish_bup';
+con_bup: Backing up database -- will block with lock
+BACKUP DATABASE bup_vp TO "bup_vp.bak";
+
+SET DEBUG_SYNC= 'now WAIT_FOR sync_complete_insert';
+Backup has been blocked by ongoing insert
+SET DEBUG_SYNC= 'now SIGNAL complete_insert';
+
+con_ntx1: Reap insert
+Check that record has been inserted; Should be 1 record
+SELECT * FROM bup_vp.t1 WHERE col_a like 'ntx1%';
+col_a
+ntx1: 06 Some data to test
+
+con_ntx2: Wait until backup has set CB, then try to insert
+SET DEBUG_SYNC= 'now WAIT_FOR try_insert';
+SET DEBUG_SYNC= 'wait_if_global_read_lock SIGNAL sync_insert_blocked';
+INSERT INTO bup_vp.t1 VALUES ("ntx2: Should NOT be in backup");
+
+SET DEBUG_SYNC= 'now WAIT_FOR sync_insert_blocked';
+Insert in ntx2 is blocked and should not be in t1; Should be 0 records
+SELECT * FROM bup_vp.t1 WHERE col_a like 'ntx2%';
+col_a
+
+SET DEBUG_SYNC= 'now SIGNAL insert_blocked';
+
+con_ntx1: Backup has now released CB. Perform insert
+SET DEBUG_SYNC= 'now WAIT_FOR commit_unblocked';
+INSERT INTO bup_vp.t1 VALUES ("ntx1: Should NOT be in backup");
+SET DEBUG_SYNC= 'now SIGNAL finish_bup';
+
+con_ntx1: Reap backup
+backup_id
+#
+
+con_bup: Showing data after updates and backup
+SELECT * FROM bup_vp.t1;
+col_a
+01 Some data to test
+02 Some data to test
+03 Some data to test
+04 Some data to test
+05 Some data to test
+ntx1: 06 Some data to test
+ntx2: Should NOT be in backup
+ntx1: Should NOT be in backup
+con_bup: Dropping the database
+DROP TABLE bup_vp.t1;
+DROP DATABASE bup_vp;
+con_bup: Restoring the database
+RESTORE FROM "bup_vp.bak";
+backup_id
+#
+
+con_bup: Showing the data after restore
+SELECT * FROM bup_vp.t1;
+col_a
+01 Some data to test
+02 Some data to test
+03 Some data to test
+04 Some data to test
+05 Some data to test
+ntx1: 06 Some data to test
+
+Verifying results:
+
+T1 should have changes from con_ntx1; Should be 1 record
+SELECT * FROM bup_vp.t1 WHERE col_a like 'ntx1%';
+col_a
+ntx1: 06 Some data to test
+
+T1 should not have the changes from con_ntx2; Should be 0 records
+SELECT * FROM bup_vp.t1 WHERE col_a like 'ntx2%';
+col_a
+
+con_bup: Cleanup
+DROP DATABASE bup_vp;
+SET DEBUG_SYNC= 'RESET';
=== added file 'mysql-test/suite/backup/r/backup_vp_tx.result'
--- a/mysql-test/suite/backup/r/backup_vp_tx.result 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/backup/r/backup_vp_tx.result 2008-11-20 09:49:34 +0000
@@ -0,0 +1,203 @@
+SET DEBUG_SYNC= 'RESET';
+DROP DATABASE IF EXISTS bup_vp;
+CREATE DATABASE bup_vp;
+
+Starting Test
+
+con_bup: Creating tables
+CREATE TABLE bup_vp.t1 (col_a CHAR(40)) ENGINE=INNODB;
+CREATE TABLE bup_vp.t2 (col_a CHAR(40)) ENGINE=INNODB;
+CREATE TABLE bup_vp.t3 (col_a CHAR(40)) ENGINE=INNODB;
+
+con_bup: Loading data
+con_bup: Scenario a) - commited before backup
+INSERT INTO bup_vp.t1 VALUES ("01 Some data to test");
+INSERT INTO bup_vp.t1 VALUES ("02 Some data to test");
+INSERT INTO bup_vp.t1 VALUES ("03 Some data to test");
+INSERT INTO bup_vp.t1 VALUES ("04 Some data to test");
+INSERT INTO bup_vp.t1 VALUES ("05 Some data to test");
+INSERT INTO bup_vp.t2 VALUES ("01 Some data to test");
+INSERT INTO bup_vp.t2 VALUES ("02 Some data to test");
+INSERT INTO bup_vp.t2 VALUES ("03 Some data to test");
+INSERT INTO bup_vp.t2 VALUES ("04 Some data to test");
+INSERT INTO bup_vp.t2 VALUES ("05 Some data to test");
+INSERT INTO bup_vp.t3 VALUES ("01 Some data to test");
+INSERT INTO bup_vp.t3 VALUES ("02 Some data to test");
+INSERT INTO bup_vp.t3 VALUES ("03 Some data to test");
+INSERT INTO bup_vp.t3 VALUES ("04 Some data to test");
+INSERT INTO bup_vp.t3 VALUES ("05 Some data to test");
+
+con_bup: Show the data before we start backup
+SELECT * FROM bup_vp.t1;
+col_a
+01 Some data to test
+02 Some data to test
+03 Some data to test
+04 Some data to test
+05 Some data to test
+SELECT * FROM bup_vp.t2;
+col_a
+01 Some data to test
+02 Some data to test
+03 Some data to test
+04 Some data to test
+05 Some data to test
+SELECT * FROM bup_vp.t3;
+col_a
+01 Some data to test
+02 Some data to test
+03 Some data to test
+04 Some data to test
+05 Some data to test
+
+Scenario d) - commit after VP; tx not included in backup
+con_tx3: Start transaction but do not commit
+BEGIN;
+INSERT INTO bup_vp.t3 VALUES ("tx3: 06 Should NOT be in backup");
+
+Scenario b) - Commit in progress blocks CB; tx is included in backup
+con_tx1: Get a transaction going and stop in the middle of commit
+BEGIN;
+INSERT INTO bup_vp.t1 VALUES ("tx1: 06 Some data to test");
+con_tx1: Make commit stop in the middle of execution
+SET DEBUG_SYNC= 'within_ha_commit_trans SIGNAL commit_started
+ WAIT_FOR complete_commit';
+COMMIT;
+
+Scenario c) - commit blocked by CB; tx not included in backup
+con_tx2: Wait until tx1 has started
+SET DEBUG_SYNC= 'now WAIT_FOR commit_started';
+con_tx2: Start transaction but do not commit
+BEGIN;
+INSERT INTO bup_vp.t2 VALUES ("tx2: 06 Should NOT be in backup");
+
+con_bup: Activate synchronization points for BACKUP.
+SET DEBUG_SYNC= 'wait_lock_global_read_lock SIGNAL sync_complete_commit';
+SET DEBUG_SYNC= 'before_backup_data_lock SIGNAL try_commit
+ WAIT_FOR commit_blocked';
+SET DEBUG_SYNC= 'after_backup_binlog SIGNAL commit_unblocked
+ WAIT_FOR finish_bup';
+con_bup: Backing up database -- will block with lock
+BACKUP DATABASE bup_vp TO "bup_vp.bak";
+
+SET DEBUG_SYNC= 'now WAIT_FOR sync_complete_commit';
+Backup has been blocked by ongoing commit
+Check that con_tx1 has not committed; Should be 0 records
+SELECT * FROM bup_vp.t1 WHERE col_a like 'tx1%';
+col_a
+
+SET DEBUG_SYNC= 'now SIGNAL complete_commit';
+
+con_tx1: Reap commit
+Check that con_tx1 has committed; Should be 1 record
+SELECT * FROM bup_vp.t1 WHERE col_a like 'tx1%';
+col_a
+tx1: 06 Some data to test
+
+
+con_tx2: Commit request will be blocked by CB
+SET DEBUG_SYNC= 'now WAIT_FOR try_commit';
+SET DEBUG_SYNC= 'wait_if_global_read_lock SIGNAL sync_commit_blocked';
+COMMIT;
+
+SET DEBUG_SYNC= 'now WAIT_FOR sync_commit_blocked';
+Check that con_tx2 has not committed; Should be 0 records
+SELECT * FROM bup_vp.t2 WHERE col_a like 'tx2%';
+col_a
+
+SET DEBUG_SYNC= 'now SIGNAL commit_blocked';
+
+con_bup: Reap commit
+con_tx2: Backup has now released CB.
+Check that con_tx2 has committed; Should be 1 record
+SELECT * FROM bup_vp.t2 WHERE col_a like 'tx2%';
+col_a
+tx2: 06 Should NOT be in backup
+
+
+con_tx3: Backup has now released CB. Commit transaction
+SET DEBUG_SYNC= 'now WAIT_FOR commit_unblocked';
+COMMIT;
+SET DEBUG_SYNC= 'now SIGNAL finish_bup';
+
+con_bup: Reap backup
+backup_id
+#
+
+con_bup: Showing data after updates and backup
+SELECT * FROM bup_vp.t1;
+col_a
+01 Some data to test
+02 Some data to test
+03 Some data to test
+04 Some data to test
+05 Some data to test
+tx1: 06 Some data to test
+SELECT * FROM bup_vp.t2;
+col_a
+01 Some data to test
+02 Some data to test
+03 Some data to test
+04 Some data to test
+05 Some data to test
+tx2: 06 Should NOT be in backup
+SELECT * FROM bup_vp.t3;
+col_a
+01 Some data to test
+02 Some data to test
+03 Some data to test
+04 Some data to test
+05 Some data to test
+tx3: 06 Should NOT be in backup
+con_bup: Dropping the database
+DROP TABLE bup_vp.t1;
+DROP TABLE bup_vp.t2;
+DROP TABLE bup_vp.t3;
+DROP DATABASE bup_vp;
+con_bup: Restoring the database
+RESTORE FROM "bup_vp.bak";
+backup_id
+#
+
+con_bup: Showing the data after restore (tx2 and tx3 should not be there)
+SELECT * FROM bup_vp.t1;
+col_a
+01 Some data to test
+02 Some data to test
+03 Some data to test
+04 Some data to test
+05 Some data to test
+tx1: 06 Some data to test
+SELECT * FROM bup_vp.t2;
+col_a
+01 Some data to test
+02 Some data to test
+03 Some data to test
+04 Some data to test
+05 Some data to test
+SELECT * FROM bup_vp.t3;
+col_a
+01 Some data to test
+02 Some data to test
+03 Some data to test
+04 Some data to test
+05 Some data to test
+
+Verifying results:
+
+T1 should have changes from con_tx1; Should be 1 record
+SELECT * FROM bup_vp.t1 WHERE col_a like 'tx1%';
+col_a
+tx1: 06 Some data to test
+
+T2 should not have the changes from con_tx2; Should be 0 records
+SELECT * FROM bup_vp.t2 WHERE col_a like 'tx2%';
+col_a
+
+T3 should not have the changes from con_tx3; Should be 0 records
+SELECT * FROM bup_vp.t3 WHERE col_a like 'tx3%';
+col_a
+
+con_bup: Cleanup
+DROP DATABASE bup_vp;
+SET DEBUG_SYNC= 'RESET';
=== modified file 'mysql-test/suite/backup/t/backup.test'
--- a/mysql-test/suite/backup/t/backup.test 2008-10-07 17:15:44 +0000
+++ b/mysql-test/suite/backup/t/backup.test 2008-11-17 09:57:51 +0000
@@ -434,7 +434,7 @@ SELECT * FROM bup_delete.me;
--echo do restore
--replace_column 1 #
-RESTORE FROM 'bup_delete.bak';
+RESTORE FROM 'bup_delete.bak' OVERWRITE;
--echo show the data
SELECT * FROM bup_delete.me;
@@ -472,7 +472,7 @@ BACKUP DATABASE bup_default TO 'bup_defa
--echo Restore the database.
--replace_column 1 #
-RESTORE FROM 'bup_default_timestamp.bak';
+RESTORE FROM 'bup_default_timestamp.bak' OVERWRITE;
--echo Show data after restore (timestamp should be same as above).
SELECT * FROM bup_default.time_t1;
=== modified file 'mysql-test/suite/backup/t/backup_backupdir.test'
--- a/mysql-test/suite/backup/t/backup_backupdir.test 2008-10-07 17:15:44 +0000
+++ b/mysql-test/suite/backup/t/backup_backupdir.test 2008-11-17 09:57:51 +0000
@@ -41,7 +41,7 @@ BACKUP DATABASE bup_backupdir TO 'bup_ba
--echo Perform restore
--replace_column 1 #
-RESTORE FROM 'bup_backupdir1.bak';
+RESTORE FROM 'bup_backupdir1.bak' OVERWRITE;
--echo Now do the backup and restore by specifying a path.
@@ -54,7 +54,7 @@ BACKUP DATABASE bup_backupdir TO '../bup
--echo Perform restore
--replace_column 1 #
-RESTORE FROM '../bup_backupdir2.bak';
+RESTORE FROM '../bup_backupdir2.bak' OVERWRITE;
--echo Perform backup
--replace_column 1 #
=== modified file 'mysql-test/suite/backup/t/backup_commit_backup.test'
--- a/mysql-test/suite/backup/t/backup_commit_backup.test 2008-10-07 17:15:44 +0000
+++ b/mysql-test/suite/backup/t/backup_commit_backup.test 2008-11-17 09:57:51 +0000
@@ -216,7 +216,7 @@ SELECT release_lock("sync");
echo Checking contents of the backup image;
replace_column 1 #;
-RESTORE FROM 'db1.bak';
+RESTORE FROM 'db1.bak' OVERWRITE;
SELECT * FROM db1.t1;
SELECT * FROM db1.t2;
=== removed file 'mysql-test/suite/backup/t/backup_commit_blocker.test'
--- a/mysql-test/suite/backup/t/backup_commit_blocker.test 2008-10-07 17:15:44 +0000
+++ b/mysql-test/suite/backup/t/backup_commit_blocker.test 1970-01-01 00:00:00 +0000
@@ -1,800 +0,0 @@
-#
-# This test is for the commit blocker
-# The goals of the test should be to ensure the following assumptions for
-# the behaviour of the commit blocker hold true.
-#
-# a) transactions in progress are not committed until after the backup
-# b) transactions that are committing are allowed to commit
-# c) transactions that have not started are allowed to start but do not commit
-# d) non-transaction statements in progress are allowed to finish
-# e) non-transaction statements that have not started are blocked
-#
-# The results of the backup should show (based on statements above):
-#
-# a) Test result for this assumption: Not included in backup
-# b) Test result for this assumption: Included in backup
-# c) Test result for this assumption: Not included in backup
-# d) Test result for this assumption: Included in backup
-# e) Test result for this assumption: Not included in backup
-#
-# Note: the statements above assume statements that change data.
-#
-# The test shall run three sets of data manipulation statements.
-#
-# 1) transactional statments only
-# 2) non-transactional statements only
-# 3) mix of both transactional and non-transactional statements
-#
-# TODO : Add a native driver to the test when one becomes available
-#
-
---source include/have_innodb.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;
---enable_warnings
-
-CREATE DATABASE bup_commit_blocker;
-
-#
-# Connections used in this test
-#
-# con1 - used to create data, load data, and run the backup
-# 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 to show status
-# con6 - used for setting up non-transactions in progress
-# con7 - used for setting up non-transactions about to start
-#
-
-connect (con1,localhost,root,,);
-connect (con2,localhost,root,,);
-connect (con3,localhost,root,,);
-connect (con4,localhost,root,,);
-connect (con5,localhost,root,,);
-connect (con6,localhost,root,,);
-connect (con7,localhost,root,,);
-
-#
-# Note: Originally we used SELECT ... FROM INFORMATION_SCHEMA.PROCESSLIST; to show status of
-# the various connections participating in the test. But INFORMATION_SCHEMA.PROCESSLIST implementation
-# proved to be not relaiable. From time to time (nondeterminisrtically) test hanged on these SELECTs.
-# As showing the status is not essential for the test (we test correctness by checking the contents of
-# the created backup image), the selects are commented out now. They can be re-enabled when
-# I_S.PROCESSLIST is in a better shape.
-#
-
-connection con1;
-
-#
-# Test 1 - transactional statements only
-#
-
---echo
---echo Starting Test 1
---echo
-
-#
-# Test 1 sequence diagram (not UML)
-#
-# con1 con2 con3 con4 con5
-# (setup) | | | |
-# | | | | |
-# | BEGIN | | |
-# | UPDATE t1 | | |
-# | | BEGIN | |
-# | | INSERT t2 | |
-# | | INSERT t2 | |
-# | | | | show status
-# BACKUP | | | |
-# | | COMMIT | |
-# | | | | show status
-# | | | BEGIN |
-# | | | | show status
-# | DELETE t1 | | |
-# | COMMIT | | |
-# | | <...> | |
-# | | | UPDATE t3 |
-# | | | COMMIT |
-# <...> | | | |
-# (results) | | | |
-#
-# Note: The resume of the commands is indicated with <...> and
-# may occur in any order.
-#
-
-# Create transaction tables and load them with data.
---echo con1: Creating tables
-CREATE TABLE bup_commit_blocker.t1 (col_a CHAR(40)) ENGINE=INNODB;
-CREATE TABLE bup_commit_blocker.t2 (col_a CHAR(40)) ENGINE=INNODB;
-CREATE TABLE bup_commit_blocker.t3 (col_a CHAR(40)) ENGINE=INNODB;
-
---echo con1: Loading data
-INSERT INTO bup_commit_blocker.t1 VALUES ("01 Some data to test");
-INSERT INTO bup_commit_blocker.t1 VALUES ("02 Some data to test");
-INSERT INTO bup_commit_blocker.t1 VALUES ("03 Some data to test");
-INSERT INTO bup_commit_blocker.t1 VALUES ("04 Some data to test");
-INSERT INTO bup_commit_blocker.t1 VALUES ("05 Some data to test");
-
-INSERT INTO bup_commit_blocker.t2 VALUES ("01 Some data to test");
-INSERT INTO bup_commit_blocker.t2 VALUES ("02 Some data to test");
-INSERT INTO bup_commit_blocker.t2 VALUES ("03 Some data to test");
-INSERT INTO bup_commit_blocker.t2 VALUES ("04 Some data to test");
-INSERT INTO bup_commit_blocker.t2 VALUES ("05 Some data to test");
-
-INSERT INTO bup_commit_blocker.t3 VALUES ("01 Some data to test");
-INSERT INTO bup_commit_blocker.t3 VALUES ("02 Some data to test");
-INSERT INTO bup_commit_blocker.t3 VALUES ("03 Some data to test");
-INSERT INTO bup_commit_blocker.t3 VALUES ("04 Some data to test");
-INSERT INTO bup_commit_blocker.t3 VALUES ("05 Some data to test");
-
---echo con1: Show that the new data doesn't exist before backup.
-SELECT * FROM bup_commit_blocker.t1;
-SELECT * FROM bup_commit_blocker.t2;
-SELECT * FROM bup_commit_blocker.t3;
-
-connection con2;
-
---echo con2: Get a transaction going and stop in the middle
---echo Assumption (a): TRX in progress is not included in backup
-BEGIN;
- UPDATE bup_commit_blocker.t1 SET col_a = "con2: CHANGED" WHERE col_a LIKE '01%';
-
-connection con3;
-
---echo con3: Start a transaction and send commit after lock is taken
---echo Assumption (b): TRX in commit is included in backup
-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 con1;
-
-#
-# We must start the backup and allow it to gather the metadata first.
-# We stop (with a sync point) the backup after the metadata but before
-# the commit blocker.
-#
---echo con1: Activate synchronization points for BACKUP.
-# Before blocking commits, pause to show processlist state.
-# Before going to wait for the protection against global read lock to
-# disappear, signal about the wait, so that another thread can continue.
-# When COMMIT finishes, it releases the protection against global read lock,
-# which would allow BACKUP to continue while COMMIT also continues and
-# signals "commit_done". It is important that BACKUP does not run in
-# parallel and send another signal without waiting for the commit_done
-# signal to be processed. So BACKUP itself has to wait for that signal
-# after awaking and taking the global read lock. Only then BACKUP
-# can proceed and send a signal telling that it took the global read
-# lock. Unfortunately DEBUG_SYNC does not allow a sync point to emit a
-# signal after a wait_for action. So we need to send the signal in a later
-# sync point. For this test it is not important where this signal is sent,
-# as long as it is sent while BACKUP holds the global read lock.
-# Here we do it "before_backup_unblock_commit", where we have to
-# synchronize anyway.
-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_data_lock WAIT_FOR commit_done';
-SET DEBUG_SYNC= 'before_backup_unblock_commit SIGNAL bup_read_locked
- 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;
-
---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: 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;
-
---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%";
-
---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%";
-
---echo con5: Let COMMIT continue until end of statement.
---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_read_locked';
-#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 on sync point
---echo Assumption (c): TRX not started is not included in backup
-send BEGIN;
-
-connection con5;
-
---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: Sending finish signal to wake them all.
-SET DEBUG_SYNC= 'now SIGNAL finish';
-
-# Reconnect to connections and fetch their results.
-
-connection con2;
-
---echo con2: Completing transaction
- DELETE FROM bup_commit_blocker.t1 WHERE col_a LIKE '02%';
-COMMIT;
-
-connection con3;
-
---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;
-
-connection con1;
-
---echo con1: Fetch BACKUP result
---replace_column 1 #
-reap;
-
-# Now restore the database and then check to make sure the new rows
-# were not backed up.
-
-# Do selects to show that all changes got applied.
---echo con1: Showing data after updates and backup
-SELECT * FROM bup_commit_blocker.t1;
-SELECT * FROM bup_commit_blocker.t2;
-SELECT * FROM bup_commit_blocker.t3;
-
---echo con1: Dropping the database
-DROP TABLE bup_commit_blocker.t1;
-DROP TABLE bup_commit_blocker.t2;
-DROP TABLE bup_commit_blocker.t3;
-
---echo con1: Restoring the database
---replace_column 1 #
- RESTORE FROM "bup_commit_blocker.bak";
-
---echo con1: Showing the data (no new data should be here).
-SELECT * FROM bup_commit_blocker.t1;
-SELECT * FROM bup_commit_blocker.t2;
-SELECT * FROM bup_commit_blocker.t3;
-
---echo
---echo Verifying test 1 results:
---echo
-
---echo T1 should not have the changes after backup - count(*) = 0
-SELECT count(*) FROM bup_commit_blocker.t1 WHERE col_a like 'con2%';
-
---echo T2 should have the changes after backup - count(*) = 2
-SELECT count(*) FROM bup_commit_blocker.t2 WHERE col_a like 'con3%';
-
---echo T3 should not have the changes after backup - count(*) = 0
-SELECT count(*) FROM bup_commit_blocker.t3 WHERE col_a like 'con4%';
-
---echo con1: Cleanup
-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
-#
-
---echo
---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) | | | | | |
-# | | | | | | |
-# | | | | | #DELETE t4 |
-# | | | | #show status | |
-# BACKUP | | | | | |
-# | | | | show status | |
-# | | | | | | (results)
-# | | | | | | UPDATE t5
-# | | | | show status | |
-# <...> | | | | <...> <...>
-# (results) | | | | | |
-#
-# Note: The resume of the commands is indicated with <...> and
-# may occur in any order.
-#
-
-CREATE DATABASE bup_commit_blocker;
-
-# Create a non-transaction table and load it with data.
---echo con1: Creating tables
-#CREATE TABLE bup_commit_blocker.t4 (col_a int) ENGINE=MEMORY;
-CREATE TABLE bup_commit_blocker.t5 (col_a int) ENGINE=MEMORY;
-
---echo con1: Loading data
-#INSERT INTO bup_commit_blocker.t4 VALUES (1), (2), (3), (4), (5);
-INSERT INTO bup_commit_blocker.t5 VALUES (10), (20), (30), (40), (50);
-
---echo con1: Show that the new data doesn't exist before backup.
-#SELECT * FROM bup_commit_blocker.t4;
-SELECT * FROM bup_commit_blocker.t5;
-
-#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;
-#
-#--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;
-
---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%";
-
-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 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;
-
---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: Sending finish signal to wake them all.
-SET DEBUG_SYNC= 'now SIGNAL finish';
-
-# Reconnect to con6 and con7 and fetch their results.
-
-#connection con6;
-#
-#--echo con6: Fetch DELETE result
-#reap;
-
-connection con7;
-
---echo con7: Fetch UPDATE result
-reap;
-
-connection con1;
-
---echo con1: Fetch BACKUP result
---replace_column 1 #
-reap;
-
-# Now restore the database and then check to make sure the new rows
-# were not backed up.
-
-# Do selects to show that all changes got applied.
---echo con1: Showing data after updates and backup
-#SELECT * FROM bup_commit_blocker.t4;
-SELECT * FROM bup_commit_blocker.t5;
-
---echo con1: Dropping the database
-#DROP TABLE bup_commit_blocker.t4;
-DROP TABLE bup_commit_blocker.t5;
-
---echo con1: Restoring the database
---replace_column 1 #
- RESTORE FROM "bup_commit_blocker.bak";
-
---echo con1: Showing the data (no new data should be here).
-#SELECT * FROM bup_commit_blocker.t4;
-SELECT * FROM bup_commit_blocker.t5;
-
---echo
---echo Verifying test 2 results:
---echo
-
-#--echo T4 should have the changes after backup - count(*) = 3
-#SELECT count(*) FROM bup_commit_blocker.t4 WHERE col_a > 2;
-
---echo T5 should not have the changes after backup - count(*) = 0
-SELECT count(*) FROM bup_commit_blocker.t5 WHERE col_a = 333;
-
---echo con1: Cleanup
-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
-#
-
---echo
---echo Starting Test 3
---echo
-
-#
-# Test 3 sequence diagram (not UML)
-#
-# con1 con2 con3 con4 con5 con6 con7
-# (setup) | | | | | |
-# | | | | | | |
-# | BEGIN | | | | |
-# | UPDATE t1 | | | | |
-# | | BEGIN | | | |
-# | | INSERT t2 | | | |
-# | | INSERT t2 | | | |
-# BACKUP | | | | | |
-# | | | | | #INSERT t4 |
-# | | | | show status | |
-# | | COMMIT | | | |
-# | | | | show status | |
-# | | | BEGIN | | |
-# | | | | show status | |
-# | | | | | | (results)
-# | | | | | | DELETE t5
-# | | | | show status | |
-# | | | | wake all | |
-# | DELETE t1 | | | | |
-# | COMMIT | | | | |
-# | | <...> | | | |
-# | | | UPDATE t3 | | |
-# | | | UPDATE t3 | | |
-# | | | COMMIT | | |
-# <...> | | | | <...> <...>
-# (results) | | | | | |
-#
-# Note: The resume of the commands is indicated with <...> and
-# may occur in any order.
-#
-
-CREATE DATABASE bup_commit_blocker;
-
-# Create tables and load them with data.
---echo con1: Creating tables
-CREATE TABLE bup_commit_blocker.t1 (col_a CHAR(40)) ENGINE=INNODB;
-CREATE TABLE bup_commit_blocker.t2 (col_a CHAR(40)) ENGINE=INNODB;
-CREATE TABLE bup_commit_blocker.t3 (col_a CHAR(40)) ENGINE=INNODB;
-#CREATE TABLE bup_commit_blocker.t4 (col_a int) ENGINE=MEMORY;
-CREATE TABLE bup_commit_blocker.t5 (col_a int) ENGINE=MEMORY;
-
---echo con1: Loading data
-INSERT INTO bup_commit_blocker.t1 VALUES ("01 Some data to test");
-INSERT INTO bup_commit_blocker.t1 VALUES ("02 Some data to test");
-INSERT INTO bup_commit_blocker.t1 VALUES ("03 Some data to test");
-INSERT INTO bup_commit_blocker.t1 VALUES ("04 Some data to test");
-INSERT INTO bup_commit_blocker.t1 VALUES ("05 Some data to test");
-
-INSERT INTO bup_commit_blocker.t2 VALUES ("01 Some data to test");
-INSERT INTO bup_commit_blocker.t2 VALUES ("02 Some data to test");
-INSERT INTO bup_commit_blocker.t2 VALUES ("03 Some data to test");
-INSERT INTO bup_commit_blocker.t2 VALUES ("04 Some data to test");
-INSERT INTO bup_commit_blocker.t2 VALUES ("05 Some data to test");
-
-INSERT INTO bup_commit_blocker.t3 VALUES ("01 Some data to test");
-INSERT INTO bup_commit_blocker.t3 VALUES ("02 Some data to test");
-INSERT INTO bup_commit_blocker.t3 VALUES ("03 Some data to test");
-INSERT INTO bup_commit_blocker.t3 VALUES ("04 Some data to test");
-INSERT INTO bup_commit_blocker.t3 VALUES ("05 Some data to test");
-
-#INSERT INTO bup_commit_blocker.t4 VALUES (1), (2), (3), (4), (5);
-INSERT INTO bup_commit_blocker.t5 VALUES (10), (20), (30), (40), (50);
-
---echo con1: Show that the new data doesn't exist before backup.
-SELECT * FROM bup_commit_blocker.t1;
-SELECT * FROM bup_commit_blocker.t2;
-SELECT * FROM bup_commit_blocker.t3;
-#SELECT * FROM bup_commit_blocker.t4;
-SELECT * FROM bup_commit_blocker.t5;
-
-connection con2;
-
---echo con2: Get a transaction going and stop in the middle
---echo Assumption (a): TRX in progress is not included in backup
-BEGIN;
- UPDATE bup_commit_blocker.t1 SET col_a = "con2: CHANGED" WHERE col_a LIKE '01%';
-
-connection con3;
-
---echo con3: Start a transaction and send commit after lock is taken
---echo Assumption (b): TRX in commit is included in backup
-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 con1;
-
-#
-# We must start the backup and allow it to gather the metadata first.
-# We stop (with a sync point) the backup after the metadata but before
-# the commit blocker.
-#
---echo con1: Activate synchronization points for BACKUP.
-# Before blocking commits, pause to show processlist state.
-# Before going to wait for the protection against global read lock to
-# disappear, signal about the wait, so that another thread can continue.
-# When COMMIT finishes, it releases the protection against global read lock,
-# which would allow BACKUP to continue while COMMIT also continues and
-# signals "commit_done". It is important that BACKUP does not run in
-# parallel and send another signal without waiting for the commit_done
-# signal to be processed. So BACKUP itself has to wait for that signal
-# after awaking and taking the global read lock. Only then BACKUP
-# can proceed and send a signal telling that it took the global read
-# lock. Unfortunately DEBUG_SYNC does not allow a sync point to emit a
-# signal after a wait_for action. So we need to send the signal in a later
-# sync point. For this test it is not important where this signal is sent,
-# as long as it is sent while BACKUP holds the global read lock.
-# Here we do it "before_backup_unblock_commit", where we have to
-# synchronize anyway.
-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_data_lock WAIT_FOR commit_done';
-SET DEBUG_SYNC= 'before_backup_unblock_commit SIGNAL bup_read_locked
- 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;
-#
-#--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;
-
---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%";
-
-#--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: 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;
-
---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%";
-
---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%";
-
---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_read_locked';
-#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;
-
---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%";
-
-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;
-
---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: Sending finish signal to wake them all.
-SET DEBUG_SYNC= 'now SIGNAL finish';
-
-# Reconnect to con2, con3, con4, con6, and con7 and fetch their results.
-
-connection con2;
-
---echo con2: Completing transaction
- DELETE FROM bup_commit_blocker.t2 WHERE col_a LIKE '02%';
-COMMIT;
-
-connection con3;
-
---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;
-
-connection con6;
-
-#--echo con6: Fetch INSERT result
-#reap;
-
-connection con7;
-
---echo con7: Fetch DELETE result
-reap;
-
-connection con1;
-
---echo con1: Fetch BACKUP result
---replace_column 1 #
-reap;
-
-# Now restore the database and then check to make sure the new rows
-# were not backed up.
-
-# Do selects to show that all changes got applied.
---echo con1: Showing data after updates and backup
-SELECT * FROM bup_commit_blocker.t1;
-SELECT * FROM bup_commit_blocker.t2;
-SELECT * FROM bup_commit_blocker.t3;
-#SELECT * FROM bup_commit_blocker.t4;
-SELECT * FROM bup_commit_blocker.t5;
-
---echo con1: Dropping the database
-DROP TABLE bup_commit_blocker.t1;
-DROP TABLE bup_commit_blocker.t2;
-DROP TABLE bup_commit_blocker.t3;
-#DROP TABLE bup_commit_blocker.t4;
-DROP TABLE bup_commit_blocker.t5;
-
---echo con1: Restoring the database
---replace_column 1 #
-RESTORE FROM "bup_commit_blocker.bak";
-
---echo con1: Showing the data (no new data should be here).
-SELECT * FROM bup_commit_blocker.t1;
-SELECT * FROM bup_commit_blocker.t2;
-SELECT * FROM bup_commit_blocker.t3;
-#SELECT * FROM bup_commit_blocker.t4;
-SELECT * FROM bup_commit_blocker.t5;
-
---echo
---echo Verifying test 3 results:
---echo
-
---echo T1 should not have the changes after backup - count(*) = 0
-SELECT count(*) FROM bup_commit_blocker.t1 WHERE col_a like 'con2%';
-
---echo T2 should have the changes after backup - count(*) = 2
-SELECT count(*) FROM bup_commit_blocker.t2 WHERE col_a like 'con3%';
-
---echo T3 should not have the changes after backup - count(*) = 0
-SELECT count(*) FROM bup_commit_blocker.t3 WHERE col_a like 'con4%';
-
-#--echo T4 should have the changes after backup - count(*) = 3
-#SELECT count(*) FROM bup_commit_blocker.t4 WHERE col_a > 30;
-
---echo T5 should not have the changes after backup - count(*) = 1
-SELECT count(*) FROM bup_commit_blocker.t5 WHERE col_a >= 50;
-
---echo con1: Cleanup
-DROP DATABASE bup_commit_blocker;
-
-remove_file $MYSQLTEST_VARDIR/master-data/bup_commit_blocker.bak;
-SET DEBUG_SYNC= 'RESET';
-
=== modified file 'mysql-test/suite/backup/t/backup_commit_restore.test'
--- a/mysql-test/suite/backup/t/backup_commit_restore.test 2008-10-23 08:13:54 +0000
+++ b/mysql-test/suite/backup/t/backup_commit_restore.test 2008-11-17 09:57:51 +0000
@@ -20,7 +20,7 @@ replace_column 1 #;
BACKUP DATABASE commit_test TO '81';
replace_column 1 #;
-RESTORE FROM '81';
+RESTORE FROM '81' OVERWRITE;
SELECT * FROM t1;
ROLLBACK;
@@ -37,7 +37,7 @@ replace_column 1 #;
BACKUP DATABASE commit_test TO '82';
replace_column 1 #;
-RESTORE FROM '82';
+RESTORE FROM '82' OVERWRITE;
SELECT * FROM t1;
SELECT * FROM t2;
@@ -58,7 +58,7 @@ replace_column 1 #;
BACKUP DATABASE commit_test TO '83';
replace_column 1 #;
-RESTORE FROM '83';
+RESTORE FROM '83' OVERWRITE;
SELECT * FROM t1;
SELECT * FROM t2;
@@ -81,7 +81,7 @@ replace_column 1 #;
BACKUP DATABASE commit_test TO '84';
replace_column 1 #;
-RESTORE FROM '84';
+RESTORE FROM '84' OVERWRITE;
SELECT * FROM t1;
SELECT * FROM t2;
@@ -106,7 +106,7 @@ replace_column 1 #;
BACKUP DATABASE commit_test TO '85';
replace_column 1 #;
-RESTORE FROM '85';
+RESTORE FROM '85' OVERWRITE;
SELECT * FROM t1;
SELECT * FROM t2;
@@ -133,7 +133,7 @@ BACKUP DATABASE commit_test TO '86';
SET @@autocommit=0;
replace_column 1 #;
-RESTORE FROM '86';
+RESTORE FROM '86' OVERWRITE;
#Test of scenario from BUG#34205
DROP TABLE t5;
@@ -162,7 +162,7 @@ BACKUP DATABASE commit_test TO '87';
SET @@autocommit=1;
replace_column 1 #;
-RESTORE FROM '87';
+RESTORE FROM '87' OVERWRITE;
SELECT * FROM t1;
SELECT * FROM t2;
=== modified file 'mysql-test/suite/backup/t/backup_compression.test'
--- a/mysql-test/suite/backup/t/backup_compression.test 2008-10-07 17:15:44 +0000
+++ b/mysql-test/suite/backup/t/backup_compression.test 2008-11-17 09:57:51 +0000
@@ -12,11 +12,11 @@ replace_column 1 #;
BACKUP DATABASE db1 TO 'db2.bak.gz' WITH COMPRESSION COMPRESSION_ALGORITHM=gzip;
replace_column 1 #;
-RESTORE FROM 'db1.bak.gz';
+RESTORE FROM 'db1.bak.gz' OVERWRITE;
SHOW TABLES FROM db1;
replace_column 1 #;
-RESTORE FROM 'db2.bak.gz';
+RESTORE FROM 'db2.bak.gz' OVERWRITE;
SHOW TABLES FROM db1;
DROP DATABASE db1;
=== modified file 'mysql-test/suite/backup/t/backup_concurrent.test'
--- a/mysql-test/suite/backup/t/backup_concurrent.test 2008-10-07 17:15:44 +0000
+++ b/mysql-test/suite/backup/t/backup_concurrent.test 2008-11-17 09:57:51 +0000
@@ -79,7 +79,7 @@ reap;
--echo ---------------------------------------------------
--echo Starting restore
SET DEBUG_SYNC= 'after_backup_start_restore SIGNAL running WAIT_FOR restore';
-send RESTORE FROM 'backup1';
+send RESTORE FROM 'backup1' OVERWRITE;
connection default;
--echo Waiting for restore to get going
=== modified file 'mysql-test/suite/backup/t/backup_db_grants.test'
--- a/mysql-test/suite/backup/t/backup_db_grants.test 2008-10-07 17:15:44 +0000
+++ b/mysql-test/suite/backup/t/backup_db_grants.test 2008-11-17 09:57:51 +0000
@@ -63,7 +63,7 @@ SHOW GRANTS FOR 'bup_user3'@'%';
--echo Run Restore
--replace_column 1 #
-RESTORE FROM 'bup_db_grants.bak';
+RESTORE FROM 'bup_db_grants.bak' OVERWRITE;
SHOW TABLES FROM bup_db_grants;
@@ -90,7 +90,7 @@ CREATE USER 'bup_user1'@'nosuchhost';
--echo Run Restore
--replace_column 1 #
-RESTORE FROM 'bup_db_grants.bak';
+RESTORE FROM 'bup_db_grants.bak' OVERWRITE;
SHOW TABLES FROM bup_db_grants;
@@ -178,7 +178,7 @@ EXECUTE stmt3;
--echo Run restore.
--replace_column 1 #
-RESTORE FROM 'bup_db_grants.bak';
+RESTORE FROM 'bup_db_grants.bak' OVERWRITE;
FLUSH PRIVILEGES;
=== modified file 'mysql-test/suite/backup/t/backup_ddl_blocker.test'
--- a/mysql-test/suite/backup/t/backup_ddl_blocker.test 2008-10-24 08:25:48 +0000
+++ b/mysql-test/suite/backup/t/backup_ddl_blocker.test 2008-11-20 14:07:23 +0000
@@ -243,7 +243,7 @@ DROP TABLE bup_ddl_blocker.t1, bup_ddl_b
--echo con1: Restoring the database
--replace_column 1 #
-RESTORE FROM "bup_ddl_blocker.bak";
+RESTORE FROM "bup_ddl_blocker.bak" OVERWRITE;
--echo con1: Showing columns that were backed up
@@ -297,7 +297,7 @@ SET DEBUG_SYNC= 'now WAIT_FOR con3_start
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";
+send RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE;
connection con6;
@@ -514,7 +514,7 @@ DROP TABLE bup_ddl_blocker.t01, bup_ddl_
--echo con1: Restoring the database
--replace_column 1 #
-RESTORE FROM "bup_ddl_blocker.bak";
+RESTORE FROM "bup_ddl_blocker.bak" OVERWRITE;
--echo con1: Showing columns that were backed up
--echo con1: Table t01 should be in restore
@@ -564,7 +564,7 @@ SET DEBUG_SYNC= 'now WAIT_FOR con3_start
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";
+send RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE;
connection con6;
@@ -774,7 +774,7 @@ DROP TABLE bup_ddl_blocker.t1, bup_ddl_b
--echo con1: Restoring the database
--replace_column 1 #
-RESTORE FROM "bup_ddl_blocker.bak";
+RESTORE FROM "bup_ddl_blocker.bak" OVERWRITE;
--echo con1: Showing columns that were backed up
--echo con1: Table t2 should not be in restore
@@ -823,7 +823,7 @@ SET DEBUG_SYNC= 'now WAIT_FOR con3_start
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";
+send RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE;
connection con6;
@@ -1061,7 +1061,7 @@ DROP DATABASE bup_ddl_blocker_3;
--echo con1: Restoring the database
--replace_column 1 #
--disable_warnings
-RESTORE FROM "bup_ddl_blocker.bak";
+RESTORE FROM "bup_ddl_blocker.bak" OVERWRITE;
--enable_warnings
--echo con1: Showing databases that were backed up
@@ -1137,7 +1137,7 @@ SET DEBUG_SYNC= 'now WAIT_FOR con3_start
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";
+send RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE;
connection con6;
@@ -1381,7 +1381,7 @@ DROP DATABASE bup_ddl_blocker_4;
--echo con1: Restoring the database
--replace_column 1 #
-RESTORE FROM "bup_ddl_blocker.bak";
+RESTORE FROM "bup_ddl_blocker.bak" OVERWRITE;
--echo con1: Showing databases that were backed up
--echo con1: bup_ddl_blocker_1 has been renamed and
@@ -1465,7 +1465,7 @@ SET DEBUG_SYNC= 'now WAIT_FOR con3_start
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";
+send RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE;
connection con6;
@@ -1732,7 +1732,7 @@ DROP DATABASE bup_ddl_blocker_4;
--echo con1: Restoring the database
--replace_column 1 #
--disable_warnings
-RESTORE FROM "bup_ddl_blocker.bak";
+RESTORE FROM "bup_ddl_blocker.bak" OVERWRITE;
--enable_warnings
--echo con1: Showing databases that were backed up
@@ -1829,7 +1829,7 @@ SET DEBUG_SYNC= 'now WAIT_FOR con3_start
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";
+send RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE;
connection con6;
=== modified file 'mysql-test/suite/backup/t/backup_errors.test'
--- a/mysql-test/suite/backup/t/backup_errors.test 2008-11-05 09:41:15 +0000
+++ b/mysql-test/suite/backup/t/backup_errors.test 2008-11-17 09:57:51 +0000
@@ -294,3 +294,54 @@ DROP DATABASE db1;
--echo
--echo Done testing for Bug#38624
+
+
+--echo
+--echo Testing RESTORE ... OVERWRITE functionality
+--echo See bug#34579
+--echo
+
+--source include/not_embedded.inc
+
+--echo Initialize
+CREATE DATABASE db1;
+USE db1;
+CREATE TABLE table1 (text VARCHAR(20));
+INSERT INTO table1 VALUES ('Inserted before');
+
+--echo
+--echo Backup database
+--replace_column 1 #
+BACKUP DATABASE db1 TO 'overwrite.bak';
+
+--echo
+--echo Insert more data and display
+INSERT INTO table1 VALUES ('Inserted after');
+SELECT * FROM table1;
+
+--echo
+--echo Restore without OVERWRITE flag; will fail
+--error ER_RESTORE_DB_EXISTS
+RESTORE FROM 'overwrite.bak';
+
+--echo
+--echo Restore with OVERWRITE flag; will succeed
+--replace_column 1 #
+RESTORE FROM 'overwrite.bak' OVERWRITE;
+
+--echo
+--echo Show that inserted value 2 is not there
+SELECT * FROM table1;
+
+DROP DATABASE db1;
+
+--echo
+--echo Restore after deleting db; will succeed
+--replace_column 1 #
+RESTORE FROM 'overwrite.bak';
+
+--echo
+--echo Show that inserted value 2 is not there
+SELECT * FROM table1;
+
+DROP DATABASE db1;
=== modified file 'mysql-test/suite/backup/t/backup_fkey.test'
--- a/mysql-test/suite/backup/t/backup_fkey.test 2008-10-24 08:25:48 +0000
+++ b/mysql-test/suite/backup/t/backup_fkey.test 2008-11-17 09:57:51 +0000
@@ -79,12 +79,12 @@ SHOW VARIABLES LIKE 'foreign_key_checks%
# Restore the database and ensure there are no errors.
--echo Now restore the database.
--replace_column 1 #
-RESTORE FROM 'backup_fkey.bak';
+RESTORE FROM 'backup_fkey.bak' OVERWRITE;
# Now restore the original files to show there are no problems
# restoring valid fkey relationships.
--replace_column 1 #
-RESTORE FROM 'backup_fkey_orig.bak';
+RESTORE FROM 'backup_fkey_orig.bak' OVERWRITE;
--echo Show data
SELECT * FROM backup_fkey.parent;
@@ -120,7 +120,7 @@ SHOW VARIABLES LIKE 'foreign_key_checks%
--echo Restoring data
--replace_column 1 #
-RESTORE FROM 'backup_fkey.bak';
+RESTORE FROM 'backup_fkey.bak' OVERWRITE;
--echo Verify foreign_key_checks = ON
SHOW VARIABLES LIKE 'foreign_key_checks%';
@@ -131,7 +131,7 @@ SHOW VARIABLES LIKE 'foreign_key_checks%
--echo Restoring data
--replace_column 1 #
-RESTORE FROM 'backup_fkey.bak';
+RESTORE FROM 'backup_fkey.bak' OVERWRITE;
--echo Verify foreign_key_checks = OFF
SHOW VARIABLES LIKE 'foreign_key_checks%';
=== modified file 'mysql-test/suite/backup/t/backup_lock_myisam.test'
--- a/mysql-test/suite/backup/t/backup_lock_myisam.test 2008-10-07 17:15:44 +0000
+++ b/mysql-test/suite/backup/t/backup_lock_myisam.test 2008-11-17 09:57:51 +0000
@@ -98,7 +98,7 @@ DROP DATABASE db1;
--echo now start the restore and while the restore is running, fire the trigger
--echo activate synchronization points for restore.
SET DEBUG_SYNC= 'restore_in_progress SIGNAL wait_for_restore WAIT_FOR finish';
---send RESTORE FROM 'db1.bak'
+--send RESTORE FROM 'db1.bak' OVERWRITE;
--echo From breakpoints:
--connection breakpoints
@@ -147,7 +147,7 @@ DELETE FROM db2.t2;
--echo now start the restore and while the restore is running, fire the trigger
--echo activate synchronization points for restore.
SET DEBUG_SYNC= 'restore_in_progress SIGNAL wait_for_restore WAIT_FOR finish';
---send RESTORE FROM 'db1.bak'
+--send RESTORE FROM 'db1.bak' OVERWRITE;
--echo From breakpoints:
--connection breakpoints
=== modified file 'mysql-test/suite/backup/t/backup_logs.test'
--- a/mysql-test/suite/backup/t/backup_logs.test 2008-11-07 10:40:48 +0000
+++ b/mysql-test/suite/backup/t/backup_logs.test 2008-11-17 09:57:51 +0000
@@ -154,7 +154,7 @@ SET DEBUG_SYNC= 'after_backup_start_rest
--echo con2: Send restore command.
--echo con2: Backup id = 501.
-send RESTORE FROM 'backup_logs_orig.bak';
+send RESTORE FROM 'backup_logs_orig.bak' OVERWRITE;
connection con1;
=== modified file 'mysql-test/suite/backup/t/backup_logs_output-master.opt'
--- a/mysql-test/suite/backup/t/backup_logs_output-master.opt 2008-11-11 08:37:27 +0000
+++ b/mysql-test/suite/backup/t/backup_logs_output-master.opt 2008-11-17 11:17:59 +0000
@@ -1 +1 @@
---backup_history_log_file=$MYSQLTEST_VARDIR/master-data/history.txt --backup_progress_log_file=$MYSQLTEST_VARDIR/master-data/progress.txt --log-backup-output=FILE
+--backup_history_log_file=$MYSQLTEST_VARDIR/master-data/history.txt --backup_progress_log_file=$MYSQLTEST_VARDIR/master-data/progress.txt --log-backup-output
=== modified file 'mysql-test/suite/backup/t/backup_logs_purge.test'
--- a/mysql-test/suite/backup/t/backup_logs_purge.test 2008-10-28 14:17:05 +0000
+++ b/mysql-test/suite/backup/t/backup_logs_purge.test 2008-11-17 09:57:51 +0000
@@ -74,16 +74,16 @@ BACKUP DATABASE backup_logs to 'backup3.
BACKUP DATABASE backup_logs to 'backup4.bak';
--echo Do restore of database
-RESTORE from 'backup1.bak';
+RESTORE from 'backup1.bak' OVERWRITE;
--echo Do restore of database
-RESTORE from 'backup2.bak';
+RESTORE from 'backup2.bak' OVERWRITE;
--echo Do restore of database
-RESTORE from 'backup3.bak';
+RESTORE from 'backup3.bak' OVERWRITE;
--echo Do restore of database
-RESTORE from 'backup4.bak';
+RESTORE from 'backup4.bak' OVERWRITE;
--file_exists $MYSQLTEST_VARDIR/master-data/backup1.bak
--file_exists $MYSQLTEST_VARDIR/master-data/backup2.bak
@@ -148,18 +148,18 @@ BACKUP DATABASE backup_logs to 'backup4.
SET SESSION debug="-d";
--echo Do restore of database
-RESTORE from 'backup1.bak';
+RESTORE from 'backup1.bak' OVERWRITE;
--echo Do restore of database
-RESTORE from 'backup2.bak';
+RESTORE from 'backup2.bak' OVERWRITE;
--echo Do restore of database
-RESTORE from 'backup3.bak';
+RESTORE from 'backup3.bak' OVERWRITE;
SET SESSION debug="+d,set_log_time";
--echo Do restore of database
-RESTORE from 'backup4.bak';
+RESTORE from 'backup4.bak' OVERWRITE;
SET SESSION debug="-d";
@@ -310,13 +310,13 @@ SELECT count(*) FROM mysql.backup_progre
--echo Now do the same test for restore.
--replace_column 1 #
-RESTORE FROM 'backup1.bak';
+RESTORE FROM 'backup1.bak' OVERWRITE;
--replace_column 1 #
-RESTORE FROM 'backup2.bak';
+RESTORE FROM 'backup2.bak' OVERWRITE;
--replace_column 1 #
-RESTORE FROM 'backup3.bak';
+RESTORE FROM 'backup3.bak' OVERWRITE;
--replace_column 1 #
-RESTORE FROM 'backup4.bak';
+RESTORE FROM 'backup4.bak' OVERWRITE;
SELECT count(*) FROM mysql.backup_history;
SELECT count(*) FROM mysql.backup_progress;
@@ -329,7 +329,7 @@ connection con2;
#
--echo con2: Activate sync points for the backup statement.
SET DEBUG_SYNC= 'before_restore_done SIGNAL ready WAIT_FOR proceed';
-SEND RESTORE FROM 'backup5.bak';
+SEND RESTORE FROM 'backup5.bak' OVERWRITE;
connection con1;
=== modified file 'mysql-test/suite/backup/t/backup_no_be.test'
--- a/mysql-test/suite/backup/t/backup_no_be.test 2008-10-30 10:41:48 +0000
+++ b/mysql-test/suite/backup/t/backup_no_be.test 2008-11-17 09:57:51 +0000
@@ -84,7 +84,7 @@ SELECT drivers FROM mysql.backup_history
# check that we can restore from the created image.
--replace_column 1 #
-RESTORE FROM 'db1.bak';
+RESTORE FROM 'db1.bak' OVERWRITE;
SHOW TABLES IN db1;
=== modified file 'mysql-test/suite/backup/t/backup_no_data.test'
--- a/mysql-test/suite/backup/t/backup_no_data.test 2008-10-09 09:55:08 +0000
+++ b/mysql-test/suite/backup/t/backup_no_data.test 2008-11-20 14:07:23 +0000
@@ -26,7 +26,7 @@ DROP DATABASE other_db;
SHOW DATABASES;
--replace_column 1 #
-RESTORE FROM 'all.bak';
+RESTORE FROM 'all.bak' OVERWRITE;
SHOW DATABASES;
@@ -40,7 +40,7 @@ SHOW DATABASES;
SHOW TABLES IN empty_db;
--replace_column 1 #
-RESTORE FROM 'all.bak';
+RESTORE FROM 'all.bak' OVERWRITE;
SHOW DATABASES;
SHOW TABLES IN empty_db;
@@ -64,7 +64,7 @@ BACKUP DATABASE empty_db TO 'empty_db.ba
SHOW DATABASES;
--replace_column 1 #
-RESTORE FROM 'empty_db.bak';
+RESTORE FROM 'empty_db.bak' OVERWRITE;
USE empty_db;
=== added file 'mysql-test/suite/backup/t/backup_nodata_driver-master.opt'
--- a/mysql-test/suite/backup/t/backup_nodata_driver-master.opt 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/backup/t/backup_nodata_driver-master.opt 2008-11-21 15:02:34 +0000
@@ -0,0 +1 @@
+$EXAMPLE_PLUGIN_OPT
=== modified file 'mysql-test/suite/backup/t/backup_nodata_driver.test'
--- a/mysql-test/suite/backup/t/backup_nodata_driver.test 2008-10-07 17:15:44 +0000
+++ b/mysql-test/suite/backup/t/backup_nodata_driver.test 2008-11-21 15:02:34 +0000
@@ -1,5 +1,9 @@
#
# This test tests the backup using no data engines.
+# These are engines which tables don't contain data.
+# This is obvious for BLACKHOLE and EXAMPLE.
+# Other engines behave like placeholders for tables of other
+# engines and don't have data themselves. Examples are MERGE and FEDERATED.
# It was made a separate test due to the possibility that some
# of the engines used may not be available on all platforms or
# builds.
@@ -10,18 +14,26 @@
#
--source include/not_embedded.inc
--source include/have_federated_db.inc
---source include/have_exampledb.inc
+# MERGE is always available --source include/have_merge.inc
--source include/have_blackhole.inc
+#
+# Example engine must be loaded as plugin.
+# Currently this does not work on Windows yet.
+#
+--source include/not_windows.inc
+--source include/have_example_plugin.inc
+INSTALL PLUGIN example SONAME 'ha_example.so';
+--source include/have_exampledb.inc
--disable_warnings
DROP DATABASE IF EXISTS bup_nodata;
DROP DATABASE IF EXISTS bup_data;
--enable_warnings
-# Create data
---echo Creating tables
-CREATE DATABASE bup_nodata;
-
+--echo #
+--echo # Create a database with tables that can work as
+--echo # base tables for MERGE and FEDERATED.
+--echo #
CREATE DATABASE bup_data;
CREATE TABLE bup_data.myisam1 (a int, b char(30)) ENGINE=MYISAM;
@@ -39,6 +51,11 @@ CREATE TABLE bup_data.f1 (
)
DEFAULT CHARSET=latin1;
+--echo #
+--echo # Create a database with tables from no-data engines.
+--echo #
+CREATE DATABASE bup_nodata;
+
CREATE TABLE bup_nodata.merge1 (a int, b char(30))
ENGINE=MERGE UNION=(bup_data.myisam1, bup_data.myisam2, bup_data.myisam3);
@@ -60,8 +77,9 @@ CREATE TABLE bup_nodata.e1 (
Vapor_period smallint(4) unsigned DEFAULT '0' NOT NULL
) ENGINE=example;
-# Insert some data (for merge and federated to ensure proper working tables)
---echo Inserting data
+--echo #
+--echo # Insert some data.
+--echo #
INSERT INTO bup_data.myisam1 VALUES (11, 'table 1');
INSERT INTO bup_data.myisam1 VALUES (12, 'table 1');
INSERT INTO bup_data.myisam1 VALUES (13, 'table 1');
@@ -78,85 +96,146 @@ INSERT INTO bup_data.f1 (id, `group`) VA
INSERT INTO bup_data.f1 (id, `batch`) VALUES (4, 23);
INSERT INTO bup_data.f1 (id, `qty`) VALUES (5, 1);
-# Show the data
---echo show data
+--echo #
+--echo # Show the data.
+--echo #
SHOW FULL TABLES FROM bup_data;
SHOW FULL TABLES FROM bup_nodata;
-
SELECT * FROM bup_nodata.merge1;
SELECT * FROM bup_nodata.f1;
SELECT * FROM bup_nodata.b1;
SELECT * FROM bup_nodata.e1;
-# Do the backup of the bup_data DB.
+--echo #
+--echo # Backup the bup_data DB, which tables contain data.
+--echo #
--replace_column 1 #
BACKUP DATABASE bup_data TO 'bup_data.bak';
-# Do the backup of the bup_nodata DB.
+--echo #
+--echo # Backup the bup_nodata DB, which tables do not contain data.
+--echo #
--replace_column 1 #
BACKUP DATABASE bup_nodata TO 'bup_nodata.bak';
-# Show the data
---echo show data
+--echo #
+--echo # Show the data again. Backup did not modify them.
+--echo #
SHOW FULL TABLES FROM bup_data;
SHOW FULL TABLES FROM bup_nodata;
-
SELECT * FROM bup_nodata.merge1;
SELECT * FROM bup_nodata.f1;
SELECT * FROM bup_nodata.b1;
SELECT * FROM bup_nodata.e1;
-# Now drop the data database and show what is left
-
+--echo #
+--echo # Now drop the bup_data database.
+--echo #
DROP DATABASE bup_data;
-# Show the data
---echo show data
+--echo #
+--echo # Show that the data have gone.
+--echo # The MERGE and FEDERATED tables have errors since
+--echo # their base tables have been dropped with bup_data.
+--echo #
SHOW FULL TABLES FROM bup_nodata;
-
-# The merge and federated tables should have errors since data is missing.
---error ER_NO_SUCH_TABLE
+--error ER_WRONG_MRG_TABLE
SELECT * FROM bup_nodata.merge1;
--error ER_CONNECT_TO_FOREIGN_DATA_SOURCE,ER_QUERY_ON_FOREIGN_DATA_SOURCE
SELECT * FROM bup_nodata.f1;
SELECT * FROM bup_nodata.b1;
SELECT * FROM bup_nodata.e1;
+--echo #
+--echo # Now drop the bup_nodata database too.
+--echo #
DROP DATABASE bup_nodata;
-# Now restore the nodata database and see if it is the same as above.
---echo Restoring nodata database.
+--echo #
+--echo # Now try to restore the bup_nodata database. This fails because
+--echo # restore opens the tables for filling them with data, even when
+--echo # they were empty on backup. 'bup_nodata.bak' does not contain
+--echo # the base tables for the MERGE and FEDERATED tables.
+--echo # NOTE: Since restore fails after restoring the meta data,
+--echo # after creating the tables that is, we have the same
+--echo # situation as before. The tables exist, but the base
+--echo # tables for MERGE and FEDERATED do not exist.
+--echo #
--replace_column 1 #
-RESTORE FROM 'bup_nodata.bak';
+--error ER_WRONG_MRG_TABLE,ER_CONNECT_TO_FOREIGN_DATA_SOURCE,ER_QUERY_ON_FOREIGN_DATA_SOURCE
+RESTORE FROM 'bup_nodata.bak' OVERWRITE;
-# Show the data
---echo show data
+--echo #
+--echo # Show what we have.
+--echo # NOTE: If restore would work as all or nothing,
+--echo # all of the SHOW and SELECT statements in this section would fail.
+--echo #
SHOW FULL TABLES FROM bup_nodata;
-
-# The merge and federated tables should have errors since data is missing.
---error ER_NO_SUCH_TABLE
+--error ER_WRONG_MRG_TABLE
SELECT * FROM bup_nodata.merge1;
--error ER_CONNECT_TO_FOREIGN_DATA_SOURCE,ER_QUERY_ON_FOREIGN_DATA_SOURCE
SELECT * FROM bup_nodata.f1;
SELECT * FROM bup_nodata.b1;
SELECT * FROM bup_nodata.e1;
-# Now restore the data database and see that all is well.
---echo Restoring data database.
+--echo #
+--echo # Now restore the bup_data database as well.
+--echo #
--replace_column 1 #
RESTORE FROM 'bup_data.bak';
-# Show the data
---echo show data
+--echo #
+--echo # Show that everything is well.
+--echo # NOTE: If restore would work as all or nothing,
+--echo # the bup_nodata tables would not exist here.
+--echo #
SHOW FULL TABLES FROM bup_data;
SHOW FULL TABLES FROM bup_nodata;
+SELECT * FROM bup_nodata.merge1;
+SELECT * FROM bup_nodata.f1;
+SELECT * FROM bup_nodata.b1;
+SELECT * FROM bup_nodata.e1;
+
+--echo #
+--echo # Now restore the bup_nodata database and see if it is the same
+--echo # as above. Note that this step would not be required here
+--echo # because all bup_nodata tables have no data and were created
+--echo # by the failed restore. Anyway, the correct approach is to do a
+--echo # succeeding restore before assuming that everything exists again.
+--echo #
+--replace_column 1 #
+RESTORE FROM 'bup_nodata.bak' OVERWRITE;
+--echo #
+--echo # Show that everything is well.
+--echo #
+SHOW FULL TABLES FROM bup_nodata;
SELECT * FROM bup_nodata.merge1;
SELECT * FROM bup_nodata.f1;
SELECT * FROM bup_nodata.b1;
SELECT * FROM bup_nodata.e1;
+--echo #
+--echo # Now drop the bup_data database with the base tables again.
+--echo #
DROP DATABASE bup_data;
+
+--echo #
+--echo # Show that the data have gone.
+--echo # The MERGE and FEDERATED tables have errors since
+--echo # their base tables have been dropped with bup_data.
+--echo #
+SHOW FULL TABLES FROM bup_nodata;
+--error ER_WRONG_MRG_TABLE
+SELECT * FROM bup_nodata.merge1;
+--error ER_CONNECT_TO_FOREIGN_DATA_SOURCE,ER_QUERY_ON_FOREIGN_DATA_SOURCE
+SELECT * FROM bup_nodata.f1;
+SELECT * FROM bup_nodata.b1;
+SELECT * FROM bup_nodata.e1;
+
+--echo #
+--echo # Cleanup.
+--echo #
DROP DATABASE bup_nodata;
--error 0,1
@@ -164,3 +243,5 @@ DROP DATABASE bup_nodata;
--error 0,1
--remove_file $MYSQLTEST_VARDIR/master-data/bup_nodata.bak
+UNINSTALL PLUGIN example;
+
=== modified file 'mysql-test/suite/backup/t/backup_security.test'
--- a/mysql-test/suite/backup/t/backup_security.test 2008-10-24 08:25:48 +0000
+++ b/mysql-test/suite/backup/t/backup_security.test 2008-11-17 09:57:51 +0000
@@ -72,7 +72,7 @@ BACKUP DATABASE backup_test to 'bup_with
--echo no_rights: Attempting restore. Should succeed
--replace_column 1 #
-RESTORE FROM 'bup_with_rights.bak';
+RESTORE FROM 'bup_with_rights.bak' OVERWRITE;
SELECT * FROM backup_test.t1;
@@ -82,7 +82,7 @@ disconnect with_rights;
connection default;
--replace_column 1 #
-RESTORE FROM 'backup_test_orig.bak';
+RESTORE FROM 'backup_test_orig.bak' OVERWRITE;
SELECT * FROM backup_test.t1;
=== modified file 'mysql-test/suite/backup/t/backup_snapshot.test'
--- a/mysql-test/suite/backup/t/backup_snapshot.test 2008-10-07 17:15:44 +0000
+++ b/mysql-test/suite/backup/t/backup_snapshot.test 2008-11-17 09:57:51 +0000
@@ -116,7 +116,7 @@ DROP TABLE bup_snapshot.t1;
--echo con1: Restoring the database
--replace_column 1 #
-RESTORE FROM "bup_snapshot.bak";
+RESTORE FROM "bup_snapshot.bak" OVERWRITE;
--echo con1: Showing the data (no new data should be here).
SELECT * FROM bup_snapshot.t1 WHERE word LIKE '-%';
@@ -175,7 +175,7 @@ DROP TABLE bup_snapshot.t1;
--echo con1: Restoring the database
--replace_column 1 #
-RESTORE FROM "bup_snapshot.bak";
+RESTORE FROM "bup_snapshot.bak" OVERWRITE;
--echo con1: Showing the data (no new data should be here).
SELECT * FROM bup_snapshot.t1 WHERE word LIKE '-%';
=== modified file 'mysql-test/suite/backup/t/backup_timeout.test'
--- a/mysql-test/suite/backup/t/backup_timeout.test 2008-10-07 17:15:44 +0000
+++ b/mysql-test/suite/backup/t/backup_timeout.test 2008-11-19 22:01:28 +0000
@@ -159,4 +159,6 @@ SHOW VARIABLES LIKE 'backup_wait%';
DROP DATABASE bup_ddl_blocker;
+SET DEBUG_SYNC= 'reset';
+
--remove_file $MYSQLTEST_VARDIR/master-data/bup_ddl_blocker.bak
=== added file 'mysql-test/suite/backup/t/backup_vp_nontx.test'
--- a/mysql-test/suite/backup/t/backup_vp_nontx.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/backup/t/backup_vp_nontx.test 2008-11-20 09:49:34 +0000
@@ -0,0 +1,256 @@
+#
+# This test is one of two validity point tests. See:
+# backup_vp_tx.test
+#
+# The goal of the test should be to ensure the following assumptions
+# for the behavior of validity point (VP) hold. Validity point is
+# implemented using commit blocker (CB).
+#
+# Note: in this file, "DML" refers to DML operations executed in
+# non-transactional storage engines.
+#
+# a) DMLs that are executed before VP are in the backup image
+#
+# b) setting the validity point should not be done while DMLs are
+# being processed in any table involved in the backup. An active
+# DML therefore blocks backup from setting commit blocker. The DML
+# has to complete before backup can set CB (and ultimately set the
+# VP), and will therefore be in the backup image
+#
+# c) setting the validity point should not be done while DMLs are
+# being processed in any table involved in the backup. A DML
+# operation requested when backup is ready to set VP is therefore
+# blocked by CB. The DML has to wait for CB to be released before
+# it can continue, and will therefore not be in the backup image
+#
+# d) DMLs executed after VP are not in the backup image
+#
+#
+
+--source include/have_debug_sync.inc
+--source include/not_embedded.inc
+
+--disable_warnings
+SET DEBUG_SYNC= 'RESET';
+DROP DATABASE IF EXISTS bup_vp;
+
+let $bdir=`SELECT @@backupdir`;
+
+--error 0,1
+remove_file $bdir/bup_vp.bak;
+--enable_warnings
+
+
+CREATE DATABASE bup_vp;
+
+#
+# Connections used in this test
+#
+# con_bup - used to create data, load data, and run the backup
+# con_ntx1 - used for non-transactional execution
+# con_ntx2 - used for non-transactional execution
+# con_sync - used to make sync point work flow easier to read
+#
+
+connect (con_bup,localhost,root,,);
+connect (con_ntx1,localhost,root,,);
+connect (con_ntx2,localhost,root,,);
+connect (con_sync,localhost,root,,);
+
+connection con_bup;
+
+--echo
+--echo Starting Test
+--echo
+
+#
+# Sequence diagram (not UML), only relevant parts shown
+#
+# bup tx1 tx2
+# | | |
+# a) | |
+# (setup) | |
+# | b) |
+# | INSERT |
+# BACKUP <...> |
+# SET CB <...> |
+# <###> <...> |
+# <...> | c)
+# | | INSERT
+# SET VP | <###>
+# RELEASE CB | <###>
+# | d) <...>
+# | INSERT |
+# BUP DONE | |
+# (results) | |
+#
+# Note: Ongoing operations are indicated with <...>
+# Blocked operations are indicated with <###>
+#
+
+# Create transaction tables and load them with data.
+--echo con_bup: Creating tables
+CREATE TABLE bup_vp.t1 (col_a CHAR(40)) ENGINE=MEMORY;
+
+--echo con_bup: Loading data
+--echo con_bup: Scenario a) - commited before backup
+INSERT INTO bup_vp.t1 VALUES ("01 Some data to test");
+INSERT INTO bup_vp.t1 VALUES ("02 Some data to test");
+INSERT INTO bup_vp.t1 VALUES ("03 Some data to test");
+INSERT INTO bup_vp.t1 VALUES ("04 Some data to test");
+INSERT INTO bup_vp.t1 VALUES ("05 Some data to test");
+
+--echo
+--echo con_bup: Show the data before we start backup
+SELECT * FROM bup_vp.t1;
+
+### CON 1 ###
+ --echo
+ connection con_ntx1;
+
+ --echo Scenario (b): Insert in progress blocks CB and is included in backup
+ --echo con_ntx1: Start insert and stop it in the middle of processing
+
+ --echo con_ntx1: Make insert stop in the middle of execution
+ # Will continue once backup has been blocked from setting CB
+ SET DEBUG_SYNC= 'after_insert_locked_tables SIGNAL insert_started
+ WAIT_FOR complete_insert';
+ send INSERT INTO bup_vp.t1 VALUES ("ntx1: 06 Some data to test");
+
+
+### CON BUP ###
+--echo
+connection con_bup;
+
+# Backup will be blocked from setting CB by the ongoing insert in
+# con_ntx1. Backup will signal con_ntx1 that it has been blocked. The
+# insert will then finish, making backup able to set CB. When CB has
+# been set, ntx2 will be signaled to try to insert. ntx2 insert will
+# be blocked by the CB and send a signal that it has been blocked. CB
+# is then released, but backup is stopped immediately after releasing
+# CB. ntx2 will now be able to complete the insert, and ntx1 will
+# issue and complete another insert. Finally, backup is allowed to
+# complete.
+
+--echo con_bup: Activate synchronization points for BACKUP.
+# Signal when backup is blocked by ongoing insert in con_ntx1
+SET DEBUG_SYNC= 'wait_lock_global_read_lock SIGNAL sync_complete_insert';
+
+# ntx1 insert is completed, so backup can set CB. Just before reaching
+# VP, signal ntx2 should try to insert. Wait until ntx2 signals it has
+# been blocked
+SET DEBUG_SYNC= 'before_backup_data_lock SIGNAL try_insert
+ WAIT_FOR insert_blocked';
+
+# ntx2 insert has been blocked. Create VP and release CB, and then wait
+# while ntx2 and ntx1 inserts.
+SET DEBUG_SYNC= 'after_backup_binlog SIGNAL commit_unblocked
+ WAIT_FOR finish_bup';
+
+--echo con_bup: Backing up database -- will block with lock
+send BACKUP DATABASE bup_vp TO "bup_vp.bak";
+
+### CON SYNC ###
+--echo
+connection con_sync;
+SET DEBUG_SYNC= 'now WAIT_FOR sync_complete_insert';
+--echo Backup has been blocked by ongoing insert
+
+# cannot test with select that insert has not completed ntx1 has X-lock
+SET DEBUG_SYNC= 'now SIGNAL complete_insert';
+
+### CON 1 ###
+ --echo
+ connection con_ntx1;
+ --echo con_ntx1: Reap insert
+ reap;
+
+ --echo Check that record has been inserted; Should be 1 record
+ SELECT * FROM bup_vp.t1 WHERE col_a like 'ntx1%';
+ --echo
+
+###########
+## Below this line happens after BACKUP has taken CB
+###########
+
+### CON 2 ###
+ connection con_ntx2;
+
+ --echo con_ntx2: Wait until backup has set CB, then try to insert
+ # Wait for backup to set CB
+ SET DEBUG_SYNC= 'now WAIT_FOR try_insert';
+ # Signal to backup that the insert is blocked
+ SET DEBUG_SYNC= 'wait_if_global_read_lock SIGNAL sync_insert_blocked';
+ send INSERT INTO bup_vp.t1 VALUES ("ntx2: Should NOT be in backup");
+
+ # INSERT is blocked until CB has been released
+
+### CON SYNC ###
+--echo
+connection con_sync;
+SET DEBUG_SYNC= 'now WAIT_FOR sync_insert_blocked';
+
+--echo Insert in ntx2 is blocked and should not be in t1; Should be 0 records
+SELECT * FROM bup_vp.t1 WHERE col_a like 'ntx2%';
+--echo
+
+SET DEBUG_SYNC= 'now SIGNAL insert_blocked';
+
+
+### CON 1 ###
+ --echo
+ connection con_ntx1;
+
+ --echo con_ntx1: Backup has now released CB. Perform insert
+ # Double-check that backup has reached sync point after CB release
+ SET DEBUG_SYNC= 'now WAIT_FOR commit_unblocked';
+ INSERT INTO bup_vp.t1 VALUES ("ntx1: Should NOT be in backup");
+ SET DEBUG_SYNC= 'now SIGNAL finish_bup';
+
+
+### CON BUP ###
+--echo
+connection con_bup;
+--echo con_ntx1: Reap backup
+--replace_column 1 #
+reap;
+
+
+###########
+## Verify results
+###########
+
+# Do selects to show that all changes got applied.
+--echo
+--echo con_bup: Showing data after updates and backup
+SELECT * FROM bup_vp.t1;
+
+--echo con_bup: Dropping the database
+DROP TABLE bup_vp.t1;
+DROP DATABASE bup_vp;
+
+--echo con_bup: Restoring the database
+--replace_column 1 #
+RESTORE FROM "bup_vp.bak";
+
+--echo
+--echo con_bup: Showing the data after restore
+SELECT * FROM bup_vp.t1;
+
+--echo
+--echo Verifying results:
+--echo
+
+--echo T1 should have changes from con_ntx1; Should be 1 record
+SELECT * FROM bup_vp.t1 WHERE col_a like 'ntx1%';
+--echo
+
+--echo T1 should not have the changes from con_ntx2; Should be 0 records
+SELECT * FROM bup_vp.t1 WHERE col_a like 'ntx2%';
+--echo
+
+--echo con_bup: Cleanup
+DROP DATABASE bup_vp;
+
+remove_file $bdir/bup_vp.bak;
+SET DEBUG_SYNC= 'RESET';
=== added file 'mysql-test/suite/backup/t/backup_vp_tx.test'
--- a/mysql-test/suite/backup/t/backup_vp_tx.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/backup/t/backup_vp_tx.test 2008-11-20 09:49:34 +0000
@@ -0,0 +1,329 @@
+#
+# This test is one of two validity point tests. See:
+# backup_vp_nontx.test
+#
+# The goal of the test should be to ensure the following assumptions
+# for the behavior of validity point (VP) hold. Validity point is
+# implemented using commit blocker (CB).
+#
+# a) transactions that commit before VP are in the backup image
+#
+# b) setting the validity point should not be done while commits are
+# being processed in any table involved in the backup. Transactions
+# with ongoing commits therefore block backup from setting commit
+# blocker. The commit has to complete before backup can set CB (and
+# ultimately set the VP), and will therefore be in the backup image
+#
+# c) setting the validity point should not be done while commits are
+# being processed in any table involved in the backup. Transactions
+# that try to commit when backup is ready to set VP are therefore
+# blocked by CB. The commit has to wait for CB to be released
+# before it can continue, and will therefore not be in the backup
+# image
+#
+# d) transactions that commit after VP are not in the backup image
+#
+# Note: the transactions have to modify data.
+#
+#
+#
+
+--source include/have_innodb.inc
+--source include/have_debug_sync.inc
+--source include/not_embedded.inc
+
+--disable_warnings
+SET DEBUG_SYNC= 'RESET';
+DROP DATABASE IF EXISTS bup_vp;
+
+let $bdir=`SELECT @@backupdir`;
+
+--error 0,1
+remove_file $bdir/bup_vp.bak;
+--enable_warnings
+
+CREATE DATABASE bup_vp;
+
+#
+# Connections used in this test
+#
+# con_bup - used to create data, load data, and run the backup
+# con_tx1 - used for transactional execution
+# con_tx2 - used for transactional execution
+# con_tx3 - used for transactional execution
+# con_sync - used to make sync point work flow easier to read
+#
+
+connect (con_bup,localhost,root,,);
+connect (con_tx1,localhost,root,,);
+connect (con_tx2,localhost,root,,);
+connect (con_tx3,localhost,root,,);
+connect (con_sync,localhost,root,,);
+
+connection con_bup;
+
+--echo
+--echo Starting Test
+--echo
+
+#
+# Sequence diagram (not UML), only relevant parts shown
+#
+# bup tx1 tx2 tx3
+# | | | |
+# a) | | |
+# (setup) | | |
+# COMMIT | | d)
+# | | | BEGIN
+# | b) | INSERT t3
+# | BEGIN | |
+# | INSERT t1 | |
+# | COMMIT c) |
+# | <...> BEGIN |
+# | <...> INSERT t2 |
+# | <...> | |
+# BACKUP <...> | |
+# SET CB <...> | |
+# <###> <...> | |
+# <...> | | |
+# | | COMMIT |
+# SET VP | <###> |
+# RELEASE CB | <###> |
+# | | <...> COMMIT
+# | | | |
+# BUP DONE | | |
+# (results) | | |
+#
+# Note: Ongoing operations are indicated with <...>
+# Blocked operations are indicated with <###>
+#
+
+# Create transaction tables and load them with data.
+--echo con_bup: Creating tables
+CREATE TABLE bup_vp.t1 (col_a CHAR(40)) ENGINE=INNODB;
+CREATE TABLE bup_vp.t2 (col_a CHAR(40)) ENGINE=INNODB;
+CREATE TABLE bup_vp.t3 (col_a CHAR(40)) ENGINE=INNODB;
+
+--echo
+--echo con_bup: Loading data
+--echo con_bup: Scenario a) - commited before backup
+INSERT INTO bup_vp.t1 VALUES ("01 Some data to test");
+INSERT INTO bup_vp.t1 VALUES ("02 Some data to test");
+INSERT INTO bup_vp.t1 VALUES ("03 Some data to test");
+INSERT INTO bup_vp.t1 VALUES ("04 Some data to test");
+INSERT INTO bup_vp.t1 VALUES ("05 Some data to test");
+
+INSERT INTO bup_vp.t2 VALUES ("01 Some data to test");
+INSERT INTO bup_vp.t2 VALUES ("02 Some data to test");
+INSERT INTO bup_vp.t2 VALUES ("03 Some data to test");
+INSERT INTO bup_vp.t2 VALUES ("04 Some data to test");
+INSERT INTO bup_vp.t2 VALUES ("05 Some data to test");
+
+INSERT INTO bup_vp.t3 VALUES ("01 Some data to test");
+INSERT INTO bup_vp.t3 VALUES ("02 Some data to test");
+INSERT INTO bup_vp.t3 VALUES ("03 Some data to test");
+INSERT INTO bup_vp.t3 VALUES ("04 Some data to test");
+INSERT INTO bup_vp.t3 VALUES ("05 Some data to test");
+
+--echo
+--echo con_bup: Show the data before we start backup
+SELECT * FROM bup_vp.t1;
+SELECT * FROM bup_vp.t2;
+SELECT * FROM bup_vp.t3;
+
+### CON 3 ###
+ --echo
+ connection con_tx3;
+
+ --echo Scenario d) - commit after VP; tx not included in backup
+ --echo con_tx3: Start transaction but do not commit
+ BEGIN;
+ INSERT INTO bup_vp.t3 VALUES ("tx3: 06 Should NOT be in backup");
+
+### CON 1 ###
+ --echo
+ connection con_tx1;
+
+ --echo Scenario b) - Commit in progress blocks CB; tx is included in backup
+ --echo con_tx1: Get a transaction going and stop in the middle of commit
+ BEGIN;
+ INSERT INTO bup_vp.t1 VALUES ("tx1: 06 Some data to test");
+
+ --echo con_tx1: Make commit stop in the middle of execution
+ # Will continue once backup has been blocked from setting CB
+ SET DEBUG_SYNC= 'within_ha_commit_trans SIGNAL commit_started
+ WAIT_FOR complete_commit';
+ send COMMIT;
+
+### CON 2 ###
+ --echo
+ connection con_tx2;
+
+ --echo Scenario c) - commit blocked by CB; tx not included in backup
+ --echo con_tx2: Wait until tx1 has started
+ SET DEBUG_SYNC= 'now WAIT_FOR commit_started';
+ --echo con_tx2: Start transaction but do not commit
+ BEGIN;
+ INSERT INTO bup_vp.t2 VALUES ("tx2: 06 Should NOT be in backup");
+
+### CON BUP ###
+--echo
+connection con_bup;
+
+# Backup will be blocked from setting CB by the ongoing commit in
+# con_tx1. Backup will signal con_tx1 that it has been blocked. The
+# commit will then finish, making backup able to set CB. When CB has
+# been set, tx2 will be signaled to try to commit. tx2 commit will be
+# blocked by the CB and send a signal that it has been blocked. CB is
+# then released, but backup is stopped immediately after releasing CB.
+# tx2 will now be able to complete the commit, and tx3 will issue and
+# complete a commit. Finally, backup is allowed to complete.
+
+--echo con_bup: Activate synchronization points for BACKUP.
+# Signal when backup is blocked by ongoing commit in con_tx1
+SET DEBUG_SYNC= 'wait_lock_global_read_lock SIGNAL sync_complete_commit';
+
+# tx1 commit is completed, so backup can set CB. Just before reaching
+# VP, signal tx2 should try to commit. Wait until tx2 signals it has
+# been blocked
+SET DEBUG_SYNC= 'before_backup_data_lock SIGNAL try_commit
+ WAIT_FOR commit_blocked';
+
+# tx2 commit has been blocked. Create VP and release CB, and then wait
+# while tx2 and tx2 commits.
+SET DEBUG_SYNC= 'after_backup_binlog SIGNAL commit_unblocked
+ WAIT_FOR finish_bup';
+
+--echo con_bup: Backing up database -- will block with lock
+send BACKUP DATABASE bup_vp TO "bup_vp.bak";
+
+
+### CON SYNC ###
+--echo
+connection con_sync;
+SET DEBUG_SYNC= 'now WAIT_FOR sync_complete_commit';
+--echo Backup has been blocked by ongoing commit
+
+--echo Check that con_tx1 has not committed; Should be 0 records
+SELECT * FROM bup_vp.t1 WHERE col_a like 'tx1%';
+--echo
+
+SET DEBUG_SYNC= 'now SIGNAL complete_commit';
+
+### CON 1 ###
+ --echo
+ connection con_tx1;
+ --echo con_tx1: Reap commit
+ reap;
+ --echo Check that con_tx1 has committed; Should be 1 record
+ SELECT * FROM bup_vp.t1 WHERE col_a like 'tx1%';
+ --echo
+
+###########
+## Below this line happens after BACKUP has taken CB
+###########
+
+### CON 2 ###
+ --echo
+ connection con_tx2;
+ --echo con_tx2: Commit request will be blocked by CB
+
+ # Wait for backup to set CB
+ SET DEBUG_SYNC= 'now WAIT_FOR try_commit';
+
+ # Signal to backup that the commit is blocked
+ SET DEBUG_SYNC= 'wait_if_global_read_lock SIGNAL sync_commit_blocked';
+
+ send COMMIT;
+
+ # Test is blocked on COMMIT until CB has been released
+
+### CON SYNC ###
+--echo
+connection con_sync;
+SET DEBUG_SYNC= 'now WAIT_FOR sync_commit_blocked';
+
+--echo Check that con_tx2 has not committed; Should be 0 records
+SELECT * FROM bup_vp.t2 WHERE col_a like 'tx2%';
+--echo
+
+SET DEBUG_SYNC= 'now SIGNAL commit_blocked';
+
+### CON 2 ###
+ --echo
+ connection con_tx2;
+ --echo con_bup: Reap commit
+ # commit completes only after CB has been released
+ reap;
+
+ --echo con_tx2: Backup has now released CB.
+ --echo Check that con_tx2 has committed; Should be 1 record
+ SELECT * FROM bup_vp.t2 WHERE col_a like 'tx2%';
+ --echo
+
+### CON 3 ###
+ --echo
+ connection con_tx3;
+ --echo con_tx3: Backup has now released CB. Commit transaction
+
+ # Double-check that backup has reached sync point after CB release
+ SET DEBUG_SYNC= 'now WAIT_FOR commit_unblocked';
+ COMMIT;
+ SET DEBUG_SYNC= 'now SIGNAL finish_bup';
+
+
+### CON BUP ###
+--echo
+connection con_bup;
+--echo con_bup: Reap backup
+--replace_column 1 #
+reap;
+
+###########
+## Verify results
+###########
+
+# Do selects to show that all changes got applied.
+--echo
+--echo con_bup: Showing data after updates and backup
+SELECT * FROM bup_vp.t1;
+SELECT * FROM bup_vp.t2;
+SELECT * FROM bup_vp.t3;
+
+--echo con_bup: Dropping the database
+DROP TABLE bup_vp.t1;
+DROP TABLE bup_vp.t2;
+DROP TABLE bup_vp.t3;
+DROP DATABASE bup_vp;
+
+--echo con_bup: Restoring the database
+--replace_column 1 #
+RESTORE FROM "bup_vp.bak";
+
+--echo
+--echo con_bup: Showing the data after restore (tx2 and tx3 should not be there)
+SELECT * FROM bup_vp.t1;
+SELECT * FROM bup_vp.t2;
+SELECT * FROM bup_vp.t3;
+
+--echo
+--echo Verifying results:
+--echo
+
+--echo T1 should have changes from con_tx1; Should be 1 record
+SELECT * FROM bup_vp.t1 WHERE col_a like 'tx1%';
+
+--echo
+--echo T2 should not have the changes from con_tx2; Should be 0 records
+SELECT * FROM bup_vp.t2 WHERE col_a like 'tx2%';
+
+--echo
+--echo T3 should not have the changes from con_tx3; Should be 0 records
+SELECT * FROM bup_vp.t3 WHERE col_a like 'tx3%';
+
+--echo
+--echo con_bup: Cleanup
+DROP DATABASE bup_vp;
+
+remove_file $bdir/bup_vp.bak;
+SET DEBUG_SYNC= 'RESET';
=== modified file 'mysql-test/suite/backup_engines/include/backup_ptr_commit.inc'
--- a/mysql-test/suite/backup_engines/include/backup_ptr_commit.inc 2008-10-08 04:26:25 +0000
+++ b/mysql-test/suite/backup_engines/include/backup_ptr_commit.inc 2008-11-17 09:57:51 +0000
@@ -202,7 +202,7 @@ SELECT * FROM ptr.t3;
--echo Perform restore operation
--replace_column 1 #
-RESTORE FROM 'ptr_commit.bak';
+RESTORE FROM 'ptr_commit.bak' OVERWRITE;
SHOW TABLES FROM ptr;
SELECT * FROM ptr.t1;
SELECT * FROM ptr.t2;
=== modified file 'mysql-test/suite/backup_engines/r/backup_online_testing.result'
--- a/mysql-test/suite/backup_engines/r/backup_online_testing.result 2008-06-30 19:40:33 +0000
+++ b/mysql-test/suite/backup_engines/r/backup_online_testing.result 2008-11-19 22:01:28 +0000
@@ -1135,3 +1135,4 @@ COUNT(*)
*** DROP bup_online DATABASE ****
DROP DATABASE bup_online;
+SET DEBUG_SYNC= 'RESET';
=== modified file 'mysql-test/suite/backup_engines/r/backup_ptr_commit_mixed.result'
--- a/mysql-test/suite/backup_engines/r/backup_ptr_commit_mixed.result 2008-10-08 04:26:25 +0000
+++ b/mysql-test/suite/backup_engines/r/backup_ptr_commit_mixed.result 2008-11-17 09:57:51 +0000
@@ -304,7 +304,7 @@ id name
Perform Restore and Recover committed data using mysqlbinlog position
after backup.
Perform restore operation
-RESTORE FROM 'ptr_commit.bak';
+RESTORE FROM 'ptr_commit.bak' OVERWRITE;
backup_id
#
SHOW TABLES FROM ptr;
=== modified file 'mysql-test/suite/backup_engines/r/backup_ptr_commit_row.result'
--- a/mysql-test/suite/backup_engines/r/backup_ptr_commit_row.result 2008-10-08 04:26:25 +0000
+++ b/mysql-test/suite/backup_engines/r/backup_ptr_commit_row.result 2008-11-17 09:57:51 +0000
@@ -304,7 +304,7 @@ id name
Perform Restore and Recover committed data using mysqlbinlog position
after backup.
Perform restore operation
-RESTORE FROM 'ptr_commit.bak';
+RESTORE FROM 'ptr_commit.bak' OVERWRITE;
backup_id
#
SHOW TABLES FROM ptr;
=== modified file 'mysql-test/suite/backup_engines/r/backup_ptr_commit_stmt.result'
--- a/mysql-test/suite/backup_engines/r/backup_ptr_commit_stmt.result 2008-10-08 04:26:25 +0000
+++ b/mysql-test/suite/backup_engines/r/backup_ptr_commit_stmt.result 2008-11-17 09:57:51 +0000
@@ -304,7 +304,7 @@ id name
Perform Restore and Recover committed data using mysqlbinlog position
after backup.
Perform restore operation
-RESTORE FROM 'ptr_commit.bak';
+RESTORE FROM 'ptr_commit.bak' OVERWRITE;
backup_id
#
SHOW TABLES FROM ptr;
=== modified file 'mysql-test/suite/backup_engines/r/backup_tmp_tables.result'
--- a/mysql-test/suite/backup_engines/r/backup_tmp_tables.result 2008-10-30 12:29:54 +0000
+++ b/mysql-test/suite/backup_engines/r/backup_tmp_tables.result 2008-11-17 09:57:51 +0000
@@ -29,7 +29,7 @@ backup_id
** Drop and restore the database
DROP TABLE t1;
DROP TABLE t2;
-RESTORE FROM 'db.bkp';
+RESTORE FROM 'db.bkp' OVERWRITE;
backup_id
#
** Check definitions of the tables after restore
=== modified file 'mysql-test/suite/backup_engines/t/backup_online_testing.test'
--- a/mysql-test/suite/backup_engines/t/backup_online_testing.test 2008-06-30 19:40:33 +0000
+++ b/mysql-test/suite/backup_engines/t/backup_online_testing.test 2008-11-19 22:01:28 +0000
@@ -1152,3 +1152,4 @@ DROP DATABASE bup_online;
remove_file $MYSQLTEST_VARDIR/master-data/bup_online.bak;
+SET DEBUG_SYNC= 'RESET';
=== modified file 'mysql-test/suite/backup_engines/t/backup_tmp_tables.test'
--- a/mysql-test/suite/backup_engines/t/backup_tmp_tables.test 2008-11-12 17:42:23 +0000
+++ b/mysql-test/suite/backup_engines/t/backup_tmp_tables.test 2008-11-17 09:57:51 +0000
@@ -52,7 +52,7 @@ BACKUP DATABASE db TO 'db.bkp';
DROP TABLE t1;
DROP TABLE t2;
--replace_column 1 #
-RESTORE FROM 'db.bkp';
+RESTORE FROM 'db.bkp' OVERWRITE;
#
# Note: Above DROP TABLE statements should be removed once BUG#30099 is fixed.
=== modified file 'mysql-test/suite/rpl/r/rpl_backup.result'
--- a/mysql-test/suite/rpl/r/rpl_backup.result 2008-10-31 15:31:52 +0000
+++ b/mysql-test/suite/rpl/r/rpl_backup.result 2008-11-17 09:57:51 +0000
@@ -169,7 +169,7 @@ CREATE TABLE rpl_backup.t2 (b int);
INSERT INTO rpl_backup.t2 VALUES (888), (999);
Get master's binlog position before restore.
Backup_id = 502.
-RESTORE FROM 'rpl_bup_m2.bak';
+RESTORE FROM 'rpl_bup_m2.bak' OVERWRITE;
backup_id
502
Show the incident event issued as a result of restore.
@@ -241,7 +241,7 @@ t1 BASE TABLE
t2 BASE TABLE
STOP SLAVE;
Backup_id = 602.
-RESTORE FROM '../master-data/rpl_bup_m2.bak';
+RESTORE FROM '../master-data/rpl_bup_m2.bak' OVERWRITE;
backup_id
602
Showing databases on slave.
@@ -258,11 +258,11 @@ BACKUP DATABASE rpl_backup TO 'rpl_bup_s
backup_id
603
Test restore on slave while replication turned on.
-RESTORE FROM 'rpl_bup_s1.bak';
+RESTORE FROM 'rpl_bup_s1.bak' OVERWRITE;
ERROR HY000: A restore operation was attempted on a slave during replication. You must stop the slave prior to running a restore.
Stop slave and restart after restore.
STOP SLAVE;
-RESTORE FROM 'rpl_bup_s3.bak';
+RESTORE FROM 'rpl_bup_s3.bak' OVERWRITE;
backup_id
#
START SLAVE;
@@ -312,7 +312,7 @@ sql_log_bin ON
RESET MASTER;
Get master's binlog position before restore.
Backup_id = 504.
-RESTORE FROM 'rpl_bup_m3.bak';
+RESTORE FROM 'rpl_bup_m3.bak' OVERWRITE;
backup_id
504
Get master's binlog position after restore.
=== modified file 'mysql-test/suite/rpl/t/rpl_backup.test'
--- a/mysql-test/suite/rpl/t/rpl_backup.test 2008-10-31 15:31:52 +0000
+++ b/mysql-test/suite/rpl/t/rpl_backup.test 2008-11-17 09:57:51 +0000
@@ -209,7 +209,7 @@ INSERT INTO rpl_backup.t2 VALUES (888),
let $master_before_pos = query_get_value("SHOW MASTER STATUS", Position, 1);
--echo Backup_id = 502.
-RESTORE FROM 'rpl_bup_m2.bak';
+RESTORE FROM 'rpl_bup_m2.bak' OVERWRITE;
--echo Show the incident event issued as a result of restore.
--replace_column 2 # 5 #
@@ -266,7 +266,7 @@ STOP SLAVE;
--source include/wait_for_slave_to_stop.inc
--echo Backup_id = 602.
-RESTORE FROM '../master-data/rpl_bup_m2.bak';
+RESTORE FROM '../master-data/rpl_bup_m2.bak' OVERWRITE;
--echo Showing databases on slave.
SHOW DATABASES LIKE 'rpl_backup%';
@@ -289,13 +289,13 @@ connection slave;
--echo Test restore on slave while replication turned on.
--error ER_RESTORE_ON_SLAVE
-RESTORE FROM 'rpl_bup_s1.bak';
+RESTORE FROM 'rpl_bup_s1.bak' OVERWRITE;
--echo Stop slave and restart after restore.
STOP SLAVE;
--replace_column 1 #
-RESTORE FROM 'rpl_bup_s3.bak';
+RESTORE FROM 'rpl_bup_s3.bak' OVERWRITE;
START SLAVE;
--source include/wait_for_slave_to_start.inc
@@ -354,7 +354,7 @@ RESET MASTER;
let $master_before_pos = query_get_value("SHOW MASTER STATUS", Position, 1);
--echo Backup_id = 504.
-RESTORE FROM 'rpl_bup_m3.bak';
+RESTORE FROM 'rpl_bup_m3.bak' OVERWRITE;
--echo Get master's binlog position after restore.
let $master_after_pos = query_get_value("SHOW MASTER STATUS", Position, 1);
=== modified file 'mysql-test/t/implicit_commit.test'
--- a/mysql-test/t/implicit_commit.test 2008-07-27 13:14:46 +0000
+++ b/mysql-test/t/implicit_commit.test 2008-11-20 14:03:27 +0000
@@ -1136,7 +1136,7 @@ source include/implicit_commit_helper.in
--echo #
let $statement=
- restore from 'backup_db1.ba';
+ restore from 'backup_db1.ba' overwrite;
source include/implicit_commit_helper.inc;
--remove_file $MYSQLTEST_VARDIR/master-data/backup_db1.ba
=== modified file 'sql/backup/backup_info.h'
--- a/sql/backup/backup_info.h 2008-10-27 13:06:21 +0000
+++ b/sql/backup/backup_info.h 2008-11-13 13:02:36 +0000
@@ -48,6 +48,10 @@ class Backup_info: public backup::Image_
private:
+ // Prevent copying/assignments
+ Backup_info(const Backup_info&);
+ Backup_info& operator=(const Backup_info&);
+
class Global_iterator; ///< Iterates over global items (for which meta-data is stored).
class Perdb_iterator; ///< Iterates over all per-database objects (except tables).
=== modified file 'sql/backup/backup_kernel.h'
--- a/sql/backup/backup_kernel.h 2008-10-30 17:53:24 +0000
+++ b/sql/backup/backup_kernel.h 2008-11-17 09:57:51 +0000
@@ -30,7 +30,7 @@ void backup_shutdown();
Called from the big switch in mysql_execute_command() to execute
backup related statement
*/
-int execute_backup_command(THD*, LEX*, String*);
+int execute_backup_command(THD*, LEX*, String*, bool);
// forward declarations
@@ -74,7 +74,7 @@ class Backup_restore_ctx: public backup:
const char*);
int do_backup();
- int do_restore();
+ int do_restore(bool overwrite);
int fatal_error(int, ...);
int log_error(int, ...);
@@ -84,6 +84,10 @@ class Backup_restore_ctx: public backup:
private:
+ // Prevent copying/assignments
+ Backup_restore_ctx(const Backup_restore_ctx&);
+ Backup_restore_ctx& operator=(const Backup_restore_ctx&);
+
/** @c current_op points to the @c Backup_restore_ctx for the
ongoing backup/restore operation. If pointer is null, no
operation is currently running. */
=== modified file 'sql/backup/kernel.cc'
--- a/sql/backup/kernel.cc 2008-11-13 08:40:43 +0000
+++ b/sql/backup/kernel.cc 2008-11-20 13:53:41 +0000
@@ -121,6 +121,8 @@ static int send_reply(Backup_restore_ctx
@param[IN] thd current thread object reference.
@param[IN] lex results of parsing the statement.
@param[IN] backupdir value of the backupdir variable from server.
+ @param[IN] overwrite whether or not restore should overwrite existing
+ DB with same name as in backup image
@note This function sends response to the client (ok, result set or error).
@@ -132,7 +134,7 @@ static int send_reply(Backup_restore_ctx
*/
int
-execute_backup_command(THD *thd, LEX *lex, String *backupdir)
+execute_backup_command(THD *thd, LEX *lex, String *backupdir, bool overwrite)
{
int res= 0;
@@ -226,7 +228,7 @@ execute_backup_command(THD *thd, LEX *le
DEBUG_SYNC(thd, "after_backup_start_restore");
- res= context.do_restore();
+ res= context.do_restore(overwrite);
DEBUG_SYNC(thd, "restore_before_end");
@@ -331,7 +333,6 @@ int send_reply(Backup_restore_ctx &conte
goto err;
}
my_eof(context.thd()); // Never errors
- context.report_cleanup(); // Never errors
DBUG_RETURN(0);
err:
@@ -399,7 +400,7 @@ Backup_restore_ctx::Backup_restore_ctx(T
Backup_restore_ctx::~Backup_restore_ctx()
{
close();
-
+
delete mem_alloc;
delete m_catalog;
delete m_stream;
@@ -1199,11 +1200,14 @@ int Backup_restore_ctx::restore_triggers
@pre @c prepare_for_restore() method was called.
+ @param[IN] overwrite whether or not restore should overwrite existing
+ DB with same name as in backup image
+
@returns 0 on success, error code otherwise.
@todo Remove the @c reset_diagnostic_area() hack.
*/
-int Backup_restore_ctx::do_restore()
+int Backup_restore_ctx::do_restore(bool overwrite)
{
DBUG_ENTER("do_restore");
@@ -1223,6 +1227,24 @@ int Backup_restore_ctx::do_restore()
DBUG_PRINT("restore", ("Restoring meta-data"));
+ // unless RESTORE... OVERWRITE: return error if database already exists
+ if (!overwrite) {
+ Image_info::Db_iterator *dbit= info.get_dbs();
+
+ if (!dbit) {
+ DBUG_RETURN(fatal_error(ER_OUT_OF_RESOURCES));
+ }
+
+ Image_info::Db *mydb;
+ while ((mydb= static_cast<Image_info::Db*>((*dbit)++))) {
+ if (!obs::check_db_existence(&mydb->name())) {
+ delete dbit;
+ DBUG_RETURN(fatal_error(ER_RESTORE_DB_EXISTS, mydb->name().ptr()));
+ }
+ }
+ delete dbit;
+ }
+
disable_fkey_constraints(); // Never errors
if (read_meta_data(info, s))
@@ -1971,6 +1993,7 @@ int bcat_create_item(st_bstream_image_he
{
DBUG_PRINT("restore",(" tablespace has changed on the server - aborting"));
info->m_ctx.fatal_error(ER_BACKUP_TS_CHANGE, desc);
+ delete ts;
return BSTREAM_ERROR;
}
}
=== modified file 'sql/backup/logger.h'
--- a/sql/backup/logger.h 2008-11-13 08:40:43 +0000
+++ b/sql/backup/logger.h 2008-11-14 15:02:10 +0000
@@ -67,7 +67,6 @@ class Logger
DBUG_ASSERT(backup_log);
return backup_log->get_backup_id();
}
- void report_cleanup() { delete backup_log; }
void save_errors();
void stop_save_errors();
@@ -85,6 +84,10 @@ class Logger
int write_message(log_level::value level , int error_code, const char *msg);
private:
+ // Prevent copying/assigments
+ Logger(const Logger&);
+ Logger& operator=(const Logger&);
+
util::SAVED_MYSQL_ERROR error; ///< Used to store saved errors.
bool m_save_errors; ///< Flag telling if errors should be saved.
bool m_push_errors; ///< Should errors be pushed on warning stack?
@@ -96,12 +99,16 @@ inline
Logger::Logger(THD *thd)
:m_type(BACKUP), m_state(CREATED),
m_thd(thd), m_save_errors(FALSE), m_push_errors(TRUE), backup_log(0)
-{}
+{
+ clear_saved_errors();
+}
+
inline
Logger::~Logger()
{
clear_saved_errors();
+ delete backup_log;
}
/// Report unregistered message.
=== modified file 'sql/backup/restore_info.h'
--- a/sql/backup/restore_info.h 2008-05-05 15:06:40 +0000
+++ b/sql/backup/restore_info.h 2008-11-13 13:02:36 +0000
@@ -47,6 +47,10 @@ class Restore_info: public backup::Image
private:
+ // Prevent copying/assignments
+ Restore_info(const Restore_info&);
+ Restore_info& operator=(const Restore_info&);
+
friend int backup::restore_table_data(THD*, Restore_info&,
backup::Input_stream&);
friend int ::bcat_add_item(st_bstream_image_header*,
=== modified file 'sql/backup/stream.h'
--- a/sql/backup/stream.h 2008-10-15 20:00:48 +0000
+++ b/sql/backup/stream.h 2008-11-13 13:02:36 +0000
@@ -98,7 +98,7 @@ class Stream: public fd_stream
::String *m_path;
int m_flags; ///< flags used when opening the file
size_t m_block_size;
- Logger m_log;
+ Logger& m_log;
friend int stream_write(void*, bstream_blob*, bstream_blob);
friend int stream_read(void*, bstream_blob*, bstream_blob);
=== modified file 'sql/backup/stream_v1.c'
--- a/sql/backup/stream_v1.c 2008-09-30 08:08:16 +0000
+++ b/sql/backup/stream_v1.c 2008-11-13 13:02:36 +0000
@@ -1277,10 +1277,9 @@ int bstream_wr_meta_data(backup_stream *
CHECK_WR_RES(bstream_wr_item_def(s,cat,PER_TABLE_ITEM,item));
}
+wr_error:
bcat_iterator_free(cat,iter);
- wr_error:
-
return ret;
}
=== modified file 'sql/lex.h'
--- a/sql/lex.h 2008-07-09 07:12:43 +0000
+++ b/sql/lex.h 2008-11-17 09:57:51 +0000
@@ -389,6 +389,7 @@ static SYMBOL symbols[] = {
{ "OUT", SYM(OUT_SYM)},
{ "OUTER", SYM(OUTER)},
{ "OUTFILE", SYM(OUTFILE)},
+ { "OVERWRITE", SYM(OVERWRITE_SYM)},
{ "OWNER", SYM(OWNER_SYM)},
{ "PACK_KEYS", SYM(PACK_KEYS_SYM)},
{ "PARSER", SYM(PARSER_SYM)},
=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc 2008-11-13 09:46:39 +0000
+++ b/sql/mysqld.cc 2008-11-17 11:17:59 +0000
@@ -8278,7 +8278,7 @@ mysqld_get_one_option(int optid,
{
if (!argument || !argument[0])
{
- log_backup_output_options= LOG_FILE;
+ log_backup_output_options= LOG_TABLE;
log_backup_output_str= log_output_typelib.type_names[1];
}
else
=== modified file 'sql/share/errmsg.txt'
--- a/sql/share/errmsg.txt 2008-11-13 08:40:43 +0000
+++ b/sql/share/errmsg.txt 2008-11-19 22:08:05 +0000
@@ -6423,7 +6423,7 @@ ER_BACKUP_PURGE_DATETIME
ER_BACKUP_LOGS_DELETED
eng "Backup log entries deleted: "
ER_BACKUP_LOGS_TRUNCATED
- eng "All backup logs entries have been deleted"
+ eng "All backup log entries have been deleted"
ER_MASTER_BLOCKING_SLAVES
eng "The master is not allowing slave connections."
ER_RESTORE_ON_MASTER
@@ -6432,6 +6432,7 @@ ER_RESTORE_ON_SLAVE
eng "A restore operation was attempted on a slave during replication. You must stop the slave prior to running a restore."
ER_NONUNIQ_DB 42000 S1009
eng "Not unique database: '%-.192s'"
+ER_RESTORE_DB_EXISTS
+ eng "Database \'%-.64s\' already exists. Use OVERWRITE flag to overwrite."
ER_QUERY_CACHE_DISABLED
eng "Query cache is disabled; restart the server with query_cache_type=1 to enable it"
-
=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc 2008-11-13 08:40:43 +0000
+++ b/sql/sql_parse.cc 2008-11-17 09:57:51 +0000
@@ -43,7 +43,7 @@
@defgroup Runtime_Environment Runtime Environment
@{
*/
-int execute_backup_command(THD*, LEX*, String*);
+int execute_backup_command(THD*, LEX*, String*, bool);
/* Used in error handling only */
#define SP_TYPE_STRING(LP) \
@@ -2312,11 +2312,29 @@ mysql_execute_command(THD *thd)
sys_var_backupdir.value_length);
backupdir.length(sys_var_backupdir.value_length);
+ /* Used to specify if RESTORE should overwrite existing db with same name */
+ bool overwrite_restore= false;
+
+ Item *it= (Item *)lex->value_list.head();
+
+ // Item only set for RESTORE in sql_yacc.yy, no error checking of
+ // item necessary
+ if (it)
+ {
+ /*
+ it is OK to only emulate fix_fields, because we need only
+ value of constant
+ */
+ it->quick_fix_field();
+
+ if ((int8)it->val_int() == 1)
+ overwrite_restore= true;
+ }
/*
Note: execute_backup_command() sends a correct response to the client
(either ok, result set or error message).
*/
- if (execute_backup_command(thd, lex, &backupdir))
+ if (execute_backup_command(thd, lex, &backupdir, overwrite_restore))
goto error;
break;
}
=== modified file 'sql/sql_yacc.yy'
--- a/sql/sql_yacc.yy 2008-11-13 08:40:43 +0000
+++ b/sql/sql_yacc.yy 2008-11-17 09:57:51 +0000
@@ -974,6 +974,7 @@ bool my_yyoverflow(short **a, YYSTYPE **
%token OUTER
%token OUTFILE
%token OUT_SYM /* SQL-2003-R */
+%token OVERWRITE_SYM
%token OWNER_SYM
%token PACK_KEYS_SYM
%token PAGE_SYM
@@ -6433,12 +6434,32 @@ restore:
lex->clear_db_list();
}
FROM
- TEXT_STRING_sys
+ TEXT_STRING_sys
+ opt_overwrite
{
Lex->backup_dir = $4;
}
;
+opt_overwrite:
+ /* empty */
+ {
+ LEX *lex= Lex;
+ Item *it= new Item_int((int8) 0);
+
+ lex->value_list.empty();
+ lex->value_list.push_front(it);
+ }
+ | OVERWRITE_SYM
+ {
+ LEX *lex= Lex;
+ Item *it= new Item_int((int8) 1);
+
+ lex->value_list.empty();
+ lex->value_list.push_front(it);
+ }
+ ;
+
backup:
BACKUP_SYM
{
| Thread |
|---|
| • bzr commit into mysql-6.0 branch (horst:2921) | Horst Hunger | 26 Nov |