Jorgen,
I have some suggestions on how to test these conditions. It would be good to
include them. Perhaps you can add it to the existing backup_errors test?
The tests will require use of the DEBUG_SYNC() mechanism -- see other backup
tests that use it.
> --- a/sql/si_objects.cc 2008-07-09 07:12:43 +0000
> +++ b/sql/si_objects.cc 2008-08-07 09:06:06 +0000
> @@ -1607,7 +1607,7 @@ bool DatabaseObj::do_serialize(THD *thd,
> if (check_db_dir_existence(m_db_name.c_ptr()))
> {
> my_error(ER_BAD_DB_ERROR, MYF(0), m_db_name.c_ptr());
> - DBUG_RETURN(FALSE);
> + DBUG_RETURN(TRUE);
> }
For this one, I would try stopping the backup after the databases have been
read and before execution of the do_serialize() method. When the backup is
paused, issue a command to destroy the database folder, then resume the
backup. This should encounter the error. I must admit I got carried away
making an example for you and before I knew it I had written the test. :P
So, here's a head start (feel free to use and modify as you see fit):
--source include/not_embedded.inc
--source include/have_debug_sync.inc
SET DEBUG_SYNC= 'reset';
connect (con1,localhost,root,,);
connect (con2,localhost,root,,);
connection con1;
SET DEBUG_SYNC= 'reset';
CREATE DATABASE db_in_question;
connection con2;
SET DEBUG_SYNC= 'before_check_db_create SIGNAL started WAIT_FOR
db_will_fail';
send BACKUP DATABASE db_in_question TO 'b1.bak';
connection con1;
SET DEBUG_SYNC='now WAIT_FOR started';
--remove_file $MYSQLTEST_VARDIR/master-data/db_in_question/db.opt
--rmdir $MYSQLTEST_VARDIR/master-data/db_in_question
SET DEBUG_SYNC='now SIGNAL db_will_fail';
connection con2;
--error ER_BAD_DB_ERROR
reap;
SET DEBUG_SYNC= 'reset';
> -1939,7 +1939,7 @@ bool TriggerObj::do_serialize(THD *thd,
> alloc_mdl_locks(lst, thd->mem_root);
>
> if (open_tables(thd, &lst, &num_tables, 0))
> - DBUG_RETURN(FALSE);
> + DBUG_RETURN(TRUE);
>
> DBUG_ASSERT(num_tables == 1);
> Table_triggers_list *triggers= lst->table->triggers;
Well, for this error we could do something similar as above but it may need
to be done with a DBUG_EXECUTE_IF() macro inserted in the code before the
open_tables() call. Before I get carried away again, I will leave the rest
for you! Let me know if you have questions.
Cheers!
Chuck