List:Commits« Previous MessageNext Message »
From:Hema Sridharan Date:February 6 2009 4:46pm
Subject:bzr commit into mysql-6.0-backup branch (hema:2761) WL#4408
View as plain text  
#At file:///export/home/tmp/wl%234408/mysql-6.0-backup/ based on revid:charles.bell@stripped

 2761 Hema Sridharan	2009-02-06
      WL#4408(Test compression of backup and restore). Made some modifications as per review comments in
      backup_compression.test
added:
  mysql-test/suite/backup/r/backup_errors_compression.result
  mysql-test/suite/backup/t/backup_errors-master.opt
  mysql-test/suite/backup/t/backup_errors_compression-master.opt
  mysql-test/suite/backup/t/backup_errors_compression.test
modified:
  mysql-test/lib/mtr_report.pl
  mysql-test/suite/backup/r/backup_compression.result
  mysql-test/suite/backup/r/backup_errors.result
  mysql-test/suite/backup/t/backup_compression.test
  mysql-test/suite/backup/t/backup_errors.test

per-file messages:
  mysql-test/lib/mtr_report.pl
    suppressing warning messages
=== modified file 'mysql-test/lib/mtr_report.pl'
--- a/mysql-test/lib/mtr_report.pl	2009-01-29 10:42:21 +0000
+++ b/mysql-test/lib/mtr_report.pl	2009-02-06 16:45:39 +0000
@@ -337,6 +337,12 @@ sub mtr_report_stats ($) {
 		  /Backup:/ or /Restore:/ or /Can't open the backup logs as tables/
 		) or
 
