From: Rafal Somla Date: October 29 2008 3:08pm Subject: Re: bzr commit into mysql-6.0-backup branch (cbell:2720) WL#4209 List-Archive: http://lists.mysql.com/commits/57324 Message-Id: <49087C5A.4050208@sun.com> MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset=UTF-8 Content-Transfer-Encoding: 7BIT Hi Chuck, I see some problems with the proposed test case. See my comments inlined below. Chuck Bell wrote: > === added file 'mysql-test/suite/rpl/t/rpl_backup.test' > --- a/mysql-test/suite/rpl/t/rpl_backup.test 1970-01-01 00:00:00 +0000 > +++ b/mysql-test/suite/rpl/t/rpl_backup.test 2008-10-29 00:10:42 +0000 > @@ -0,0 +1,284 @@ > +# > +# Test backup and replication integration. > +# > + > +--source include/master-slave.inc > +--source include/not_embedded.inc > +--source include/have_debug_sync.inc > +--source include/have_debug.inc > + > +connection master; > + > +--echo Create some data... > +CREATE DATABASE rpl_backup; > +CREATE TABLE rpl_backup.t1 (a int) ENGINE=MEMORY; > +INSERT INTO rpl_backup.t1 VALUES (1), (2), (3), (4), (5); > + > +# > +# Use Case 1 - Backup performed on a master. > +# When a backup is performed on a master, the master shall not log > +# the backup event nor shall the master replicate any data produced > +# (logged) by the backup. > + (cut) > +--echo Backup_id = 500. > +BACKUP DATABASE rpl_backup TO 'rpl_bup_m1.bak'; > + > +SET SESSION debug="d"; > + > +# > +# Now check slave to see if backup logs are affected. > +# > +connection slave; > + > +--echo Should have count(*) = 0. > +SELECT count(*) FROM mysql.backup_history; > + More things can and should be checked: - check that nothing was added to master's binary log with SHOW BINLOG EVENTS. - check that slave is active after BACKUP on master - check that slave's master position was not changed I see some of these checked below in Case 3, which is confusing - do it here as this is the place to test what happens when you perform BACKUP on a master host. > +--echo Check backup log. Compare should be 1 > +--echo Perform backup on slave and examine backup log. Above should not be here? > +--echo Check backup log. Compare should be NULL > +FLUSH BACKUP LOGS; > +PURGE BACKUP LOGS; > + > +# > +# Use Case 3 - Backup performed on a slave (part 1 of 2) > +# Test backup on slave but slave has not slaves. > +# (cut) > +--echo Backup_id = 600. > +BACKUP DATABASE rpl_backup TO 'rpl_bup_s1.bak'; > + > +SET SESSION debug="d"; > + > +--echo Check saving of master's binlog information. > +--echo Should have count(*) = 1. > +SELECT count(*) FROM mysql.backup_progress > +WHERE backup_id = 600 AND notes LIKE 'Recording master binlog information%'; This does not check that a correct position has been reported. > + > +--echo Should have count(*) = 1. > +SELECT count(*) FROM mysql.backup_history; > + > +--echo Verify backup run on master does not advance binlog pos. > +connection master; This is part of Case 1, I think. > + > +--echo Get binlog position before backup. > +let $before_pos = query_get_value("SHOW MASTER STATUS", Position, 1); > + > +--echo Backup_id = 501. > +BACKUP DATABASE rpl_backup TO 'rpl_bup_m2.bak'; > + > +--echo Get binlog position after backup. > +let $after_pos = query_get_value("SHOW MASTER STATUS", Position, 1); > + Case 3 talks about "BACKUP on slave" but you perform it on master. This looks like still testing Case 1. Don't forget to test BACKUP on slave as well. (cut) > +# > +# Use Case 2 - Restore performed on a master. > +# > + > +# To ensure the master does not log anything in the binary log > +# during a restore, we first drop the database on the slave > +# then run the restore and after slave is restarted check to > +# see if database is still missing (it should be). > + Please do more: - check what is inserted into binlog on master - check that slave is stopped after restore on master (due to the incident event). - check that restored data is not in the slave in case slave replicates a database which is being restored on master. - check that new slaves can not connect when RESTORE runs on the master (cut) > +# > +# Use Case 5 - Backup run with no binary log. > +# > + Do we need to include this test case in a test checking how BACKUP/RESTORE interracts with binary logging and replication. Equally well, you could include a scenario where neither BACKUP nor RESTORE is executed ;) (cut) > +# > +# Use Case 6 - Restore run with binary log turned on but no slaves attached. > +# > + > +--echo backup_id = 505. > +RESTORE FROM 'rpl_bup_m4.bak'; Check contents of the binary log, e.g., with SHOW BINLOG EVENTS. Rafal