List:Commits« Previous MessageNext Message »
From:Alexander Nozdrin Date:October 30 2008 12:40pm
Subject:bzr push into mysql-6.0 branch (alik:2719)
View as plain text  
 2719 Alexander Nozdrin	2008-10-30 [merge]
      Pull from 6.0

=== modified file 'mysql-test/lib/mtr_report.pl'
--- a/mysql-test/lib/mtr_report.pl	2008-10-20 19:13:22 +0000
+++ b/mysql-test/lib/mtr_report.pl	2008-10-27 13:06:21 +0000
@@ -355,7 +355,7 @@ sub mtr_report_stats ($) {
 		# The tablespace test triggers error below on purpose
 		($testname eq 'backup.backup_tablespace') and
 		(
-		  /Restore: Tablespace .* needed by tables being restored has changed on the server/
+		  /Restore: Tablespace .* needed by tables being restored, but the current/
 		) or
                 
 		# The backup_securefilepriv test triggers error below on purpose

=== modified file 'mysql-test/suite/backup/r/backup_commit_restore.result'
--- a/mysql-test/suite/backup/r/backup_commit_restore.result	2008-10-07 17:15:44 +0000
+++ b/mysql-test/suite/backup/r/backup_commit_restore.result	2008-10-23 08:13:54 +0000
@@ -81,7 +81,7 @@ s1
 a3
 COMMIT;
 SET @@autocommit=0;
-CREATE TABLE t4 (s1 CHAR(2));
+CREATE TABLE t4 (s1 CHAR(2)) ENGINE=falcon;
 INSERT INTO t1 VALUES ('a4');
 INSERT INTO t2 VALUES ('a4');
 INSERT INTO t3 VALUES ('a4');
@@ -188,10 +188,12 @@ a4
 a5
 COMMIT;
 SET @@autocommit=1;
+CREATE TABLE t5 (s1 CHAR(2)) ENGINE=falcon;
 INSERT INTO t1 VALUES ('a6');
 INSERT INTO t2 VALUES ('a6');
 INSERT INTO t3 VALUES ('a6');
 INSERT INTO t4 VALUES ('a6');
+INSERT INTO t5 VALUES ('a6');
 BACKUP DATABASE commit_test TO '86';
 backup_id
 #
@@ -199,6 +201,7 @@ SET @@autocommit=0;
 RESTORE FROM '86';
 backup_id
 #
+DROP TABLE t5;
 SELECT * FROM t1;
 s1
 a1

=== modified file 'mysql-test/suite/backup/r/backup_logs.result'
--- a/mysql-test/suite/backup/r/backup_logs.result	2008-10-07 17:15:44 +0000
+++ b/mysql-test/suite/backup/r/backup_logs.result	2008-10-15 20:00:48 +0000
@@ -9,6 +9,7 @@ AND character_set_name LIKE 'utf8' 
 ORDER BY column_name;
 column_name	character_set_name
 backup_file	utf8
+backup_file_path	utf8
 backup_state	utf8
 binlog_file	utf8
 command	utf8
@@ -115,6 +116,7 @@ stop_time	#
 host_or_server_name	localhost
 username	root
 backup_file	#
+backup_file_path	#
 user_comment	
 command	BACKUP DATABASE backup_logs to 'backup_logs_orig.bak'
 drivers	MyISAM, Default, Snapshot
@@ -175,6 +177,7 @@ stop_time	#
 host_or_server_name	localhost
 username	root
 backup_file	#
+backup_file_path	#
 user_comment	
 command	RESTORE FROM 'backup_logs_orig.bak'
 drivers	MyISAM, Default, Snapshot

=== modified file 'mysql-test/suite/backup/r/backup_tablespace.result'
--- a/mysql-test/suite/backup/r/backup_tablespace.result	2008-10-07 17:15:44 +0000
+++ b/mysql-test/suite/backup/r/backup_tablespace.result	2008-10-13 12:37:10 +0000
@@ -50,7 +50,7 @@ DROP TABLESPACE bup_ts ENGINE=FALCON;
 CREATE TABLESPACE bup_ts ADD DATAFILE 'different.dat' ENGINE=FALCON;
 Now restore the database.
 RESTORE FROM 'backup_ts.bak';
-ERROR HY000: Tablespace `bup_ts` needed by tables being restored has changed on the server. The original definition of the required tablespace is 'CREATE TABLESPACE `bup_ts` ADD DATAFILE 'bup_ts.dat' COMMENT = 'test tablespace backup' ENGINE=Falcon' while the same tablespace is defined o
+ERROR HY000: Tablespace `bup_ts` needed by tables being restored, but the current tablespace definition differs from how it was when backup was made.
 Cleanup
 DROP DATABASE IF EXISTS backup_ts;
 DROP TABLESPACE bup_ts ENGINE=FALCON;

=== modified file 'mysql-test/suite/backup/r/backup_triggers_and_events.result'
--- a/mysql-test/suite/backup/r/backup_triggers_and_events.result	2008-10-07 17:15:44 +0000
+++ b/mysql-test/suite/backup/r/backup_triggers_and_events.result	2008-10-24 08:11:18 +0000
@@ -34,7 +34,7 @@ CALL trg_msg(NEW.a);
 CREATE TRIGGER before_upd BEFORE UPDATE ON t1 FOR EACH ROW 
 CALL trg_msg(NEW.a);
 ||
-CREATE TRIGGER before_del BEFORE DELETE ON t1 FOR EACH ROW 
+CREATE TRIGGER ev BEFORE DELETE ON t1 FOR EACH ROW 
 CALL trg_msg(OLD.a);
 ||
 USE test||
@@ -134,7 +134,7 @@ Definer	root@localhost
 character_set_client	#
 collation_connection	latin1_swedish_ci
 Database Collation	latin1_swedish_ci
-Trigger	before_del
+Trigger	ev
 Event	DELETE
 Table	t1
 Statement	CALL trg_msg(OLD.a)

=== modified file 'mysql-test/suite/backup/t/backup_commit_restore.test'
--- a/mysql-test/suite/backup/t/backup_commit_restore.test	2008-10-07 17:15:44 +0000
+++ b/mysql-test/suite/backup/t/backup_commit_restore.test	2008-10-23 08:13:54 +0000
@@ -1,5 +1,6 @@
 --source include/have_innodb.inc
 --source include/not_embedded.inc
+--source include/have_falcon.inc
 
 # Test that it is not possible to rollback restore.  That is, that an
 # automatic commit is performed as part of restore.  This test both
@@ -70,7 +71,7 @@ COMMIT;
 
 # Test using InnoDB, Memory, MyISAM and Falcon (Consistent Snapshot)
 SET @@autocommit=0;
-CREATE TABLE t4 (s1 CHAR(2));
+CREATE TABLE t4 (s1 CHAR(2)) ENGINE=falcon;
 INSERT INTO t1 VALUES ('a4');
 INSERT INTO t2 VALUES ('a4');
 INSERT INTO t3 VALUES ('a4');
@@ -120,10 +121,12 @@ COMMIT;
 
 # Test doing backup with auto-commit on and restore with auto-commit off
 SET @@autocommit=1;
+CREATE TABLE t5 (s1 CHAR(2)) ENGINE=falcon;
 INSERT INTO t1 VALUES ('a6');
 INSERT INTO t2 VALUES ('a6');
 INSERT INTO t3 VALUES ('a6');
 INSERT INTO t4 VALUES ('a6');
+INSERT INTO t5 VALUES ('a6');
 
 replace_column 1 #;
 BACKUP DATABASE commit_test TO '86';
@@ -131,6 +134,9 @@ BACKUP DATABASE commit_test TO '86';
 SET @@autocommit=0;
 replace_column 1 #;
 RESTORE FROM '86';
+
+#Test of scenario from BUG#34205
+DROP TABLE t5;
 
 SELECT * FROM t1;
 SELECT * FROM t2;

=== modified file 'mysql-test/suite/backup/t/backup_ddl_blocker.test'
--- a/mysql-test/suite/backup/t/backup_ddl_blocker.test	2008-10-07 17:15:44 +0000
+++ b/mysql-test/suite/backup/t/backup_ddl_blocker.test	2008-10-24 08:25:48 +0000
@@ -251,7 +251,7 @@ RESTORE FROM "bup_ddl_blocker.bak";
 --echo con1: Table t4 should not have new column in restored data.
 DESCRIBE bup_ddl_blocker.t1;
 DESCRIBE bup_ddl_blocker.t2;
---error 1146
+--error ER_NO_SUCH_TABLE
 DESCRIBE bup_ddl_blocker.t3;
 DESCRIBE bup_ddl_blocker.t4;
 
@@ -379,7 +379,7 @@ reap;
 --echo con1: Table t2 should not have new column in restored data.
 --echo con1: Table t3 should be in restored data.
 --echo con1: Table t4 should have new column in restored data.
---error 1146
+--error ER_NO_SUCH_TABLE
 DESCRIBE bup_ddl_blocker.t1;
 DESCRIBE bup_ddl_blocker.t2;
 DESCRIBE bup_ddl_blocker.t3;

=== modified file 'mysql-test/suite/backup/t/backup_fkey.test'
--- a/mysql-test/suite/backup/t/backup_fkey.test	2008-10-07 17:15:44 +0000
+++ b/mysql-test/suite/backup/t/backup_fkey.test	2008-10-24 08:25:48 +0000
@@ -49,7 +49,7 @@ INSERT INTO backup_fkey.child VALUES (2,
 INSERT INTO backup_fkey.child VALUES (3, 2);
 
 # Show that foreign key constraints are enforced.
---error 1452
+--error ER_NO_REFERENCED_ROW_2
 INSERT INTO backup_fkey.child VALUES (4, 6);
 
 # Backup the database with fkey constraints preserved.

=== modified file 'mysql-test/suite/backup/t/backup_logs.test'
--- a/mysql-test/suite/backup/t/backup_logs.test	2008-10-07 17:15:44 +0000
+++ b/mysql-test/suite/backup/t/backup_logs.test	2008-10-15 20:00:48 +0000
@@ -134,7 +134,7 @@ reap;
 connection con1;
 
 #Show results
---replace_column 1 # 2 # 3 # 4 # 10 # 11 # 12 # 15 #
+--replace_column 1 # 2 # 3 # 4 # 10 # 11 # 12 # 15 # 16 #
 --query_vertical SELECT ob.* FROM mysql.backup_history AS ob JOIN backup_logs.t1_res AS t1 ON ob.backup_id = t1.id;
 --replace_column 1 # 3 # 4 #
 SELECT obp.* FROM mysql.backup_progress AS obp JOIN backup_logs.t1_res AS t1 ON obp.backup_id = t1.id;
@@ -185,7 +185,7 @@ SET DEBUG_SYNC= 'now WAIT_FOR complete';
 DELETE FROM backup_logs.t1_res;
 SELECT MAX(backup_id) INTO @bup_id FROM mysql.backup_history WHERE command LIKE "RESTORE FROM%";
 INSERT INTO backup_logs.t1_res (id) VALUES (@bup_id);
---replace_column 1 # 2 # 3 # 4 # 10 # 11 # 12 # 15 #
+--replace_column 1 # 2 # 3 # 4 # 10 # 11 # 12 # 15 # 16 #
 --query_vertical SELECT ob.* FROM mysql.backup_history AS ob JOIN backup_logs.t1_res AS t1 ON ob.backup_id = t1.id;
 --replace_column 1 # 3 # 4 #
 SELECT obp.* FROM mysql.backup_progress AS obp JOIN backup_logs.t1_res AS t1 ON obp.backup_id = t1.id;

=== modified file 'mysql-test/suite/backup/t/backup_security.test'
--- a/mysql-test/suite/backup/t/backup_security.test	2008-10-07 17:15:44 +0000
+++ b/mysql-test/suite/backup/t/backup_security.test	2008-10-24 08:25:48 +0000
@@ -49,13 +49,13 @@ connect (no_rights,localhost,bup_no_righ
 
 --echo no_rights: Attempting backup. Should fail with error 1227
 --replace_column 1 #
---error 1227
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
 BACKUP DATABASE backup_test to 'bup_no_rights.bak';
 SHOW ERRORS;
 
 --echo no_rights: Attempting restore. Should fail with error 1227
 --replace_column 1 #
---error 1227
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
 RESTORE FROM 'bup_no_rights.bak';
 SHOW ERRORS;
 

=== modified file 'mysql-test/suite/backup/t/backup_triggers_and_events.test'
--- a/mysql-test/suite/backup/t/backup_triggers_and_events.test	2008-10-07 17:15:44 +0000
+++ b/mysql-test/suite/backup/t/backup_triggers_and_events.test	2008-10-24 08:11:18 +0000
@@ -79,7 +79,9 @@ CREATE TRIGGER before_upd BEFORE UPDATE 
 CALL trg_msg(NEW.a);
 ||
 
-CREATE TRIGGER before_del BEFORE DELETE ON t1 FOR EACH ROW 
+# Create a trigger with the same name as an event to test that backup is
+# able to handle that.  (Bug#38810)
+CREATE TRIGGER ev BEFORE DELETE ON t1 FOR EACH ROW 
 CALL trg_msg(OLD.a);
 ||
 

=== modified file 'mysql-test/suite/funcs_1/r/is_columns_mysql.result'
--- a/mysql-test/suite/funcs_1/r/is_columns_mysql.result	2008-09-03 12:39:48 +0000
+++ b/mysql-test/suite/funcs_1/r/is_columns_mysql.result	2008-10-21 16:35:31 +0000
@@ -3,12 +3,13 @@ WHERE table_schema = 'mysql'
 ORDER BY table_schema, table_name, column_name;
 TABLE_CATALOG	TABLE_SCHEMA	TABLE_NAME	COLUMN_NAME	ORDINAL_POSITION	COLUMN_DEFAULT	IS_NULLABLE	DATA_TYPE	CHARACTER_MAXIMUM_LENGTH	CHARACTER_OCTET_LENGTH	NUMERIC_PRECISION	NUMERIC_SCALE	CHARACTER_SET_NAME	COLLATION_NAME	COLUMN_TYPE	COLUMN_KEY	EXTRA	PRIVILEGES	COLUMN_COMMENT	STORAGE	FORMAT
 NULL	mysql	backup_history	backup_file	15		NO	char	100	400	NULL	NULL	utf8	utf8_general_ci	char(100)			select,insert,update,references	The name of the file	Default	Default
+NULL	mysql	backup_history	backup_file_path	16		NO	varchar	512	2048	NULL	NULL	utf8	utf8_general_ci	varchar(512)			select,insert,update,references	The full path to the backup image file	Default	Default
 NULL	mysql	backup_history	backup_id	1	NULL	NO	bigint	NULL	NULL	19	0	NULL	NULL	bigint(20) unsigned			select,insert,update,references	Surrogate key for (near) duplicate entries	Default	Default
 NULL	mysql	backup_history	backup_state	5	NULL	NO	enum	14	56	NULL	NULL	utf8	utf8_general_ci	enum('complete','starting','validity point','running','error','cancel')			select,insert,update,references	Status of current operation	Default	Default
 NULL	mysql	backup_history	binlog_file	4		NO	char	64	256	NULL	NULL	utf8	utf8_general_ci	char(64)			select,insert,update,references	The recorded binlog filename at time of backup/restore	Default	Default
 NULL	mysql	backup_history	binlog_pos	3	0	NO	int	NULL	NULL	10	0	NULL	NULL	int(10) unsigned			select,insert,update,references	The recorded binlog position of backup/restore	Default	Default
-NULL	mysql	backup_history	command	17		NO	varchar	512	2048	NULL	NULL	utf8	utf8_general_ci	varchar(512)			select,insert,update,references	The command used to issue operation	Default	Default
-NULL	mysql	backup_history	drivers	18		NO	varchar	100	400	NULL	NULL	utf8	utf8_general_ci	varchar(100)			select,insert,update,references	The name of the storage engines used in the operation	Default	Default
+NULL	mysql	backup_history	command	18		NO	varchar	512	2048	NULL	NULL	utf8	utf8_general_ci	varchar(512)			select,insert,update,references	The command used to issue operation	Default	Default
+NULL	mysql	backup_history	drivers	19		NO	varchar	100	400	NULL	NULL	utf8	utf8_general_ci	varchar(100)			select,insert,update,references	The name of the storage engines used in the operation	Default	Default
 NULL	mysql	backup_history	error_num	7	0	NO	int	NULL	NULL	10	0	NULL	NULL	int(11)			select,insert,update,references	The error from this run 0 == none	Default	Default
 NULL	mysql	backup_history	host_or_server_name	13		NO	char	30	120	NULL	NULL	utf8	utf8_general_ci	char(30)			select,insert,update,references	The server name where operation ran	Default	Default
 NULL	mysql	backup_history	num_objects	8	0	NO	int	NULL	NULL	10	0	NULL	NULL	int(10) unsigned			select,insert,update,references	The number of objects in the backup	Default	Default
@@ -18,7 +19,7 @@ NULL	mysql	backup_history	start_time	11	
 NULL	mysql	backup_history	stop_time	12	0000-00-00 00:00:00	NO	datetime	NULL	NULL	NULL	NULL	NULL	NULL	datetime			select,insert,update,references	The date/time of end of operation	Default	Default
 NULL	mysql	backup_history	total_bytes	9	0	NO	bigint	NULL	NULL	19	0	NULL	NULL	bigint(20) unsigned			select,insert,update,references	The size of the backup repository in bytes	Default	Default
 NULL	mysql	backup_history	username	14		NO	char	30	120	NULL	NULL	utf8	utf8_general_ci	char(30)			select,insert,update,references	The user name who ran the operation	Default	Default
-NULL	mysql	backup_history	user_comment	16		NO	varchar	200	800	NULL	NULL	utf8	utf8_general_ci	varchar(200)			select,insert,update,references	The comment from user entered at command line	Default	Default
+NULL	mysql	backup_history	user_comment	17		NO	varchar	200	800	NULL	NULL	utf8	utf8_general_ci	varchar(200)			select,insert,update,references	The comment from user entered at command line	Default	Default
 NULL	mysql	backup_history	validity_point_time	10	0000-00-00 00:00:00	NO	datetime	NULL	NULL	NULL	NULL	NULL	NULL	datetime			select,insert,update,references	The time of the validity point.	Default	Default
 NULL	mysql	backup_progress	backup_id	1	NULL	NO	bigint	NULL	NULL	19	0	NULL	NULL	bigint(20) unsigned			select,insert,update,references	Key for backup_history table entries	Default	Default
 NULL	mysql	backup_progress	error_num	7	0	NO	int	NULL	NULL	10	0	NULL	NULL	int(11)			select,insert,update,references	The error from this run 0 == none	Default	Default
@@ -329,6 +330,7 @@ NULL	mysql	backup_history	stop_time	date
 4.0000	mysql	backup_history	host_or_server_name	char	30	120	utf8	utf8_general_ci	char(30)
 4.0000	mysql	backup_history	username	char	30	120	utf8	utf8_general_ci	char(30)
 4.0000	mysql	backup_history	backup_file	char	100	400	utf8	utf8_general_ci	char(100)
+4.0000	mysql	backup_history	backup_file_path	varchar	512	2048	utf8	utf8_general_ci	varchar(512)
 4.0000	mysql	backup_history	user_comment	varchar	200	800	utf8	utf8_general_ci	varchar(200)
 4.0000	mysql	backup_history	command	varchar	512	2048	utf8	utf8_general_ci	varchar(512)
 4.0000	mysql	backup_history	drivers	varchar	100	400	utf8	utf8_general_ci	varchar(100)

=== modified file 'scripts/mysql_system_tables.sql'
--- a/scripts/mysql_system_tables.sql	2008-09-03 12:39:48 +0000
+++ b/scripts/mysql_system_tables.sql	2008-10-15 20:00:48 +0000
@@ -82,7 +82,7 @@ DROP PREPARE stmt;
 
 CREATE TABLE IF NOT EXISTS event ( db char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', name char(64) CHARACTER SET utf8 NOT NULL default '', body longblob NOT NULL, definer char(77) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', execute_at DATETIME default NULL, interval_value int(11) default NULL, interval_field ENUM('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK','SECOND','MICROSECOND','YEAR_MONTH','DAY_HOUR','DAY_MINUTE','DAY_SECOND','HOUR_MINUTE','HOUR_SECOND','MINUTE_SECOND','DAY_MICROSECOND','HOUR_MICROSECOND','MINUTE_MICROSECOND','SECOND_MICROSECOND') default NULL, created TIMESTAMP NOT NULL, modified TIMESTAMP NOT NULL, last_executed DATETIME default NULL, starts DATETIME default NULL, ends DATETIME default NULL, status ENUM('ENABLED','DISABLED','SLAVESIDE_DISABLED') NOT NULL default 'ENABLED', on_completion ENUM('DROP','PRESERVE') NOT NULL default 'DROP', sql_mode  set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') DEFAULT '' NOT NULL, comment char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', originator int(10) NOT NULL, time_zone char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM', character_set_client char(32) collate utf8_bin, collation_connection char(32) collate utf8_bin, db_collation char(32) collate utf8_bin, body_utf8 longblob, PRIMARY KEY (db, name) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT 'Events';
 
-CREATE TABLE IF NOT EXISTS backup_history ( backup_id BIGINT UNSIGNED NOT NULL COMMENT 'Surrogate key for (near) duplicate entries', process_id INT UNSIGNED NOT NULL COMMENT 'The process id that operation ran as', binlog_pos INT UNSIGNED  NOT NULL DEFAULT 0 COMMENT 'The recorded binlog position of backup/restore', binlog_file CHAR(64)  NOT NULL DEFAULT '' COMMENT 'The recorded binlog filename at time of backup/restore', backup_state ENUM('complete', 'starting', 'validity point', 'running', 'error', 'cancel') NOT NULL COMMENT 'Status of current operation', operation ENUM('backup', 'restore') NOT NULL COMMENT 'Type of operation', error_num INT NOT NULL DEFAULT 0 COMMENT 'The error from this run 0 == none', num_objects INT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'The number of objects in the backup', total_bytes BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'The size of the backup repository in bytes', validity_point_time datetime NOT NULL DEFAULT 0 COMMENT 'The time of the validity point.', start_time datetime NOT NULL DEFAULT 0 COMMENT 'The date/time of start of operation', stop_time datetime NOT NULL DEFAULT 0 COMMENT 'The date/time of end of operation', host_or_server_name CHAR (30)  NOT NULL DEFAULT '' COMMENT 'The server name where operation ran', username CHAR (30)  NOT NULL DEFAULT '' COMMENT 'The user name who ran the operation', backup_file CHAR (100) NOT NULL DEFAULT ''  COMMENT 'The name of the file', user_comment VARCHAR (200) NOT NULL DEFAULT ''  COMMENT 'The comment from user entered at command line', command VARCHAR (512)  NOT NULL DEFAULT '' COMMENT 'The command used to issue operation', drivers VARCHAR (100) NOT NULL DEFAULT '' COMMENT 'The name of the storage engines used in the operation') ENGINE=CSV DEFAULT CHARACTER SET utf8;
+CREATE TABLE IF NOT EXISTS backup_history ( backup_id BIGINT UNSIGNED NOT NULL COMMENT 'Surrogate key for (near) duplicate entries', process_id INT UNSIGNED NOT NULL COMMENT 'The process id that operation ran as', binlog_pos INT UNSIGNED  NOT NULL DEFAULT 0 COMMENT 'The recorded binlog position of backup/restore', binlog_file CHAR(64)  NOT NULL DEFAULT '' COMMENT 'The recorded binlog filename at time of backup/restore', backup_state ENUM('complete', 'starting', 'validity point', 'running', 'error', 'cancel') NOT NULL COMMENT 'Status of current operation', operation ENUM('backup', 'restore') NOT NULL COMMENT 'Type of operation', error_num INT NOT NULL DEFAULT 0 COMMENT 'The error from this run 0 == none', num_objects INT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'The number of objects in the backup', total_bytes BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'The size of the backup repository in bytes', validity_point_time datetime NOT NULL DEFAULT 0 COMMENT 'The time of the validity point.', start_time datetime NOT NULL DEFAULT 0 COMMENT 'The date/time of start of operation', stop_time datetime NOT NULL DEFAULT 0 COMMENT 'The date/time of end of operation', host_or_server_name CHAR (30)  NOT NULL DEFAULT '' COMMENT 'The server name where operation ran', username CHAR (30)  NOT NULL DEFAULT '' COMMENT 'The user name who ran the operation', backup_file CHAR (100) NOT NULL DEFAULT ''  COMMENT 'The name of the file', backup_file_path VARCHAR (512) NOT NULL DEFAULT '' COMMENT 'The full path to the backup image file', user_comment VARCHAR (200) NOT NULL DEFAULT ''  COMMENT 'The comment from user entered at command line', command VARCHAR (512)  NOT NULL DEFAULT '' COMMENT 'The command used to issue operation', drivers VARCHAR (100) NOT NULL DEFAULT '' COMMENT 'The name of the storage engines used in the operation') ENGINE=CSV DEFAULT CHARACTER SET utf8;
 
 CREATE TABLE IF NOT EXISTS backup_progress ( backup_id BIGINT UNSIGNED NOT NULL COMMENT 'Key for backup_history table entries', object CHAR (30) NOT NULL DEFAULT '' COMMENT 'The object being operated on', start_time datetime NOT NULL DEFAULT 0 COMMENT 'The date/time of start of operation', stop_time datetime NOT NULL DEFAULT 0 COMMENT 'The date/time of end of operation', total_bytes BIGINT NOT NULL DEFAULT 0 COMMENT 'The size of the object in bytes', progress BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'The number of bytes processed', error_num INT NOT NULL DEFAULT 0 COMMENT 'The error from this run 0 == none', notes CHAR(100) NOT NULL DEFAULT '' COMMENT 'Commentary from the backup engine') ENGINE=CSV DEFAULT CHARACTER SET utf8;
 

=== modified file 'scripts/mysql_system_tables_fix.sql'
--- a/scripts/mysql_system_tables_fix.sql	2008-08-07 03:05:33 +0000
+++ b/scripts/mysql_system_tables_fix.sql	2008-10-15 20:00:48 +0000
@@ -604,3 +604,5 @@ UPDATE user SET Create_tablespace_priv =
 # changes was correct
 
 flush privileges;
+
+ALTER TABLE backup_history ADD COLUMN backup_file_path VARCHAR (512) NOT NULL DEFAULT '' COMMENT 'The full path to the backup image file' AFTER backup_file;

=== modified file 'sql/backup/backup_aux.h'
--- a/sql/backup/backup_aux.h	2008-08-21 19:28:49 +0000
+++ b/sql/backup/backup_aux.h	2008-10-14 12:08:56 +0000
@@ -6,11 +6,6 @@
  
   @brief Auxiliary declarations used in online backup code.
 
-  @todo Fix error detection in places marked with "FIXME: detect errors...". 
-  These are places where functions or methods are called and if they can 
-  report errors it should be detected and appropriate action taken. If callee 
-  never reports errors or we want to ignore errors, a comment explaining this
-  should be added.
 */ 
 
 typedef st_plugin_int* storage_engine_ref;
@@ -140,8 +135,8 @@ class String: public ::String
 };
 
 inline
-void set_table_list(TABLE_LIST &tl, const Table_ref &tbl, 
-                    thr_lock_type lock_type, MEM_ROOT *mem)
+int set_table_list(TABLE_LIST &tl, const Table_ref &tbl,
+                   thr_lock_type lock_type, MEM_ROOT *mem)
 {
   DBUG_ASSERT(mem);
 
@@ -149,8 +144,12 @@ void set_table_list(TABLE_LIST &tl, cons
   tl.db= const_cast<char*>(tbl.db().name().ptr());
   tl.lock_type= lock_type;
 
-  // FIXME: detect errors (if NULL returned).
   tl.mdl_lock_data= mdl_alloc_lock(0, tl.db, tl.table_name, mem); 
+  if (!tl.mdl_lock_data)                    // Failed to allocate lock
+  {
+    return 1;
+  }
+  return 0;
 }
 
 inline
@@ -165,7 +164,10 @@ TABLE_LIST* mk_table_list(const Table_re
      return NULL;
 
   bzero(ptr, sizeof(TABLE_LIST));
-  set_table_list(*ptr, tbl, lock_type, mem);
+  if (set_table_list(*ptr, tbl, lock_type, mem)) // Failed to allocate lock
+  {
+    return NULL;
+  }
 
   return ptr;
 }

=== modified file 'sql/backup/backup_info.cc'
--- a/sql/backup/backup_info.cc	2008-10-21 15:45:46 +0000
+++ b/sql/backup/backup_info.cc	2008-10-27 13:06:21 +0000
@@ -5,16 +5,6 @@
   implements algorithm for selecting backup engine used to backup
   given table.
   
-  @todo Fix error detection in places marked with "FIXME: detect errors...". 
-  These are places where functions or methods are called and if they can 
-  report errors it should be detected and appropriate action taken. If callee 
-  never reports errors or we want to ignore errors, a comment explaining this
-  should be added.
-
-  @todo Fix error logging in places marked with "FIXME: error logging...". In 
-  these places it should be decided if and how the error should be shown to the
-  user. If an error message should be logged, it can happen either in the place
-  where error was detected or somewhere up the call stack.
 */
 
 #include "../mysql_priv.h"
@@ -250,7 +240,7 @@ struct Backup_info::Dep_node: public Sql
   Dbobj *obj;
   String key;
 
-  Dep_node(const ::String &db_name, const ::String &name);
+  Dep_node(const ::String &db_name, const ::String &name, const obj_type type);
   Dep_node(const Dep_node&);
 
   static uchar* get_key(const uchar *record, size_t *key_length, my_bool);
@@ -260,14 +250,18 @@ struct Backup_info::Dep_node: public Sql
 /**
   Create an empty dependency list node for a given per-database object.
 
-  The object is identified by its name and the name of the database to which
-  it belongs. 
+  The object is identified by its name, the name of the database to
+  which it belongs, and its type.
  */ 
 inline
-Backup_info::Dep_node::Dep_node(const ::String &db_name, const ::String &name)
+Backup_info::Dep_node::Dep_node(const ::String &db_name, const ::String &name,
+                                const obj_type type)
   :next(NULL), obj(NULL)
 {
   key.length(0);
+  // Add type to make sure keys are unique even between different namespaces
+  key.set_int(type, TRUE, &my_charset_bin);
+  key.append("|");
   key.append(db_name);
   key.append(".");
   key.append(name);
@@ -317,14 +311,16 @@ Backup_info::Backup_info(Backup_restore_
 
   bzero(m_snap, sizeof(m_snap));
 
-  // FIXME: detect errors if reported.
-  // FIXME: error logging.
-  hash_init(&ts_hash, &::my_charset_bin, 16, 0, 0,
-            Ts_hash_node::get_key, Ts_hash_node::free, MYF(0));
-  // FIXME: detect errors if reported.
-  // FIXME: error logging.
-  hash_init(&dep_hash, &::my_charset_bin, 16, 0, 0,
-            Dep_node::get_key, Dep_node::free, MYF(0));
+  if (hash_init(&ts_hash, &::my_charset_bin, 16, 0, 0,
+                Ts_hash_node::get_key, Ts_hash_node::free, MYF(0))
+      ||
+      hash_init(&dep_hash, &::my_charset_bin, 16, 0, 0,
+                Dep_node::get_key, Dep_node::free, MYF(0)))
+  {
+    // Allocation failed. Error has been reported, but not logged to backup logs
+    m_ctx.log_error(ER_OUT_OF_RESOURCES);
+    return;
+  }
 
   /* 
     Create nodata, default, and CS snapshot objects and add them to the 
@@ -332,35 +328,56 @@ Backup_info::Backup_info(Backup_restore_
     element on that list, as a "catch all" entry. 
    */
 
-  snap= new Nodata_snapshot(m_ctx);  // reports errors
-
-  // FIXME: error logging (in case snap could not be allocated).
-  if (!snap || !snap->is_valid())
+  snap= new Nodata_snapshot(m_ctx);             // logs errors
+  if (!snap)
+  {
+    m_ctx.fatal_error(ER_OUT_OF_RESOURCES);
     return;
+  }
 
-  // FIXME: detect errors if reported.
-  // FIXME: error logging.
-  snapshots.push_back(snap);
+  if (!snap->is_valid())
+    return;    // Error has been logged by Nodata_snapshot constructor
 
-  snap= new CS_snapshot(m_ctx); // reports errors
+  if (snapshots.push_back(snap))
+  {
+    // Allocation failed. Error has been reported, but not logged to backup logs
+    m_ctx.log_error(ER_OUT_OF_RESOURCES);
+    return;
+  }
 
-  // FIXME: error logging (in case snap could not be allocated).
-  if (!snap || !snap->is_valid())
+  snap= new CS_snapshot(m_ctx);                 // logs errors
+  if (!snap)
+  {
+    m_ctx.fatal_error(ER_OUT_OF_RESOURCES);
     return;
+  }
 
-  // FIXME: detect errors if reported.
-  // FIXME: error logging.
-  snapshots.push_back(snap);
+  if (!snap->is_valid())
+    return;        // Error has been logged by CS_snapshot constructor
 
-  snap= new Default_snapshot(m_ctx);  // reports errors
+  if (snapshots.push_back(snap))
+  {
+    // Allocation failed. Error has been reported, but not logged to backup logs
+    m_ctx.log_error(ER_OUT_OF_RESOURCES);
+    return;                                   // Error has been logged
+  }
 
-  // FIXME: error logging (in case snap could not be allocated).
-  if (!snap || !snap->is_valid())
+  snap= new Default_snapshot(m_ctx);            // logs errors
+  if (!snap)
+  {
+    m_ctx.fatal_error(ER_OUT_OF_RESOURCES);
     return;
+  }
 
-  // FIXME: detect errors if reported.
-  // FIXME: error logging.
-  snapshots.push_back(snap);
+  if (!snap->is_valid())
+    return;  // Error has been logged by Default_snapshot constructor
+
+  if (snapshots.push_back(snap))
+  {
+    // Allocation failed. Error has been reported, but not logged to backup logs
+    m_ctx.log_error(ER_OUT_OF_RESOURCES);
+    return;                                   // Error has been logged
+  }
 
   m_state= CREATED;
 }
@@ -939,13 +956,13 @@ int Backup_info::add_view_deps(obs::Obj 
     Dep_node *n= NULL;
     const ::String *name= bv->get_name();
     const ::String *db_name= bv->get_db_name();
-  
+
     DBUG_ASSERT(name); 
     DBUG_ASSERT(db_name); 
 
     // Locate or create a dependency list node for the base view.
 
-    int res= get_dep_node(*db_name, *name, n);
+    int res= get_dep_node(*db_name, *name, BSTREAM_IT_VIEW, n);
 
     if (res == get_dep_node_res::ERROR)
       goto error;
@@ -1061,7 +1078,7 @@ Backup_info::add_db_object(Db &db, const
 
   // Get a dep. list node for the object.  
 
-  int res= get_dep_node(db.name(), *name, n);
+  int res= get_dep_node(db.name(), *name, type, n);
   
   if (res == get_dep_node_res::ERROR)
   {
@@ -1146,9 +1163,10 @@ Backup_info::add_db_object(Db &db, const
  */ 
 int Backup_info::get_dep_node(const ::String &db_name, 
                               const ::String &name, 
+                              const obj_type type,
                               Dep_node* &node)
 {
-  Dep_node n(db_name, name);
+  Dep_node n(db_name, name, type);
   size_t klen;
   uchar  *key= Dep_node::get_key((const uchar*)&n, &klen, TRUE);
 
@@ -1297,7 +1315,9 @@ class Backup_info::Global_iterator
 
  public:
 
-  Global_iterator(const Image_info&);
+  Global_iterator(const Backup_info&);
+
+  int init();
 
  private:
 
@@ -1306,14 +1326,24 @@ class Backup_info::Global_iterator
 };
 
 inline
-Backup_info::Global_iterator::Global_iterator(const Image_info &info)
+Backup_info::Global_iterator::Global_iterator(const Backup_info &info)
  :Iterator(info), mode(TABLESPACES), m_it(NULL), m_obj(NULL)
+{}
+
+
+inline
+int Backup_info::Global_iterator::init()
 {
-  // FIXME: detect errors (if NULL returned).
   m_it= m_info.get_tablespaces();
-  next();       // Note: next() doesn't report errors.
-}
+  if (!m_it)
+  {
+    const Backup_info* info= static_cast<const Backup_info*>(&m_info);
+    return info->m_ctx.fatal_error(ER_OUT_OF_RESOURCES);
+  }
+  next();                                       // Never errors
 
+  return 0;
+}
 
 inline
 backup::Image_info::Obj*
@@ -1351,6 +1381,14 @@ Backup_info::Global_iterator::next()
     // We have finished enumerating tablespaces, move on to databases.
     mode= DATABASES;
     m_it= m_info.get_dbs();
+    if (!m_it)
+    {
+      const Backup_info* info= static_cast<const Backup_info*>(&m_info);
+      info->m_ctx.fatal_error(ER_OUT_OF_RESOURCES);
+      mode= DONE;
+      return FALSE;
+    }
+
     m_obj= (*m_it)++;
     return m_obj != NULL;
 
@@ -1426,11 +1464,33 @@ bool Backup_info::Perdb_iterator::next()
 /// Wrapper to return global iterator.
 backup::Image_info::Iterator* Backup_info::get_global() const
 {
-  return new Global_iterator(*this);
+  Global_iterator* it = new Global_iterator(*this);
+  if (it == NULL) 
+  {
+    m_ctx.fatal_error(ER_OUT_OF_RESOURCES);
+    return NULL;
+  }    
+  if (it->init())                               // Error has been logged
+  {
+    return NULL;
+  }
+
+  return it;
 }
 
 /// Wrapper to return iterator for per-database objects.
 backup::Image_info::Iterator* Backup_info::get_perdb()  const
 {
-  return new Perdb_iterator(*this);
+  Perdb_iterator* it = new Perdb_iterator(*this);
+  if (it == NULL) 
+  {
+    m_ctx.fatal_error(ER_OUT_OF_RESOURCES);
+    return NULL;
+  }    
+  if (it->init())                               // Error has been logged
+  {
+    return NULL;
+  }
+
+  return it;
 }

=== modified file 'sql/backup/backup_info.h'
--- a/sql/backup/backup_info.h	2008-10-17 11:28:25 +0000
+++ b/sql/backup/backup_info.h	2008-10-27 13:06:21 +0000
@@ -69,7 +69,8 @@ class Backup_info: public backup::Image_
 
   struct Dep_node;
 
-  int get_dep_node(const ::String&, const ::String&, Dep_node*&);
+  int get_dep_node(const ::String&, const ::String&, const obj_type, 
+                   Dep_node*&);
   int add_to_dep_list(const obj_type, Dep_node*);
 
   struct get_dep_node_res 

=== modified file 'sql/backup/backup_kernel.h'
--- a/sql/backup/backup_kernel.h	2008-10-08 10:54:19 +0000
+++ b/sql/backup/backup_kernel.h	2008-10-27 13:06:21 +0000
@@ -76,6 +76,7 @@ class Backup_restore_ctx: public backup:
   int do_backup();
   int do_restore();
   int fatal_error(int, ...);
+  int log_error(int, ...);
 
   int close();
 
@@ -111,7 +112,7 @@ class Backup_restore_ctx: public backup:
    */ 
   int m_error;
   
-  const char *m_path;   ///< Path to where the backup image file is located.
+  ::String  m_path;   ///< Path to where the backup image file is located.
 
   /** If true, the backup image file is deleted at clean-up time. */
   bool m_remove_loc;
@@ -122,7 +123,9 @@ class Backup_restore_ctx: public backup:
   /** Memory allocator for backup stream library. */
   backup::Mem_allocator *mem_alloc;
 
-  int prepare(LEX_STRING location);
+  int prepare_path(::String *backupdir, 
+                   LEX_STRING orig_loc);
+  int prepare(::String *backupdir, LEX_STRING location);
   void disable_fkey_constraints();
   int  restore_triggers_and_events();
   
@@ -132,7 +135,7 @@ class Backup_restore_ctx: public backup:
   bool m_tables_locked; 
 
   int lock_tables_for_restore();
-  int unlock_tables();
+  void unlock_tables();
   
   int report_stream_open_failure(int open_error, const LEX_STRING *location);
 

=== modified file 'sql/backup/data_backup.cc'
--- a/sql/backup/data_backup.cc	2008-09-30 07:51:48 +0000
+++ b/sql/backup/data_backup.cc	2008-10-14 12:08:56 +0000
@@ -7,17 +7,6 @@
   drivers and protocols to create snapshot of the data stored in the tables being
   backed up.
 
-  @todo Fix error detection in places marked with "FIXME: detect errors...". 
-  These are places where functions or methods are called and if they can 
-  report errors it should be detected and appropriate action taken. If callee 
-  never reports errors or we want to ignore errors, a comment explaining this
-  should be added.
-
-  @todo Fix error logging in places marked with "FIXME: error logging...". In 
-  these places it should be decided if and how the error should be shown to the
-  user. If an error message should be logged, it can happen either in the place
-  where error was detected or somewhere up the call stack.
-
   @todo Implement better scheduling strategy in Scheduler::step
   @todo Add error reporting in the scheduler and elsewhere
   @todo If an error from driver is ignored (and operation retried) leave trace
@@ -104,7 +93,7 @@ class Block_writer
 
   result_t  get_buf(Buffer &);
   result_t  write_buf(const Buffer&);
-  result_t  drop_buf(Buffer&);
+  void      drop_buf(Buffer&);
 
   Block_writer(byte, size_t, Output_stream&);
   ~Block_writer();
@@ -477,9 +466,14 @@ int write_table_data(THD* thd, Backup_in
       if (init_size > max_init_size)
         max_init_size= init_size;
 
-      // FIXME: detect errors if reported.
-      // FIXME: error logging.
-      inactive.push_back(p);
+      if (inactive.push_back(p))
+      {
+        /* Allocation failed. 
+           Error has been reported, but not logged to backup logs.
+        */
+        info.m_ctx.log_error(ER_OUT_OF_RESOURCES);
+        goto error;
+      }
     }
   }
 
@@ -599,9 +593,11 @@ int write_table_data(THD* thd, Backup_in
       Save binlog information for point in time recovery on restore.
     */
     if (mysql_bin_log.is_open())
-      // FIXME: detect errors if reported.
-      // FIXME: error logging.
-      mysql_bin_log.get_current_log(&binlog_pos);
+      if (mysql_bin_log.get_current_log(&binlog_pos))
+      {
+        info.m_ctx.fatal_error(ER_BACKUP_BINLOG);
+        goto error;
+      }
 
     /*
       Save VP creation time.
@@ -788,8 +784,7 @@ int Scheduler::step()
       break;
 
     case backup_state::DONE:
-      // FIXME: detect errors if reported.
-      p->end();
+      res= p->end();  // Logs errors, fall-through to error handling below
 
     case backup_state::ERROR:
       remove_pump(p);   // Note: never errors.
@@ -1014,11 +1009,15 @@ Backup_pump::Backup_pump(Snapshot_info &
 {
   DBUG_ASSERT(snap.m_num > 0);
   m_buf.data= NULL;
-  // FIXME: detect errors if reported.
-  bitmap_init(&m_closed_streams,
+  if (bitmap_init(&m_closed_streams,
               NULL,
               1 + snap.table_count(),
-              FALSE); // not thread safe
+              FALSE)) // not thread safe
+  {
+    state= backup_state::ERROR;  // Created object will be invalid
+    return;
+  }
+
   m_name= snap.name();
   if (ERROR == snap.get_backup_driver(m_drv) || !m_drv)
     state= backup_state::ERROR;
@@ -1253,10 +1252,8 @@ int Backup_pump::pump(size_t *howmuch)
 
         if (m_buf.size > 0)
           mode= WRITING;
-        else
-          // FIXME: detect errors (perhaps ensure that drop_buf never errors).
-          // FIXME: error logging.
-          m_bw.drop_buf(m_buf);
+        else 
+          m_bw.drop_buf(m_buf);              // Never errors
 
         break;
 
@@ -1274,9 +1271,7 @@ int Backup_pump::pump(size_t *howmuch)
         state= backup_state::DONE;
 
       case BUSY:
-        // FIXME: detect errors (perhaps ensure that drop_buf never errors).
-        // FIXME: error logging.
-        m_bw.drop_buf(m_buf);
+        m_bw.drop_buf(m_buf);                   // Never errors
         m_buf_head=NULL;  // thus a new request will be made
       }
 
@@ -1531,9 +1526,7 @@ int restore_table_data(THD *thd, Restore
           bad_drivers.append(",");
         bad_drivers.append(info.m_snap[n]->name());
       }
-      // FIXME: detect errors.
-      // FIXME: error logging.
-      drv[n]->free();
+      drv[n]->free();                           // Never errors
     }
 
     if (!bad_drivers.is_empty())
@@ -1551,9 +1544,7 @@ int restore_table_data(THD *thd, Restore
     if (!drv[n])
       continue;
 
-    // FIXME: detect errors.
-    // FIXME: error logging (perhaps we don't want to report errors here).
-    drv[n]->free();
+    drv[n]->free();                             // Never errors
   }
 
   DBUG_RETURN(backup::ERROR);
@@ -1651,13 +1642,12 @@ Block_writer::write_buf(const Buffer &bu
   method can return it to the buffer pool so that it can be reused for other
   transfers.
  */
-Block_writer::result_t
+void
 Block_writer::drop_buf(Buffer &buf)
 {
   buf.data= NULL;
   buf.size= 0;
   taken= FALSE;
-  return OK;
 }
 
 } // backup namespace

=== modified file 'sql/backup/image_info.cc'
--- a/sql/backup/image_info.cc	2008-08-20 13:23:10 +0000
+++ b/sql/backup/image_info.cc	2008-10-14 12:08:56 +0000
@@ -8,16 +8,6 @@
 
   @brief Implements @c Image_info class and friends.
 
-  @todo Fix error detection in places marked with "FIXME: detect errors...". 
-  These are places where functions or methods are called and if they can 
-  report errors it should be detected and appropriate action taken. If callee 
-  never reports errors or we want to ignore errors, a comment explaining this
-  should be added.
-
-  @todo Fix error logging in places marked with "FIXME: error logging...". In 
-  these places it should be decided if and how the error should be shown to the
-  user. If an error message should be logged, it can happen either in the place
-  where error was detected or somewhere up the call stack.
 */
 
 namespace backup {
@@ -25,8 +15,7 @@ namespace backup {
 Image_info::Image_info()
   :data_size(0), m_table_count(0), m_dbs(16, 16), m_ts_map(16,16)
 {
-  // FIXME: detect errors if reported.
-  init_alloc_root(&mem_root, 4 * 1024, 0);
+  init_alloc_root(&mem_root, 4 * 1024, 0);      // Never errors
 
   /* initialize st_bstream_image_header members */
 
@@ -308,10 +297,8 @@ Image_info::add_table(Db &db, const ::St
 
   if (snap.add_table(*t, pos))  // reports errors
     return NULL;
-  
-  // FIXME: error logging.
-  if (db.add_table(*t))
-    return NULL;
+
+  db.add_table(*t);                             // Never errors
 
   if (!snap.m_num)
     snap.m_num= add_snapshot(snap); // reports errors

=== modified file 'sql/backup/image_info.h'
--- a/sql/backup/image_info.h	2008-10-01 15:19:53 +0000
+++ b/sql/backup/image_info.h	2008-10-15 15:38:28 +0000
@@ -4,10 +4,6 @@
 /**
   @file
   
-  @todo Fix error logging in places marked with "FIXME: error logging...". In 
-  these places it should be decided if and how the error should be shown to the
-  user. If an error message should be logged, it can happen either in the place
-  where error was detected or somewhere up the call stack.
 */ 
 
 #include <si_objects.h>
@@ -424,7 +420,7 @@ class Image_info::Db
   obs::Obj* materialize(uint ver, const ::String &sdata);
   result_t add_obj(Dbobj&, ulong pos);
   Dbobj*   get_obj(ulong pos) const;
-  result_t add_table(Table&);
+  void add_table(Table&);
   const char* describe(describe_buf&) const;
 
  private:
@@ -559,6 +555,15 @@ class Image_info::Iterator
   Iterator(const Image_info &info);
   virtual ~Iterator();
 
+  
+  /** 
+    Initialize the iterator after construction.
+    Subclasses need to implement this if initialization may generate errors.
+   
+    @returns 0 if success.  Otherwise, error code.
+   */
+  virtual int init() { return 0; }  
+
   Obj* operator++(int);
 
  protected:
@@ -747,15 +752,9 @@ inline
 time_t Image_info::get_vp_time() const
 {
   struct tm time;
-  time_t tz_offset;
 
   bzero(&time,sizeof(time));
 
-  // Determine system timezone offset by calculating offset of the Epoch date.
-  time.tm_year=70;
-  time.tm_mday=1;
-  tz_offset= mktime(&time);
-
   time.tm_year= vp_time.year;
   time.tm_mon= vp_time.mon;
   time.tm_mday= vp_time.mday;
@@ -767,7 +766,7 @@ time_t Image_info::get_vp_time() const
     Note: mktime() assumes that time is expressed as local time and vp_time is
     in UTC. Hence we must correct the result to get it right.
    */ 
-  return mktime(&time) - tz_offset;
+  return mktime(&time) - (time_t)timezone;
 }
 
 /**
@@ -836,28 +835,52 @@ void Image_info::save_binlog_pos(const :
   flags|= BSTREAM_FLAG_BINLOG;
 }
 
-/// Returns an iterator enumerating all databases stored in backup catalogue.
+/**
+  Returns an iterator enumerating all databases stored in backup catalogue.
+
+  @returns Pointer to @c Image_info::Db_iterator or NULL if allocation fails.
+ */ 
 inline
 Image_info::Db_iterator* Image_info::get_dbs() const
 {
-  // FIXME: error logging (in case allocation fails).
-  return new Db_iterator(*this);
+  Db_iterator* it = new Db_iterator(*this);
+
+  if (it && it->init()) // Initialization failed
+    it= NULL;
+
+  return it; // Error logging context not available, caller must handle NULL
 }
 
-/// Returns an iterator enumerating all tablespaces stored in backup catalogue.
+/**
+  Returns an iterator enumerating all tablespaces stored in backup catalogue.
+
+  @returns Pointer to @c Image_info::Ts_iterator or NULL if allocation fails.
+ */
 inline
 Image_info::Ts_iterator* Image_info::get_tablespaces() const
 {
-  // FIXME: error logging (in case allocation fails).
-  return new Ts_iterator(*this);
+  Ts_iterator* it = new Ts_iterator(*this);
+
+  if (it && it->init()) // Initialization failed
+    it= NULL;
+
+  return it; // Error logging context not available, caller must handle NULL
 }
 
-/// Returns an iterator enumerating all objects in a given database.
+/**
+  Returns an iterator enumerating all objects in a given database.
+
+  @returns Pointer to @c Image_info::Dbobj_iterator or NULL if allocation fails.
+ */
 inline
 Image_info::Dbobj_iterator* Image_info::get_db_objects(const Db &db) const
 {
-  // FIXME: error logging (in case allocation fails).
-  return new Dbobj_iterator(*this, db);
+  Dbobj_iterator* it = new Dbobj_iterator(*this, db);
+
+  if (it && it->init()) // Initialization failed
+    it= NULL;
+
+  return it; // Error logging context not available, caller must handle NULL
 }
 
 /********************************************************************
@@ -1065,7 +1088,7 @@ obs::Obj* Image_info::Dbobj::materialize
   The table is appended to database's table list.
  */
 inline
-result_t Image_info::Db::add_table(Table &tbl)
+void Image_info::Db::add_table(Table &tbl)
 {
   tbl.next_table= NULL;
   
@@ -1076,8 +1099,6 @@ result_t Image_info::Db::add_table(Table
     last_table->next_table= &tbl;
     last_table= &tbl;
   }
-  
-  return OK;
 }
 
 /**

=== modified file 'sql/backup/kernel.cc'
--- a/sql/backup/kernel.cc	2008-10-18 07:57:38 +0000
+++ b/sql/backup/kernel.cc	2008-10-27 13:06:21 +0000
@@ -52,17 +52,6 @@
   } // if code jumps here, context destructor will do the clean-up automatically
   @endcode
 
-  @todo Fix error detection in places marked with "FIXME: detect errors...". 
-  These are places where functions or methods are called and if they can 
-  report errors it should be detected and appropriate action taken. If callee 
-  never reports errors or we want to ignore errors, a comment explaining this
-  should be added.
-
-  @todo Fix error logging in places marked with "FIXME: error logging...". In 
-  these places it should be decided if and how the error should be shown to the
-  user. If an error message should be logged, it can happen either in the place
-  where error was detected or somewhere up the call stack.
-
   @todo Use internal table name representation when passing tables to
         backup/restore drivers.
   @todo Handle other types of meta-data in Backup_info methods.
@@ -295,8 +284,10 @@ int send_error(Backup_restore_ctx &log, 
 /**
   Send positive reply after a backup/restore operation.
 
-  Currently the id of the operation is returned. It can be used to select
-  correct entries form the backup progress tables.
+  Currently the id of the operation is returned to the client. It can
+  be used to select correct entries from the backup progress tables.
+
+  @returns 0 on success, error code otherwise.
 */
 int send_reply(Backup_restore_ctx &context)
 {
@@ -309,32 +300,37 @@ int send_reply(Backup_restore_ctx &conte
   /*
     Send field list.
   */
-  // FIXME: detect errors if  reported.
-  // FIXME: error logging.
-  field_list.push_back(new Item_empty_string(STRING_WITH_LEN("backup_id")));
-  protocol->send_result_set_metadata(&field_list, Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF);
+  if (field_list.push_back(new Item_empty_string(STRING_WITH_LEN("backup_id"))))
+  {
+    goto err;
+  }
+  if (protocol->send_result_set_metadata(&field_list,
+                            Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
+  {
+    goto err;
+  }
 
   /*
     Send field data.
   */
-  // FIXME: detect errors if  reported.
-  // FIXME: error logging.
-  protocol->prepare_for_resend();
-  // FIXME: detect errors if  reported.
-  // FIXME: error logging.
-  llstr(context.op_id(), buf);
-  // FIXME: detect errors if  reported.
-  // FIXME: error logging.
-  protocol->store(buf, system_charset_info);
-  // FIXME: detect errors if  reported.
-  // FIXME: error logging.
-  protocol->write();
-
-  // FIXME: detect errors if  reported.
-  // FIXME: error logging.
-  my_eof(context.thd());
-  context.report_cleanup();
+  protocol->prepare_for_resend();               // Never errors
+  llstr(context.op_id(), buf);                  // Never errors
+  if (protocol->store(buf, system_charset_info))
+  {
+    goto err;
+  }
+  if (protocol->write())
+  {
+    goto err;
+  }
+  my_eof(context.thd());                        // Never errors
+  context.report_cleanup();                     // Never errors
   DBUG_RETURN(0);
+
+ err:
+  DBUG_RETURN(context.fatal_error(ER_BACKUP_SEND_REPLY,
+                                  context.m_type == backup::Logger::BACKUP
+                                  ? "BACKUP" : "RESTORE"));
 }
 
 
@@ -381,7 +377,7 @@ pthread_mutex_t Backup_restore_ctx::run_
 
 Backup_restore_ctx::Backup_restore_ctx(THD *thd)
  :Logger(thd), m_state(CREATED), m_thd_options(thd->options),
-  m_error(0), m_path(NULL), m_remove_loc(FALSE), m_stream(NULL),
+  m_error(0), m_remove_loc(FALSE), m_stream(NULL),
   m_catalog(NULL), mem_alloc(NULL), m_tables_locked(FALSE)
 {
   /*
@@ -402,6 +398,81 @@ Backup_restore_ctx::~Backup_restore_ctx(
 }
 
 /**
+  Prepare path for access.
+
+  This method takes the backupdir and the file name specified on the backup
+  command (orig_loc) and forms a combined path + file name as follows:
+
+    1. If orig_loc has a relative path, make it relative to backupdir
+    2. If orig_loc has a hard path, use it.
+    3. If orig_loc has no path, append to backupdir
+
+  @param[IN]  backupdir  The backupdir system variable value.
+  @param[IN]  orig_loc   The path + file name specified in the backup command.
+
+  @returns 0
+*/
+int Backup_restore_ctx::prepare_path(::String *backupdir, 
+                                     LEX_STRING orig_loc)
+{
+  char fix_path[FN_REFLEN]; 
+  char full_path[FN_REFLEN]; 
+
+  /*
+    Prepare the path using the backupdir iff no relative path
+    or no hard path included.
+
+    Relative paths are formed from the backupdir system variable.
+
+    Case 1: Backup image file name has relative path. 
+            Make relative to backupdir.
+
+    Example BACKUP DATATBASE ... TO '../monthly/dec.bak'
+            If backupdir = '/dev/daily' then the
+            calculated path becomes
+            '/dev/monthly/dec.bak'
+
+    Case 2: Backup image file name has no path or has a subpath. 
+
+    Example BACKUP DATABASE ... TO 'week2.bak'
+            If backupdir = '/dev/weekly/' then the
+            calculated path becomes
+            '/dev/weekly/week2.bak'
+    Example BACKUP DATABASE ... TO 'jan/day1.bak'
+            If backupdir = '/dev/monthly/' then the
+            calculated path becomes
+            '/dev/monthly/jan/day1.bak'
+
+    Case 3: Backup image file name has hard path. 
+
+    Example BACKUP DATATBASE ... TO '/dev/dec.bak'
+            If backupdir = '/dev/daily/backup' then the
+            calculated path becomes
+            '/dev/dec.bak'
+  */
+
+  /*
+    First, we construct the complete path from backupdir.
+  */
+  fn_format(fix_path, backupdir->ptr(), mysql_real_data_home, "", 
+            MY_UNPACK_FILENAME | MY_RELATIVE_PATH);
+
+  /*
+    Next, we contruct the full path to the backup file.
+  */
+  fn_format(full_path, orig_loc.str, fix_path, "", 
+            MY_UNPACK_FILENAME | MY_RELATIVE_PATH);
+
+  /*
+    Copy result to member variable for Stream class.
+  */
+  m_path.copy(full_path, strlen(full_path), system_charset_info);
+  report_backup_file(m_path.c_ptr());
+ 
+  return 0;
+}
+
+/**
   Do preparations common to backup and restore operations.
   
   It is checked if another operation is in progress and if yes then
@@ -412,20 +483,17 @@ Backup_restore_ctx::~Backup_restore_ctx(
 
   @returns 0 on success, error code otherwise.
  */ 
-int Backup_restore_ctx::prepare(LEX_STRING location)
+int Backup_restore_ctx::prepare(String *backupdir, LEX_STRING location)
 {
   if (m_error)
     return m_error;
   
   // Prepare error reporting context.
   
-  // FIXME: detect errors if  reported.
-  // FIXME: error logging.
-  mysql_reset_errors(m_thd, 0);
+  mysql_reset_errors(m_thd, 0);                 // Never errors
   m_thd->no_warnings_for_error= FALSE;
-  // FIXME: detect errors if  reported.
-  // FIXME: error logging.
-  save_errors();  
+
+  save_errors();                                // Never errors
 
 
   /*
@@ -479,7 +547,10 @@ int Backup_restore_ctx::prepare(LEX_STRI
     return m_error;
   }
 
-  m_path= location.str;
+  /*
+    Computer full path to backup file.
+  */
+  prepare_path(backupdir, location);
 
   // create new instance of memory allocator for backup stream library
 
@@ -534,7 +605,7 @@ Backup_restore_ctx::prepare_for_backup(S
   if (m_error)
     return NULL;
   
-  if (Logger::init(BACKUP, orig_loc, query))
+  if (Logger::init(BACKUP, query))
   {
     fatal_error(ER_BACKUP_LOGGER_INIT);
     return NULL;
@@ -547,15 +618,14 @@ Backup_restore_ctx::prepare_for_backup(S
     Do preparations common to backup and restore operations. After call
     to prepare() all meta-data changes are blocked.
    */ 
-  if (prepare(orig_loc))
+  if (prepare(backupdir, orig_loc))
     return NULL;
 
   /*
     Open output stream.
    */
   Output_stream *s= new Output_stream(*this, 
-                                      backupdir, 
-                                      orig_loc,
+                                      &m_path,
                                       with_compression);
   m_stream= s;
   
@@ -576,7 +646,7 @@ Backup_restore_ctx::prepare_for_backup(S
     Create backup catalogue.
    */
 
-  Backup_info *info= new Backup_info(*this); // reports errors
+  Backup_info *info= new Backup_info(*this);    // Logs errors
 
   if (!info)
   {
@@ -585,7 +655,7 @@ Backup_restore_ctx::prepare_for_backup(S
   }
 
   if (!info->is_valid())
-    return NULL;
+    return NULL;    // Error has been logged by Backup_Info constructor
 
   /*
     If binlog is enabled, set BSTREAM_FLAG_BINLOG in the header to indicate
@@ -631,7 +701,7 @@ Backup_restore_ctx::prepare_for_restore(
   if (m_error)
     return NULL;
   
-  if (Logger::init(RESTORE, orig_loc, query))
+  if (Logger::init(RESTORE, query))
   {
     fatal_error(ER_BACKUP_LOGGER_INIT);
     return NULL;
@@ -644,14 +714,14 @@ Backup_restore_ctx::prepare_for_restore(
     Do preparations common to backup and restore operations. After this call
     changes of meta-data are blocked.
    */ 
-  if (prepare(orig_loc))
+  if (prepare(backupdir, orig_loc))
     return NULL;
   
   /*
     Open input stream.
    */
 
-  Input_stream *s= new Input_stream(*this, backupdir, orig_loc);
+  Input_stream *s= new Input_stream(*this, &m_path);
   m_stream= s;
   
   if (!s)
@@ -753,14 +823,14 @@ int Backup_restore_ctx::lock_tables_for_
       backup::Image_info::Table *tbl= snap->get_table(t);
       DBUG_ASSERT(tbl); // All tables should be present in the catalogue.
 
-      // FIXME: detect errors. Don't assert here but report error instead.
-      // FIXME: error logging.
       TABLE_LIST *ptr= backup::mk_table_list(*tbl, TL_WRITE, m_thd->mem_root);
-      DBUG_ASSERT(ptr);
+      if (!ptr)
+      {
+        // Error has been reported, but not logged to backup logs
+        return log_error(ER_OUT_OF_RESOURCES);
+      }
 
-      // FIXME: detect errors if reported.
-      // FIXME: error logging.
-      tables= backup::link_table_list(*ptr, tables);      
+      tables= backup::link_table_list(*ptr, tables); // Never errors
       tbl->m_table= ptr;
     }
   }
@@ -785,20 +855,54 @@ int Backup_restore_ctx::lock_tables_for_
 /**
   Unlock tables which were locked by @c lock_tables_for_restore.
  */ 
-int Backup_restore_ctx::unlock_tables()
+void Backup_restore_ctx::unlock_tables()
 {
   // Do nothing if tables are not locked.
   if (!m_tables_locked)
-    return 0;
+    return;
 
   DBUG_PRINT("restore",("unlocking tables"));
 
-  close_thread_tables(m_thd);
+  close_thread_tables(m_thd);                   // Never errors
   m_tables_locked= FALSE;
 
-  return 0;
+  return;
+}
+
+
+/**
+  Report error and move context object into error state without pushing the 
+  error on the server's warning stack.  
+  
+  Similar to @c fatal_error, but does not push the error on the
+  server's warning stack.  To be used when an error is reported from a
+  server function that has already pushed the error on the warning stack.
+  
+  @return error code given as input or stored in the context object if
+  a fatal error was reported before.
+ */ 
+inline
+int Backup_restore_ctx::log_error(int error_code, ...)
+{
+  if (m_error)
+    return m_error;
+
+  bool saved = push_errors(FALSE);         // Do not use warning stack
+  
+  m_error= error_code;
+  m_remove_loc= TRUE;
+
+  va_list args;
+  va_start(args,error_code);
+  v_report_error(backup::log_level::ERROR, error_code, args);
+  va_end(args);
+
+  push_errors(saved);                      // Reset
+
+  return error_code;
 }
 
+
 /**
   Destroy a backup/restore context.
   
@@ -813,6 +917,7 @@ int Backup_restore_ctx::unlock_tables()
  */ 
 int Backup_restore_ctx::close()
 {
+  int error= 0;
   if (m_state == CLOSED)
     return 0;
 
@@ -821,15 +926,10 @@ int Backup_restore_ctx::close()
   time_t when= my_time(0);
 
   // unlock tables if they are still locked
-
-  // FIXME: detect errors if reported.
-  unlock_tables();
+  unlock_tables();                              // Never errors
 
   // unfreeze meta-data
-
-  // FIXME: detect errors if reported.
-  // FIXME: error logging.
-  obs::ddl_blocker_disable();
+  obs::ddl_blocker_disable();                   // Never errors
 
   // restore thread options
 
@@ -837,10 +937,11 @@ int Backup_restore_ctx::close()
 
   // close stream
 
-  if (m_stream)
-    // FIXME: detect errors if reported.
-    // FIXME: error logging.
-    m_stream->close();
+  if (m_stream && !m_stream->close())
+  {
+    // Note error, but complete clean-up
+    error= ER_BACKUP_CLOSE;
+  }
 
   if (m_catalog)
     m_catalog->save_end_time(when); // Note: no errors.
@@ -853,23 +954,31 @@ int Backup_restore_ctx::close()
    */
   if (m_remove_loc && m_state == PREPARED_FOR_BACKUP)
   {
-    int res= my_delete(m_path, MYF(0));
+    int res= my_delete(m_path.c_ptr(), MYF(0));
 
     /*
       Ignore ENOENT error since it is ok if the file doesn't exist.
      */
     if (res && my_errno != ENOENT)
     {
-      report_error(ER_CANT_DELETE_FILE, m_path, my_errno);
-      if (!m_error)
-        m_error= ER_CANT_DELETE_FILE;
+      error= ER_CANT_DELETE_FILE;
     }
   }
 
-  // We report completion of the operation only if no errors were detected.
-
-  if (!m_error)
-    report_stop(when, TRUE);
+  /* We report completion of the operation only if no errors were detected,
+     and logger has been initialized.
+  */
+  if (!error)
+  {
+    if (backup::Logger::m_state == backup::Logger::RUNNING)
+    {
+      report_stop(when, TRUE);
+    }
+  }
+  else
+  {
+    fatal_error(error);                         // Log error
+  }
 
   /* 
     Destroy backup stream's memory allocator (this frees memory)
@@ -890,7 +999,7 @@ int Backup_restore_ctx::close()
   pthread_mutex_unlock(&run_lock);
 
   m_state= CLOSED;
-  return m_error;
+  return error;
 }
 
 /**
@@ -918,9 +1027,7 @@ int Backup_restore_ctx::do_backup()
 
   DEBUG_SYNC(m_thd, "before_backup_meta");
 
-  // FIXME: detect errors if reported.
-  // FIXME: error logging.
-  report_stats_pre(info);
+  report_stats_pre(info);                       // Never errors
 
   DBUG_PRINT("backup",("Writing preamble"));
   DEBUG_SYNC(m_thd, "backup_before_write_preamble");
@@ -935,7 +1042,7 @@ int Backup_restore_ctx::do_backup()
 
   DEBUG_SYNC(m_thd, "before_backup_data");
 
-  if (write_table_data(m_thd, info, s)) // reports errors
+  if (write_table_data(m_thd, info, s)) // logs errors
     DBUG_RETURN(send_error(*this, ER_BACKUP_BACKUP));
 
   DBUG_PRINT("backup",("Writing summary"));
@@ -946,9 +1053,7 @@ int Backup_restore_ctx::do_backup()
     DBUG_RETURN(m_error);
   }
 
-  // FIXME: detect errors if reported.
-  // FIXME: error logging.
-  report_stats_post(info);
+  report_stats_post(info);                      // Never errors
 
   DBUG_PRINT("backup",("Backup done."));
   DEBUG_SYNC(m_thd, "before_backup_done");
@@ -976,30 +1081,38 @@ int Backup_restore_ctx::restore_triggers
 
   DBUG_ASSERT(m_catalog);
 
-  // FIXME: detect errors (when dbit==NULL). Perhaps just assert.
-  Image_info::Iterator *dbit= m_catalog->get_dbs();
+  DBUG_ENTER("restore_triggers_and_events");
+
   Image_info::Obj *obj;
   List<Image_info::Obj> events;
   Image_info::Obj::describe_buf buf;
 
-  DBUG_ENTER("restore_triggers_and_events");
+  Image_info::Iterator *dbit= m_catalog->get_dbs();
+  if (!dbit)
+  {
+    DBUG_RETURN(fatal_error(ER_OUT_OF_RESOURCES));
+  }
 
   // create all trigers and collect events in the events list
   
   while ((obj= (*dbit)++)) 
   {
-    // FIXME: detect errors (when it==NULL). Perhaps just assert.
-    Image_info::Iterator *it= 
+    Image_info::Iterator *it=
                     m_catalog->get_db_objects(*static_cast<Image_info::Db*>(obj));
-
+    if (!it)
+    {
+      DBUG_RETURN(fatal_error(ER_OUT_OF_RESOURCES));
+    }
     while ((obj= (*it)++))
       switch (obj->type()) {
       
       case BSTREAM_IT_EVENT:
         DBUG_ASSERT(obj->m_obj_ptr);
-        // FIXME: detect errors if reported.
-        // FIXME: error logging.
-        events.push_back(obj);
+        if (events.push_back(obj))
+        {
+          // Error has been reported, but not logged to backup logs
+          DBUG_RETURN(log_error(ER_OUT_OF_RESOURCES)); 
+        }
         break;
       
       case BSTREAM_IT_TRIGGER:
@@ -1061,27 +1174,24 @@ int Backup_restore_ctx::do_restore()
   Input_stream &s= *static_cast<Input_stream*>(m_stream);
   Restore_info &info= *static_cast<Restore_info*>(m_catalog);
 
-  // FIXME: detect errors if reported.
-  // FIXME: error logging.
-  report_stats_pre(info);
+  report_stats_pre(info);                       // Never errors
 
   DBUG_PRINT("restore", ("Restoring meta-data"));
 
-  // FIXME: detect errors if reported.
-  disable_fkey_constraints();  // reports errors
+  disable_fkey_constraints();                   // Never errors
 
   if (read_meta_data(info, s))
   {
-    // FIXME: detect errors.
-    // FIXME: error logging.
-    m_thd->main_da.reset_diagnostics_area();
+    m_thd->main_da.reset_diagnostics_area();    // Never errors
 
     fatal_error(ER_BACKUP_READ_META);
     DBUG_RETURN(m_error);
   }
 
-  // FIXME: detect errors.
-  s.next_chunk();
+  if (s.next_chunk() == BSTREAM_ERROR)
+  {
+    DBUG_RETURN(fatal_error(ER_BACKUP_NEXT_CHUNK));
+  }
 
   DBUG_PRINT("restore",("Restoring table data"));
 
@@ -1091,21 +1201,16 @@ int Backup_restore_ctx::do_restore()
     It should be fixed inside object services implementation and then the
     following line should be removed.
    */
-  // FIXME: detect errors.
-  // FIXME: error logging.
-  close_thread_tables(m_thd);
-  // FIXME: detect errors.
-  // FIXME: error logging.
-  m_thd->main_da.reset_diagnostics_area();
+  close_thread_tables(m_thd);                   // Never errors
+  m_thd->main_da.reset_diagnostics_area();      // Never errors  
 
-  if (lock_tables_for_restore()) // reports errors
+  if (lock_tables_for_restore())                // logs errors
     DBUG_RETURN(m_error);
 
   // Here restore drivers are created to restore table data
   err= restore_table_data(m_thd, info, s); // reports errors
 
-  // FIXME: detect errors if reported.
-  unlock_tables();
+  unlock_tables();                              // Never errors
 
   if (err)
     DBUG_RETURN(ER_BACKUP_RESTORE);
@@ -1134,12 +1239,8 @@ int Backup_restore_ctx::do_restore()
     It should be fixed inside object services implementation and then the
     following line should be removed.
    */
-  // FIXME: detect errors.
-  // FIXME: error logging.
-  close_thread_tables(m_thd);
-  // FIXME: detect errors.
-  // FIXME: error logging.
-  m_thd->main_da.reset_diagnostics_area();
+  close_thread_tables(m_thd);                   // Never errors
+  m_thd->main_da.reset_diagnostics_area();      // Never errors
 
   /*
     Report validity point time and binlog position stored in the backup image
@@ -1150,9 +1251,7 @@ int Backup_restore_ctx::do_restore()
   if (info.flags & BSTREAM_FLAG_BINLOG)
     report_binlog_pos(info.binlog_pos);
 
-  // FIXME: detect errors if reported.
-  // FIXME: error logging.
-  report_stats_post(info);
+  report_stats_post(info);                      // Never errors
 
   DBUG_RETURN(0);
 }
@@ -1551,27 +1650,25 @@ void* bcat_iterator_get(st_bstream_image
   case BSTREAM_IT_TABLESPACE:     // table spaces
   {
     Iterator *it= info->get_tablespaces();
-  
-    if (!it)
+    if (!it) 
     {
-      info->m_ctx.fatal_error(ER_BACKUP_CAT_ENUM);
+      info->m_ctx.fatal_error(ER_OUT_OF_RESOURCES);
       return NULL;
     }
-
+  
     return it;
   }
 
   case BSTREAM_IT_DB:       // all databases
   {
     Iterator *it= info->get_dbs();
-  
-    if (!it)
+    if (!it) 
     {
-      info->m_ctx.fatal_error(ER_BACKUP_CAT_ENUM);
+      info->m_ctx.fatal_error(ER_OUT_OF_RESOURCES);
       return NULL;
     }
 
-    return it;
+    return it;  
   }
   
   case BSTREAM_IT_PERDB:    // per-db objects, except tables
@@ -1590,14 +1687,8 @@ void* bcat_iterator_get(st_bstream_image
   case BSTREAM_IT_GLOBAL:   // all global objects
   {
     Iterator *it= info->get_global();
-  
-    if (!it)
-    {
-      info->m_ctx.fatal_error(ER_BACKUP_CAT_ENUM);
-      return NULL;
-    }
 
-    return it;
+    return it;      // if (!it), error has been logged in get_global()
   }
 
   default:
@@ -1686,10 +1777,9 @@ void* bcat_db_iterator_get(st_bstream_im
   }
 
   backup::Image_info::Iterator *it= info->get_db_objects(*db);
-
   if (!it)
   {
-    info->m_ctx.fatal_error(ER_BACKUP_LIST_DB_TABLES);
+    info->m_ctx.fatal_error(ER_OUT_OF_RESOURCES);
     return NULL;
   }
 
@@ -1833,9 +1923,7 @@ int bcat_create_item(st_bstream_image_he
     if (ts)
     {
       DBUG_PRINT("restore",(" tablespace has changed on the server - aborting"));
-      info->m_ctx.fatal_error(ER_BACKUP_TS_CHANGE, desc,
-                              obs::get_tablespace_description(sobj)->ptr(),
-                              obs::get_tablespace_description(ts)->ptr());
+      info->m_ctx.fatal_error(ER_BACKUP_TS_CHANGE, desc);
       return BSTREAM_ERROR;
     }
   }
@@ -2029,7 +2117,11 @@ TABLE_LIST *build_table_list(const Table
   for( uint tno=0; tno < tables.count() ; tno++ )
   {
     TABLE_LIST *ptr = mk_table_list(tables[tno], lock, ::current_thd->mem_root);
-    DBUG_ASSERT(ptr);
+    if (!ptr)
+    {
+      // Failed to allocate (failure has been reported)
+      return NULL;
+    }
     tl= link_table_list(*ptr,tl);
   }
 

=== modified file 'sql/backup/logger.cc'
--- a/sql/backup/logger.cc	2008-10-08 10:54:19 +0000
+++ b/sql/backup/logger.cc	2008-10-27 13:06:21 +0000
@@ -53,8 +53,9 @@ int Logger::write_message(log_level::val
      }
 
      sql_print_error(out);
-     push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
-                         error_code, msg);
+     if (m_push_errors)
+       push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+			   error_code, msg);
      DBUG_PRINT("backup_log",("[ERROR] %s", out));
      
      if (m_state == READY || m_state == RUNNING)
@@ -69,8 +70,9 @@ int Logger::write_message(log_level::val
 
    case log_level::WARNING:
      sql_print_warning(out);
-     push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
-                         error_code, msg);
+     if (m_push_errors)
+       push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+                           error_code, msg);
      DBUG_PRINT("backup_log",("[Warning] %s", out));
      return 0;
 
@@ -134,5 +136,20 @@ void Logger::report_stats_post(const Ima
   DBUG_ASSERT(m_state == RUNNING);
   backup_log->size(info.data_size);
 }
+
+/*
+ Indicate if reported errors should be pushed on the warning stack.
+
+ If @c flag is TRUE, errors will be pushed on the warning stack, otherwise
+ they will not.
+
+ @returns Current setting.
+*/
+bool Logger::push_errors(bool flag)
+{
+  bool old= m_push_errors;
+  m_push_errors= flag;
+  return old;
+} 
 
 } // backup namespace

=== modified file 'sql/backup/logger.h'
--- a/sql/backup/logger.h	2008-10-18 07:57:38 +0000
+++ b/sql/backup/logger.h	2008-10-27 13:06:21 +0000
@@ -44,7 +44,7 @@ class Logger
 
    Logger(THD*);
    ~Logger();
-   int init(enum_type type, const LEX_STRING path, const char *query);
+   int init(enum_type type, const char *query);
 
    int report_error(int error_code, ...);
    int report_error(log_level::value level, int error_code, ...);
@@ -57,6 +57,7 @@ class Logger
    void report_vp_time(time_t, bool);
    void report_binlog_pos(const st_bstream_binlog_pos&);
    void report_driver(const char *driver);
+   void report_backup_file(char * path);
    void report_stats_pre(const Image_info&);
    void report_stats_post(const Image_info&);
    ulonglong get_op_id() const 
@@ -70,6 +71,7 @@ class Logger
    void stop_save_errors();
    void clear_saved_errors();
    util::SAVED_MYSQL_ERROR *last_saved_error();
+   bool push_errors(bool);
 
  protected:
 
@@ -83,13 +85,15 @@ class Logger
  private:
   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?
+
   Backup_log *backup_log;    ///< Backup log interface class.
 };
 
 inline
 Logger::Logger(THD *thd) 
   :m_type(BACKUP), m_state(CREATED),
-   m_thd(thd), m_save_errors(FALSE), backup_log(0)
+   m_thd(thd), m_save_errors(FALSE), m_push_errors(TRUE), backup_log(0)
 {}
 
 inline
@@ -276,6 +280,17 @@ void Logger::report_driver(const char *d
   backup_log->add_driver(driver); 
 }
 
+/** 
+  Report backup file and path.
+*/
+inline
+void Logger::report_backup_file(char *path)
+{ 
+  DBUG_ASSERT(m_state == RUNNING);
+  DBUG_ASSERT(backup_log);
+  backup_log->backup_file(path); 
+}
+
 /**
   Initialize logger for backup or restore operation.
   
@@ -283,7 +298,6 @@ void Logger::report_driver(const char *d
   member.
   
   @param[in]  type  type of operation (backup or restore)
-  @param[in]  path  location of the backup image
   @param[in]  query backup or restore query starting the operation
     
   @returns 0 on success, error code otherwise.
@@ -292,14 +306,14 @@ void Logger::report_driver(const char *d
   @todo Add code to get the user comment from command.
 */ 
 inline
-int Logger::init(enum_type type, const LEX_STRING path, const char *query)
+int Logger::init(enum_type type, const char *query)
 {
   if (m_state != CREATED)
     return 0;
 
   m_type= type;
   m_state= READY;
-  backup_log = new Backup_log(m_thd, (enum_backup_operation)type, path, query);
+  backup_log = new Backup_log(m_thd, (enum_backup_operation)type, query);
   backup_log->state(BUP_STARTING);
   DEBUG_SYNC(m_thd, "after_backup_log_init");
   return 0;

=== modified file 'sql/backup/stream.cc'
--- a/sql/backup/stream.cc	2008-09-11 11:14:59 +0000
+++ b/sql/backup/stream.cc	2008-10-15 20:00:48 +0000
@@ -190,11 +190,9 @@ extern "C" int stream_read(void *instanc
 }
 
 
-Stream::Stream(Logger &log, ::String *backupdir, 
-               LEX_STRING orig_loc, int flags)
-  :m_flags(flags), m_block_size(0), m_log(log)
+Stream::Stream(Logger &log, ::String *path, int flags)
+  :m_path(path), m_flags(flags), m_block_size(0), m_log(log)
 {
-  prepare_path(backupdir, orig_loc);
   bzero(&stream, sizeof(stream));
   bzero(&buf, sizeof(buf));
   bzero(&mem, sizeof(mem));
@@ -204,190 +202,6 @@ Stream::Stream(Logger &log, ::String *ba
 }
 
 /**
-  Make a relative path.
-
-  This method takes the backupdir and the path specified on the backup command
-  (orig_loc) and forms a combined path. It walks the backupdir from the right
-  and the orig_loc from the left to position the paths for concatenation. Output
-  is written to new_path.
-
-  @param[OUT] new_path   The newly combined path + file name.
-  @param[IN]  orig_loc   The path + file name specified in the backup command.
-  @param[IN]  backupdir  The backupdir system variable value.
-
-  For example, if backupdir = '/dev/tmp' and orig_log = '../backup.bak', the 
-  combined path is = '/dev/backup.bak'.
-
-  Note: fn_format may likely be used instead of this function - will
-  not be changed unless bugs are found.
-
-  @returns 
-    0 if success
-    1 if cannot be combined. Note: m_path is set to '' when this occurs to
-      trigger error in call stack.
-*/
-int Stream::make_relative_path(char *new_path, 
-                               char *orig_loc, 
-                               ::String *backupdir)
-{
-  char fixed_base[FN_LEN];
-  char fixed_rel[FN_LEN];
-  cleanup_dirname(fixed_base, backupdir->c_ptr());
-  cleanup_dirname(fixed_rel, orig_loc);
-  char *rel;
-  char *base= fixed_base;
-  bool done= FALSE;
-  char *found= fixed_rel;
-  int j= backupdir->length() - 1;
-  new_path[0]= 0;  // initialize the new path to an empty string
-
-  /*
-    For each '../' in orig_loc, move the pointer to the right for rel.
-    For each '../' in orig_loc, move pointer to the left for base.
-  */
-  while (!done)
-  {
-    rel= found; // save last known position
-    // find location of next level in relative path
-    found= strstr(found, FN_PARENTDIR);
-    if (found)
-    {
-      found+= 2;   // move past '..\'
-      if (base[j] == FN_LIBCHAR)
-        j--;       // move past last '\'
-      if (j == 0)  // We are trying to move too far down the path
-        return 1;
-      /*
-        Look for the next level down.
-      */
-      while ((base[j] != FN_LIBCHAR) && j)
-        j--;       
-    }
-    else
-      done= TRUE;
-  }
-  strcpy (new_path, base);
-  strcpy (new_path + j, rel);
-  return 0;
-}
-
-/**
-  Prepare path for access.
-
-  This method takes the backupdir and the file name specified on the backup
-  command (orig_loc) and forms a combined path + file name as follows:
-
-    1. If orig_loc has a relative path, make it relative to backupdir
-    2. If orig_loc has a hard path, use it.
-    3. If orig_loc has no path, append to backupdir
-
-  @param[IN]  backupdir  The backupdir system variable value.
-  @param[IN]  orig_loc   The path + file name specified in the backup command.
-
-  @returns 0
-*/
-int Stream::prepare_path(::String *backupdir, 
-                         LEX_STRING orig_loc)
-{
-  int path_len= 0;
-
-  /*
-    The full path is needed to test for secure-file-priv option in
-    Stream::open. If not full, replace backupdir with the full
-    path name, which is relative to datadir (i.e., global variable
-    mysql_real_data_home)
-  */
-  if (!test_if_hard_path(backupdir->c_ptr()))
-  {
-    char full_path[FN_LEN];
-    
-    /* 
-       MY_UNPACK_FILENAME  "~/" will be changed to full path
-       MY_RELATIVE_PATH    path is constructed from the base path
-                           mysql_real_data_home combined with the
-                           relative path backupdir. Also handles
-                           "../" in backupdir and converts dirname 
-                           to fit this system
-    */
-    fn_format(full_path, backupdir->c_ptr(), mysql_real_data_home, "",
-              MY_UNPACK_FILENAME | MY_RELATIVE_PATH);
-
-    uint32 full_path_len= strlen(full_path);
-    backupdir->copy(full_path, full_path_len, &::my_charset_bin);
-  }
-  
-  /*
-    Prepare the path using the backupdir iff no relative path
-    or no hard path included.
-
-    Relative paths are formed from the backupdir system variable.
-  */
-  if (is_prefix(orig_loc.str, FN_PARENTDIR))
-  {
-    /* 
-      Case 1: Backup image file name has relative path. 
-              Make relative to backupdir.
-
-      Example BACKUP DATATBASE ... TO '../monthly/dec.bak'
-              If backupdir = '/dev/daily' then the
-              calculated path becomes
-              '/dev/monthly/dec.bak'
-    */
-    char new_path[FN_LEN];
-    if (make_relative_path(new_path, orig_loc.str, backupdir))
-      m_path.length(0);
-    path_len= strlen(new_path) + 1;
-    m_path.alloc(path_len);
-    m_path.length(0);
-    m_path.append(new_path);
-  }
-  else if (!test_if_hard_path(orig_loc.str))
-  {
-    /* 
-      Case 2: Backup image file name has no path or has a subpath. 
-
-      Example BACKUP DATABASE ... TO 'week2.bak'
-              If backupdir = '/dev/weekly/' then the
-              calculated path becomes
-              '/dev/weekly/week2.bak'
-      Example BACKUP DATABASE ... TO 'jan/day1.bak'
-              If backupdir = '/dev/monthly/' then the
-              calculated path becomes
-              '/dev/monthly/jan/day1.bak'
-    */
-    path_len=backupdir->length() + orig_loc.length + 1;
-    m_path.alloc(path_len);
-    fn_format(m_path.c_ptr(), orig_loc.str, backupdir->c_ptr(), "",
-              MY_UNPACK_FILENAME | MY_RELATIVE_PATH);
-  }
-  else 
-  {
-    /* 
-      Case 3: Backup image file name has hard path. 
-
-      Example BACKUP DATATBASE ... TO '/dev/dec.bak'
-              If backupdir = '/dev/daily/backup' then the
-              calculated path becomes
-              '/dev/dec.bak'
-    */
-    path_len= orig_loc.length + 1;
-    int dn_length= dirname_length(orig_loc.str);
-
-    m_path.alloc(path_len);
-    m_path.length(0);
-    m_path.append(orig_loc.str, dn_length); // Append directory-part only
-
-    // Convert directory name to fit this system
-    convert_dirname(m_path.c_ptr(), m_path.c_ptr(), m_path.c_ptr() + dn_length);
-
-    // Append filename now that directory name has been converted
-    m_path.append(orig_loc.str + dn_length);
-  }
-  m_path.length(path_len);
-  return 0;
-}
-
-/**
   Check if secure-file-priv option has been set and if so, whether
   or not backup tries to write to the path (or a sub-path) specified
   by secure-file-priv.
@@ -419,11 +233,12 @@ bool Stream::test_secure_file_priv_acces
  */
 int Stream::open()
 {
-  close();
-  if (!test_secure_file_priv_access(m_path.c_ptr()))
+  close();        // If close() should fail, we will still try to open
+
+  if (!test_secure_file_priv_access(m_path->c_ptr()))
     return ER_OPTION_PREVENTS_STATEMENT;
 
-  m_fd= my_open(m_path.c_ptr(), m_flags, MYF(0));
+  m_fd= my_open(m_path->c_ptr(), m_flags, MYF(0));
 
   if (!(m_fd >= 0))
     return -1;
@@ -431,13 +246,18 @@ int Stream::open()
   return 0;
 }
 
-void Stream::close()
+bool Stream::close()
 {
+  bool ret= TRUE;
   if (m_fd >= 0)
   {
-    my_close(m_fd, MYF(0));
+    if (my_close(m_fd, MYF(0)))
+    {
+      ret= FALSE;
+    }
     m_fd= -1;
   }
+  return ret;
 }
 
 bool Stream::rewind()
@@ -451,10 +271,9 @@ bool Stream::rewind()
 }
 
 
-Output_stream::Output_stream(Logger &log, ::String *backupdir,
-                             LEX_STRING orig_loc,
+Output_stream::Output_stream(Logger &log, ::String *path,
                              bool with_compression)
-  :Stream(log, backupdir, orig_loc, 0)
+  :Stream(log, path, 0)
 {
   m_with_compression= with_compression;
   stream.write= stream_write;
@@ -532,10 +351,10 @@ bool Output_stream::init()
 int Output_stream::open()
 {
   MY_STAT stat_info;
-  close();
+  close();        // If close() should fail, we will still try to open
 
   /* Allow to write to existing named pipe */
-  if (my_stat(m_path.c_ptr(), &stat_info, MYF(0)) &&
+  if (my_stat(m_path->c_ptr(), &stat_info, MYF(0)) &&
       MY_S_ISFIFO(stat_info.st_mode))
     m_flags= O_WRONLY;
   else
@@ -585,17 +404,22 @@ int Output_stream::open()
   Close backup stream
 
   If @c destroy is TRUE, the stream object is deleted.
+
+  @retval TRUE  Operation Succeeded
+  @retval FALSE Operation Failed
 */
-void Output_stream::close()
+bool Output_stream::close()
 {
+  bool ret= TRUE;
   if (m_fd < 0)
-    return;
+    return TRUE;
+
+  if (bstream_close(this) == BSTREAM_ERROR)
+  {
+    // Note that close failed, and continue with lower level clean-up.
+    ret= FALSE;
+  }
 
-  /*
-   Note: Even if bstream_close() fails we want to do the lower level clean-up.
-   This is why errors from bstream_close() are ignored.
-  */ 
-  bstream_close(this);
 #ifdef HAVE_COMPRESS
   if (m_with_compression)
   {
@@ -624,7 +448,8 @@ void Output_stream::close()
     my_free(zbuf, MYF(0));
   }
 #endif
-  Stream::close();
+  ret &= Stream::close();
+  return ret;
 }
 
 /**
@@ -648,9 +473,8 @@ bool Output_stream::rewind()
 }
 
 
-Input_stream::Input_stream(Logger &log, ::String *backupdir, 
-                           LEX_STRING orig_loc)
-  :Stream(log, backupdir, orig_loc, O_RDONLY)
+Input_stream::Input_stream(Logger &log, ::String *path)
+  :Stream(log, path, O_RDONLY)
 {
   m_with_compression= false;
   stream.read= stream_read;
@@ -723,7 +547,7 @@ bool Input_stream::init()
 */
 int Input_stream::open()
 {
-  close();
+  close();        // If close() should fail, we will still try to open
 
   int ret= Stream::open();
 
@@ -776,17 +600,22 @@ int Input_stream::open()
   Close backup stream
 
   If @c destroy is TRUE, the stream object is deleted.
+
+  @retval TRUE  Operation Succeeded
+  @retval FALSE Operation Failed
 */
-void Input_stream::close()
+bool Input_stream::close()
 {
+  bool ret= TRUE;
   if (m_fd < 0)
-    return;
+    return TRUE;
+
+  if (bstream_close(this) == BSTREAM_ERROR)
+  {
+    // Note that close failed, and continue with lower level clean-up.
+    ret= FALSE;
+  }
 
-  /*
-   Note: Even if bstream_close() fails we want to do the lower level clean-up.
-   This is why errors from bstream_close() are ignored.
-  */ 
-  bstream_close(this);
 #ifdef HAVE_COMPRESS
   if (m_with_compression)
   {
@@ -796,7 +625,8 @@ void Input_stream::close()
     my_free(zbuf, (MYF(0)));
   }
 #endif
-  Stream::close();
+  ret &= Stream::close();
+  return ret;
 }
 
 /**

=== modified file 'sql/backup/stream.h'
--- a/sql/backup/stream.h	2008-09-02 09:04:39 +0000
+++ b/sql/backup/stream.h	2008-10-15 20:00:48 +0000
@@ -80,7 +80,8 @@ class Stream: public fd_stream
  public:
 
   int open();
-  virtual void close();
+  virtual bool close();
+
   bool rewind();
 
   /// Check if stream is opened
@@ -92,9 +93,9 @@ class Stream: public fd_stream
 
  protected:
 
-  Stream(Logger&, ::String *, LEX_STRING, int);
+  Stream(Logger&, ::String *, int);
 
-  String  m_path;
+  ::String  *m_path;
   int     m_flags;  ///< flags used when opening the file
   size_t  m_block_size;
   Logger  m_log;
@@ -104,11 +105,6 @@ class Stream: public fd_stream
 
 private:
 
-  int make_relative_path(char *new_path, 
-                         char *orig_loc, 
-                         ::String *backupdir);
-  int prepare_path(::String *backupdir, 
-                   LEX_STRING orig_loc);
   bool test_secure_file_priv_access(char *path);
 
 };
@@ -119,10 +115,10 @@ class Output_stream:
 {
  public:
 
-  Output_stream(Logger&, ::String *, LEX_STRING, bool);
+  Output_stream(Logger&, ::String *, bool);
 
-  int  open();
-  void close();
+  int open();
+  bool close();
   bool rewind();
 
  private:
@@ -137,10 +133,10 @@ class Input_stream:
 {
  public:
 
-  Input_stream(Logger&, ::String *, LEX_STRING);
+   Input_stream(Logger&, ::String *);
 
-  int  open();
-  void close();
+  int open();
+  bool close();
   bool rewind();
 
   int next_chunk();

=== modified file 'sql/log.cc'
--- a/sql/log.cc	2008-10-22 11:51:28 +0000
+++ b/sql/log.cc	2008-10-27 13:06:21 +0000
@@ -898,6 +898,15 @@ bool Log_to_csv_event_handler::
     table->field[ET_OBH_FIELD_BACKUP_FILE]->set_notnull();
   }
 
+  if (history_data->backup_file_path)
+  {
+    if (table->field[ET_OBH_FIELD_BACKUP_FILE_PATH]->store(
+        history_data->backup_file_path, 
+        strlen(history_data->backup_file_path), system_charset_info))
+      goto err;
+    table->field[ET_OBH_FIELD_BACKUP_FILE_PATH]->set_notnull();
+  }
+
   if (history_data->user_comment)
   {
     if (table->field[ET_OBH_FIELD_COMMENT]->store(history_data->user_comment,
@@ -3145,7 +3154,7 @@ bool MYSQL_BACKUP_LOG::open(const char *
                    "\terror_num \tnum_objects \ttotal_bytes "
                    "\tvalidity_point_time \tstart_time \tstop_time "
                    "\thost_or_server_name \tusername \tbackup_file "
-                   "\tuser_comment \tcommand \tdrivers\n",
+                   "\tbackup_file_path \tuser_comment \tcommand \tdrivers\n",
                    sizeof(buff) - len);
     else
       end= strnmov(buff + len, "\nbackup_id \tobject \tstart_time \tstop_time "
@@ -3340,6 +3349,8 @@ bool MYSQL_BACKUP_LOG::write(THD *thd, s
     if (write_str(user))
       goto err;
     if (write_str(history_data->backup_file))
+      goto err;
+    if (write_str(history_data->backup_file_path))
       goto err;
     if (write_str(history_data->user_comment))
       goto err;

=== modified file 'sql/log.h'
--- a/sql/log.h	2008-10-20 19:13:22 +0000
+++ b/sql/log.h	2008-10-27 13:06:21 +0000
@@ -38,6 +38,7 @@ enum enum_backup_history_log_field
   ET_OBH_FIELD_HOST_OR_SERVER,
   ET_OBH_FIELD_USERNAME,
   ET_OBH_FIELD_BACKUP_FILE,
+  ET_OBH_FIELD_BACKUP_FILE_PATH,
   ET_OBH_FIELD_COMMENT,
   ET_OBH_FIELD_COMMAND,
   ET_OBH_FIELD_DRIVERS,

=== modified file 'sql/mdl.cc'
--- a/sql/mdl.cc	2008-08-13 10:36:29 +0000
+++ b/sql/mdl.cc	2008-10-14 12:08:56 +0000
@@ -300,7 +300,7 @@ void mdl_init_lock(MDL_LOCK_DATA *lock_d
 
    @note The allocated lock request will have MDL_SHARED type.
 
-   @retval 0      Error
+   @retval 0      Error if out of memory
    @retval non-0  Pointer to an object representing a lock request
 */
 

=== modified file 'sql/share/errmsg.txt'
--- a/sql/share/errmsg.txt	2008-10-27 14:29:17 +0000
+++ b/sql/share/errmsg.txt	2008-10-29 06:20:09 +0000
@@ -6347,7 +6347,7 @@ ER_BACKUP_CAT_ENUM
 ER_BACKUP_CANT_RESTORE_TS
         eng "Could not create tablespace %-.64s needed by tables being restored."
 ER_BACKUP_TS_CHANGE
-        eng "Tablespace %-.64s needed by tables being restored has changed on the server. The original definition of the required tablespace is '%-.256s' while the same tablespace is defined on the server as '%-.256s'"
+        eng "Tablespace %-.64s needed by tables being restored, but the current tablespace definition differs from how it was when backup was made."
 ER_BACKUP_GET_META_TS
         eng "Failed to obtain meta-data for tablespace %-.64s."
 ER_TABLESPACE_DATAFILE_EXIST
@@ -6386,3 +6386,16 @@ ER_BACKUP_LOGPATHS
   eng "The log names for backup_history and backup_progress must be unique."
 ER_BACKUP_LOGPATH_INVALID
   eng "The path specified for the %-.64s is invalid. ref: %-.64s"
+ER_BACKUP_SEND_REPLY
+        eng "Failed to send reply to client after successful %-.64s operation"
+        nor "Feil ved sending av svar til klient etter %-.64s"
+        norwegian-ny "Feil ved sending av svar til klienten etter %-.64s"
+ER_BACKUP_CLOSE
+        eng "Backup/Restore: Error on close of backup stream"
+        nor "Backup/Restore: Feil ved lukning av backup-strøm"
+        norwegian-ny "Backup/Restore:  Feil ved lukking av backup-straum"
+ER_BACKUP_BINLOG
+        eng "Error on accessing binlog during BACKUP"
+        nor "Lesing av binlog feilet under BACKUP"
+        norwegian-ny "Lesing av binlog feila under BACKUP"
+

=== modified file 'sql/si_logs.cc'
--- a/sql/si_logs.cc	2008-09-30 07:51:48 +0000
+++ b/sql/si_logs.cc	2008-10-15 20:00:48 +0000
@@ -28,7 +28,6 @@
 */ 
 Backup_log::Backup_log(THD *thd, 
                        enum_backup_operation type, 
-                       const LEX_STRING path, 
                        const char *query)
 {
   m_thd= thd;
@@ -38,9 +37,6 @@ Backup_log::Backup_log(THD *thd, 
   m_op_hist.state= BUP_STARTING;
   m_op_hist.operation= type;
 
-  if (path.length > 0)
-     m_op_hist.backup_file= path.str;
-
   if (strlen(query) > 0)
     m_op_hist.command= (char *)query;
 
@@ -68,6 +64,27 @@ void Backup_log::add_driver(const char *
   if (strlen(driver_name) > 0)
     str.append(driver_name);
   m_op_hist.driver_name.copy(str);
+}
+
+/**
+  Report name of a backup image file and path used in backup/restore.
+
+  This method updates the backup_file and backup_file_path information 
+  in the history data. 
+
+  @param[IN] char * full_path  The full path and file name of the backup file.
+*/
+void Backup_log::backup_file(const char *full_path)
+{
+  String str;   
+
+  if (strlen(full_path))
+  {
+    size_t i= 0;
+    size_t j= 0;
+    j= dirname_part(m_op_hist.backup_file_path, full_path, &i);
+    m_op_hist.backup_file = (char *)(full_path + i);
+  }
 }
 
 /**

=== modified file 'sql/si_logs.h'
--- a/sql/si_logs.h	2008-09-30 07:51:48 +0000
+++ b/sql/si_logs.h	2008-10-15 20:00:48 +0000
@@ -48,6 +48,7 @@ struct st_backup_history
   int error_num;                   ///< error number
   char *user_comment;              ///< user comment from command
   char *backup_file;               ///< the backup image file
+  char backup_file_path[FN_REFLEN]; ///< the backup image path
   char *command;                   ///< the command used
   int binlog_pos;                  ///< position in the binary log
   char *binlog_file;               ///< the name of the binary log file
@@ -94,7 +95,6 @@ class Backup_log
 public:
   Backup_log(THD *thd, 
              enum_backup_operation type, 
-             const LEX_STRING path, 
              const char *query); 
 
   /* 
@@ -132,6 +132,7 @@ public:
   void stop(time_t when);
   void vp_time(time_t when, bool report);
   void add_driver(const char* driver);
+  void backup_file(const char *full_path);
 
 private:
   st_backup_history m_op_hist;  ///< history log information

=== modified file 'sql/si_objects.cc'
--- a/sql/si_objects.cc	2008-10-17 11:28:25 +0000
+++ b/sql/si_objects.cc	2008-10-27 13:06:21 +0000
@@ -3685,22 +3685,6 @@ Obj *is_tablespace(THD *thd, Obj *ts)
   DBUG_RETURN(other_ts);
 }
 
-/**
-  Decribe a tablespace.
-
-  This method returns a description of the tablespace useful for communicating
-  with the user.
-
-  @param[in]  ts  The Tablspace to describe.
-
-  @returns tablespace description
-*/
-const String *get_tablespace_description(Obj *ts)
-{
-  DBUG_ENTER("obs::get_tablespace_description()");
-  DBUG_RETURN(((TablespaceObj *)ts)->describe());
-}
-
 ///////////////////////////////////////////////////////////////////////////
 
 //

=== modified file 'sql/si_objects.h'
--- a/sql/si_objects.h	2008-10-17 11:28:25 +0000
+++ b/sql/si_objects.h	2008-10-27 13:06:21 +0000
@@ -617,13 +617,6 @@ bool tablespace_exists(THD *thd, Obj *ts
 
 Obj *is_tablespace(THD *thd, Obj *ts);
 
-/**
-  Return a description of the tablespace useful for communicating with the
-  user.
-*/
-
-const String *get_tablespace_description(Obj *ts);
-
 ///////////////////////////////////////////////////////////////////////////
 
 //

Thread
bzr push into mysql-6.0 branch (alik:2719) Alexander Nozdrin30 Oct