+                # backup_errors_compression test is supposed to trigger lots of backup related errors
+                ($testname eq 'backup.backup_errors_compression') and
+                (
+                  /Backup:/ or /Restore:/ or /Can't open the backup logs as tables/
+                ) or
+
 		# backup_backupdir test is supposed to trigger backup related errors
 		($testname eq 'backup.backup_backupdir') and
 		(

=== modified file 'mysql-test/suite/backup/r/backup_compression.result'
--- a/mysql-test/suite/backup/r/backup_compression.result	2008-11-17 09:57:51 +0000
+++ b/mysql-test/suite/backup/r/backup_compression.result	2009-02-06 16:45:39 +0000
@@ -1,23 +1,376 @@
 CREATE DATABASE db1;
-CREATE TABLE db1.t1(a INT);
+CREATE DATABASE db2;
+CREATE DATABASE db3;
+CREATE TABLE db1.t1(a INT) ENGINE= MYISAM;
+CREATE TABLE db1.t2(a CHAR(20)) ENGINE= INNODB;
+CREATE TABLE db2.t1(b INT) ENGINE= FALCON;
+CREATE TABLE db2.t2(b CHAR(20)) ENGINE= MEMORY;
+CREATE TABLE db3.t1(c INT) ENGINE= BLACKHOLE;
+INSERT INTO db1.t1 VALUES(10),(20),(30),(40);
+INSERT INTO db1.t2 VALUES('TEST1'),('TEST2'),('TEST3'),('TEST4');
+INSERT INTO db2.t1 VALUES(10),(20),(30),(40);
+INSERT INTO db2.t2 VALUES('TEST1'),('TEST2'),('TEST3'),('TEST4');
+INSERT INTO db3.t1 VALUES(10),(20),(30),(40);
+Perform backup with compression
+PURGE BACKUP LOGS;
 BACKUP DATABASE db1 TO 'db1.bak.gz' WITH COMPRESSION;
 backup_id
 #
-CREATE TABLE db1.t2(a INT);
-BACKUP DATABASE db1 TO 'db2.bak.gz' WITH COMPRESSION COMPRESSION_ALGORITHM=gzip;
+verify backup history log for backup_state.
+SELECT backup_state,operation, backup_file, command FROM mysql.backup_history;
+backup_state	operation	backup_file	command
+complete	backup	db1.bak.gz	BACKUP DATABASE db1 TO 'db1.bak.gz' WITH COMPRESSION
+
+Verify total bytes of compressed and uncompressed data
+
+Select total_bytes of compressed data in @total_bytes_comp
+SELECT total_bytes into @total_bytes_comp FROM mysql.backup_history;
+PURGE BACKUP LOGS;
+Perform backup without compression
+BACKUP DATABASE db1 TO 'db1_no_compression.bak';
 backup_id
 #
+
+Select total_bytes of uncompressed data in @total_bytes_no_comp
+SELECT total_bytes into @total_bytes_no_comp FROM mysql.backup_history;
+Verify the result
+SELECT @total_bytes_comp < @total_bytes_no_comp;
+@total_bytes_comp < @total_bytes_no_comp
+0
+The result 0 indicates that total bytes of compressed and uncompressed
+data is same(bug#41898). Once this bug is fixed, result should be 1.
+The size of compressed backup image should be less than uncomressed 
+image. 
+
+Drop database and execute restore operation
+DROP DATABASE db1;
+PURGE BACKUP LOGS;
+RESTORE FROM 'db1.bak.gz';
+backup_id
+#
+verify backup history logs:
+SELECT backup_state,operation, backup_file, command FROM mysql.backup_history;
+backup_state	operation	backup_file	command
+complete	restore	db1.bak.gz	RESTORE FROM 'db1.bak.gz'
+SHOW TABLES FROM db1;
+Tables_in_db1
+t1
+t2
+SELECT * FROM db1.t1;
+a
+10
+20
+30
+40
+SELECT * FROM db1.t2;
+a
+TEST1
+TEST2
+TEST3
+TEST4
+
+Now perform backup by specifying the compression algorithm.
+
+PURGE BACKUP LOGS;
+BACKUP DATABASE db1 TO 'db1.bak.gz' WITH COMPRESSION 
+COMPRESSION_ALGORITHM=gzip;
+backup_id
+#
+verify backup history log for backup_state.
+SELECT backup_state,operation, backup_file, command FROM mysql.backup_history;
+backup_state	operation	backup_file	command
+complete	backup	db1.bak.gz	BACKUP DATABASE db1 TO 'db1.bak.gz' WITH COMPRESSION 
+COMPRESSION_ALGORITHM=gzip
+PURGE BACKUP LOGS;
+Perform restore
 RESTORE FROM 'db1.bak.gz' OVERWRITE;
 backup_id
 #
+verify backup history log:
+SELECT backup_state,operation, backup_file, command FROM mysql.backup_history;
+backup_state	operation	backup_file	command
+complete	restore	db1.bak.gz	RESTORE FROM 'db1.bak.gz' OVERWRITE
+SHOW TABLES FROM db1;
+Tables_in_db1
+t1
+t2
+SELECT * FROM db1.t1;
+a
+10
+20
+30
+40
+SELECT * FROM db1.t2;
+a
+TEST1
+TEST2
+TEST3
+TEST4
+
+Perform backup using invalid syntax.
+
+BACKUP DATABASE db1 TO 'db1.bak.gz' WITH COMPRESSION
+COMPRESSION_ALGORITHM;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 2
+SHOW WARNINGS;
+Level	Code	Message
+Error	#	You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 2
+BACKUP DATABASE db1 TO 'db1.bak.gz' COMPRESSION_ALGORITHM=gzip;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'COMPRESSION_ALGORITHM=gzip' at line 1
+SHOW WARNINGS;
+Level	Code	Message
+Error	#	You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'COMPRESSION_ALGORITHM=gzip' at line 1
+
+Execute backup with compression using invalid compression algorithm.
+
+BACKUP DATABASE db1 TO 'db1.bak.gz' WITH COMPRESSION 
+COMPRESSION_ALGORITHM=invalid;
+ERROR HY000: Incorrect arguments to COMPRESSION_ALGORITHM
+SHOW WARNINGS;
+Level	Code	Message
+Error	#	Incorrect arguments to COMPRESSION_ALGORITHM
+
+Perform backup of all the databases using compression algorithm
+
+PURGE BACKUP LOGS;
+BACKUP DATABASE db1, db2, db3 TO 'db123.bak.gz' WITH COMPRESSION 
+COMPRESSION_ALGORITHM=gzip;
+backup_id
+#
+verify backup history log for backup_state.
+SELECT backup_state,operation, backup_file, command FROM mysql.backup_history;
+backup_state	operation	backup_file	command
+complete	backup	db123.bak.gz	BACKUP DATABASE db1, db2, db3 TO 'db123.bak.gz' WITH COMPRESSION 
+COMPRESSION_ALGORITHM=gzip
+PURGE BACKUP LOGS;
+RESTORE FROM 'db123.bak.gz' OVERWRITE;
+backup_id
+#
+verify backup history log:
+SELECT backup_state,operation, backup_file FROM mysql.backup_history;
+backup_state	operation	backup_file
+complete	restore	db123.bak.gz
+SHOW TABLES FROM db1;
+Tables_in_db1
+t1
+t2
+SHOW TABLES FROM db2;
+Tables_in_db2
+t1
+t2
+SHOW TABLES FROM db3;
+Tables_in_db3
+t1
+
+Unzip a gzip file and perform restore.
+
+PURGE BACKUP LOGS;
+BACKUP DATABASE db1 TO 'db1.bak.gz' WITH COMPRESSION;
+backup_id
+#
+verify backup history for backup_state.
+SELECT backup_state,operation, backup_file, command FROM mysql.backup_history;
+backup_state	operation	backup_file	command
+complete	backup	db1.bak.gz	BACKUP DATABASE db1 TO 'db1.bak.gz' WITH COMPRESSION
+Unzip db1.bak.gz and perform restore of unzipped file.
+DROP DATABASE db1;
+PURGE BACKUP LOGS;
+Restore of unzipped file(db1.bak)
+RESTORE FROM 'db1.bak';
+backup_id
+#
+verify backup history log:
+SELECT backup_state,operation, backup_file, command FROM mysql.backup_history;
+backup_state	operation	backup_file	command
+complete	restore	db1.bak	RESTORE FROM 'db1.bak'
+SHOW TABLES FROM db1;
+Tables_in_db1
+t1
+t2
+SELECT * FROM db1.t1;
+a
+10
+20
+30
+40
+SELECT * FROM db1.t2;
+a
+TEST1
+TEST2
+TEST3
+TEST4
+
+Restore of any manually gzipped image
+
+PURGE BACKUP LOGS;
+BACKUP DATABASE db1 TO 'db1.bak';
+backup_id
+#
+verify backup history log for backup_state.
+SELECT backup_state,operation, backup_file, command FROM mysql.backup_history;
+backup_state	operation	backup_file	command
+complete	backup	db1.bak	BACKUP DATABASE db1 TO 'db1.bak'
+Zip the db1.bak file and perform restore of zipped file.
+DROP DATABASE db1;
+PURGE BACKUP LOGS;
+Restore of zipped file
+RESTORE FROM 'db1.bak.gz';
+backup_id
+#
+verify backup history logs:
+SELECT backup_state,operation, backup_file, command FROM mysql.backup_history;
+backup_state	operation	backup_file	command
+complete	restore	db1.bak.gz	RESTORE FROM 'db1.bak.gz'
 SHOW TABLES FROM db1;
 Tables_in_db1
 t1
-RESTORE FROM 'db2.bak.gz' OVERWRITE;
+t2
+SELECT * FROM db1.t1;
+a
+10
+20
+30
+40
+SELECT * FROM db1.t2;
+a
+TEST1
+TEST2
+TEST3
+TEST4
+
+Rename of gzip file without .gz extension, then perform restore.
+
+BACKUP DATABASE db1 TO 'db1.bak.gz' WITH COMPRESSION
+COMPRESSION_ALGORITHM=gzip;
+backup_id
+#
+Rename gzip file db1.bak.gz to db1_copy.bak and perform restore
+Verify that db1_copy.bak file exists using file_exists command
+Perform restore from renamed gzip file
+PURGE BACKUP LOGS;
+RESTORE FROM 'db1_copy.bak' OVERWRITE;
 backup_id
 #
+verify backup history log:
+SELECT backup_state,operation, backup_file, command FROM mysql.backup_history;
+backup_state	operation	backup_file	command
+complete	restore	db1_copy.bak	RESTORE FROM 'db1_copy.bak' OVERWRITE
 SHOW TABLES FROM db1;
 Tables_in_db1
 t1
 t2
+SELECT * FROM db1.t1;
+a
+10
+20
+30
+40
+SELECT * FROM db1.t2;
+a
+TEST1
+TEST2
+TEST3
+TEST4
+Creating objects
+** create view **
+CREATE VIEW db1.v1 AS SELECT * FROM db1.t1;
+CREATE VIEW db2.vv AS SELECT * FROM db1.v1;
+** create triggers **
+CREATE TRIGGER db1.trg AFTER INSERT ON db1.t2 FOR EACH ROW
+BEGIN
+INSERT INTO db2.t2 VALUES('Trigger insertion');
+END;||
+** create procedures **
+CREATE PROCEDURE db2.p1()
+BEGIN
+SELECT * FROM db1.t2;
+END;
+||
+** create functions **
+CREATE FUNCTION db2.f1() RETURNS INTEGER
+BEGIN
+RETURN (SELECT COUNT(*) FROM db1.t1);
+END;
+||
+** create event **
+CREATE EVENT db3.e1 ON SCHEDULE EVERY 1 YEAR DO
+DELETE FROM db3.t1 WHERE c=1000;
+
+Do backup of database
+PURGE BACKUP LOGS;
+BACKUP DATABASE db1, db2, db3 TO 'db123.bak.gz' WITH COMPRESSION;
+backup_id
+#
+verify backup history log for backup_state.
+SELECT backup_state,operation, backup_file, command FROM mysql.backup_history;
+backup_state	operation	backup_file	command
+complete	backup	db123.bak.gz	BACKUP DATABASE db1, db2, db3 TO 'db123.bak.gz' WITH COMPRESSION
+Drop the database and perform restore
+DROP DATABASE db1;
+DROP DATABASE db2;
+DROP DATABASE db3;
+PURGE BACKUP LOGS;
+RESTORE FROM 'db123.bak.gz' OVERWRITE;
+backup_id
+#
+verify backup history log for backup state:
+SELECT backup_state,operation, backup_file, command FROM mysql.backup_history;
+backup_state	operation	backup_file	command
+complete	restore	db123.bak.gz	RESTORE FROM 'db123.bak.gz' OVERWRITE
+SHOW FULL TABLES FROM db1;
+Tables_in_db1	Table_type
+t1	BASE TABLE
+t2	BASE TABLE
+v1	VIEW
+SHOW FULL TABLES FROM db2;
+Tables_in_db2	Table_type
+t1	BASE TABLE
+t2	BASE TABLE
+vv	VIEW
+SHOW TABLES FROM db3;
+Tables_in_db3
+t1
+Excercise objects
+Firing trigger trg
+INSERT INTO db1.t2 VALUES('TEST5');
+SELECT * FROM db1.t2;
+a
+TEST1
+TEST2
+TEST3
+TEST4
+TEST5
+SELECT * FROM db2.t2;
+b
+TEST1
+TEST2
+TEST3
+TEST4
+Trigger insertion
+Call procedures and functions
+CALL db2.p1();
+a
+TEST1
+TEST2
+TEST3
+TEST4
+TEST5
+SELECT db2.f1();
+db2.f1()
+4
+SELECT * FROM db1.v1;
+a
+10
+20
+30
+40
+SELECT * FROM db2.vv;
+a
+10
+20
+30
+40
+Test cleanup: Drop databases and remove backup files
 DROP DATABASE db1;
+DROP DATABASE db2;
+DROP DATABASE db3;

=== modified file 'mysql-test/suite/backup/r/backup_errors.result'
--- a/mysql-test/suite/backup/r/backup_errors.result	2009-02-03 07:48:09 +0000
+++ b/mysql-test/suite/backup/r/backup_errors.result	2009-02-06 16:45:39 +0000
@@ -1,18 +1,14 @@
 DROP DATABASE IF EXISTS adb;
 DROP DATABASE IF EXISTS bdb;
+PURGE BACKUP LOGS;
 # non-existent backup archive
 RESTORE FROM 'test.bak';
 ERROR HY000: File 'MYSQLTEST_VARDIR/master-data/test.bak' not found (Errcode: #)
-Get last backup_id
-SELECT MAX(backup_id) INTO @bup_id FROM mysql.backup_history
-WHERE command LIKE "RESTORE FROM 'test%";
-verify backup history and progress logs:
-SELECT backup_state,operation, backup_file FROM mysql.backup_history
-WHERE backup_id=@bup_id;
-backup_state	operation	backup_file
-error	restore	test.bak
-SELECT notes FROM mysql.backup_progress
-WHERE backup_id=@bup_id;
+verify backup history and progress logs:
+SELECT backup_state,operation, backup_file, command FROM mysql.backup_history;
+backup_state	operation	backup_file	command
+error	restore	test.bak	RESTORE FROM 'test.bak'
+SELECT notes FROM mysql.backup_progress;
 notes
 starting
 running
@@ -21,59 +17,69 @@ error
 CREATE DATABASE adb;
 CREATE DATABASE bdb;
 CREATE TABLE bdb.t1(a int) ENGINE=MEMORY;
+PURGE BACKUP LOGS;
 # invalid location
-BACKUP DATABASE adb TO '';
+BACKUP DATABASE adb TO '' ;
 ERROR HY000: Malformed file path ''
 SHOW WARNINGS;
 Level	Code	Message
 Error	#	Malformed file path ''
 Warning	#	Operation aborted
-Get last backup_id
-SELECT MAX(backup_id) INTO @bup_id FROM mysql.backup_history
-WHERE command LIKE "BACKUP DATABASE adb TO%";
-verify backup history and progress logs:
-SELECT backup_state,operation, backup_file FROM mysql.backup_history
-WHERE backup_id=@bup_id;
-backup_state	operation	backup_file
-error	backup	
-SELECT notes FROM mysql.backup_progress
-WHERE backup_id=@bup_id;
+verify backup history and progress logs:
+SELECT backup_state,operation, backup_file, command FROM mysql.backup_history;
+backup_state	operation	backup_file	command
+error	backup		BACKUP DATABASE adb TO ''
+SELECT notes FROM mysql.backup_progress;
 notes
 starting
 running
 Malformed file path ''
 error
+PURGE BACKUP LOGS;
+BACKUP DATABASE adb TO '/yyy/invalid/location' ;
+ERROR HY000: Can't create/write to file '/yyy/invalid/location' (Errcode: #)
+SHOW WARNINGS;
+Level	Code	Message
+Error	#	Can't create/write to file '/yyy/invalid/location' (Errcode: #)
+Error	#	Can't write to backup location '/yyy/invalid/location'
+Warning	#	Operation aborted
+verify backup history and progress logs:
+SELECT backup_state,operation, backup_file, command FROM mysql.backup_history;
+backup_state	operation	backup_file	command
+error	backup	location	BACKUP DATABASE adb TO '/yyy/invalid/location'
+SELECT notes FROM mysql.backup_progress;
+notes
+starting
+running
+Can't write to backup location '/yyy/invalid/location'
+error
 # don't overwrite existing files
-BACKUP DATABASE adb TO "bdb/t1.frm";
+BACKUP DATABASE adb TO "bdb/t1.frm" ;
 ERROR HY000: Can't create/write to file 'MYSQLTEST_VARDIR/master-data/bdb/t1.frm' (Errcode: #)
 SHOW WARNINGS;
 Level	Code	Message
 Error	#	Can't create/write to file 'MYSQLTEST_VARDIR/master-data/bdb/t1.frm' (Errcode: #)
 Error	#	Can't write to backup location 'bdb/t1.frm'
 Warning	#	Operation aborted
-BACKUP DATABASE adb TO "test.bak";
+BACKUP DATABASE adb TO "test.bak" ;
 backup_id
 #
 SHOW WARNINGS;
 Level	Code	Message
+PURGE BACKUP LOGS;
 # don't overwrite existing backup image
-BACKUP DATABASE adb TO "test.bak";
+BACKUP DATABASE adb TO "test.bak" ;
 ERROR HY000: Can't create/write to file 'MYSQLTEST_VARDIR/master-data/test.bak' (Errcode: #)
 SHOW WARNINGS;
 Level	Code	Message
 Error	#	Can't create/write to file 'MYSQLTEST_VARDIR/master-data/test.bak' (Errcode: #)
 Error	#	Can't write to backup location 'test.bak'
 Warning	#	Operation aborted
-Get last backup_id
-SELECT MAX(backup_id) INTO @bup_id FROM mysql.backup_history
-WHERE command LIKE "BACKUP DATABASE adb TO%";
 verify backup history and progress logs for backup_state.
-SELECT backup_state,operation, backup_file FROM mysql.backup_history
-WHERE backup_id=@bup_id;
-backup_state	operation	backup_file
-error	backup	test.bak
-SELECT notes FROM mysql.backup_progress
-WHERE backup_id=@bup_id;
+SELECT backup_state,operation, backup_file, command FROM mysql.backup_history;
+backup_state	operation	backup_file	command
+error	backup	test.bak	BACKUP DATABASE adb TO "test.bak"
+SELECT notes FROM mysql.backup_progress;
 notes
 starting
 running
@@ -82,39 +88,41 @@ error
 # non-existent database
 DROP DATABASE IF EXISTS foo;
 DROP DATABASE IF EXISTS bar;
-BACKUP DATABASE foo TO 'test.bak';
+BACKUP DATABASE foo TO 'test.bak' ;
 ERROR 42000: Unknown database 'foo'
 SHOW WARNINGS;
 Level	Code	Message
 Error	#	Unknown database 'foo'
 Warning	#	Operation aborted
-BACKUP DATABASE test,foo,bdb,bar TO 'test.bak';
+PURGE BACKUP LOGS;
+BACKUP DATABASE test,foo,bdb,bar TO 'test.bak' ;
 ERROR 42000: Unknown database 'foo,bar'
 SHOW WARNINGS;
 Level	Code	Message
 Error	#	Unknown database 'foo,bar'
 Warning	#	Operation aborted
-Get last backup_id
-SELECT MAX(backup_id) INTO @bup_id FROM mysql.backup_history
-WHERE command LIKE "BACKUP DATABASE test,foo,bdb,bar TO%";
-verify backup history and progress logs:
-SELECT backup_state,operation,backup_file FROM mysql.backup_history
-WHERE backup_id=@bup_id;
-backup_state	operation	backup_file
-error	backup	test.bak
-SELECT notes FROM mysql.backup_progress
-WHERE backup_id=@bup_id;
+verify backup history and progress logs:
+SELECT backup_state,operation,backup_file, command FROM mysql.backup_history;
+backup_state	operation	backup_file	command
+error	backup	test.bak	BACKUP DATABASE test,foo,bdb,bar TO 'test.bak'
+SELECT notes FROM mysql.backup_progress;
 notes
 starting
 running
 Unknown database 'foo,bar'
 error
+PURGE BACKUP LOGS;
 # repeated database
-BACKUP DATABASE foo,test,bar,foo TO 'test.bak';
+BACKUP DATABASE foo,test,bar,foo TO 'test.bak' ;
 ERROR 42000: Not unique database: 'foo'
 SHOW WARNINGS;
 Level	Code	Message
 Error	#	Not unique database: 'foo'
+verify backup history and progress logs for backup_state.
+SELECT backup_state,operation, backup_file, command FROM mysql.backup_history;
+backup_state	operation	backup_file	command
+SELECT notes FROM mysql.backup_progress;
+notes
 use adb;
 create table t1 (a int);
 create procedure p1() backup database test to 'test.bak';
@@ -139,118 +147,109 @@ do restore from 'test.bak';
 ERROR 0A000: RESTORE is not allowed in stored procedures
 DROP DATABASE adb;
 DROP DATABASE bdb;
+PURGE BACKUP LOGS;
 Backup of mysql, information_schema scenario 1
-BACKUP DATABASE mysql TO 't.bak';
+BACKUP DATABASE mysql TO 't.bak' ;
 ERROR HY000: Database 'mysql' cannot be included in a backup
 SHOW WARNINGS;
 Level	Code	Message
 Error	#	Database 'mysql' cannot be included in a backup
 Warning	#	Operation aborted
-Get last backup_id
-SELECT MAX(backup_id) INTO @bup_id FROM mysql.backup_history
-WHERE command LIKE "BACKUP DATABASE mysql TO%";
-verify backup history and progress logs:
-SELECT backup_state,operation, backup_file FROM mysql.backup_history
-WHERE backup_id=@bup_id;
-backup_state	operation	backup_file
-error	backup	t.bak
-SELECT notes FROM mysql.backup_progress
-WHERE backup_id=@bup_id;
+verify backup history and progress logs:
+SELECT backup_state,operation, backup_file, command FROM mysql.backup_history;
+backup_state	operation	backup_file	command
+error	backup	t.bak	BACKUP DATABASE mysql TO 't.bak'
+SELECT notes FROM mysql.backup_progress;
 notes
 starting
 running
 Database 'mysql' cannot be included in a backup
 error
+PURGE BACKUP LOGS;
 Backup of mysql, information_schema scenario 2
-BACKUP DATABASE information_schema TO 't.bak';
+BACKUP DATABASE information_schema TO 't.bak' ;
 ERROR HY000: Database 'information_schema' cannot be included in a backup
 SHOW WARNINGS;
 Level	Code	Message
 Error	#	Database 'information_schema' cannot be included in a backup
 Warning	#	Operation aborted
-Get last backup_id
-SELECT MAX(backup_id) INTO @bup_id FROM mysql.backup_history
-WHERE command LIKE "BACKUP DATABASE information_schema TO%";
-verify backup history and progress logs:
-SELECT backup_state,operation, backup_file FROM mysql.backup_history
-WHERE backup_id=@bup_id;
-backup_state	operation	backup_file
-error	backup	t.bak
-SELECT  notes FROM mysql.backup_progress
-WHERE backup_id=@bup_id;
+verify backup history and progress logs:
+SELECT backup_state,operation, backup_file,command FROM mysql.backup_history;
+backup_state	operation	backup_file	command
+error	backup	t.bak	BACKUP DATABASE information_schema TO 't.bak'
+SELECT  notes FROM mysql.backup_progress;
 notes
 starting
 running
 Database 'information_schema' cannot be included in a backup
 error
+PURGE BACKUP LOGS;
 Backup of mysql, information_schema scenario 3
-BACKUP DATABASE mysql, information_schema TO 't.bak';
+BACKUP DATABASE mysql, information_schema TO 't.bak' ;
 ERROR HY000: Database 'mysql' cannot be included in a backup
 SHOW WARNINGS;
 Level	Code	Message
 Error	#	Database 'mysql' cannot be included in a backup
 Warning	#	Operation aborted
-Get last backup_id
-SELECT MAX(backup_id) INTO @bup_id FROM mysql.backup_history
-WHERE command LIKE "BACKUP DATABASE mysql, information_schema TO%";
-verify backup history and progress logs:
-SELECT backup_state,operation, backup_file FROM mysql.backup_history
-WHERE backup_id=@bup_id;
-backup_state	operation	backup_file
-error	backup	t.bak
-SELECT notes FROM mysql.backup_progress
-WHERE backup_id=@bup_id;
+verify backup history and progress logs:
+SELECT backup_state,operation, backup_file,command FROM mysql.backup_history;
+backup_state	operation	backup_file	command
+error	backup	t.bak	BACKUP DATABASE mysql, information_schema TO 't.bak'
+SELECT notes FROM mysql.backup_progress;
 notes
 starting
 running
 Database 'mysql' cannot be included in a backup
 error
+PURGE BACKUP LOGS;
 Backup of mysql, information_schema scenario 4
-BACKUP DATABASE mysql, test TO 't.bak';
+BACKUP DATABASE mysql, test TO 't.bak' ;
 ERROR HY000: Database 'mysql' cannot be included in a backup
 SHOW WARNINGS;
 Level	Code	Message
 Error	#	Database 'mysql' cannot be included in a backup
 Warning	#	Operation aborted
-Get last backup_id
-SELECT MAX(backup_id) INTO @bup_id FROM mysql.backup_history
-WHERE command LIKE "BACKUP DATABASE mysql, test TO%";
-verify backup history and progress logs:
-SELECT backup_state,operation, backup_file FROM mysql.backup_history
-WHERE backup_id=@bup_id;
-backup_state	operation	backup_file
-error	backup	t.bak
-SELECT notes FROM mysql.backup_progress
-WHERE backup_id=@bup_id;
+verify backup history and progress logs:
+SELECT backup_state,operation, backup_file,command FROM mysql.backup_history;
+backup_state	operation	backup_file	command
+error	backup	t.bak	BACKUP DATABASE mysql, test TO 't.bak'
+SELECT notes FROM mysql.backup_progress;
 notes
 starting
 running
 Database 'mysql' cannot be included in a backup
 error
+PURGE BACKUP LOGS;
 Backup of mysql, information_schema scenario 5
-BACKUP DATABASE information_schema, test TO 't.bak';
+BACKUP DATABASE information_schema, test TO 't.bak' ;
 ERROR HY000: Database 'information_schema' cannot be included in a backup
 SHOW WARNINGS;
 Level	Code	Message
 Error	#	Database 'information_schema' cannot be included in a backup
 Warning	#	Operation aborted
+verify backup history and progress logs:
+SELECT backup_state,operation, backup_file,command FROM mysql.backup_history;
+backup_state	operation	backup_file	command
+error	backup	t.bak	BACKUP DATABASE information_schema, test TO 't.bak'
+SELECT notes FROM mysql.backup_progress;
+notes
+starting
+running
+Database 'information_schema' cannot be included in a backup
+error
+PURGE BACKUP LOGS;
 Backup of mysql, information_schema scenario 6
-BACKUP DATABASE mysql, information_schema, test TO 't.bak';
+BACKUP DATABASE mysql, information_schema, test TO 't.bak' ;
 ERROR HY000: Database 'mysql' cannot be included in a backup
 SHOW WARNINGS;
 Level	Code	Message
 Error	#	Database 'mysql' cannot be included in a backup
 Warning	#	Operation aborted
-Get last backup_id
-SELECT MAX(backup_id) INTO @bup_id FROM mysql.backup_history
-WHERE command LIKE "BACKUP DATABASE mysql, information_schema, test TO%";
-verify backup history and progress logs:
-SELECT backup_state,operation, backup_file FROM mysql.backup_history
-WHERE backup_id=@bup_id;
-backup_state	operation	backup_file
-error	backup	t.bak
-SELECT notes FROM mysql.backup_progress
-WHERE backup_id=@bup_id;
+verify backup history and progress logs:
+SELECT backup_state,operation, backup_file, command FROM mysql.backup_history;
+backup_state	operation	backup_file	command
+error	backup	t.bak	BACKUP DATABASE mysql, information_schema, test TO 't.bak'
+SELECT notes FROM mysql.backup_progress;
 notes
 starting
 running
@@ -263,12 +262,12 @@ CREATE DATABASE test_ob_error;
 CREATE TABLE test_ob_error.t1 (col_a int);
 INSERT INTO test_ob_error.t1 VALUES (1), (2), (3), (4), (5);
 Backup the database;
-BACKUP DATABASE test_ob_error TO 'ob_err.bak';
+BACKUP DATABASE test_ob_error TO 'ob_err.bak' ;
 backup_id
 #
 DROP TABLE mysql.backup_history;
 Backup the database;
-BACKUP DATABASE test_ob_error TO 'ob_err.bak';
+BACKUP DATABASE test_ob_error TO 'ob_err.bak' ;
 ERROR HY000: Can't open the backup logs as tables. Check 'mysql.backup_history' and 'mysql.backup_progress' or run mysql_upgrade to repair.
 SHOW WARNINGS;
 Level	Code	Message
@@ -279,7 +278,7 @@ CREATE TABLE mysql.backup_history LIKE t
 DROP TABLE test.ob_copy;
 DROP TABLE mysql.backup_progress;
 Backup the database;
-BACKUP DATABASE test_ob_error TO 'ob_err.bak';
+BACKUP DATABASE test_ob_error TO 'ob_err.bak' ;
 ERROR HY000: Can't open the backup logs as tables. Check 'mysql.backup_history' and 'mysql.backup_progress' or run mysql_upgrade to repair.
 SHOW WARNINGS;
 Level	Code	Message
@@ -296,6 +295,7 @@ after backup starts
 SET DEBUG_SYNC= 'reset';
 DROP DATABASE IF EXISTS db1;
 CREATE DATABASE db1;
+PURGE BACKUP LOGS;
 start backup but stop just before adding metadata to backup image
 SET DEBUG_SYNC= 'backup_before_write_preamble SIGNAL running WAIT_FOR db_will_fail';
 BACKUP DATABASE db1 TO 'bup_db1.bak';
@@ -309,6 +309,16 @@ ERROR HY000: Failed to obtain meta-data 
 Test that backup fails with error if a table used by 
 a trigger cannot be opened
 SET DEBUG_SYNC= 'reset';
+verify backup history and progress logs:
+SELECT backup_state,operation, backup_file, command FROM mysql.backup_history;
+backup_state	operation	backup_file	command
+error	backup	bup_db1.bak	BACKUP DATABASE db1 TO 'bup_db1.bak'
+SELECT notes FROM mysql.backup_progress;
+notes
+starting
+running
+Failed to obtain meta-data for database `db1`
+error
 DROP DATABASE IF EXISTS db1;
 CREATE DATABASE db1;
 CREATE TABLE db1.t1 (i int);
@@ -320,20 +330,15 @@ END;||
 SET DEBUG_SYNC= 'reset';
 Setting debug point that will make backup fail when adding the
 trigger metadata
+PURGE BACKUP LOGS;
 SET SESSION DEBUG='+d,backup_fail_add_trigger';
-BACKUP DATABASE db1 TO 'bup_db1.bak';
+BACKUP DATABASE db1 TO 'bup_db1.bak' ;
 ERROR HY000: Failed to obtain meta-data for trigger `db1`.`trg`
-SET SESSION DEBUG='-d';
-Get last backup_id
-SELECT MAX(backup_id) INTO @bup_id FROM mysql.backup_history
-WHERE command LIKE "BACKUP DATABASE db1 TO%";
-verify backup history and progress logs:
-SELECT backup_state,operation, backup_file FROM mysql.backup_history
-WHERE backup_id=@bup_id;
-backup_state	operation	backup_file
-error	backup	bup_db1.bak
-SELECT notes FROM mysql.backup_progress
-WHERE backup_id=@bup_id;
+verify backup history and progress logs:
+SELECT backup_state,operation, backup_file,command FROM mysql.backup_history;
+backup_state	operation	backup_file	command
+error	backup	bup_db1.bak	BACKUP DATABASE db1 TO 'bup_db1.bak'
+SELECT notes FROM mysql.backup_progress;
 notes
 starting
 running
@@ -354,7 +359,7 @@ CREATE TABLE table1 (text VARCHAR(20));
 INSERT INTO table1 VALUES ('Inserted before');
 
 Backup database
-BACKUP DATABASE db1 TO 'overwrite.bak';
+BACKUP DATABASE db1 TO 'overwrite.bak' ;
 backup_id
 #
 
@@ -393,22 +398,33 @@ Inserted before
 # Test error handling by backup code when injecting commit blocker error.
 #
 SET SESSION DEBUG='+d,backup_grl_fail';
-BACKUP DATABASE db1 TO 'overwrite1.bak';
+BACKUP DATABASE db1 TO 'overwrite1.bak' ;
 ERROR HY000: Backup failed to synchronize table images.
 SET SESSION DEBUG='-d';
 
+PURGE BACKUP LOGS;
 SET SESSION DEBUG='+d,backup_grl_block_commit_fail';
-BACKUP DATABASE db1 TO 'overwrite1.bak';
+BACKUP DATABASE db1 TO 'overwrite1.bak' ;
 ERROR HY000: Backup failed to synchronize table images.
 SET SESSION DEBUG='-d';
+verify backup history and progress logs:
+SELECT backup_state,operation, backup_file,command FROM mysql.backup_history;
+backup_state	operation	backup_file	command
+error	backup	overwrite1.bak	BACKUP DATABASE db1 TO 'overwrite1.bak'
+SELECT notes FROM mysql.backup_progress;
+notes
+starting
+running
+Backup failed to synchronize table images.
+error
 #
 # Test that BACKUP and RESTORE clears warning stack
 #
-BACKUP DATABASE db1 TO 'test.bak';
+BACKUP DATABASE db1 TO 'test.bak' ;
 backup_id
 #
 # Generate warning - test.bak cannot be overwritten
-BACKUP DATABASE db1 TO 'test.bak';
+BACKUP DATABASE db1 TO 'test.bak' ;
 ERROR HY000: Can't create/write to file 'MYSQLTEST_VARDIR/master-data/test.bak' (Errcode: #)
 SHOW WARNINGS;
 Level	Code	Message
@@ -417,14 +433,15 @@ Error	#	Can't write to backup location '
 Warning	#	Operation aborted
 
 # Test that there are no warnings after successful BACKUP
-BACKUP DATABASE db1 TO 'newtest.bak';
+BACKUP DATABASE db1 TO 'newtest.bak' ;
 backup_id
 #
 SHOW WARNINGS;
 Level	Code	Message
 
+PURGE BACKUP LOGS;
 # Generate warning - test.bak cannot be overwritten
-BACKUP DATABASE db1 TO 'test.bak';
+BACKUP DATABASE db1 TO 'test.bak' ;
 ERROR HY000: Can't create/write to file 'MYSQLTEST_VARDIR/master-data/test.bak' (Errcode: #)
 SHOW WARNINGS;
 Level	Code	Message
@@ -432,6 +449,16 @@ Error	#	Can't create/write to file 'MYSQ
 Error	#	Can't write to backup location 'test.bak'
 Warning	#	Operation aborted
 
+verify backup history and progress logs:
+SELECT backup_state,operation, backup_file,command FROM mysql.backup_history;
+backup_state	operation	backup_file	command
+error	backup	test.bak	BACKUP DATABASE db1 TO 'test.bak'
+SELECT notes FROM mysql.backup_progress;
+notes
+starting
+running
+Can't write to backup location 'test.bak'
+error
 # Test that there are no warnings after successful RESTORE
 RESTORE FROM 'newtest.bak' OVERWRITE;
 backup_id
@@ -447,9 +474,9 @@ CREATE TABLE table2 (i int NOT NULL) ENG
 INSERT INTO table2 values (1),(2);
 CREATE TRIGGER db1.trg AFTER INSERT ON db1.table2 FOR EACH ROW
 BEGIN
-INSERT INTO db1.table1(v) VALUES ('Test trigger fired');   
+INSERT INTO db1.table1(v) VALUES ('Test trigger fired');
 END;||
-BACKUP DATABASE db1 TO 'errorinject.bak';
+BACKUP DATABASE db1 TO 'errorinject.bak' ;
 backup_id
 #
 DROP DATABASE db1;
@@ -464,7 +491,7 @@ ERROR HY000: Can't read backup archive p
 SET SESSION DEBUG='-d';
 #
 # Error injection in RESTORE: Get next chunk;
-# Called from prepare_for_restore, after read_header 
+# Called from prepare_for_restore, after read_header
 #
 SET SESSION DEBUG='+d,restore_prepare_next_chunk_1';
 RESTORE FROM 'errorinject.bak';
@@ -479,7 +506,7 @@ ERROR HY000: Can't read backup archive p
 SET SESSION DEBUG='-d';
 #
 # Error injection in RESTORE: Get next chunk;
-# Called from prepare_for_restore, after read_catalog 
+# Called from prepare_for_restore, after read_catalog
 #
 SET SESSION DEBUG='+d,restore_prepare_next_chunk_2';
 RESTORE FROM 'errorinject.bak';
@@ -495,7 +522,7 @@ SET SESSION DEBUG='-d';
 DROP DATABASE db1;
 #
 # Error injection in RESTORE: Get next chunk;
-# Called from do_restore 
+# Called from do_restore
 #
 SET SESSION DEBUG='+d,restore_stream_next_chunk';
 RESTORE FROM 'errorinject.bak';
@@ -527,14 +554,6 @@ ERROR HY000: Error when sending data (fo
 SET SESSION DEBUG='-d';
 DROP DATABASE db1;
 #
-# Error injection in RESTORE: Restore trigger
-#
-SET SESSION DEBUG='+d,restore_trigger';
-RESTORE FROM 'errorinject.bak';
-ERROR HY000: Could not restore trigger `db1`.`trg`
-SET SESSION DEBUG='-d';
-DROP DATABASE db1;
-#
 # Error injection in RESTORE: Read summary
 #
 SET SESSION DEBUG='+d,restore_read_summary';

=== added file 'mysql-test/suite/backup/r/backup_errors_compression.result'
--- a/mysql-test/suite/backup/r/backup_errors_compression.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/backup/r/backup_errors_compression.result	2009-02-06 16:45:39 +0000
@@ -0,0 +1,566 @@
+DROP DATABASE IF EXISTS adb;
+DROP DATABASE IF EXISTS bdb;
+PURGE BACKUP LOGS;
+# non-existent backup archive
+RESTORE FROM 'test.bak';
+ERROR HY000: File 'MYSQLTEST_VARDIR/master-data/test.bak' not found (Errcode: #)
+verify backup history and progress logs:
+SELECT backup_state,operation, backup_file, command FROM mysql.backup_history;
+backup_state	operation	backup_file	command
+error	restore	test.bak	RESTORE FROM 'test.bak'
+SELECT notes FROM mysql.backup_progress;
+notes
+starting
+running
+Can't read backup location 'test.bak'
+error
+CREATE DATABASE adb;
+CREATE DATABASE bdb;
+CREATE TABLE bdb.t1(a int) ENGINE=MEMORY;
+PURGE BACKUP LOGS;
+# invalid location
+BACKUP DATABASE adb TO '' WITH COMPRESSION;
+ERROR HY000: Malformed file path ''
+SHOW WARNINGS;
+Level	Code	Message
+Error	#	Malformed file path ''
+Warning	#	Operation aborted
+verify backup history and progress logs:
+SELECT backup_state,operation, backup_file, command FROM mysql.backup_history;
+backup_state	operation	backup_file	command
+error	backup		BACKUP DATABASE adb TO '' WITH COMPRESSION
+SELECT notes FROM mysql.backup_progress;
+notes
+starting
+running
+Malformed file path ''
+error
+PURGE BACKUP LOGS;
+BACKUP DATABASE adb TO '/yyy/invalid/location' WITH COMPRESSION;
+ERROR HY000: Can't create/write to file '/yyy/invalid/location' (Errcode: #)
+SHOW WARNINGS;
+Level	Code	Message
+Error	#	Can't create/write to file '/yyy/invalid/location' (Errcode: #)
+Error	#	Can't write to backup location '/yyy/invalid/location'
+Warning	#	Operation aborted
+verify backup history and progress logs:
+SELECT backup_state,operation, backup_file, command FROM mysql.backup_history;
+backup_state	operation	backup_file	command
+error	backup	location	BACKUP DATABASE adb TO '/yyy/invalid/location' WITH COMPRESSION
+SELECT notes FROM mysql.backup_progress;
+notes
+starting
+running
+Can't write to backup location '/yyy/invalid/location'
+error
+# don't overwrite existing files
+BACKUP DATABASE adb TO "bdb/t1.frm" WITH COMPRESSION;
+ERROR HY000: Can't create/write to file 'MYSQLTEST_VARDIR/master-data/bdb/t1.frm' (Errcode: #)
+SHOW WARNINGS;
+Level	Code	Message
+Error	#	Can't create/write to file 'MYSQLTEST_VARDIR/master-data/bdb/t1.frm' (Errcode: #)
+Error	#	Can't write to backup location 'bdb/t1.frm'
+Warning	#	Operation aborted
+BACKUP DATABASE adb TO "test.bak" WITH COMPRESSION;
+backup_id
+#
+SHOW WARNINGS;
+Level	Code	Message
+PURGE BACKUP LOGS;
+# don't overwrite existing backup image
+BACKUP DATABASE adb TO "test.bak" WITH COMPRESSION;
+ERROR HY000: Can't create/write to file 'MYSQLTEST_VARDIR/master-data/test.bak' (Errcode: #)
+SHOW WARNINGS;
+Level	Code	Message
+Error	#	Can't create/write to file 'MYSQLTEST_VARDIR/master-data/test.bak' (Errcode: #)
+Error	#	Can't write to backup location 'test.bak'
+Warning	#	Operation aborted
+verify backup history and progress logs for backup_state.
+SELECT backup_state,operation, backup_file, command FROM mysql.backup_history;
+backup_state	operation	backup_file	command
+error	backup	test.bak	BACKUP DATABASE adb TO "test.bak" WITH COMPRESSION
+SELECT notes FROM mysql.backup_progress;
+notes
+starting
+running
+Can't write to backup location 'test.bak'
+error
+# non-existent database
+DROP DATABASE IF EXISTS foo;
+DROP DATABASE IF EXISTS bar;
+BACKUP DATABASE foo TO 'test.bak' WITH COMPRESSION;
+ERROR 42000: Unknown database 'foo'
+SHOW WARNINGS;
+Level	Code	Message
+Error	#	Unknown database 'foo'
+Warning	#	Operation aborted
+PURGE BACKUP LOGS;
+BACKUP DATABASE test,foo,bdb,bar TO 'test.bak' WITH COMPRESSION;
+ERROR 42000: Unknown database 'foo,bar'
+SHOW WARNINGS;
+Level	Code	Message
+Error	#	Unknown database 'foo,bar'
+Warning	#	Operation aborted
+verify backup history and progress logs:
+SELECT backup_state,operation,backup_file, command FROM mysql.backup_history;
+backup_state	operation	backup_file	command
+error	backup	test.bak	BACKUP DATABASE test,foo,bdb,bar TO 'test.bak' WITH COMPRESSION
+SELECT notes FROM mysql.backup_progress;
+notes
+starting
+running
+Unknown database 'foo,bar'
+error
+PURGE BACKUP LOGS;
+# repeated database
+BACKUP DATABASE foo,test,bar,foo TO 'test.bak' WITH COMPRESSION;
+ERROR 42000: Not unique database: 'foo'
+SHOW WARNINGS;
+Level	Code	Message
+Error	#	Not unique database: 'foo'
+verify backup history and progress logs for backup_state.
+SELECT backup_state,operation, backup_file, command FROM mysql.backup_history;
+backup_state	operation	backup_file	command
+SELECT notes FROM mysql.backup_progress;
+notes
+use adb;
+create table t1 (a int);
+create procedure p1() backup database test to 'test.bak';
+ERROR 0A000: BACKUP is not allowed in stored procedures
+create procedure p1() restore from 'test.bak';
+ERROR 0A000: RESTORE is not allowed in stored procedures
+create function f1() returns int backup database test to 'test.bak';
+ERROR 0A000: BACKUP is not allowed in stored procedures
+create function f1() returns int restore from 'test.bak';
+ERROR 0A000: RESTORE is not allowed in stored procedures
+create trigger tr1 before insert on t1 
+for each row backup database test to 'test.bak';
+ERROR 0A000: BACKUP is not allowed in stored procedures
+create trigger tr1 before insert on t1 
+for each row restore from 'test.bak';
+ERROR 0A000: RESTORE is not allowed in stored procedures
+create event ev1 on schedule every 1 day 
+do backup database test to 'test.bak';
+ERROR 0A000: BACKUP is not allowed in stored procedures
+create event ev1 on schedule every 1 day 
+do restore from 'test.bak';
+ERROR 0A000: RESTORE is not allowed in stored procedures
+DROP DATABASE adb;
+DROP DATABASE bdb;
+PURGE BACKUP LOGS;
+Backup of mysql, information_schema scenario 1
+BACKUP DATABASE mysql TO 't.bak' WITH COMPRESSION;
+ERROR HY000: Database 'mysql' cannot be included in a backup
+SHOW WARNINGS;
+Level	Code	Message
+Error	#	Database 'mysql' cannot be included in a backup
+Warning	#	Operation aborted
+verify backup history and progress logs:
+SELECT backup_state,operation, backup_file, command FROM mysql.backup_history;
+backup_state	operation	backup_file	command
+error	backup	t.bak	BACKUP DATABASE mysql TO 't.bak' WITH COMPRESSION
+SELECT notes FROM mysql.backup_progress;
+notes
+starting
+running
+Database 'mysql' cannot be included in a backup
+error
+PURGE BACKUP LOGS;
+Backup of mysql, information_schema scenario 2
+BACKUP DATABASE information_schema TO 't.bak' WITH COMPRESSION;
+ERROR HY000: Database 'information_schema' cannot be included in a backup
+SHOW WARNINGS;
+Level	Code	Message
+Error	#	Database 'information_schema' cannot be included in a backup
+Warning	#	Operation aborted
+verify backup history and progress logs:
+SELECT backup_state,operation, backup_file,command FROM mysql.backup_history;
+backup_state	operation	backup_file	command
+error	backup	t.bak	BACKUP DATABASE information_schema TO 't.bak' WITH COMPRESSION
+SELECT  notes FROM mysql.backup_progress;
+notes
+starting
+running
+Database 'information_schema' cannot be included in a backup
+error
+PURGE BACKUP LOGS;
+Backup of mysql, information_schema scenario 3
+BACKUP DATABASE mysql, information_schema TO 't.bak' WITH COMPRESSION;
+ERROR HY000: Database 'mysql' cannot be included in a backup
+SHOW WARNINGS;
+Level	Code	Message
+Error	#	Database 'mysql' cannot be included in a backup
+Warning	#	Operation aborted
+verify backup history and progress logs:
+SELECT backup_state,operation, backup_file,command FROM mysql.backup_history;
+backup_state	operation	backup_file	command
+error	backup	t.bak	BACKUP DATABASE mysql, information_schema TO 't.bak' WITH COMPRESSION
+SELECT notes FROM mysql.backup_progress;
+notes
+starting
+running
+Database 'mysql' cannot be included in a backup
+error
+PURGE BACKUP LOGS;
+Backup of mysql, information_schema scenario 4
+BACKUP DATABASE mysql, test TO 't.bak' WITH COMPRESSION;
+ERROR HY000: Database 'mysql' cannot be included in a backup
+SHOW WARNINGS;
+Level	Code	Message
+Error	#	Database 'mysql' cannot be included in a backup
+Warning	#	Operation aborted
+verify backup history and progress logs:
+SELECT backup_state,operation, backup_file,command FROM mysql.backup_history;
+backup_state	operation	backup_file	command
+error	backup	t.bak	BACKUP DATABASE mysql, test TO 't.bak' WITH COMPRESSION
+SELECT notes FROM mysql.backup_progress;
+notes
+starting
+running
+Database 'mysql' cannot be included in a backup
+error
+PURGE BACKUP LOGS;
+Backup of mysql, information_schema scenario 5
+BACKUP DATABASE information_schema, test TO 't.bak' WITH COMPRESSION;
+ERROR HY000: Database 'information_schema' cannot be included in a backup
+SHOW WARNINGS;
+Level	Code	Message
+Error	#	Database 'information_schema' cannot be included in a backup
+Warning	#	Operation aborted
+verify backup history and progress logs:
+SELECT backup_state,operation, backup_file,command FROM mysql.backup_history;
+backup_state	operation	backup_file	command
+error	backup	t.bak	BACKUP DATABASE information_schema, test TO 't.bak' WITH COMPRESSION
+SELECT notes FROM mysql.backup_progress;
+notes
+starting
+running
+Database 'information_schema' cannot be included in a backup
+error
+PURGE BACKUP LOGS;
+Backup of mysql, information_schema scenario 6
+BACKUP DATABASE mysql, information_schema, test TO 't.bak' WITH COMPRESSION;
+ERROR HY000: Database 'mysql' cannot be included in a backup
+SHOW WARNINGS;
+Level	Code	Message
+Error	#	Database 'mysql' cannot be included in a backup
+Warning	#	Operation aborted
+verify backup history and progress logs:
+SELECT backup_state,operation, backup_file, command FROM mysql.backup_history;
+backup_state	operation	backup_file	command
+error	backup	t.bak	BACKUP DATABASE mysql, information_schema, test TO 't.bak' WITH COMPRESSION
+SELECT notes FROM mysql.backup_progress;
+notes
+starting
+running
+Database 'mysql' cannot be included in a backup
+error
+Making copies of progress tables.
+CREATE TABLE IF NOT EXISTS test.ob_copy LIKE mysql.backup_history;
+CREATE TABLE IF NOT EXISTS test.obp_copy LIKE mysql.backup_progress;
+CREATE DATABASE test_ob_error;
+CREATE TABLE test_ob_error.t1 (col_a int);
+INSERT INTO test_ob_error.t1 VALUES (1), (2), (3), (4), (5);
+Backup the database;
+BACKUP DATABASE test_ob_error TO 'ob_err.bak' WITH COMPRESSION;
+backup_id
+#
+DROP TABLE mysql.backup_history;
+Backup the database;
+BACKUP DATABASE test_ob_error TO 'ob_err.bak' WITH COMPRESSION;
+ERROR HY000: Can't open the backup logs as tables. Check 'mysql.backup_history' and 'mysql.backup_progress' or run mysql_upgrade to repair.
+SHOW WARNINGS;
+Level	Code	Message
+Error	#	Table 'mysql.backup_history' doesn't exist
+Error	#	Cannot create backup/restore execution context
+Restoring the table
+CREATE TABLE mysql.backup_history LIKE test.ob_copy;
+DROP TABLE test.ob_copy;
+DROP TABLE mysql.backup_progress;
+Backup the database;
+BACKUP DATABASE test_ob_error TO 'ob_err.bak' WITH COMPRESSION;
+ERROR HY000: Can't open the backup logs as tables. Check 'mysql.backup_history' and 'mysql.backup_progress' or run mysql_upgrade to repair.
+SHOW WARNINGS;
+Level	Code	Message
+Error	#	Table 'mysql.backup_progress' doesn't exist
+Error	#	Cannot create backup/restore execution context
+Restoring the table
+CREATE TABLE mysql.backup_progress LIKE test.obp_copy;
+DROP TABLE test.obp_copy;
+DROP DATABASE test_ob_error;
+
+Bug#38624
+Test that backup fails with error if database files are removed 
+after backup starts
+SET DEBUG_SYNC= 'reset';
+DROP DATABASE IF EXISTS db1;
+CREATE DATABASE db1;
+PURGE BACKUP LOGS;
+start backup but stop just before adding metadata to backup image
+SET DEBUG_SYNC= 'backup_before_write_preamble SIGNAL running WAIT_FOR db_will_fail';
+BACKUP DATABASE db1 TO 'bup_db1.bak';
+SET DEBUG_SYNC='now WAIT_FOR running';
+delete database files so that check_db_dir_exists will fail in 
+si_objects.cc @ DatabaseObj::do_serialize
+SET DEBUG_SYNC='now SIGNAL db_will_fail';
+Database has been deleted, backup will fail
+ERROR HY000: Failed to obtain meta-data for database `db1`
+
+Test that backup fails with error if a table used by 
+a trigger cannot be opened
+SET DEBUG_SYNC= 'reset';
+verify backup history and progress logs:
+SELECT backup_state,operation, backup_file, command FROM mysql.backup_history;
+backup_state	operation	backup_file	command
+error	backup	bup_db1.bak	BACKUP DATABASE db1 TO 'bup_db1.bak'
+SELECT notes FROM mysql.backup_progress;
+notes
+starting
+running
+Failed to obtain meta-data for database `db1`
+error
+DROP DATABASE IF EXISTS db1;
+CREATE DATABASE db1;
+CREATE TABLE db1.t1 (i int);
+CREATE TABLE db1.t2 (v varchar (20));
+CREATE TRIGGER db1.trg AFTER INSERT ON db1.t1 FOR EACH ROW
+BEGIN
+INSERT INTO db1.t2(v) VALUES ('Test trigger fired');   
+END;||
+SET DEBUG_SYNC= 'reset';
+Setting debug point that will make backup fail when adding the
+trigger metadata
+PURGE BACKUP LOGS;
+SET SESSION DEBUG='+d,backup_fail_add_trigger';
+BACKUP DATABASE db1 TO 'bup_db1.bak' WITH COMPRESSION;
+ERROR HY000: Failed to obtain meta-data for trigger `db1`.`trg`
+verify backup history and progress logs:
+SELECT backup_state,operation, backup_file,command FROM mysql.backup_history;
+backup_state	operation	backup_file	command
+error	backup	bup_db1.bak	BACKUP DATABASE db1 TO 'bup_db1.bak' WITH COMPRESSION
+SELECT notes FROM mysql.backup_progress;
+notes
+starting
+running
+Failed to obtain meta-data for trigger `db1`.`trg`
+error
+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' WITH COMPRESSION;
+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
+#
+# Test error handling by backup code when injecting commit blocker error.
+#
+SET SESSION DEBUG='+d,backup_grl_fail';
+BACKUP DATABASE db1 TO 'overwrite1.bak' WITH COMPRESSION;
+ERROR HY000: Backup failed to synchronize table images.
+SET SESSION DEBUG='-d';
+
+PURGE BACKUP LOGS;
+SET SESSION DEBUG='+d,backup_grl_block_commit_fail';
+BACKUP DATABASE db1 TO 'overwrite1.bak' WITH COMPRESSION;
+ERROR HY000: Backup failed to synchronize table images.
+SET SESSION DEBUG='-d';
+verify backup history and progress logs:
+SELECT backup_state,operation, backup_file,command FROM mysql.backup_history;
+backup_state	operation	backup_file	command
+error	backup	overwrite1.bak	BACKUP DATABASE db1 TO 'overwrite1.bak' WITH COMPRESSION
+SELECT notes FROM mysql.backup_progress;
+notes
+starting
+running
+Backup failed to synchronize table images.
+error
+#
+# Test that BACKUP and RESTORE clears warning stack
+#
+BACKUP DATABASE db1 TO 'test.bak' WITH COMPRESSION;
+backup_id
+#
+# Generate warning - test.bak cannot be overwritten
+BACKUP DATABASE db1 TO 'test.bak' WITH COMPRESSION;
+ERROR HY000: Can't create/write to file 'MYSQLTEST_VARDIR/master-data/test.bak' (Errcode: #)
+SHOW WARNINGS;
+Level	Code	Message
+Error	#	Can't create/write to file 'MYSQLTEST_VARDIR/master-data/test.bak' (Errcode: #)
+Error	#	Can't write to backup location 'test.bak'
+Warning	#	Operation aborted
+
+# Test that there are no warnings after successful BACKUP
+BACKUP DATABASE db1 TO 'newtest.bak' WITH COMPRESSION;
+backup_id
+#
+SHOW WARNINGS;
+Level	Code	Message
+
+PURGE BACKUP LOGS;
+# Generate warning - test.bak cannot be overwritten
+BACKUP DATABASE db1 TO 'test.bak' WITH COMPRESSION;
+ERROR HY000: Can't create/write to file 'MYSQLTEST_VARDIR/master-data/test.bak' (Errcode: #)
+SHOW WARNINGS;
+Level	Code	Message
+Error	#	Can't create/write to file 'MYSQLTEST_VARDIR/master-data/test.bak' (Errcode: #)
+Error	#	Can't write to backup location 'test.bak'
+Warning	#	Operation aborted
+
+verify backup history and progress logs:
+SELECT backup_state,operation, backup_file,command FROM mysql.backup_history;
+backup_state	operation	backup_file	command
+error	backup	test.bak	BACKUP DATABASE db1 TO 'test.bak' WITH COMPRESSION
+SELECT notes FROM mysql.backup_progress;
+notes
+starting
+running
+Can't write to backup location 'test.bak'
+error
+# Test that there are no warnings after successful RESTORE
+RESTORE FROM 'newtest.bak' OVERWRITE;
+backup_id
+#
+SHOW WARNINGS;
+Level	Code	Message
+
+#
+# Test error handling by injecting errors into RESTORE
+#
+# Make backup image with objects necessary for error injection
+CREATE TABLE table2 (i int NOT NULL) ENGINE=CSV;
+INSERT INTO table2 values (1),(2);
+CREATE TRIGGER db1.trg AFTER INSERT ON db1.table2 FOR EACH ROW
+BEGIN
+INSERT INTO db1.table1(v) VALUES ('Test trigger fired');
+END;||
+BACKUP DATABASE db1 TO 'errorinject.bak' WITH COMPRESSION;
+backup_id
+#
+DROP DATABASE db1;
+#
+# Backup image created. Start RESTORE with error injection
+#
+# Error injection in RESTORE: Read header
+#
+SET SESSION DEBUG='+d,restore_read_header';
+RESTORE FROM 'errorinject.bak';
+ERROR HY000: Can't read backup archive preamble
+SET SESSION DEBUG='-d';
+#
+# Error injection in RESTORE: Get next chunk;
+# Called from prepare_for_restore, after read_header
+#
+SET SESSION DEBUG='+d,restore_prepare_next_chunk_1';
+RESTORE FROM 'errorinject.bak';
+ERROR HY000: Can't go to the next chunk in backup stream
+SET SESSION DEBUG='-d';
+#
+# Error injection in RESTORE: Read catalog
+#
+SET SESSION DEBUG='+d,restore_read_catalog';
+RESTORE FROM 'errorinject.bak';
+ERROR HY000: Can't read backup archive preamble
+SET SESSION DEBUG='-d';
+#
+# Error injection in RESTORE: Get next chunk;
+# Called from prepare_for_restore, after read_catalog
+#
+SET SESSION DEBUG='+d,restore_prepare_next_chunk_2';
+RESTORE FROM 'errorinject.bak';
+ERROR HY000: Can't go to the next chunk in backup stream
+SET SESSION DEBUG='-d';
+#
+# Error injection in RESTORE: Read metadata from stream
+#
+SET SESSION DEBUG='+d,restore_read_meta_data';
+RESTORE FROM 'errorinject.bak';
+ERROR HY000: Error when reading meta-data
+SET SESSION DEBUG='-d';
+DROP DATABASE db1;
+#
+# Error injection in RESTORE: Get next chunk;
+# Called from do_restore
+#
+SET SESSION DEBUG='+d,restore_stream_next_chunk';
+RESTORE FROM 'errorinject.bak';
+ERROR HY000: Can't go to the next chunk in backup stream
+SET SESSION DEBUG='-d';
+DROP DATABASE db1;
+#
+# Error injection in RESTORE: Lock tables
+#
+SET SESSION DEBUG='+d,restore_lock_tables_for_restore';
+RESTORE FROM 'errorinject.bak';
+ERROR HY000: Open and lock tables failed in RESTORE
+SET SESSION DEBUG='-d';
+DROP DATABASE db1;
+#
+# Error injection in RESTORE: Restore table data
+#
+SET SESSION DEBUG='+d,restore_tbl_data_read';
+RESTORE FROM 'errorinject.bak';
+ERROR HY000: Error when reading data from backup stream
+SET SESSION DEBUG='-d';
+DROP DATABASE db1;
+#
+# Error injection in RESTORE: Send data (default driver)
+#
+SET SESSION DEBUG='+d,restore_default_send_data';
+RESTORE FROM 'errorinject.bak';
+ERROR HY000: Error when sending data (for table #1) to Default restore driver
+SET SESSION DEBUG='-d';
+DROP DATABASE db1;
+#
+# Error injection in RESTORE: Read summary
+#
+SET SESSION DEBUG='+d,restore_read_summary';
+RESTORE FROM 'errorinject.bak';
+ERROR HY000: Error when reading summary section of backup image
+SET SESSION DEBUG='-d';
+#
+# Cleanup
+#
+DROP DATABASE db1;

=== modified file 'mysql-test/suite/backup/t/backup_compression.test'
--- a/mysql-test/suite/backup/t/backup_compression.test	2008-11-17 09:57:51 +0000
+++ b/mysql-test/suite/backup/t/backup_compression.test	2009-02-06 16:45:39 +0000
@@ -1,24 +1,336 @@
 --source include/not_embedded.inc
 --source include/have_compress.inc
+--source include/have_innodb.inc
+--source include/not_windows.inc
+
+# Windows installations does not support gzip commands by default. 
+# Therefore, the test will not be compatible with standard windows installs.
 
 CREATE DATABASE db1;
+CREATE DATABASE db2;
+CREATE DATABASE db3;
 
-CREATE TABLE db1.t1(a INT);
-replace_column 1 #;
+CREATE TABLE db1.t1(a INT) ENGINE= MYISAM;
+CREATE TABLE db1.t2(a CHAR(20)) ENGINE= INNODB;
+CREATE TABLE db2.t1(b INT) ENGINE= FALCON;
+CREATE TABLE db2.t2(b CHAR(20)) ENGINE= MEMORY;
+CREATE TABLE db3.t1(c INT) ENGINE= BLACKHOLE;
+
+INSERT INTO db1.t1 VALUES(10),(20),(30),(40);
+INSERT INTO db1.t2 VALUES('TEST1'),('TEST2'),('TEST3'),('TEST4');
+INSERT INTO db2.t1 VALUES(10),(20),(30),(40);
+INSERT INTO db2.t2 VALUES('TEST1'),('TEST2'),('TEST3'),('TEST4');
+INSERT INTO db3.t1 VALUES(10),(20),(30),(40);
+
+# Execute backup database operation and verify compression syntax.
+# Ensure that backup history logs properly indicate the backup performed with
+# compression.
+--echo Perform backup with compression
+
+PURGE BACKUP LOGS;
+--replace_column 1 #
 BACKUP DATABASE db1 TO 'db1.bak.gz' WITH COMPRESSION;
 
-CREATE TABLE db1.t2(a INT);
+--echo verify backup history log for backup_state.
+SELECT backup_state,operation, backup_file, command FROM mysql.backup_history;
+
+--echo 
+--echo Verify total bytes of compressed and uncompressed data
+--echo
+--echo Select total_bytes of compressed data in @total_bytes_comp
+SELECT total_bytes into @total_bytes_comp FROM mysql.backup_history;
+
+PURGE BACKUP LOGS;
+--echo Perform backup without compression
+--replace_column 1 #
+BACKUP DATABASE db1 TO 'db1_no_compression.bak';
+
+--echo
+--echo Select total_bytes of uncompressed data in @total_bytes_no_comp
+SELECT total_bytes into @total_bytes_no_comp FROM mysql.backup_history;
+
+--echo Verify the result
+SELECT @total_bytes_comp < @total_bytes_no_comp;
+
+--echo The result 0 indicates that total bytes of compressed and uncompressed
+--echo data is same(bug#41898). Once this bug is fixed, result should be 1.
+--echo The size of compressed backup image should be less than uncomressed 
+--echo image. 
+--echo
+--echo Drop database and execute restore operation
+
+DROP DATABASE db1;
+PURGE BACKUP LOGS;
 replace_column 1 #;
-BACKUP DATABASE db1 TO 'db2.bak.gz' WITH COMPRESSION COMPRESSION_ALGORITHM=gzip;
+RESTORE FROM 'db1.bak.gz';
 
+--echo verify backup history logs:
+SELECT backup_state,operation, backup_file, command FROM mysql.backup_history;
+
+SHOW TABLES FROM db1;
+SELECT * FROM db1.t1;
+SELECT * FROM db1.t2;
+--remove_file $MYSQLTEST_VARDIR/master-data/db1.bak.gz
+--remove_file $MYSQLTEST_VARDIR/master-data/db1_no_compression.bak
+
+--echo 
+--echo Now perform backup by specifying the compression algorithm.
+--echo
+
+PURGE BACKUP LOGS;
+replace_column 1 #;
+BACKUP DATABASE db1 TO 'db1.bak.gz' WITH COMPRESSION 
+COMPRESSION_ALGORITHM=gzip;
+
+--echo verify backup history log for backup_state.
+SELECT backup_state,operation, backup_file, command FROM mysql.backup_history;
+
+PURGE BACKUP LOGS;
+--echo Perform restore
 replace_column 1 #;
 RESTORE FROM 'db1.bak.gz' OVERWRITE;
+
+--echo verify backup history log:
+SELECT backup_state,operation, backup_file, command FROM mysql.backup_history;
+
 SHOW TABLES FROM db1;
+SELECT * FROM db1.t1;
+SELECT * FROM db1.t2;
+--remove_file $MYSQLTEST_VARDIR/master-data/db1.bak.gz
+
+--echo 
+--echo Perform backup using invalid syntax.
+--echo
 
 replace_column 1 #;
-RESTORE FROM 'db2.bak.gz' OVERWRITE;
+--error ER_PARSE_ERROR
+BACKUP DATABASE db1 TO 'db1.bak.gz' WITH COMPRESSION
+COMPRESSION_ALGORITHM;
+--replace_column 2 #
+SHOW WARNINGS;
+
+# The errorneous operations will not be logged in the backup history logs.
+# Therefore we don't verify history log when backup fails.
+--error 0,1
+--remove_file $MYSQLTEST_VARDIR/master-data/db1.bak.gz
+
+--replace_column 1 #
+--error ER_PARSE_ERROR
+BACKUP DATABASE db1 TO 'db1.bak.gz' COMPRESSION_ALGORITHM=gzip;
+--replace_column 2 #
+SHOW WARNINGS;
+
+--error 0,1
+--remove_file $MYSQLTEST_VARDIR/master-data/db1.bak.gz
+
+--echo
+--echo Execute backup with compression using invalid compression algorithm.
+--echo
+
+--replace_column 1 #
+--error ER_WRONG_ARGUMENTS
+BACKUP DATABASE db1 TO 'db1.bak.gz' WITH COMPRESSION 
+COMPRESSION_ALGORITHM=invalid;
+
+--replace_column 2 #
+SHOW WARNINGS;
+
+# The errorneous operations will not be logged in the backup history and
+# progress logs.
+
+--error 0,1
+--remove_file $MYSQLTEST_VARDIR/master-data/db1.bak.gz
+
+--echo
+--echo Perform backup of all the databases using compression algorithm
+--echo
+
+PURGE BACKUP LOGS;
+--replace_column 1 #
+BACKUP DATABASE db1, db2, db3 TO 'db123.bak.gz' WITH COMPRESSION 
+COMPRESSION_ALGORITHM=gzip;
+
+--echo verify backup history log for backup_state.
+SELECT backup_state,operation, backup_file, command FROM mysql.backup_history;
+
+PURGE BACKUP LOGS;
+--replace_column 1 #
+RESTORE FROM 'db123.bak.gz' OVERWRITE;
+
+--echo verify backup history log:
+SELECT backup_state,operation, backup_file FROM mysql.backup_history;
+
 SHOW TABLES FROM db1;
+SHOW TABLES FROM db2;
+SHOW TABLES FROM db3;
+--remove_file $MYSQLTEST_VARDIR/master-data/db123.bak.gz
+
+--echo
+--echo Unzip a gzip file and perform restore.
+--echo
+
+PURGE BACKUP LOGS;
+--replace_column 1 #
+BACKUP DATABASE db1 TO 'db1.bak.gz' WITH COMPRESSION;
+
+--echo verify backup history for backup_state.
+SELECT backup_state,operation, backup_file, command FROM mysql.backup_history;
+
+--echo Unzip db1.bak.gz and perform restore of unzipped file.
+--exec gunzip $MYSQLTEST_VARDIR/master-data/db1.bak.gz 
+file_exists $MYSQLTEST_VARDIR/master-data/db1.bak;
 
 DROP DATABASE db1;
+
+PURGE BACKUP LOGS;
+--echo Restore of unzipped file(db1.bak)
+--replace_column 1 #
+RESTORE FROM 'db1.bak';
+
+--echo verify backup history log:
+SELECT backup_state,operation, backup_file, command FROM mysql.backup_history;
+
+SHOW TABLES FROM db1;
+SELECT * FROM db1.t1;
+SELECT * FROM db1.t2;
+--remove_file $MYSQLTEST_VARDIR/master-data/db1.bak
+
+--echo
+--echo Restore of any manually gzipped image
+--echo
+
+PURGE BACKUP LOGS;
+--replace_column 1 #
+BACKUP DATABASE db1 TO 'db1.bak';
+
+--echo verify backup history log for backup_state.
+SELECT backup_state,operation, backup_file, command FROM mysql.backup_history;
+
+--echo Zip the db1.bak file and perform restore of zipped file.
+--exec gzip $MYSQLTEST_VARDIR/master-data/db1.bak
+file_exists $MYSQLTEST_VARDIR/master-data/db1.bak.gz;
+
+DROP DATABASE db1;
+
+PURGE BACKUP LOGS;
+--echo Restore of zipped file
+--replace_column 1 #
+RESTORE FROM 'db1.bak.gz';
+
+--echo verify backup history logs:
+SELECT backup_state,operation, backup_file, command FROM mysql.backup_history;
+
+SHOW TABLES FROM db1;
+SELECT * FROM db1.t1;
+SELECT * FROM db1.t2;
 --remove_file $MYSQLTEST_VARDIR/master-data/db1.bak.gz
---remove_file $MYSQLTEST_VARDIR/master-data/db2.bak.gz
+
+--echo
+--echo Rename of gzip file without .gz extension, then perform restore.
+--echo
+
+--replace_column 1 #
+BACKUP DATABASE db1 TO 'db1.bak.gz' WITH COMPRESSION
+COMPRESSION_ALGORITHM=gzip;
+
+--echo Rename gzip file db1.bak.gz to db1_copy.bak and perform restore
+--copy_file $MYSQLTEST_VARDIR/master-data/db1.bak.gz $MYSQLTEST_VARDIR/master-data/db1_copy.bak
+
+--echo Verify that db1_copy.bak file exists using file_exists command
+file_exists $MYSQLTEST_VARDIR/master-data/db1_copy.bak;
+--remove_file $MYSQLTEST_VARDIR/master-data/db1.bak.gz
+
+--echo Perform restore from renamed gzip file
+PURGE BACKUP LOGS;
+--replace_column 1 #
+RESTORE FROM 'db1_copy.bak' OVERWRITE;
+
+--echo verify backup history log:
+SELECT backup_state,operation, backup_file, command FROM mysql.backup_history;
+
+SHOW TABLES FROM db1;
+SELECT * FROM db1.t1;
+SELECT * FROM db1.t2;
+
+# Create objects in database and perform backup operation with compression.
+# Ensure that while restoring a compressed image, data contents and objects
+# are intact.
+--echo Creating objects
+--echo ** create view **
+CREATE VIEW db1.v1 AS SELECT * FROM db1.t1;
+CREATE VIEW db2.vv AS SELECT * FROM db1.v1;
+
+--echo ** create triggers **
+delimiter ||;
+CREATE TRIGGER db1.trg AFTER INSERT ON db1.t2 FOR EACH ROW
+BEGIN
+ INSERT INTO db2.t2 VALUES('Trigger insertion');
+END;||
+
+--echo ** create procedures **
+CREATE PROCEDURE db2.p1()
+BEGIN
+  SELECT * FROM db1.t2;
+END;
+||
+
+--echo ** create functions **
+CREATE FUNCTION db2.f1() RETURNS INTEGER
+BEGIN
+RETURN (SELECT COUNT(*) FROM db1.t1);
+END;
+||
+delimiter ;||
+
+--echo ** create event **
+CREATE EVENT db3.e1 ON SCHEDULE EVERY 1 YEAR DO
+ DELETE FROM db3.t1 WHERE c=1000;
+
+--echo
+--echo Do backup of database
+
+PURGE BACKUP LOGS;
+--replace_column 1 #
+BACKUP DATABASE db1, db2, db3 TO 'db123.bak.gz' WITH COMPRESSION;
+
+--echo verify backup history log for backup_state.
+SELECT backup_state,operation, backup_file, command FROM mysql.backup_history;
+
+--echo Drop the database and perform restore
+DROP DATABASE db1;
+DROP DATABASE db2;
+DROP DATABASE db3;
+
+PURGE BACKUP LOGS;
+--replace_column 1 #
+RESTORE FROM 'db123.bak.gz' OVERWRITE;
+
+--echo verify backup history log for backup state:
+SELECT backup_state,operation, backup_file, command FROM mysql.backup_history;
+
+SHOW FULL TABLES FROM db1;
+SHOW FULL TABLES FROM db2;
+SHOW TABLES FROM db3;
+
+--echo Excercise objects
+
+--echo Firing trigger trg
+
+INSERT INTO db1.t2 VALUES('TEST5');
+
+SELECT * FROM db1.t2;
+SELECT * FROM db2.t2;
+
+--echo Call procedures and functions
+CALL db2.p1();
+SELECT db2.f1();
+
+SELECT * FROM db1.v1;
+SELECT * FROM db2.vv;
+
+--echo Test cleanup: Drop databases and remove backup files
+DROP DATABASE db1;
+DROP DATABASE db2;
+DROP DATABASE db3;
+--remove_file $MYSQLTEST_VARDIR/master-data/db123.bak.gz
+

=== added file 'mysql-test/suite/backup/t/backup_errors-master.opt'
--- a/mysql-test/suite/backup/t/backup_errors-master.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/backup/t/backup_errors-master.opt	2009-02-06 16:45:39 +0000
@@ -0,0 +1 @@
+--secure-file-priv=

=== modified file 'mysql-test/suite/backup/t/backup_errors.test'
--- a/mysql-test/suite/backup/t/backup_errors.test	2009-02-03 07:48:09 +0000
+++ b/mysql-test/suite/backup/t/backup_errors.test	2009-02-06 16:45:39 +0000
@@ -12,76 +12,77 @@ DROP DATABASE IF EXISTS bdb;
 --remove_file $MYSQLTEST_VARDIR/master-data/test.bak
 --enable_warnings
 
+PURGE BACKUP LOGS;
 --echo # non-existent backup archive
 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
 --replace_regex /Errcode: [0-9]+/Errcode: #/
 --error 29
 RESTORE FROM 'test.bak';
 
---echo Get last backup_id
-SELECT MAX(backup_id) INTO @bup_id FROM mysql.backup_history
-WHERE command LIKE "RESTORE FROM 'test%";
-
 --echo verify backup history and progress logs:
-SELECT backup_state,operation, backup_file FROM mysql.backup_history
-     WHERE backup_id=@bup_id;
-SELECT notes FROM mysql.backup_progress
-     WHERE backup_id=@bup_id;
+SELECT backup_state,operation, backup_file, command FROM mysql.backup_history;
+SELECT notes FROM mysql.backup_progress;
 
 CREATE DATABASE adb;
 CREATE DATABASE bdb;
 CREATE TABLE bdb.t1(a int) ENGINE=MEMORY;
 
+PURGE BACKUP LOGS;
 --echo # invalid location
 --error ER_BAD_PATH
-BACKUP DATABASE adb TO '';
+eval BACKUP DATABASE adb TO '' $compression;
 --replace_column 2 #
 SHOW WARNINGS;
 
---echo Get last backup_id
-SELECT MAX(backup_id) INTO @bup_id FROM mysql.backup_history
-WHERE command LIKE "BACKUP DATABASE adb TO%";
+--echo verify backup history and progress logs:
+SELECT backup_state,operation, backup_file, command FROM mysql.backup_history;
+SELECT notes FROM mysql.backup_progress;
+
+# Backup database to invalid location
+
+PURGE BACKUP LOGS;
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--replace_regex /Errcode: [0-9]+/Errcode: #/
+--error 1
+eval BACKUP DATABASE adb TO '/yyy/invalid/location' $compression;
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--replace_regex /Errcode: [0-9]+/Errcode: #/
+--replace_column 2 #
+SHOW WARNINGS;
 
 --echo verify backup history and progress logs:
-SELECT backup_state,operation, backup_file FROM mysql.backup_history
-     WHERE backup_id=@bup_id;
-SELECT notes FROM mysql.backup_progress
-     WHERE backup_id=@bup_id;
+SELECT backup_state,operation, backup_file, command FROM mysql.backup_history;
+SELECT notes FROM mysql.backup_progress;
 
 --echo # don't overwrite existing files
 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
 --replace_regex /Errcode: [0-9]+/Errcode: #/
 --error 1
-BACKUP DATABASE adb TO "bdb/t1.frm";
+eval BACKUP DATABASE adb TO "bdb/t1.frm" $compression;
 --replace_column 2 #
 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
 --replace_regex /Errcode: [0-9]+/Errcode: #/
 SHOW WARNINGS;
 
 --replace_column 1 #
-BACKUP DATABASE adb TO "test.bak";
+eval BACKUP DATABASE adb TO "test.bak" $compression;
 # There should be no warnings after a successful backup
 SHOW WARNINGS;
 
+PURGE BACKUP LOGS;
 --echo # don't overwrite existing backup image
 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
 --replace_regex /Errcode: [0-9]+/Errcode: #/
 --error 1
-BACKUP DATABASE adb TO "test.bak";
+eval BACKUP DATABASE adb TO "test.bak" $compression;
 --replace_column 2 #
 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
 --replace_regex /Errcode: [0-9]+/Errcode: #/
 SHOW WARNINGS;
 
---echo Get last backup_id
-SELECT MAX(backup_id) INTO @bup_id FROM mysql.backup_history
-WHERE command LIKE "BACKUP DATABASE adb TO%";
-
 --echo verify backup history and progress logs for backup_state.
-SELECT backup_state,operation, backup_file FROM mysql.backup_history
-     WHERE backup_id=@bup_id;
-SELECT notes FROM mysql.backup_progress
-     WHERE backup_id=@bup_id;
+SELECT backup_state,operation, backup_file, command FROM mysql.backup_history;
+SELECT notes FROM mysql.backup_progress;
 
 --remove_file $MYSQLTEST_VARDIR/master-data/test.bak
 
@@ -92,35 +93,35 @@ DROP DATABASE IF EXISTS bar;
 --enable_warnings
 
 -- error ER_BAD_DB_ERROR
-BACKUP DATABASE foo TO 'test.bak';
+eval BACKUP DATABASE foo TO 'test.bak' $compression;
 --replace_column 2 #
 SHOW WARNINGS;
 
+PURGE BACKUP LOGS;
 -- error ER_BAD_DB_ERROR
-BACKUP DATABASE test,foo,bdb,bar TO 'test.bak';
+eval BACKUP DATABASE test,foo,bdb,bar TO 'test.bak' $compression;
 --replace_column 2 #
 SHOW WARNINGS;
 
---echo Get last backup_id
-SELECT MAX(backup_id) INTO @bup_id FROM mysql.backup_history
-WHERE command LIKE "BACKUP DATABASE test,foo,bdb,bar TO%";
-
 --echo verify backup history and progress logs:
-SELECT backup_state,operation,backup_file FROM mysql.backup_history
-     WHERE backup_id=@bup_id;
-SELECT notes FROM mysql.backup_progress
-     WHERE backup_id=@bup_id;
+SELECT backup_state,operation,backup_file, command FROM mysql.backup_history;
+SELECT notes FROM mysql.backup_progress;
 
 #
 # Note: the following error is detected on parser level. Thus no 
 # backup_id is assigned and nothing is written to backup logs.
 #
+PURGE BACKUP LOGS;
 --echo # repeated database
 -- error ER_NONUNIQ_DB
-BACKUP DATABASE foo,test,bar,foo TO 'test.bak';
+eval BACKUP DATABASE foo,test,bar,foo TO 'test.bak' $compression;
 --replace_column 2 #
 SHOW WARNINGS;
 
+--echo verify backup history and progress logs for backup_state.
+SELECT backup_state,operation, backup_file, command FROM mysql.backup_history;
+SELECT notes FROM mysql.backup_progress;
+
 # Test that BACKUP/RESTORE statements are disable inside stored routines,
 # triggers and events.
 
@@ -181,111 +182,91 @@ DROP DATABASE bdb;
 #    Warning: Backup cannot include database 'mysql'
 
 # Scenario 1
+PURGE BACKUP LOGS;
 --echo Backup of mysql, information_schema scenario 1
 --error ER_BACKUP_CANNOT_INCLUDE_DB
-BACKUP DATABASE mysql TO 't.bak';
+eval BACKUP DATABASE mysql TO 't.bak' $compression;
 --replace_column 2 #
 SHOW WARNINGS;
 
---echo Get last backup_id
-SELECT MAX(backup_id) INTO @bup_id FROM mysql.backup_history
-WHERE command LIKE "BACKUP DATABASE mysql TO%";
-
 --echo verify backup history and progress logs:
-SELECT backup_state,operation, backup_file FROM mysql.backup_history
-     WHERE backup_id=@bup_id;
-SELECT notes FROM mysql.backup_progress
-     WHERE backup_id=@bup_id;
+SELECT backup_state,operation, backup_file, command FROM mysql.backup_history;
+SELECT notes FROM mysql.backup_progress;
 
 --error 0, 1
 --remove_file $MYSQLTEST_VARDIR/master-data/t.bak
 
 # Scenario 2
+PURGE BACKUP LOGS;
 --echo Backup of mysql, information_schema scenario 2
 --error ER_BACKUP_CANNOT_INCLUDE_DB
-BACKUP DATABASE information_schema TO 't.bak';
+eval BACKUP DATABASE information_schema TO 't.bak' $compression;
 --replace_column 2 #
 SHOW WARNINGS;
 
---echo Get last backup_id
-SELECT MAX(backup_id) INTO @bup_id FROM mysql.backup_history
-WHERE command LIKE "BACKUP DATABASE information_schema TO%";
-
 --echo verify backup history and progress logs:
-SELECT backup_state,operation, backup_file FROM mysql.backup_history
-     WHERE backup_id=@bup_id;
-SELECT  notes FROM mysql.backup_progress
-     WHERE backup_id=@bup_id;
+SELECT backup_state,operation, backup_file,command FROM mysql.backup_history;
+SELECT  notes FROM mysql.backup_progress;
 
 --error 0, 1
 --remove_file $MYSQLTEST_VARDIR/master-data/t.bak
 
 # Scenario 3
+PURGE BACKUP LOGS;
 --echo Backup of mysql, information_schema scenario 3
 --error ER_BACKUP_CANNOT_INCLUDE_DB
-BACKUP DATABASE mysql, information_schema TO 't.bak';
+eval BACKUP DATABASE mysql, information_schema TO 't.bak' $compression;
 --replace_column 2 #
 SHOW WARNINGS;
 
---echo Get last backup_id
-SELECT MAX(backup_id) INTO @bup_id FROM mysql.backup_history
-WHERE command LIKE "BACKUP DATABASE mysql, information_schema TO%";
-
 --echo verify backup history and progress logs:
-SELECT backup_state,operation, backup_file FROM mysql.backup_history
-     WHERE backup_id=@bup_id;
-SELECT notes FROM mysql.backup_progress
-     WHERE backup_id=@bup_id;
+SELECT backup_state,operation, backup_file,command FROM mysql.backup_history;
+SELECT notes FROM mysql.backup_progress;
 
 --error 0, 1
 --remove_file $MYSQLTEST_VARDIR/master-data/t.bak
 
 # Scenario 4
+PURGE BACKUP LOGS;
 --echo Backup of mysql, information_schema scenario 4
 --error ER_BACKUP_CANNOT_INCLUDE_DB
-BACKUP DATABASE mysql, test TO 't.bak';
+eval BACKUP DATABASE mysql, test TO 't.bak' $compression;
 --replace_column 2 #
 SHOW WARNINGS;
 
---echo Get last backup_id
-SELECT MAX(backup_id) INTO @bup_id FROM mysql.backup_history
-WHERE command LIKE "BACKUP DATABASE mysql, test TO%";
-
 --echo verify backup history and progress logs:
-SELECT backup_state,operation, backup_file FROM mysql.backup_history
-     WHERE backup_id=@bup_id;
-SELECT notes FROM mysql.backup_progress
-     WHERE backup_id=@bup_id;
+SELECT backup_state,operation, backup_file,command FROM mysql.backup_history;
+SELECT notes FROM mysql.backup_progress;
 
 --error 0, 1
 --remove_file $MYSQLTEST_VARDIR/master-data/t.bak
 
 # Scenario 5
+PURGE BACKUP LOGS;
 --echo Backup of mysql, information_schema scenario 5
 --error ER_BACKUP_CANNOT_INCLUDE_DB
-BACKUP DATABASE information_schema, test TO 't.bak';
+eval BACKUP DATABASE information_schema, test TO 't.bak' $compression;
 --replace_column 2 #
 SHOW WARNINGS;
 
+--echo verify backup history and progress logs:
+SELECT backup_state,operation, backup_file,command FROM mysql.backup_history;
+SELECT notes FROM mysql.backup_progress;
+
 --error 0, 1
 --remove_file $MYSQLTEST_VARDIR/master-data/t.bak
 
 # Scenario 6
+PURGE BACKUP LOGS;
 --echo Backup of mysql, information_schema scenario 6
 --error ER_BACKUP_CANNOT_INCLUDE_DB
-BACKUP DATABASE mysql, information_schema, test TO 't.bak';
+eval BACKUP DATABASE mysql, information_schema, test TO 't.bak' $compression;
 --replace_column 2 #
 SHOW WARNINGS;
 
---echo Get last backup_id
-SELECT MAX(backup_id) INTO @bup_id FROM mysql.backup_history
-WHERE command LIKE "BACKUP DATABASE mysql, information_schema, test TO%";
-
 --echo verify backup history and progress logs:
-SELECT backup_state,operation, backup_file FROM mysql.backup_history
-     WHERE backup_id=@bup_id;
-SELECT notes FROM mysql.backup_progress
-     WHERE backup_id=@bup_id;
+SELECT backup_state,operation, backup_file, command FROM mysql.backup_history;
+SELECT notes FROM mysql.backup_progress;
 
 --error 0, 1
 --remove_file $MYSQLTEST_VARDIR/master-data/t.bak
@@ -306,7 +287,7 @@ INSERT INTO test_ob_error.t1 VALUES (1),
 # Backup the database to ensure db is ok.
 --echo Backup the database;
 --replace_column 1 #
-BACKUP DATABASE test_ob_error TO 'ob_err.bak';
+eval BACKUP DATABASE test_ob_error TO 'ob_err.bak' $compression;
 --remove_file $MYSQLTEST_VARDIR/master-data/ob_err.bak
 
 # Drop one of the tables and try a backup.
@@ -315,7 +296,7 @@ DROP TABLE mysql.backup_history;
 # Try to backup the database (should be error).
 --echo Backup the database;
 --error ER_BACKUP_PROGRESS_TABLES
-BACKUP DATABASE test_ob_error TO 'ob_err.bak';
+eval BACKUP DATABASE test_ob_error TO 'ob_err.bak' $compression;
 --error 0,1
 --remove_file $MYSQLTEST_VARDIR/master-data/ob_err.bak
 --replace_column 2 #
@@ -332,7 +313,7 @@ DROP TABLE mysql.backup_progress;
 # Try to backup the database (should be error).
 --echo Backup the database;
 --error ER_BACKUP_PROGRESS_TABLES
-BACKUP DATABASE test_ob_error TO 'ob_err.bak';
+eval BACKUP DATABASE test_ob_error TO 'ob_err.bak' $compression;
 
 --error 0,1
 --remove_file $MYSQLTEST_VARDIR/master-data/ob_err.bak
@@ -363,6 +344,7 @@ DROP DATABASE IF EXISTS db1;
 
 CREATE DATABASE db1;
 
+PURGE BACKUP LOGS;
 connection con2;
 
 --echo start backup but stop just before adding metadata to backup image
@@ -395,6 +377,10 @@ SET DEBUG_SYNC= 'reset';
 
 connection con1;
 
+--echo verify backup history and progress logs:
+SELECT backup_state,operation, backup_file, command FROM mysql.backup_history;
+SELECT notes FROM mysql.backup_progress;
+
 --disable_warnings
 DROP DATABASE IF EXISTS db1;
 
@@ -413,21 +399,14 @@ SET DEBUG_SYNC= 'reset';
 
 --echo Setting debug point that will make backup fail when adding the
 --echo trigger metadata
-
+PURGE BACKUP LOGS;
 SET SESSION DEBUG='+d,backup_fail_add_trigger';
 --error ER_BACKUP_GET_META_TRIGGER
-BACKUP DATABASE db1 TO 'bup_db1.bak';
-SET SESSION DEBUG='-d';
-
---echo Get last backup_id
-SELECT MAX(backup_id) INTO @bup_id FROM mysql.backup_history
-WHERE command LIKE "BACKUP DATABASE db1 TO%";
+eval BACKUP DATABASE db1 TO 'bup_db1.bak' $compression;
 
 --echo verify backup history and progress logs:
-SELECT backup_state,operation, backup_file FROM mysql.backup_history
-     WHERE backup_id=@bup_id;
-SELECT notes FROM mysql.backup_progress
-     WHERE backup_id=@bup_id;
+SELECT backup_state,operation, backup_file,command FROM mysql.backup_history;
+SELECT notes FROM mysql.backup_progress;
 
 SET DEBUG_SYNC= 'reset';
 DROP DATABASE db1;
@@ -451,7 +430,7 @@ INSERT INTO table1 VALUES ('Inserted bef
 --echo
 --echo Backup database
 --replace_column 1 #
-BACKUP DATABASE db1 TO 'overwrite.bak';
+eval BACKUP DATABASE db1 TO 'overwrite.bak' $compression;
 
 --echo
 --echo Insert more data and display
@@ -481,6 +460,7 @@ RESTORE FROM 'overwrite.bak';
 --echo
 --echo Show that inserted value 2 is not there
 SELECT * FROM table1;
+--remove_file $MYSQLTEST_VARDIR/master-data/overwrite.bak
 
 --echo #
 --echo # Test error handling by backup code when injecting commit blocker error.
@@ -488,28 +468,32 @@ SELECT * FROM table1;
 
 SET SESSION DEBUG='+d,backup_grl_fail';
 --error ER_BACKUP_SYNCHRONIZE
-BACKUP DATABASE db1 TO 'overwrite1.bak';
+eval BACKUP DATABASE db1 TO 'overwrite1.bak' $compression;
 SET SESSION DEBUG='-d';
 
 --echo
-
+PURGE BACKUP LOGS;
 SET SESSION DEBUG='+d,backup_grl_block_commit_fail';
 --error ER_BACKUP_SYNCHRONIZE
-BACKUP DATABASE db1 TO 'overwrite1.bak';
+eval BACKUP DATABASE db1 TO 'overwrite1.bak' $compression;
 SET SESSION DEBUG='-d';
 
+--echo verify backup history and progress logs:
+SELECT backup_state,operation, backup_file,command FROM mysql.backup_history;
+SELECT notes FROM mysql.backup_progress;
+
 --echo #
 --echo # Test that BACKUP and RESTORE clears warning stack
 --echo #
 
 --replace_column 1 #
-BACKUP DATABASE db1 TO 'test.bak';
+eval BACKUP DATABASE db1 TO 'test.bak' $compression;
 
 --echo # Generate warning - test.bak cannot be overwritten
 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
 --replace_regex /Errcode: [0-9]+/Errcode: #/
 --error 1
-BACKUP DATABASE db1 TO 'test.bak';
+eval BACKUP DATABASE db1 TO 'test.bak' $compression;
 --replace_column 2 #
 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
 --replace_regex /Errcode: [0-9]+/Errcode: #/
@@ -518,22 +502,27 @@ SHOW WARNINGS;
 
 --echo # Test that there are no warnings after successful BACKUP
 --replace_column 1 #
-BACKUP DATABASE db1 TO 'newtest.bak';
+eval BACKUP DATABASE db1 TO 'newtest.bak' $compression;
 --replace_column 2 #
 SHOW WARNINGS;
 --echo
 
+PURGE BACKUP LOGS;
 --echo # Generate warning - test.bak cannot be overwritten
 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
 --replace_regex /Errcode: [0-9]+/Errcode: #/
 --error 1
-BACKUP DATABASE db1 TO 'test.bak';
+eval BACKUP DATABASE db1 TO 'test.bak' $compression;
 --replace_column 2 #
 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
 --replace_regex /Errcode: [0-9]+/Errcode: #/
 SHOW WARNINGS;
 --echo
 
+--echo verify backup history and progress logs:
+SELECT backup_state,operation, backup_file,command FROM mysql.backup_history;
+SELECT notes FROM mysql.backup_progress;
+
 --echo # Test that there are no warnings after successful RESTORE
 --replace_column 1 #
 RESTORE FROM 'newtest.bak' OVERWRITE;
@@ -561,12 +550,12 @@ INSERT INTO table2 values (1),(2);
 DELIMITER ||;
 CREATE TRIGGER db1.trg AFTER INSERT ON db1.table2 FOR EACH ROW
 BEGIN
-  INSERT INTO db1.table1(v) VALUES ('Test trigger fired');   
+  INSERT INTO db1.table1(v) VALUES ('Test trigger fired');
 END;||
 DELIMITER ;||
 
 --replace_column 1 #
-BACKUP DATABASE db1 TO 'errorinject.bak';
+eval BACKUP DATABASE db1 TO 'errorinject.bak' $compression;
 
 DROP DATABASE db1;
 
@@ -583,7 +572,7 @@ SET SESSION DEBUG='-d';
 
 --echo #
 --echo # Error injection in RESTORE: Get next chunk;
---echo # Called from prepare_for_restore, after read_header 
+--echo # Called from prepare_for_restore, after read_header
 --echo #
 SET SESSION DEBUG='+d,restore_prepare_next_chunk_1';
 --error ER_BACKUP_NEXT_CHUNK
@@ -600,7 +589,7 @@ SET SESSION DEBUG='-d';
 
 --echo #
 --echo # Error injection in RESTORE: Get next chunk;
---echo # Called from prepare_for_restore, after read_catalog 
+--echo # Called from prepare_for_restore, after read_catalog
 --echo #
 SET SESSION DEBUG='+d,restore_prepare_next_chunk_2';
 --error ER_BACKUP_NEXT_CHUNK
@@ -620,7 +609,7 @@ DROP DATABASE db1;
 
 --echo #
 --echo # Error injection in RESTORE: Get next chunk;
---echo # Called from do_restore 
+--echo # Called from do_restore
 --echo #
 SET SESSION DEBUG='+d,restore_stream_next_chunk';
 --error ER_BACKUP_NEXT_CHUNK
@@ -663,16 +652,6 @@ SET SESSION DEBUG='-d';
 DROP DATABASE db1;
 
 --echo #
---echo # Error injection in RESTORE: Restore trigger
---echo #
-SET SESSION DEBUG='+d,restore_trigger';
---error ER_BACKUP_CANT_RESTORE_TRIGGER
-RESTORE FROM 'errorinject.bak';
-SET SESSION DEBUG='-d';
-
-DROP DATABASE db1;
-
---echo #
 --echo # Error injection in RESTORE: Read summary
 --echo #
 SET SESSION DEBUG='+d,restore_read_summary';
@@ -686,6 +665,7 @@ SET SESSION DEBUG='-d';
 
 DROP DATABASE db1;
 
---remove_file $MYSQLTEST_VARDIR/master-data/overwrite.bak
 --remove_file $MYSQLTEST_VARDIR/master-data/errorinject.bak
 
+
+

=== added file 'mysql-test/suite/backup/t/backup_errors_compression-master.opt'
--- a/mysql-test/suite/backup/t/backup_errors_compression-master.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/backup/t/backup_errors_compression-master.opt	2009-02-06 16:45:39 +0000
@@ -0,0 +1 @@
+--secure-file-priv=

=== added file 'mysql-test/suite/backup/t/backup_errors_compression.test'
--- a/mysql-test/suite/backup/t/backup_errors_compression.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/backup/t/backup_errors_compression.test	2009-02-06 16:45:39 +0000
@@ -0,0 +1,9 @@
+#
+# This test is created as part of WL#4408
+# Test all the errors for backup command with compression.
+# Therefore we will extend the backup_errors test for testing error
+# handling of backup with compression.
+#
+
+let $compression=WITH COMPRESSION;
+--source suite/backup/t/backup_errors.test 

Thread
bzr commit into mysql-6.0-backup branch (hema:2761) WL#4408Hema Sridharan6 Feb