List:Commits« Previous MessageNext Message »
From:Rafal Somla Date:January 23 2009 3:13pm
Subject:Re: bzr commit into mysql-6.0-backup branch (jorgen.loland:2754)
Bug#41012
View as plain text  
Hi Jorgen,

STATUS
------
Changes requested.

REQUESTS
--------
1. Also cover errors when reading backup stream header and catalogue inside 
Backup_restore_ctx::prepare_for_restore().

SUGGESTIONS
-----------
2. Calls to e.g. s.next_chunk() happen in several places in the code. Using your 
test method, only first call will fail and other error branches are not tested. 
Consider if test can be changed to cover all the branches. However, I have no 
good idea how to do that :( [1]

COMMENTS
--------
Otherwise patch looks very good. Nicely written test.

DETAILS
-------
Jorgen Loland wrote:
> #At file:///localhome/jl208045/mysql/mysql-6.0-backup-41012/
> 
>  2754 Jorgen Loland	2009-01-23
>       Bug#41012 - Error checks when reading backup image not covered by tests.
>             
>       Previously, there were no tests of RESTORE when errors occured. This patch adds
> debug hooks that can be used to inject error into the RESTORE code.
> modified:
>   mysql-test/suite/backup/r/backup_errors.result
>   mysql-test/suite/backup/t/backup_errors.test
>   sql/backup/be_default.cc
>   sql/backup/data_backup.cc
>   sql/backup/kernel.cc
>   sql/backup/stream.cc
>   sql/backup/stream.h
> 
> per-file messages:
>   mysql-test/suite/backup/r/backup_errors.result
>     Add tests that inject errors into RESTORE code
>   mysql-test/suite/backup/t/backup_errors.test
>     Add tests that inject errors into RESTORE code
>   sql/backup/be_default.cc
>     Add debug hook for testing purposes that can be used to inject error into
> Restore::send_data
>   sql/backup/data_backup.cc
>     Add debug hook for testing purposes that can be used to inject error into RESTORE
> method restore_table_data
>   sql/backup/kernel.cc
>     Add debug hook for testing purposes that can be used to inject error into various
> RESTORE methods
>   sql/backup/stream.cc
>     Add debug hook for testing purposes that can be used to inject error into method
> Input_stream::next_chunk
>   sql/backup/stream.h
>     Add debug hook for testing purposes that can be used to inject error into method
> read_summary
> === modified file 'mysql-test/suite/backup/r/backup_errors.result'
> --- a/mysql-test/suite/backup/r/backup_errors.result	2009-01-08 14:57:41 +0000
> +++ b/mysql-test/suite/backup/r/backup_errors.result	2009-01-23 14:12:35 +0000
> @@ -323,6 +323,7 @@ trigger metadata
>  SET SESSION DEBUG='+d,backup_fail_add_trigger';
>  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%";
> @@ -438,4 +439,77 @@ 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';
> +backup_id
> +#
> +DROP DATABASE db1;
> +#
> +# Backup image created. Start RESTORE with error injection
> +#
> +# 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
> +#
> +SET SESSION DEBUG='+d,restore_stream_next_chunk';
> +RESTORE FROM 'errorinject.bak';
> +ERROR HY000: Can't go to the next chunk in backup stream

[1] This fails on the first call to next_chunk() but other branches are not tested.

Rafal
Thread
bzr commit into mysql-6.0-backup branch (jorgen.loland:2754) Bug#41012Jorgen Loland23 Jan
  • Re: bzr commit into mysql-6.0-backup branch (jorgen.loland:2754)Bug#41012Rafal Somla23 Jan