List:Commits« Previous MessageNext Message »
From:Hema Sridharan Date:April 29 2009 6:20pm
Subject:bzr commit into mysql-6.0-backup branch (hema:2700) WL#4195
View as plain text  
#At file:///export/home2/tmp/wl4195f/mysql-6.0-backup/ based on revid:jorgen.loland@stripped

 2700 Hema Sridharan	2009-04-29
      WL#4195(Binlogging at restore time)
      added:
        mysql-test/suite/rpl/include/rpl_backup_basic.inc
        mysql-test/suite/rpl/include/rpl_backup_multi.inc
        mysql-test/suite/rpl/include/rpl_backup_multi_sync.inc
        mysql-test/suite/rpl/r/rpl_backup_extra.result
        mysql-test/suite/rpl/r/rpl_backup_multi.result
        mysql-test/suite/rpl/r/rpl_backup_ptr.result
        mysql-test/suite/rpl/r/rpl_backup_shutdown.result
        mysql-test/suite/rpl/t/rpl_backup_extra.test
        mysql-test/suite/rpl/t/rpl_backup_multi.cnf
        mysql-test/suite/rpl/t/rpl_backup_multi.test
        mysql-test/suite/rpl/t/rpl_backup_ptr.test
        mysql-test/suite/rpl/t/rpl_backup_shutdown.test

=== added file 'mysql-test/suite/rpl/include/rpl_backup_basic.inc'
--- a/mysql-test/suite/rpl/include/rpl_backup_basic.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/include/rpl_backup_basic.inc	2009-04-29 18:20:21 +0000
@@ -0,0 +1,61 @@
+# This include file creates databases and objects. This file will be used by
+# rpl_backup_extra.test, rpl_backup_ptr.test, rpl_backup_multi.test
+# This inc file will help avoid creating objects repeatedly in the tests 
+# mentioned above
+
+--echo # Create databases and objects
+
+CREATE DATABASE db1;
+CREATE DATABASE db2;
+CREATE TABLE db1.t11(a INT NOT NULL AUTO_INCREMENT, b VARCHAR(100), c INT NOT NULL, PRIMARY KEY(a));
+CREATE TABLE db1.t12(details CHAR(30));
+CREATE TABLE db2.t21(id INT, fname VARCHAR(20), INDEX name(fname));
+
+INSERT INTO db1.t11(b, c) VALUES('a',10),('b',20),('c',30),('d',40);
+SELECT * FROM db1.t11;
+
+CREATE VIEW db1.v1 AS SELECT * FROM db2.t21;
+
+CREATE EVENT db2.e1 ON SCHEDULE EVERY 1 YEAR DO
+ DELETE FROM db1.t11 WHERE c > 100;
+
+DELIMITER ||;
+
+CREATE PROCEDURE db2.p1()
+BEGIN
+ SELECT * FROM db1.t12;
+END;||
+
+CREATE TRIGGER db2.trgi AFTER INSERT ON db2.t21 FOR EACH ROW
+BEGIN
+ INSERT INTO db1.t12 VALUES('trigger trg1 fired');
+END;||
+
+--echo Function will return number of times trigger & event is fired
+CREATE FUNCTION db1.f1() RETURNS INT
+ RETURN (SELECT COUNT(*) FROM db1.t12);||
+
+--echo
+--echo ### Create procedure to check objects in all databases ###
+
+CREATE PROCEDURE test.show_objects(db CHAR(10))
+BEGIN
+SELECT TABLE_NAME, TABLE_TYPE FROM information_schema.tables
+    WHERE TABLE_SCHEMA = db;
+(SELECT routine_name , routine_type FROM information_schema.routines
+    WHERE routine_schema = db)
+UNION (SELECT event_name, 'EVENT' FROM information_schema.events
+    WHERE event_schema = db)
+UNION (SELECT trigger_name, 'TRIGGER' FROM information_schema.triggers
+    WHERE trigger_schema = db) ORDER BY routine_name, routine_type;
+END;||
+
+DELIMITER ;||
+
+--echo # Exercise objects
+INSERT INTO db2.t21 VALUES(100, 'a');
+SELECT * FROM db1.v1;
+CALL db2.p1();
+SELECT db1.f1();
+SELECT COUNT(*) FROM db1.t11;
+

=== added file 'mysql-test/suite/rpl/include/rpl_backup_multi.inc'
--- a/mysql-test/suite/rpl/include/rpl_backup_multi.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/include/rpl_backup_multi.inc	2009-04-29 18:20:21 +0000
@@ -0,0 +1,90 @@
+--source include/master-slave.inc
+
+# Set up multi master-slave configuration
+# one master(a) and 2 slaves(b and c)
+
+--connection slave
+STOP SLAVE;
+RESET SLAVE;
+
+# master a
+--connection master
+--disconnect master
+connect (master_a,127.0.0.1,root,,test,$MASTER_MYPORT,);
+RESET MASTER;
+--disable_warnings
+STOP SLAVE;
+--enable_warnings
+RESET SLAVE;
+let $binlog_file_m= query_get_value(SHOW MASTER STATUS, File, 1);
+
+# slave 1
+--connection slave
+--disconnect slave
+connect (slave_1,127.0.0.1,root,,test,$SLAVE_MYPORT,);
+RESET MASTER;
+RESET SLAVE;
+--replace_result $MASTER_MYPORT MASTER_A_PORT $binlog_file_m MASTER_A_LOG_FILE
+--eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$MASTER_MYPORT,master_user='root',MASTER_LOG_FILE='$binlog_file_m'
+let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
+
+# slave 2
+--connection slave1
+--disconnect slave1
+connect (slave_2,127.0.0.1,root,,test,$SLAVE_MYPORT1,);
+RESET MASTER;
+--disable_warnings
+STOP SLAVE;
+--enable_warnings
+RESET SLAVE;
+--replace_result $SLAVE_MYPORT MASTER_B_PORT $binlog_file MASTER_B_LOG_FILE
+--eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$SLAVE_MYPORT,master_user='root',MASTER_LOG_FILE='$binlog_file'
+let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
+
+# slave 3
+connect (slave_3,127.0.0.1,root,,test,$SLAVE_MYPORT2,);
+RESET MASTER;
+--disable_warnings
+STOP SLAVE;
+--enable_warnings
+RESET SLAVE;
+--replace_result $MASTER_MYPORT MASTER_A_PORT $binlog_file_m MASTER_A_LOG_FILE
+--eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$MASTER_MYPORT,master_user='root',MASTER_LOG_FILE='$binlog_file_m'
+
+# Check server_ids: they should be different
+
+--connection master_a
+SHOW VARIABLES LIKE 'server_id';
+--connection slave_1
+SHOW VARIABLES LIKE 'server_id';
+--connection slave_2
+SHOW VARIABLES LIKE 'server_id';
+--connection slave_3
+SHOW VARIABLES LIKE 'server_id';
+
+
+# Start connections
+#--connection master_a
+#connect(slave,127.0.0.1,root,,test,$MASTER_MYPORT);
+#START SLAVE;
+#--source include/wait_for_slave_to_start.inc
+#--disconnect slave
+
+--connection slave_1
+connect(slave,127.0.0.1,root,,test,$SLAVE_MYPORT1);
+START SLAVE;
+--source include/wait_for_slave_to_start.inc
+--disconnect slave
+
+--connection slave_2
+connect(slave,127.0.0.1,root,,test,$SLAVE_MYPORT);
+START SLAVE;
+--source include/wait_for_slave_to_start.inc
+--disconnect slave
+
+--connection slave_3
+connect(slave,127.0.0.1,root,,test,$SLAVE_MYPORT2);
+START SLAVE;
+--source include/wait_for_slave_to_start.inc
+--disconnect slave
+

=== added file 'mysql-test/suite/rpl/include/rpl_backup_multi_sync.inc'
--- a/mysql-test/suite/rpl/include/rpl_backup_multi_sync.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/include/rpl_backup_multi_sync.inc	2009-04-29 18:20:21 +0000
@@ -0,0 +1,10 @@
+--connection master_a
+--disable_query_log
+--sync_slave_with_master slave_1
+--sync_slave_with_master slave_2
+--sync_slave_with_master slave_3
+#--sync_slave_with_master master_a
+--save_master_pos
+--connection master_a
+--enable_query_log
+

=== added file 'mysql-test/suite/rpl/r/rpl_backup_extra.result'
--- a/mysql-test/suite/rpl/r/rpl_backup_extra.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/r/rpl_backup_extra.result	2009-04-29 18:20:21 +0000
@@ -0,0 +1,324 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+
+# Connecting to master...
+
+# Get master's datadir.
+# Create databases and objects
+# Create databases and objects
+CREATE DATABASE db1;
+CREATE DATABASE db2;
+CREATE TABLE db1.t11(a INT NOT NULL AUTO_INCREMENT, b VARCHAR(100), c INT NOT NULL, PRIMARY KEY(a));
+CREATE TABLE db1.t12(details CHAR(30));
+CREATE TABLE db2.t21(id INT, fname VARCHAR(20), INDEX name(fname));
+INSERT INTO db1.t11(b, c) VALUES('a',10),('b',20),('c',30),('d',40);
+SELECT * FROM db1.t11;
+a	b	c
+1	a	10
+2	b	20
+3	c	30
+4	d	40
+CREATE VIEW db1.v1 AS SELECT * FROM db2.t21;
+CREATE EVENT db2.e1 ON SCHEDULE EVERY 1 YEAR DO
+DELETE FROM db1.t11 WHERE c > 100;
+CREATE PROCEDURE db2.p1()
+BEGIN
+SELECT * FROM db1.t12;
+END;||
+CREATE TRIGGER db2.trgi AFTER INSERT ON db2.t21 FOR EACH ROW
+BEGIN
+INSERT INTO db1.t12 VALUES('trigger trg1 fired');
+END;||
+Function will return number of times trigger & event is fired
+CREATE FUNCTION db1.f1() RETURNS INT
+RETURN (SELECT COUNT(*) FROM db1.t12);||
+
+### Create procedure to check objects in all databases ###
+CREATE PROCEDURE test.show_objects(db CHAR(10))
+BEGIN
+SELECT TABLE_NAME, TABLE_TYPE FROM information_schema.tables
+WHERE TABLE_SCHEMA = db;
+(SELECT routine_name , routine_type FROM information_schema.routines
+WHERE routine_schema = db)
+UNION (SELECT event_name, 'EVENT' FROM information_schema.events
+WHERE event_schema = db)
+UNION (SELECT trigger_name, 'TRIGGER' FROM information_schema.triggers
+WHERE trigger_schema = db) ORDER BY routine_name, routine_type;
+END;||
+# Exercise objects
+INSERT INTO db2.t21 VALUES(100, 'a');
+SELECT * FROM db1.v1;
+id	fname
+100	a
+CALL db2.p1();
+details
+trigger trg1 fired
+SELECT db1.f1();
+db1.f1()
+1
+SELECT COUNT(*) FROM db1.t11;
+COUNT(*)
+4
+
+# Test 1: Backup commands are run on slaves.  Verify that slave's binary --echo # log information is recorded in backup logs when backup commands are
+# run on slaves.
+
+# Clear all backup logs
+FLUSH BACKUP LOGS;
+PURGE BACKUP LOGS;
+# Connecting to slave...
+# Get slave's datadir.
+# Remove all entries in the backup logs.
+FLUSH BACKUP LOGS;
+PURGE BACKUP LOGS;
+# Check databases and objects in slave
+SHOW DATABASES LIKE 'db%';
+Database (db%)
+db1
+db2
+SHOW FULL TABLES FROM db1;
+Tables_in_db1	Table_type
+t11	BASE TABLE
+t12	BASE TABLE
+v1	VIEW
+SHOW FULL TABLES FROM db2;
+Tables_in_db2	Table_type
+t21	BASE TABLE
+SELECT * FROM db1.t11;
+a	b	c
+1	a	10
+2	b	20
+3	c	30
+4	d	40
+# Note down the master status in slave
+# Perform backup
+BACKUP DATABASE db1, db2 TO 'dbs.bak';
+backup_id
+#
+# Verify the backup logs has recorded the slaves binary logs information
+SELECT binlog_pos INTO @master_pos_log FROM mysql.backup_history;
+1
+# If result is 1, then slaves binary log position is same in backup 
+# logs and there is no advance in binary log position in slave status
+# Connecting to master...
+# Test 2: Restore commands run on a master. Verify that effects of 
+# restore are not logged and restore shall not record any data events
+# in the binary log
+# Clear all backup logs
+FLUSH BACKUP LOGS;
+PURGE BACKUP LOGS;
+# Excercise objects
+INSERT INTO db2.t21 VALUES(100, 'a');
+SELECT * FROM db1.v1;
+id	fname
+100	a
+100	a
+CALL db2.p1();
+details
+trigger trg1 fired
+trigger trg1 fired
+SELECT db1.f1();
+db1.f1()
+2
+# Perform backup in master for future
+BACKUP DATABASE db1, db2 TO 'db12m.bak';
+backup_id
+#
+# Clear all backup logs
+FLUSH BACKUP LOGS;
+PURGE BACKUP LOGS;
+# Note down master position
+# Perform restore
+RESTORE FROM 'dbs.bak' OVERWRITE;
+backup_id
+#
+Warnings:
+#	#	The user specified as a definer (''@'') does not exist
+# Verify binlog events from master position before restore. 
+# Note that restore incident event will be generated. Binary log position
+# will not be advanced after restore operation. 
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Incident	1	#	#2 (RESTORE_ON_MASTER)
+master-bin.000001	#	Rotate	1	#	master-bin.000002;pos=4
+# Slave will be stopped as result of restore incident event
+# Connecting to slave...
+# Check the contents in slave till restore incident event is generated
+CALL test.show_objects('db1');
+TABLE_NAME	TABLE_TYPE
+t11	BASE TABLE
+t12	BASE TABLE
+v1	VIEW
+routine_name	routine_type
+f1	FUNCTION
+CALL test.show_objects('db2');
+TABLE_NAME	TABLE_TYPE
+t21	BASE TABLE
+routine_name	routine_type
+e1	EVENT
+p1	PROCEDURE
+trgi	TRIGGER
+SELECT * FROM db1.t11;
+a	b	c
+1	a	10
+2	b	20
+3	c	30
+4	d	40
+SELECT * FROM db1.t12;
+details
+trigger trg1 fired
+trigger trg1 fired
+SELECT * FROM db2.t21;
+id	fname
+100	a
+100	a
+# Check the slave status
+SHOW SLAVE STATUS;
+Slave_IO_State	#
+Master_Host	127.0.0.1
+Master_User	root
+Master_Port	MASTER_PORT
+Connect_Retry	1
+Master_Log_File	#
+Read_Master_Log_Pos	#
+Relay_Log_File	#
+Relay_Log_Pos	#
+Relay_Master_Log_File	master-bin.000001
+Slave_IO_Running	Yes
+Slave_SQL_Running	No
+Replicate_Do_DB	
+Replicate_Ignore_DB	
+Replicate_Do_Table	
+Replicate_Ignore_Table	
+Replicate_Wild_Do_Table	
+Replicate_Wild_Ignore_Table	
+Last_Errno	1590
+Last_Error	The incident RESTORE_ON_MASTER occured on the master. Message: A restore operation was initiated on the master.
+Skip_Counter	0
+Exec_Master_Log_Pos	#
+Relay_Log_Space	#
+Until_Condition	None
+Until_Log_File	
+Until_Log_Pos	0
+Master_SSL_Allowed	No
+Master_SSL_CA_File	
+Master_SSL_CA_Path	
+Master_SSL_Cert	
+Master_SSL_Cipher	
+Master_SSL_Key	
+Seconds_Behind_Master	#
+Master_SSL_Verify_Server_Cert	No
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	1590
+Last_SQL_Error	The incident RESTORE_ON_MASTER occured on the master. Message: A restore operation was initiated on the master.
+Replicate_Ignore_Server_Ids	
+Master_Server_Id	1
+SET global sql_slave_skip_counter=1;
+# Note that slave is stopped with an error
+STOP SLAVE;
+START SLAVE;
+# Exercise objects in slave
+INSERT INTO db2.t21 VALUES(200, 'b');
+SELECT * FROM db1.v1;
+id	fname
+100	a
+100	a
+200	b
+CALL db2.p1();
+details
+trigger trg1 fired
+trigger trg1 fired
+trigger trg1 fired
+SELECT db1.f1();
+db1.f1()
+3
+SELECT * FROM db1.t11;
+a	b	c
+1	a	10
+2	b	20
+3	c	30
+4	d	40
+SELECT * FROM db2.t21;
+id	fname
+100	a
+100	a
+200	b
+# Test 3: Changes to backup logs shall not be logged.
+
+# Connecting to master...
+CALL test.show_objects('db1');
+TABLE_NAME	TABLE_TYPE
+t11	BASE TABLE
+t12	BASE TABLE
+v1	VIEW
+routine_name	routine_type
+f1	FUNCTION
+CALL test.show_objects('db2');
+TABLE_NAME	TABLE_TYPE
+t21	BASE TABLE
+routine_name	routine_type
+e1	EVENT
+p1	PROCEDURE
+trgi	TRIGGER
+# Exercise objects 
+INSERT INTO db2.t21 VALUES(300, 'b');
+SELECT * FROM db1.v1;
+id	fname
+100	a
+300	b
+CALL db2.p1();
+details
+trigger trg1 fired
+trigger trg1 fired
+SELECT db1.f1();
+db1.f1()
+2
+SELECT * FROM db1.t11;
+a	b	c
+1	a	10
+2	b	20
+3	c	30
+4	d	40
+SELECT * FROM db2.t21;
+id	fname
+100	a
+300	b
+# Clear all backup logs
+FLUSH BACKUP LOGS;
+PURGE BACKUP LOGS;
+# Note down master position
+# Connecting to slave
+# Note down the binary log position from backup logs in slave
+# Connecting to master...
+# Perform backup
+BACKUP DATABASE db1, db2 TO 'db12m1.bak';
+backup_id
+#
+# Connecting to slave
+# Verify that performing backup on the master will not lead to changes 
+# to the backup logs on the slave.
+SELECT MAX(binlog_pos) INTO @binlog_pos_s FROM mysql.backup_history;
+1
+# If result is 1, then slaves binary log position is same in backup
+# logs. This will show that changes to backup logs in master will not 
+# affect slaves 
+# Stop the slave.
+SLAVE STOP;
+# Connecting to master...
+FLUSH BACKUP LOGS;
+PURGE BACKUP LOGS;
+DROP DATABASE db1;
+DROP DATABASE db2;
+DROP PROCEDURE test.show_objects;
+SET GLOBAL EVENT_SCHEDULER=OFF;
+# Connecting to slave...
+FLUSH BACKUP LOGS;
+PURGE BACKUP LOGS;
+DROP DATABASE db1;
+DROP DATABASE db2;
+DROP PROCEDURE test.show_objects;
+SET GLOBAL EVENT_SCHEDULER=OFF;

=== added file 'mysql-test/suite/rpl/r/rpl_backup_multi.result'
--- a/mysql-test/suite/rpl/r/rpl_backup_multi.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/r/rpl_backup_multi.result	2009-04-29 18:20:21 +0000
@@ -0,0 +1,892 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+STOP SLAVE;
+RESET SLAVE;
+RESET MASTER;
+STOP SLAVE;
+RESET SLAVE;
+RESET MASTER;
+RESET SLAVE;
+CHANGE MASTER TO master_host='127.0.0.1',master_port=MASTER_A_PORT,master_user='root',MASTER_LOG_FILE='MASTER_A_LOG_FILE';
+RESET MASTER;
+STOP SLAVE;
+RESET SLAVE;
+CHANGE MASTER TO master_host='127.0.0.1',master_port=MASTER_B_PORT,master_user='root',MASTER_LOG_FILE='MASTER_B_LOG_FILE';
+RESET MASTER;
+STOP SLAVE;
+RESET SLAVE;
+CHANGE MASTER TO master_host='127.0.0.1',master_port=MASTER_A_PORT,master_user='root',MASTER_LOG_FILE='MASTER_A_LOG_FILE';
+SHOW VARIABLES LIKE 'server_id';
+Variable_name	Value
+server_id	1
+SHOW VARIABLES LIKE 'server_id';
+Variable_name	Value
+server_id	2
+SHOW VARIABLES LIKE 'server_id';
+Variable_name	Value
+server_id	3
+SHOW VARIABLES LIKE 'server_id';
+Variable_name	Value
+server_id	4
+START SLAVE;
+START SLAVE;
+START SLAVE;
+
+# Connecting to master ...
+
+# Get master's datadir.
+# Create databases and objects
+CREATE DATABASE db1;
+CREATE DATABASE db2;
+CREATE TABLE db1.t11(a INT NOT NULL AUTO_INCREMENT, b VARCHAR(100), c INT NOT NULL, PRIMARY KEY(a));
+CREATE TABLE db1.t12(details CHAR(30));
+CREATE TABLE db2.t21(id INT, fname VARCHAR(20), INDEX name(fname));
+INSERT INTO db1.t11(b, c) VALUES('a',10),('b',20),('c',30),('d',40);
+SELECT * FROM db1.t11;
+a	b	c
+1	a	10
+2	b	20
+3	c	30
+4	d	40
+CREATE VIEW db1.v1 AS SELECT * FROM db2.t21;
+CREATE EVENT db2.e1 ON SCHEDULE EVERY 1 YEAR DO
+DELETE FROM db1.t11 WHERE c > 100;
+CREATE PROCEDURE db2.p1()
+BEGIN
+SELECT * FROM db1.t12;
+END;||
+CREATE TRIGGER db2.trgi AFTER INSERT ON db2.t21 FOR EACH ROW
+BEGIN
+INSERT INTO db1.t12 VALUES('trigger trg1 fired');
+END;||
+Function will return number of times trigger & event is fired
+CREATE FUNCTION db1.f1() RETURNS INT
+RETURN (SELECT COUNT(*) FROM db1.t12);||
+
+### Create procedure to check objects in all databases ###
+CREATE PROCEDURE test.show_objects(db CHAR(10))
+BEGIN
+SELECT TABLE_NAME, TABLE_TYPE FROM information_schema.tables
+WHERE TABLE_SCHEMA = db;
+(SELECT routine_name , routine_type FROM information_schema.routines
+WHERE routine_schema = db)
+UNION (SELECT event_name, 'EVENT' FROM information_schema.events
+WHERE event_schema = db)
+UNION (SELECT trigger_name, 'TRIGGER' FROM information_schema.triggers
+WHERE trigger_schema = db) ORDER BY routine_name, routine_type;
+END;||
+# Exercise objects
+INSERT INTO db2.t21 VALUES(100, 'a');
+SELECT * FROM db1.v1;
+id	fname
+100	a
+CALL db2.p1();
+details
+trigger trg1 fired
+SELECT db1.f1();
+db1.f1()
+1
+SELECT COUNT(*) FROM db1.t11;
+COUNT(*)
+4
+# Clear backup logs
+FLUSH BACKUP LOGS;
+PURGE BACKUP LOGS;
+# Perform backup
+BACKUP DATABASE db1, db2 TO 'db12m.bak';
+backup_id
+#
+# Create new table and add some data contents after backup
+CREATE TABLE db2.t22(srno TINYINT);
+INSERT INTO db2.t22 VALUES(35),(45),(55);
+INSERT INTO db1.t11(b,c) VALUES('e',50),('f',60);
+SELECT COUNT(*) FROM db1.t11;
+COUNT(*)
+6
+
+connecting to slave1 ...
+
+# slave 1 is directly connected to master
+# Get master's datadir.
+SHOW SLAVE STATUS;;
+Slave_IO_State	#
+Master_Host	127.0.0.1
+Master_User	root
+Master_Port	MASTER_PORT
+Connect_Retry	1
+Master_Log_File	#
+Read_Master_Log_Pos	#
+Relay_Log_File	#
+Relay_Log_Pos	#
+Relay_Master_Log_File	mysqld-bin.000001
+Slave_IO_Running	Yes
+Slave_SQL_Running	Yes
+Replicate_Do_DB	
+Replicate_Ignore_DB	
+Replicate_Do_Table	
+Replicate_Ignore_Table	
+Replicate_Wild_Do_Table	
+Replicate_Wild_Ignore_Table	
+Last_Errno	0
+Last_Error	
+Skip_Counter	0
+Exec_Master_Log_Pos	#
+Relay_Log_Space	#
+Until_Condition	None
+Until_Log_File	
+Until_Log_Pos	0
+Master_SSL_Allowed	No
+Master_SSL_CA_File	
+Master_SSL_CA_Path	
+Master_SSL_Cert	
+Master_SSL_Cipher	
+Master_SSL_Key	
+Seconds_Behind_Master	#
+Master_SSL_Verify_Server_Cert	No
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	0
+Last_SQL_Error	
+Replicate_Ignore_Server_Ids	
+Master_Server_Id	1
+# Verify all objects and exercise them
+CALL test.show_objects('db1');
+TABLE_NAME	TABLE_TYPE
+t11	BASE TABLE
+t12	BASE TABLE
+v1	VIEW
+routine_name	routine_type
+f1	FUNCTION
+CALL test.show_objects('db2');
+TABLE_NAME	TABLE_TYPE
+t21	BASE TABLE
+t22	BASE TABLE
+routine_name	routine_type
+e1	EVENT
+p1	PROCEDURE
+trgi	TRIGGER
+# Perform backup in slave1 for future use
+BACKUP DATABASE db1, db2 TO 'db12s.bak';
+backup_id
+#
+INSERT INTO db2.t21 VALUES(200,'b');
+SELECT * FROM db1.v1;
+id	fname
+100	a
+200	b
+CALL db2.p1();
+details
+trigger trg1 fired
+trigger trg1 fired
+SELECT db1.f1();
+db1.f1()
+2
+SELECT COUNT(*) FROM db1.t11;
+COUNT(*)
+6
+SELECT COUNT(*) FROM db2.t22;
+COUNT(*)
+3
+# Create new table in slave1 and verify that it is replicated in slave2
+CREATE TABLE db1.s1(id INT);
+SHOW FULL TABLES FROM db1;
+Tables_in_db1	Table_type
+s1	BASE TABLE
+t11	BASE TABLE
+t12	BASE TABLE
+v1	VIEW
+
+# Connecting to slave2 ...
+
+# slave 2 is connected to slave1 which will act as master to slave2
+SHOW SLAVE STATUS;;
+Slave_IO_State	#
+Master_Host	127.0.0.1
+Master_User	root
+Master_Port	SLAVE_PORT
+Connect_Retry	60
+Master_Log_File	#
+Read_Master_Log_Pos	#
+Relay_Log_File	#
+Relay_Log_Pos	#
+Relay_Master_Log_File	mysqld-bin.000001
+Slave_IO_Running	Yes
+Slave_SQL_Running	Yes
+Replicate_Do_DB	
+Replicate_Ignore_DB	
+Replicate_Do_Table	
+Replicate_Ignore_Table	
+Replicate_Wild_Do_Table	
+Replicate_Wild_Ignore_Table	
+Last_Errno	0
+Last_Error	
+Skip_Counter	0
+Exec_Master_Log_Pos	#
+Relay_Log_Space	#
+Until_Condition	None
+Until_Log_File	
+Until_Log_Pos	0
+Master_SSL_Allowed	No
+Master_SSL_CA_File	
+Master_SSL_CA_Path	
+Master_SSL_Cert	
+Master_SSL_Cipher	
+Master_SSL_Key	
+Seconds_Behind_Master	#
+Master_SSL_Verify_Server_Cert	No
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	0
+Last_SQL_Error	
+Replicate_Ignore_Server_Ids	
+Master_Server_Id	2
+# Note that db1 will have table s1
+CALL test.show_objects('db1');
+TABLE_NAME	TABLE_TYPE
+s1	BASE TABLE
+t11	BASE TABLE
+t12	BASE TABLE
+v1	VIEW
+routine_name	routine_type
+f1	FUNCTION
+CALL test.show_objects('db2');
+TABLE_NAME	TABLE_TYPE
+t21	BASE TABLE
+t22	BASE TABLE
+routine_name	routine_type
+e1	EVENT
+p1	PROCEDURE
+trgi	TRIGGER
+SELECT COUNT(*) FROM db1.t11;
+COUNT(*)
+6
+SELECT COUNT(*) FROM db2.t22;
+COUNT(*)
+3
+CALL db2.p1();
+details
+trigger trg1 fired
+trigger trg1 fired
+SELECT db1.f1();
+db1.f1()
+2
+
+# Connecting to slave3 ...
+
+# slave 3 is directly connected to master
+SHOW SLAVE STATUS;;
+Slave_IO_State	#
+Master_Host	127.0.0.1
+Master_User	root
+Master_Port	MASTER_PORT
+Connect_Retry	60
+Master_Log_File	#
+Read_Master_Log_Pos	#
+Relay_Log_File	#
+Relay_Log_Pos	#
+Relay_Master_Log_File	mysqld-bin.000001
+Slave_IO_Running	Yes
+Slave_SQL_Running	Yes
+Replicate_Do_DB	
+Replicate_Ignore_DB	
+Replicate_Do_Table	
+Replicate_Ignore_Table	
+Replicate_Wild_Do_Table	
+Replicate_Wild_Ignore_Table	
+Last_Errno	0
+Last_Error	
+Skip_Counter	0
+Exec_Master_Log_Pos	#
+Relay_Log_Space	#
+Until_Condition	None
+Until_Log_File	
+Until_Log_Pos	0
+Master_SSL_Allowed	No
+Master_SSL_CA_File	
+Master_SSL_CA_Path	
+Master_SSL_Cert	
+Master_SSL_Cipher	
+Master_SSL_Key	
+Seconds_Behind_Master	#
+Master_SSL_Verify_Server_Cert	No
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	0
+Last_SQL_Error	
+Replicate_Ignore_Server_Ids	
+Master_Server_Id	1
+# Check the objects and other table contents in slave3
+# Note that db2.t22 will be included and not db1.s1
+CALL test.show_objects('db1');
+TABLE_NAME	TABLE_TYPE
+t11	BASE TABLE
+t12	BASE TABLE
+v1	VIEW
+routine_name	routine_type
+f1	FUNCTION
+CALL test.show_objects('db2');
+TABLE_NAME	TABLE_TYPE
+t21	BASE TABLE
+t22	BASE TABLE
+routine_name	routine_type
+e1	EVENT
+p1	PROCEDURE
+trgi	TRIGGER
+SELECT COUNT(*) FROM db1.t11;
+COUNT(*)
+6
+SELECT COUNT(*) FROM db2.t22;
+COUNT(*)
+3
+# db1.f1 will show only 2 values
+CALL db2.p1();
+details
+trigger trg1 fired
+SELECT db1.f1();
+db1.f1()
+1
+
+# Connecting to master ...
+
+# Table db1.s1 will not be in master
+CALL test.show_objects('db1');
+TABLE_NAME	TABLE_TYPE
+t11	BASE TABLE
+t12	BASE TABLE
+v1	VIEW
+routine_name	routine_type
+f1	FUNCTION
+CALL test.show_objects('db2');
+TABLE_NAME	TABLE_TYPE
+t21	BASE TABLE
+t22	BASE TABLE
+routine_name	routine_type
+e1	EVENT
+p1	PROCEDURE
+trgi	TRIGGER
+# Now perform restore from db12m.bak
+RESTORE FROM 'db12m.bak' OVERWRITE;
+backup_id
+#
+
+# Show the incident event issued as a result of restore. This will cause
+# slave1 and slave3 to stop. slave2 will function normally
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+mysqld-bin.000001	#	Incident	1	#	#2 (RESTORE_ON_MASTER)
+mysqld-bin.000001	#	Rotate	1	#	mysqld-bin.000002;pos=4
+
+# Connecting to slave1 ...
+
+SHOW SLAVE STATUS;
+Slave_IO_State	#
+Master_Host	127.0.0.1
+Master_User	root
+Master_Port	MASTER_PORT
+Connect_Retry	1
+Master_Log_File	#
+Read_Master_Log_Pos	#
+Relay_Log_File	#
+Relay_Log_Pos	#
+Relay_Master_Log_File	mysqld-bin.000001
+Slave_IO_Running	Yes
+Slave_SQL_Running	No
+Replicate_Do_DB	
+Replicate_Ignore_DB	
+Replicate_Do_Table	
+Replicate_Ignore_Table	
+Replicate_Wild_Do_Table	
+Replicate_Wild_Ignore_Table	
+Last_Errno	1590
+Last_Error	The incident RESTORE_ON_MASTER occured on the master. Message: A restore operation was initiated on the master.
+Skip_Counter	0
+Exec_Master_Log_Pos	#
+Relay_Log_Space	#
+Until_Condition	None
+Until_Log_File	
+Until_Log_Pos	0
+Master_SSL_Allowed	No
+Master_SSL_CA_File	
+Master_SSL_CA_Path	
+Master_SSL_Cert	
+Master_SSL_Cipher	
+Master_SSL_Key	
+Seconds_Behind_Master	#
+Master_SSL_Verify_Server_Cert	No
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	1590
+Last_SQL_Error	The incident RESTORE_ON_MASTER occured on the master. Message: A restore operation was initiated on the master.
+Replicate_Ignore_Server_Ids	
+Master_Server_Id	1
+
+# Show the slave stopped with an error.
+Last_SQL_Error
+The incident RESTORE_ON_MASTER occured on the master. Message: A restore operation was initiated on the master.
+SET global sql_slave_skip_counter=1;
+STOP SLAVE;
+START SLAVE;
+CALL test.show_objects('db1');
+TABLE_NAME	TABLE_TYPE
+s1	BASE TABLE
+t11	BASE TABLE
+t12	BASE TABLE
+v1	VIEW
+routine_name	routine_type
+f1	FUNCTION
+CALL test.show_objects('db2');
+TABLE_NAME	TABLE_TYPE
+t21	BASE TABLE
+t22	BASE TABLE
+routine_name	routine_type
+e1	EVENT
+p1	PROCEDURE
+trgi	TRIGGER
+SELECT COUNT(*) FROM db1.t11;
+COUNT(*)
+6
+SELECT COUNT(*) FROM db2.t22;
+COUNT(*)
+3
+CALL db2.p1();
+details
+trigger trg1 fired
+trigger trg1 fired
+SELECT db1.f1();
+db1.f1()
+2
+
+# Connecting to slave3 ...
+
+SHOW SLAVE STATUS;
+Slave_IO_State	#
+Master_Host	127.0.0.1
+Master_User	root
+Master_Port	MASTER_PORT
+Connect_Retry	60
+Master_Log_File	#
+Read_Master_Log_Pos	#
+Relay_Log_File	#
+Relay_Log_Pos	#
+Relay_Master_Log_File	mysqld-bin.000001
+Slave_IO_Running	Yes
+Slave_SQL_Running	No
+Replicate_Do_DB	
+Replicate_Ignore_DB	
+Replicate_Do_Table	
+Replicate_Ignore_Table	
+Replicate_Wild_Do_Table	
+Replicate_Wild_Ignore_Table	
+Last_Errno	1590
+Last_Error	The incident RESTORE_ON_MASTER occured on the master. Message: A restore operation was initiated on the master.
+Skip_Counter	0
+Exec_Master_Log_Pos	#
+Relay_Log_Space	#
+Until_Condition	None
+Until_Log_File	
+Until_Log_Pos	0
+Master_SSL_Allowed	No
+Master_SSL_CA_File	
+Master_SSL_CA_Path	
+Master_SSL_Cert	
+Master_SSL_Cipher	
+Master_SSL_Key	
+Seconds_Behind_Master	#
+Master_SSL_Verify_Server_Cert	No
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	1590
+Last_SQL_Error	The incident RESTORE_ON_MASTER occured on the master. Message: A restore operation was initiated on the master.
+Replicate_Ignore_Server_Ids	
+Master_Server_Id	1
+
+# Show the slave stopped with an error.
+Last_SQL_Error
+The incident RESTORE_ON_MASTER occured on the master. Message: A restore operation was initiated on the master.
+SET global sql_slave_skip_counter=1;
+STOP SLAVE;
+START SLAVE;
+CALL test.show_objects('db1');
+TABLE_NAME	TABLE_TYPE
+t11	BASE TABLE
+t12	BASE TABLE
+v1	VIEW
+routine_name	routine_type
+f1	FUNCTION
+CALL test.show_objects('db2');
+TABLE_NAME	TABLE_TYPE
+t21	BASE TABLE
+t22	BASE TABLE
+routine_name	routine_type
+e1	EVENT
+p1	PROCEDURE
+trgi	TRIGGER
+SELECT COUNT(*) FROM db1.t11;
+COUNT(*)
+6
+SELECT COUNT(*) FROM db2.t22;
+COUNT(*)
+3
+CALL db2.p1();
+details
+trigger trg1 fired
+SELECT db1.f1();
+db1.f1()
+1
+
+# Connecting to slave2 ...
+
+SHOW SLAVE STATUS;
+Slave_IO_State	#
+Master_Host	127.0.0.1
+Master_User	root
+Master_Port	SLAVE_PORT
+Connect_Retry	60
+Master_Log_File	#
+Read_Master_Log_Pos	#
+Relay_Log_File	#
+Relay_Log_Pos	#
+Relay_Master_Log_File	mysqld-bin.000001
+Slave_IO_Running	Yes
+Slave_SQL_Running	Yes
+Replicate_Do_DB	
+Replicate_Ignore_DB	
+Replicate_Do_Table	
+Replicate_Ignore_Table	
+Replicate_Wild_Do_Table	
+Replicate_Wild_Ignore_Table	
+Last_Errno	0
+Last_Error	
+Skip_Counter	0
+Exec_Master_Log_Pos	#
+Relay_Log_Space	#
+Until_Condition	None
+Until_Log_File	
+Until_Log_Pos	0
+Master_SSL_Allowed	No
+Master_SSL_CA_File	
+Master_SSL_CA_Path	
+Master_SSL_Cert	
+Master_SSL_Cipher	
+Master_SSL_Key	
+Seconds_Behind_Master	#
+Master_SSL_Verify_Server_Cert	No
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	0
+Last_SQL_Error	
+Replicate_Ignore_Server_Ids	
+Master_Server_Id	2
+
+# Check the table contents in slave_2. Note that this should not be 
+# affected because of restore incident event
+CALL test.show_objects('db1');
+TABLE_NAME	TABLE_TYPE
+s1	BASE TABLE
+t11	BASE TABLE
+t12	BASE TABLE
+v1	VIEW
+routine_name	routine_type
+f1	FUNCTION
+CALL test.show_objects('db2');
+TABLE_NAME	TABLE_TYPE
+t21	BASE TABLE
+t22	BASE TABLE
+routine_name	routine_type
+e1	EVENT
+p1	PROCEDURE
+trgi	TRIGGER
+SELECT COUNT(*) FROM db1.t11;
+COUNT(*)
+6
+SELECT COUNT(*) FROM db2.t22;
+COUNT(*)
+3
+CALL db2.p1();
+details
+trigger trg1 fired
+trigger trg1 fired
+SELECT db1.f1();
+db1.f1()
+2
+
+# Connecting to slave1 ...
+
+# Execute restore in slave_1 from db12s.bak
+RESTORE FROM 'db12s.bak' OVERWRITE;
+ERROR HY000: A restore operation was attempted on a slave during replication. You must stop the slave prior to running a restore.
+# Stop slave and then perform restore
+STOP SLAVE;
+# Perform restore
+RESTORE FROM 'db12s.bak' OVERWRITE;
+backup_id
+#
+Warnings:
+#	1449	The user specified as a definer (''@'') does not exist
+SHOW SLAVE STATUS;
+Slave_IO_State	#
+Master_Host	127.0.0.1
+Master_User	root
+Master_Port	MASTER_PORT
+Connect_Retry	1
+Master_Log_File	#
+Read_Master_Log_Pos	#
+Relay_Log_File	#
+Relay_Log_Pos	#
+Relay_Master_Log_File	mysqld-bin.000002
+Slave_IO_Running	No
+Slave_SQL_Running	No
+Replicate_Do_DB	
+Replicate_Ignore_DB	
+Replicate_Do_Table	
+Replicate_Ignore_Table	
+Replicate_Wild_Do_Table	
+Replicate_Wild_Ignore_Table	
+Last_Errno	0
+Last_Error	
+Skip_Counter	0
+Exec_Master_Log_Pos	#
+Relay_Log_Space	#
+Until_Condition	None
+Until_Log_File	
+Until_Log_Pos	0
+Master_SSL_Allowed	No
+Master_SSL_CA_File	
+Master_SSL_CA_Path	
+Master_SSL_Cert	
+Master_SSL_Cipher	
+Master_SSL_Key	
+Seconds_Behind_Master	#
+Master_SSL_Verify_Server_Cert	No
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	0
+Last_SQL_Error	
+Replicate_Ignore_Server_Ids	
+Master_Server_Id	1
+
+# Show the incident event issued as a result of restore. This will cause
+# slave2 to stop
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+mysqld-bin.000001	#	Incident	2	#	#2 (RESTORE_ON_MASTER)
+mysqld-bin.000001	#	Rotate	2	#	mysqld-bin.000002;pos=4
+# Verify objects and tables contents after restore
+CALL test.show_objects('db1');
+TABLE_NAME	TABLE_TYPE
+t11	BASE TABLE
+t12	BASE TABLE
+v1	VIEW
+routine_name	routine_type
+f1	FUNCTION
+CALL test.show_objects('db2');
+TABLE_NAME	TABLE_TYPE
+t21	BASE TABLE
+t22	BASE TABLE
+routine_name	routine_type
+e1	EVENT
+p1	PROCEDURE
+trgi	TRIGGER
+SELECT COUNT(*) FROM db1.t11;
+COUNT(*)
+6
+SELECT COUNT(*) FROM db2.t22;
+COUNT(*)
+3
+CALL db2.p1();
+details
+trigger trg1 fired
+SELECT db1.f1();
+db1.f1()
+1
+
+# Connecting to slave2 ...
+
+SHOW SLAVE STATUS;
+Slave_IO_State	#
+Master_Host	127.0.0.1
+Master_User	root
+Master_Port	SLAVE_PORT
+Connect_Retry	60
+Master_Log_File	#
+Read_Master_Log_Pos	#
+Relay_Log_File	#
+Relay_Log_Pos	#
+Relay_Master_Log_File	mysqld-bin.000001
+Slave_IO_Running	Yes
+Slave_SQL_Running	No
+Replicate_Do_DB	
+Replicate_Ignore_DB	
+Replicate_Do_Table	
+Replicate_Ignore_Table	
+Replicate_Wild_Do_Table	
+Replicate_Wild_Ignore_Table	
+Last_Errno	1590
+Last_Error	The incident RESTORE_ON_MASTER occured on the master. Message: A restore operation was initiated on the master.
+Skip_Counter	0
+Exec_Master_Log_Pos	#
+Relay_Log_Space	#
+Until_Condition	None
+Until_Log_File	
+Until_Log_Pos	0
+Master_SSL_Allowed	No
+Master_SSL_CA_File	
+Master_SSL_CA_Path	
+Master_SSL_Cert	
+Master_SSL_Cipher	
+Master_SSL_Key	
+Seconds_Behind_Master	#
+Master_SSL_Verify_Server_Cert	No
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	1590
+Last_SQL_Error	The incident RESTORE_ON_MASTER occured on the master. Message: A restore operation was initiated on the master.
+Replicate_Ignore_Server_Ids	
+Master_Server_Id	2
+
+# Show the slave stopped with an error.
+Last_SQL_Error
+The incident RESTORE_ON_MASTER occured on the master. Message: A restore operation was initiated on the master.
+SET global sql_slave_skip_counter=1;
+STOP SLAVE;
+START SLAVE;
+CALL test.show_objects('db1');
+TABLE_NAME	TABLE_TYPE
+s1	BASE TABLE
+t11	BASE TABLE
+t12	BASE TABLE
+v1	VIEW
+routine_name	routine_type
+f1	FUNCTION
+CALL test.show_objects('db2');
+TABLE_NAME	TABLE_TYPE
+t21	BASE TABLE
+t22	BASE TABLE
+routine_name	routine_type
+e1	EVENT
+p1	PROCEDURE
+trgi	TRIGGER
+SELECT COUNT(*) FROM db1.t11;
+COUNT(*)
+6
+SELECT COUNT(*) FROM db2.t22;
+COUNT(*)
+3
+CALL db2.p1();
+details
+trigger trg1 fired
+trigger trg1 fired
+SELECT db1.f1();
+db1.f1()
+2
+
+# Connecting to slave1 ...
+START SLAVE;
+
+# Connecting to master ...
+
+# Verify that objects and table contents are not affected
+CALL test.show_objects('db1');
+TABLE_NAME	TABLE_TYPE
+t11	BASE TABLE
+t12	BASE TABLE
+v1	VIEW
+routine_name	routine_type
+f1	FUNCTION
+CALL test.show_objects('db2');
+TABLE_NAME	TABLE_TYPE
+t21	BASE TABLE
+routine_name	routine_type
+e1	EVENT
+p1	PROCEDURE
+trgi	TRIGGER
+SELECT COUNT(*) FROM db1.t11;
+COUNT(*)
+4
+CALL db2.p1();
+details
+trigger trg1 fired
+SELECT db1.f1();
+db1.f1()
+1
+# Create new objects in master and verify it is replicated in slaves
+CREATE TABLE db1.m1(a CHAR(20));
+CREATE VIEW db2.v1 AS SELECT * FROM db1.m1;
+INSERT INTO db1.m1 VALUES('a'),('b');
+SELECT * FROM db2.v1;
+a
+a
+b
+
+# Connecting to slave1 ...
+
+CALL test.show_objects('db1');
+TABLE_NAME	TABLE_TYPE
+m1	BASE TABLE
+t11	BASE TABLE
+t12	BASE TABLE
+v1	VIEW
+routine_name	routine_type
+f1	FUNCTION
+CALL test.show_objects('db2');
+TABLE_NAME	TABLE_TYPE
+t21	BASE TABLE
+t22	BASE TABLE
+v1	VIEW
+routine_name	routine_type
+e1	EVENT
+p1	PROCEDURE
+trgi	TRIGGER
+
+# Connecting to slave3 ...
+
+CALL test.show_objects('db1');
+TABLE_NAME	TABLE_TYPE
+m1	BASE TABLE
+t11	BASE TABLE
+t12	BASE TABLE
+v1	VIEW
+routine_name	routine_type
+f1	FUNCTION
+CALL test.show_objects('db2');
+TABLE_NAME	TABLE_TYPE
+t21	BASE TABLE
+t22	BASE TABLE
+v1	VIEW
+routine_name	routine_type
+e1	EVENT
+p1	PROCEDURE
+trgi	TRIGGER
+
+# Connecting to slave2 ...
+
+CALL test.show_objects('db1');
+TABLE_NAME	TABLE_TYPE
+m1	BASE TABLE
+s1	BASE TABLE
+t11	BASE TABLE
+t12	BASE TABLE
+v1	VIEW
+routine_name	routine_type
+f1	FUNCTION
+CALL test.show_objects('db2');
+TABLE_NAME	TABLE_TYPE
+t21	BASE TABLE
+t22	BASE TABLE
+v1	VIEW
+routine_name	routine_type
+e1	EVENT
+p1	PROCEDURE
+trgi	TRIGGER
+*** Clean up ***
+DROP DATABASE db1;
+DROP DATABASE db2;
+DROP PROCEDURE test.show_objects;
+STOP SLAVE;
+RESET SLAVE;
+STOP SLAVE;
+RESET SLAVE;
+STOP SLAVE;
+RESET SLAVE;

=== added file 'mysql-test/suite/rpl/r/rpl_backup_ptr.result'
--- a/mysql-test/suite/rpl/r/rpl_backup_ptr.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/r/rpl_backup_ptr.result	2009-04-29 18:20:21 +0000
@@ -0,0 +1,410 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+
+# Connecting to master...
+
+# Get master's datadir.
+# Create databases and objects
+CREATE DATABASE db1;
+CREATE DATABASE db2;
+CREATE TABLE db1.t11(a INT NOT NULL AUTO_INCREMENT, b VARCHAR(100), c INT NOT NULL, PRIMARY KEY(a));
+CREATE TABLE db1.t12(details CHAR(30));
+CREATE TABLE db2.t21(id INT, fname VARCHAR(20), INDEX name(fname));
+INSERT INTO db1.t11(b, c) VALUES('a',10),('b',20),('c',30),('d',40);
+SELECT * FROM db1.t11;
+a	b	c
+1	a	10
+2	b	20
+3	c	30
+4	d	40
+CREATE VIEW db1.v1 AS SELECT * FROM db2.t21;
+CREATE EVENT db2.e1 ON SCHEDULE EVERY 1 YEAR DO
+DELETE FROM db1.t11 WHERE c > 100;
+CREATE PROCEDURE db2.p1()
+BEGIN
+SELECT * FROM db1.t12;
+END;||
+CREATE TRIGGER db2.trgi AFTER INSERT ON db2.t21 FOR EACH ROW
+BEGIN
+INSERT INTO db1.t12 VALUES('trigger trg1 fired');
+END;||
+Function will return number of times trigger & event is fired
+CREATE FUNCTION db1.f1() RETURNS INT
+RETURN (SELECT COUNT(*) FROM db1.t12);||
+
+### Create procedure to check objects in all databases ###
+CREATE PROCEDURE test.show_objects(db CHAR(10))
+BEGIN
+SELECT TABLE_NAME, TABLE_TYPE FROM information_schema.tables
+WHERE TABLE_SCHEMA = db;
+(SELECT routine_name , routine_type FROM information_schema.routines
+WHERE routine_schema = db)
+UNION (SELECT event_name, 'EVENT' FROM information_schema.events
+WHERE event_schema = db)
+UNION (SELECT trigger_name, 'TRIGGER' FROM information_schema.triggers
+WHERE trigger_schema = db) ORDER BY routine_name, routine_type;
+END;||
+# Exercise objects
+INSERT INTO db2.t21 VALUES(100, 'a');
+SELECT * FROM db1.v1;
+id	fname
+100	a
+CALL db2.p1();
+details
+trigger trg1 fired
+SELECT db1.f1();
+db1.f1()
+1
+SELECT COUNT(*) FROM db1.t11;
+COUNT(*)
+4
+# Clear all backup logs
+FLUSH BACKUP LOGS;
+PURGE BACKUP LOGS;
+
+# Connecting to slave...
+
+CALL test.show_objects('db1');
+TABLE_NAME	TABLE_TYPE
+t11	BASE TABLE
+t12	BASE TABLE
+v1	VIEW
+routine_name	routine_type
+f1	FUNCTION
+CALL test.show_objects('db2');
+TABLE_NAME	TABLE_TYPE
+t21	BASE TABLE
+routine_name	routine_type
+e1	EVENT
+p1	PROCEDURE
+trgi	TRIGGER
+# Turn off replication by stopping slave
+STOP SLAVE;
+# Check the slave has stopped from slave status
+SHOW SLAVE STATUS;
+Slave_IO_State	#
+Master_Host	127.0.0.1
+Master_User	root
+Master_Port	MASTER_PORT
+Connect_Retry	1
+Master_Log_File	#
+Read_Master_Log_Pos	#
+Relay_Log_File	#
+Relay_Log_Pos	#
+Relay_Master_Log_File	master-bin.000001
+Slave_IO_Running	No
+Slave_SQL_Running	No
+Replicate_Do_DB	
+Replicate_Ignore_DB	
+Replicate_Do_Table	
+Replicate_Ignore_Table	
+Replicate_Wild_Do_Table	
+Replicate_Wild_Ignore_Table	
+Last_Errno	0
+Last_Error	
+Skip_Counter	0
+Exec_Master_Log_Pos	#
+Relay_Log_Space	#
+Until_Condition	None
+Until_Log_File	
+Until_Log_Pos	0
+Master_SSL_Allowed	No
+Master_SSL_CA_File	
+Master_SSL_CA_Path	
+Master_SSL_Cert	
+Master_SSL_Cipher	
+Master_SSL_Key	
+Seconds_Behind_Master	#
+Master_SSL_Verify_Server_Cert	No
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	0
+Last_SQL_Error	
+Replicate_Ignore_Server_Ids	
+Master_Server_Id	1
+# Check the objects in databases db1 and db2 in slave
+CALL test.show_objects('db1');
+TABLE_NAME	TABLE_TYPE
+t11	BASE TABLE
+t12	BASE TABLE
+v1	VIEW
+routine_name	routine_type
+f1	FUNCTION
+CALL test.show_objects('db2');
+TABLE_NAME	TABLE_TYPE
+t21	BASE TABLE
+routine_name	routine_type
+e1	EVENT
+p1	PROCEDURE
+trgi	TRIGGER
+
+# Connecting to master...
+
+# Execute some DML and DDL operations in databases.
+CREATE TABLE db2.new(a CHAR(30));
+INSERT INTO db2.new VALUES('New table created'),('for'),('testing'),('PTR');
+SELECT * FROM db2.new;
+a
+New table created
+for
+testing
+PTR
+UPDATE db1.t11 SET c=100 WHERE b='d';
+DELETE FROM db1.t11 WHERE b='b';
+SELECT * FROM db1.t11;
+a	b	c
+1	a	10
+3	c	30
+4	d	100
+CREATE PROCEDURE db1.p11()
+BEGIN
+CREATE VIEW db2.vv AS SELECT * FROM db1.v1;
+END;||
+CALL db1.p11();
+SELECT * FROM db1.v1;
+id	fname
+100	a
+SELECT * FROM db2.vv;
+id	fname
+100	a
+ALTER PROCEDURE db2.p1 COMMENT 'TESTING POINT IN TIME RECOVERY';
+# Changes made in databases are
+# Table 'new' created, rows from db1.t11 updated and deleted
+# Procedure db1.p11 created, view db2.vv created
+# db2.p1 altered
+CALL test.show_objects('db1');
+TABLE_NAME	TABLE_TYPE
+t11	BASE TABLE
+t12	BASE TABLE
+v1	VIEW
+routine_name	routine_type
+f1	FUNCTION
+p11	PROCEDURE
+CALL test.show_objects('db2');
+TABLE_NAME	TABLE_TYPE
+new	BASE TABLE
+t21	BASE TABLE
+vv	VIEW
+routine_name	routine_type
+e1	EVENT
+p1	PROCEDURE
+trgi	TRIGGER
+SHOW CREATE PROCEDURE db2.p1;
+Procedure	sql_mode	Create Procedure	character_set_client	collation_connection	Database Collation
+p1		CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+    COMMENT 'TESTING POINT IN TIME RECOVERY'
+BEGIN
+SELECT * FROM db1.t12;
+END	latin1	latin1_swedish_ci	latin1_swedish_ci
+
+# Connecting to slave...
+
+# Verify that no new objects are included slave
+CALL test.show_objects('db1');
+TABLE_NAME	TABLE_TYPE
+t11	BASE TABLE
+t12	BASE TABLE
+v1	VIEW
+routine_name	routine_type
+f1	FUNCTION
+CALL test.show_objects('db2');
+TABLE_NAME	TABLE_TYPE
+t21	BASE TABLE
+routine_name	routine_type
+e1	EVENT
+p1	PROCEDURE
+trgi	TRIGGER
+SHOW CREATE PROCEDURE db2.p1;
+Procedure	sql_mode	Create Procedure	character_set_client	collation_connection	Database Collation
+p1		CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+BEGIN
+SELECT * FROM db1.t12;
+END	latin1	latin1_swedish_ci	latin1_swedish_ci
+
+# Connecting to master...
+
+# Perform backup
+BACKUP DATABASE db1, db2 TO 'db12m_ptr.bak';
+backup_id
+#
+DROP PROCEDURE test.show_objects;
+DROP DATABASE db1;
+DROP DATABASE db2;
+# Turn on replication by starting slave
+# Connecting to slave...
+
+START SLAVE;
+# Check the slave status
+SHOW SLAVE STATUS;
+Slave_IO_State	#
+Master_Host	127.0.0.1
+Master_User	root
+Master_Port	MASTER_PORT
+Connect_Retry	1
+Master_Log_File	#
+Read_Master_Log_Pos	#
+Relay_Log_File	#
+Relay_Log_Pos	#
+Relay_Master_Log_File	master-bin.000001
+Slave_IO_Running	Yes
+Slave_SQL_Running	Yes
+Replicate_Do_DB	
+Replicate_Ignore_DB	
+Replicate_Do_Table	
+Replicate_Ignore_Table	
+Replicate_Wild_Do_Table	
+Replicate_Wild_Ignore_Table	
+Last_Errno	0
+Last_Error	
+Skip_Counter	0
+Exec_Master_Log_Pos	#
+Relay_Log_Space	#
+Until_Condition	None
+Until_Log_File	
+Until_Log_Pos	0
+Master_SSL_Allowed	No
+Master_SSL_CA_File	
+Master_SSL_CA_Path	
+Master_SSL_Cert	
+Master_SSL_Cipher	
+Master_SSL_Key	
+Seconds_Behind_Master	#
+Master_SSL_Verify_Server_Cert	No
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	0
+Last_SQL_Error	
+Replicate_Ignore_Server_Ids	
+Master_Server_Id	1
+
+# Connecting to master ...
+
+# Execute mysqlbinlog
+
+########## CHECK OBJECTS AFTER PTR IN MASTER #################
+# Check that all the data contents are recovered using PTR
+CALL test.show_objects('db1');
+TABLE_NAME	TABLE_TYPE
+t11	BASE TABLE
+t12	BASE TABLE
+v1	VIEW
+routine_name	routine_type
+f1	FUNCTION
+p11	PROCEDURE
+CALL test.show_objects('db2');
+TABLE_NAME	TABLE_TYPE
+new	BASE TABLE
+t21	BASE TABLE
+vv	VIEW
+routine_name	routine_type
+e1	EVENT
+p1	PROCEDURE
+trgi	TRIGGER
+SHOW CREATE PROCEDURE db2.p1;
+Procedure	sql_mode	Create Procedure	character_set_client	collation_connection	Database Collation
+p1		CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+    COMMENT 'TESTING POINT IN TIME RECOVERY'
+BEGIN
+SELECT * FROM db1.t12;
+END	latin1	latin1_swedish_ci	latin1_swedish_ci
+
+# Exercise objects
+INSERT INTO db2.t21 VALUES(200, 'b');
+SELECT * FROM db1.v1;
+id	fname
+100	a
+200	b
+CALL db2.p1();
+details
+trigger trg1 fired
+trigger trg1 fired
+SELECT db1.f1();
+db1.f1()
+2
+SELECT * FROM db1.t11;
+a	b	c
+1	a	10
+3	c	30
+4	d	100
+SELECT * FROM db2.vv;
+id	fname
+100	a
+200	b
+
+# Connecting to slave...
+
+######## CHECK DATA IS REPLICATED IN SLAVE AFTER PTR ##########
+CALL test.show_objects('db1');
+TABLE_NAME	TABLE_TYPE
+t11	BASE TABLE
+t12	BASE TABLE
+v1	VIEW
+routine_name	routine_type
+f1	FUNCTION
+p11	PROCEDURE
+CALL test.show_objects('db2');
+TABLE_NAME	TABLE_TYPE
+new	BASE TABLE
+t21	BASE TABLE
+vv	VIEW
+routine_name	routine_type
+e1	EVENT
+p1	PROCEDURE
+trgi	TRIGGER
+SHOW CREATE PROCEDURE db2.p1;
+Procedure	sql_mode	Create Procedure	character_set_client	collation_connection	Database Collation
+p1		CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+    COMMENT 'TESTING POINT IN TIME RECOVERY'
+BEGIN
+SELECT * FROM db1.t12;
+END	latin1	latin1_swedish_ci	latin1_swedish_ci
+# Exercise objects in slave
+INSERT INTO db2.t21 VALUES(300, 'c');
+SELECT * FROM db1.v1;
+id	fname
+100	a
+200	b
+300	c
+SELECT * FROM db1.t11;
+a	b	c
+1	a	10
+3	c	30
+4	d	100
+SELECT * FROM db2.vv;
+id	fname
+100	a
+200	b
+300	c
+CALL db2.p1();
+details
+trigger trg1 fired
+trigger trg1 fired
+trigger trg1 fired
+SELECT db1.f1();
+db1.f1()
+3
+SHOW CREATE PROCEDURE db2.p1;
+Procedure	sql_mode	Create Procedure	character_set_client	collation_connection	Database Collation
+p1		CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+    COMMENT 'TESTING POINT IN TIME RECOVERY'
+BEGIN
+SELECT * FROM db1.t12;
+END	latin1	latin1_swedish_ci	latin1_swedish_ci
+# Stop the slave.
+SLAVE STOP;
+# Connecting to master...
+FLUSH BACKUP LOGS;
+PURGE BACKUP LOGS;
+DROP DATABASE db1;
+DROP DATABASE db2;
+DROP PROCEDURE test.show_objects;
+# Connecting to slave...
+FLUSH BACKUP LOGS;
+PURGE BACKUP LOGS;
+DROP DATABASE db1;
+DROP DATABASE db2;
+DROP PROCEDURE test.show_objects;

=== added file 'mysql-test/suite/rpl/r/rpl_backup_shutdown.result'
--- a/mysql-test/suite/rpl/r/rpl_backup_shutdown.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/r/rpl_backup_shutdown.result	2009-04-29 18:20:21 +0000
@@ -0,0 +1,254 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+
+# Connecting to master...
+
+# Get master's datadir.
+# Create databases and objects
+# Create databases and objects
+CREATE DATABASE db1;
+CREATE DATABASE db2;
+CREATE TABLE db1.t11(a INT NOT NULL AUTO_INCREMENT, b VARCHAR(100), c INT NOT NULL, PRIMARY KEY(a));
+CREATE TABLE db1.t12(details CHAR(30));
+CREATE TABLE db2.t21(id INT, fname VARCHAR(20), INDEX name(fname));
+INSERT INTO db1.t11(b, c) VALUES('a',10),('b',20),('c',30),('d',40);
+SELECT * FROM db1.t11;
+a	b	c
+1	a	10
+2	b	20
+3	c	30
+4	d	40
+CREATE VIEW db1.v1 AS SELECT * FROM db2.t21;
+CREATE EVENT db2.e1 ON SCHEDULE EVERY 1 YEAR DO
+DELETE FROM db1.t11 WHERE c > 100;
+CREATE PROCEDURE db2.p1()
+BEGIN
+SELECT * FROM db1.t12;
+END;||
+CREATE TRIGGER db2.trgi AFTER INSERT ON db2.t21 FOR EACH ROW
+BEGIN
+INSERT INTO db1.t12 VALUES('trigger trg1 fired');
+END;||
+Function will return number of times trigger & event is fired
+CREATE FUNCTION db1.f1() RETURNS INT
+RETURN (SELECT COUNT(*) FROM db1.t12);||
+
+### Create procedure to check objects in all databases ###
+CREATE PROCEDURE test.show_objects(db CHAR(10))
+BEGIN
+SELECT TABLE_NAME, TABLE_TYPE FROM information_schema.tables
+WHERE TABLE_SCHEMA = db;
+(SELECT routine_name , routine_type FROM information_schema.routines
+WHERE routine_schema = db)
+UNION (SELECT event_name, 'EVENT' FROM information_schema.events
+WHERE event_schema = db)
+UNION (SELECT trigger_name, 'TRIGGER' FROM information_schema.triggers
+WHERE trigger_schema = db) ORDER BY routine_name, routine_type;
+END;||
+# Exercise objects
+INSERT INTO db2.t21 VALUES(100, 'a');
+SELECT * FROM db1.v1;
+id	fname
+100	a
+CALL db2.p1();
+details
+trigger trg1 fired
+SELECT db1.f1();
+db1.f1()
+1
+SELECT COUNT(*) FROM db1.t11;
+COUNT(*)
+4
+# Clear all backup logs
+FLUSH BACKUP LOGS;
+PURGE BACKUP LOGS;
+# Perform backup in master for future
+BACKUP DATABASE db1, db2 TO 'db12m.bak';
+backup_id
+#
+# Connecting to slave...
+# Get slave's datadir.
+# Remove all entries in the backup logs.
+FLUSH BACKUP LOGS;
+PURGE BACKUP LOGS;
+# Check databases and objects in slave
+CALL test.show_objects('db1');
+TABLE_NAME	TABLE_TYPE
+t11	BASE TABLE
+t12	BASE TABLE
+v1	VIEW
+routine_name	routine_type
+f1	FUNCTION
+CALL test.show_objects('db2');
+TABLE_NAME	TABLE_TYPE
+t21	BASE TABLE
+routine_name	routine_type
+e1	EVENT
+p1	PROCEDURE
+trgi	TRIGGER
+SELECT * FROM db1.t11;
+a	b	c
+1	a	10
+2	b	20
+3	c	30
+4	d	40
+SELECT * FROM db1.t12;
+details
+trigger trg1 fired
+SELECT * FROM db2.t21;
+id	fname
+100	a
+# Connecting to master...
+# Drop the databases
+DROP DATABASE db1;
+DROP DATABASE db2;
+--> Stop master server ...
+--> Start master server ...
+SHOW DATABASES LIKE 'db%';
+Database (db%)
+# Perform Restore
+RESTORE FROM 'db12m.bak';
+backup_id
+#
+# Slave will be stopped as result of restore incident event
+# Connecting to slave...
+# Check the slave status
+SHOW SLAVE STATUS;
+Slave_IO_State	#
+Master_Host	127.0.0.1
+Master_User	root
+Master_Port	MASTER_PORT
+Connect_Retry	1
+Master_Log_File	#
+Read_Master_Log_Pos	#
+Relay_Log_File	#
+Relay_Log_Pos	#
+Relay_Master_Log_File	master-bin.000002
+Slave_IO_Running	Yes
+Slave_SQL_Running	No
+Replicate_Do_DB	
+Replicate_Ignore_DB	
+Replicate_Do_Table	
+Replicate_Ignore_Table	
+Replicate_Wild_Do_Table	
+Replicate_Wild_Ignore_Table	
+Last_Errno	1590
+Last_Error	The incident RESTORE_ON_MASTER occured on the master. Message: A restore operation was initiated on the master.
+Skip_Counter	0
+Exec_Master_Log_Pos	#
+Relay_Log_Space	#
+Until_Condition	None
+Until_Log_File	
+Until_Log_Pos	0
+Master_SSL_Allowed	No
+Master_SSL_CA_File	
+Master_SSL_CA_Path	
+Master_SSL_Cert	
+Master_SSL_Cipher	
+Master_SSL_Key	
+Seconds_Behind_Master	#
+Master_SSL_Verify_Server_Cert	No
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	1590
+Last_SQL_Error	The incident RESTORE_ON_MASTER occured on the master. Message: A restore operation was initiated on the master.
+Replicate_Ignore_Server_Ids	
+Master_Server_Id	1
+SET global sql_slave_skip_counter=1;
+# Note that slave is stopped with an error
+STOP SLAVE;
+# Perform restore in slave to have sync in master and slave state
+RESTORE FROM 'db12s.bak';
+backup_id
+#
+START SLAVE;
+# Check databases are restored in slave
+SHOW DATABASES;
+Database
+information_schema
+db1
+db2
+mtr
+mysql
+test
+# Connecting to master 
+
+# Exercise objects
+CALL test.show_objects('db1');
+TABLE_NAME	TABLE_TYPE
+t11	BASE TABLE
+t12	BASE TABLE
+v1	VIEW
+routine_name	routine_type
+f1	FUNCTION
+CALL test.show_objects('db2');
+TABLE_NAME	TABLE_TYPE
+t21	BASE TABLE
+routine_name	routine_type
+e1	EVENT
+p1	PROCEDURE
+trgi	TRIGGER
+INSERT INTO db2.t21 VALUES(200,'b');
+CALL db2.p1();
+details
+trigger trg1 fired
+trigger trg1 fired
+SELECT db1.f1();
+db1.f1()
+2
+SELECT * FROM db2.t21;
+id	fname
+100	a
+200	b
+
+# Connecting to slave...
+
+# Check the objects are replicated in slave
+CALL db2.p1();
+details
+trigger trg1 fired
+trigger trg1 fired
+SELECT db1.f1();
+db1.f1()
+2
+SHOW DATABASES;
+Database
+information_schema
+db1
+db2
+mtr
+mysql
+test
+# Exercise objects in slave
+INSERT INTO db2.t21 VALUES(300,'b');
+CALL db2.p1();
+details
+trigger trg1 fired
+trigger trg1 fired
+trigger trg1 fired
+SELECT db1.f1();
+db1.f1()
+3
+SELECT * FROM db2.t21;
+id	fname
+100	a
+200	b
+300	b
+# Stop the slave.
+SLAVE STOP;
+# Connecting to master...
+FLUSH BACKUP LOGS;
+PURGE BACKUP LOGS;
+DROP DATABASE db1;
+DROP DATABASE db2;
+DROP PROCEDURE test.show_objects;
+# Connecting to slave...
+FLUSH BACKUP LOGS;
+PURGE BACKUP LOGS;
+DROP DATABASE db1;
+DROP DATABASE db2;
+DROP PROCEDURE test.show_objects;

=== added file 'mysql-test/suite/rpl/t/rpl_backup_extra.test'
--- a/mysql-test/suite/rpl/t/rpl_backup_extra.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_backup_extra.test	2009-04-29 18:20:21 +0000
@@ -0,0 +1,217 @@
+# This test is created to test the interoperability of backup with replication
+# The tests for WL#4195
+
+--source include/master-slave.inc
+--source include/not_embedded.inc
+
+--echo
+--echo # Connecting to master...
+--echo
+connection master;
+
+--echo # Get master's datadir.
+let $MYSQLD_M_DATADIR= `select @@datadir`;
+
+--echo # Create databases and objects
+--source suite/rpl/include/rpl_backup_basic.inc
+
+--echo
+--echo # Test 1: Backup commands are run on slaves.  Verify that slave's binary --echo # log information is recorded in backup logs when backup commands are
+--echo # run on slaves.
+--echo
+
+--echo # Clear all backup logs
+FLUSH BACKUP LOGS;
+PURGE BACKUP LOGS;
+
+--echo # Connecting to slave...
+sync_slave_with_master;
+connection slave;
+
+--echo # Get slave's datadir.
+let $MYSQLD_S_DATADIR= `select @@datadir`;
+
+--echo # Remove all entries in the backup logs.
+FLUSH BACKUP LOGS;
+PURGE BACKUP LOGS;
+
+--echo # Check databases and objects in slave
+SHOW DATABASES LIKE 'db%';
+SHOW FULL TABLES FROM db1;
+SHOW FULL TABLES FROM db2;
+SELECT * FROM db1.t11;
+
+--echo # Note down the master status in slave
+let $master_pos = query_get_value("SHOW MASTER STATUS", Position, 1);
+
+--echo # Perform backup
+--replace_column 1 #
+BACKUP DATABASE db1, db2 TO 'dbs.bak';
+
+--echo # Verify the backup logs has recorded the slaves binary logs information
+SELECT binlog_pos INTO @master_pos_log FROM mysql.backup_history;
+let $result=`SELECT @master_pos_log = $master_pos AS are_identical`;
+--echo $result
+--echo # If result is 1, then slaves binary log position is same in backup 
+--echo # logs and there is no advance in binary log position in slave status
+
+--copy_file $MYSQLD_S_DATADIR/dbs.bak $MYSQLD_M_DATADIR/dbs.bak
+file_exists $MYSQLD_M_DATADIR/dbs.bak;
+
+--echo # Connecting to master...
+connection master;
+
+--echo # Test 2: Restore commands run on a master. Verify that effects of 
+--echo # restore are not logged and restore shall not record any data events
+--echo # in the binary log
+
+--echo # Clear all backup logs
+FLUSH BACKUP LOGS;
+PURGE BACKUP LOGS;
+
+--echo # Excercise objects
+
+INSERT INTO db2.t21 VALUES(100, 'a');
+SELECT * FROM db1.v1;
+CALL db2.p1();
+SELECT db1.f1();
+
+--echo # Perform backup in master for future
+--replace_column 1 #
+BACKUP DATABASE db1, db2 TO 'db12m.bak';
+
+--echo # Clear all backup logs
+FLUSH BACKUP LOGS;
+PURGE BACKUP LOGS;
+
+--echo # Note down master position
+let $master_pos = query_get_value("SHOW MASTER STATUS", Position, 1);
+
+# Note that restore will produce warning message because of Bug#44331.
+# Once this bug is fixed, no warning messages should be produced by restore
+
+--echo # Perform restore
+--replace_regex /[0000-9999]+/#/
+--replace_column 1 #
+RESTORE FROM 'dbs.bak' OVERWRITE;
+
+--echo # Verify binlog events from master position before restore. 
+--echo # Note that restore incident event will be generated. Binary log position
+--echo # will not be advanced after restore operation. 
+
+--replace_column 2 # 5 #
+--disable_query_log
+eval SHOW BINLOG EVENTS FROM $master_pos;
+--enable_query_log
+
+--echo # Slave will be stopped as result of restore incident event
+--echo # Connecting to slave...
+connection slave;
+source include/wait_for_slave_sql_to_stop.inc;
+
+--echo # Check the contents in slave till restore incident event is generated
+CALL test.show_objects('db1');
+CALL test.show_objects('db2');
+SELECT * FROM db1.t11;
+SELECT * FROM db1.t12;
+SELECT * FROM db2.t21;
+
+--echo # Check the slave status
+--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 6 # 7 # 8 # 9 # 22 # 23 # 33 #
+--query_vertical SHOW SLAVE STATUS
+
+SET global sql_slave_skip_counter=1;
+--echo # Note that slave is stopped with an error
+STOP SLAVE;
+--source include/wait_for_slave_to_stop.inc
+START SLAVE;
+--source include/wait_for_slave_to_start.inc
+
+--echo # Exercise objects in slave
+INSERT INTO db2.t21 VALUES(200, 'b');
+SELECT * FROM db1.v1;
+CALL db2.p1();
+SELECT db1.f1();
+SELECT * FROM db1.t11;
+SELECT * FROM db2.t21;
+
+--echo # Test 3: Changes to backup logs shall not be logged.
+--echo
+
+--echo # Connecting to master...
+connection master;
+
+CALL test.show_objects('db1');
+CALL test.show_objects('db2');
+
+--echo # Exercise objects 
+INSERT INTO db2.t21 VALUES(300, 'b');
+SELECT * FROM db1.v1;
+CALL db2.p1();
+SELECT db1.f1();
+SELECT * FROM db1.t11;
+SELECT * FROM db2.t21;
+
+--echo # Clear all backup logs
+FLUSH BACKUP LOGS;
+PURGE BACKUP LOGS;
+
+--echo # Note down master position
+let $master_pos = query_get_value("SHOW MASTER STATUS", Position, 1);
+
+--echo # Connecting to slave
+connection slave;
+
+--echo # Note down the binary log position from backup logs in slave
+
+Let $binlog_pos = `SELECT binlog_pos FROM mysql.backup_history`;
+
+--echo # Connecting to master...
+connection master;
+
+--echo # Perform backup
+--replace_column 1 #
+BACKUP DATABASE db1, db2 TO 'db12m1.bak';
+
+--echo # Connecting to slave
+connection slave;
+
+--echo # Verify that performing backup on the master will not lead to changes 
+--echo # to the backup logs on the slave.
+
+SELECT MAX(binlog_pos) INTO @binlog_pos_s FROM mysql.backup_history;
+let $result=`SELECT @binlog_pos_s = $binlog_pos AS are_identical`;
+--echo $result
+--echo # If result is 1, then slaves binary log position is same in backup
+--echo # logs. This will show that changes to backup logs in master will not 
+--echo # affect slaves 
+
+--echo # Stop the slave.
+SLAVE STOP;
+--source include/wait_for_slave_to_stop.inc
+
+# Clean up section
+
+--echo # Connecting to master...
+connection master;
+FLUSH BACKUP LOGS;
+PURGE BACKUP LOGS;
+DROP DATABASE db1;
+DROP DATABASE db2;
+DROP PROCEDURE test.show_objects;
+SET GLOBAL EVENT_SCHEDULER=OFF;
+--remove_file $MYSQLD_M_DATADIR/db12m.bak
+--remove_file $MYSQLD_M_DATADIR/db12m1.bak
+--remove_file $MYSQLD_M_DATADIR/dbs.bak
+
+--echo # Connecting to slave...
+connection slave;
+
+FLUSH BACKUP LOGS;
+PURGE BACKUP LOGS;
+DROP DATABASE db1;
+DROP DATABASE db2;
+DROP PROCEDURE test.show_objects;
+SET GLOBAL EVENT_SCHEDULER=OFF;
+--remove_file $MYSQLD_S_DATADIR/dbs.bak

=== added file 'mysql-test/suite/rpl/t/rpl_backup_multi.cnf'
--- a/mysql-test/suite/rpl/t/rpl_backup_multi.cnf	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_backup_multi.cnf	2009-04-29 18:20:21 +0000
@@ -0,0 +1,31 @@
+!include include/default_mysqld.cnf
+
+[mysqld.1]
+log-slave-updates
+innodb
+
+[mysqld.2]
+log-slave-updates
+innodb
+
+[mysqld.3]
+log-slave-updates
+innodb
+
+[mysqld.4]
+log-slave-updates
+innodb
+
+[ENV]
+MASTER_MYPORT=          @mysqld.1.port
+MASTER_MYSOCK=          @mysqld.1.socket
+
+SLAVE_MYPORT=          @mysqld.2.port
+SLAVE_MYSOCK=          @mysqld.2.socket
+
+SLAVE_MYPORT1=          @mysqld.3.port
+SLAVE_MYSOCK1=          @mysqld.3.socket
+
+SLAVE_MYPORT2=          @mysqld.4.port
+SLAVE_MYSOCK2=          @mysqld.4.socket
+

=== added file 'mysql-test/suite/rpl/t/rpl_backup_multi.test'
--- a/mysql-test/suite/rpl/t/rpl_backup_multi.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_backup_multi.test	2009-04-29 18:20:21 +0000
@@ -0,0 +1,375 @@
+# This test is created to test the interoperability of backup with replication
+# This test will have multi master slave configuration setup
+# master --> slave1 --> slave2
+#         |
+#          --> slave3
+# Master will be connected to slave1 and slave3. slave1 will act as master to 
+# slave  slave2
+
+--source include/not_embedded.inc
+--source include/have_innodb.inc
+
+# Set up multi master-slave configuration
+--source suite/rpl/include/rpl_backup_multi.inc
+
+# Create database and tables in master and verify that is replicated in slave
+
+--echo
+--echo # Connecting to master ...
+--echo
+--connection master_a
+--echo # Get master's datadir.
+let $MYSQLD_M_DATADIR= `select @@datadir`;
+
+--source suite/rpl/include/rpl_backup_basic.inc
+--source suite/rpl/include/rpl_backup_multi_sync.inc
+
+--echo # Clear backup logs
+FLUSH BACKUP LOGS;
+PURGE BACKUP LOGS;
+
+--echo # Perform backup
+--replace_column 1 #
+BACKUP DATABASE db1, db2 TO 'db12m.bak';
+
+--echo # Create new table and add some data contents after backup
+CREATE TABLE db2.t22(srno TINYINT);
+INSERT INTO db2.t22 VALUES(35),(45),(55);
+
+INSERT INTO db1.t11(b,c) VALUES('e',50),('f',60);
+SELECT COUNT(*) FROM db1.t11;
+
+--echo
+--echo connecting to slave1 ...
+--echo
+
+--echo # slave 1 is directly connected to master
+--connection slave_1
+
+--echo # Get master's datadir.
+let $MYSQLD_S_DATADIR= `select @@datadir`;
+
+--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 6 # 7 # 8 # 9 # 22 # 23 # 33 #
+--query_vertical SHOW SLAVE STATUS;
+
+--echo # Verify all objects and exercise them
+CALL test.show_objects('db1');
+CALL test.show_objects('db2');
+
+--echo # Perform backup in slave1 for future use
+--replace_column 1 #
+BACKUP DATABASE db1, db2 TO 'db12s.bak';
+
+INSERT INTO db2.t21 VALUES(200,'b');
+SELECT * FROM db1.v1;
+CALL db2.p1();
+SELECT db1.f1();
+SELECT COUNT(*) FROM db1.t11;
+SELECT COUNT(*) FROM db2.t22;
+
+--echo # Create new table in slave1 and verify that it is replicated in slave2
+CREATE TABLE db1.s1(id INT);
+SHOW FULL TABLES FROM db1;
+
+--echo
+--echo # Connecting to slave2 ...
+--echo
+
+--echo # slave 2 is connected to slave1 which will act as master to slave2
+--connection slave_2
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+--replace_column 1 # 6 # 7 # 8 # 9 # 22 # 23 # 33 #
+--query_vertical SHOW SLAVE STATUS;
+
+--echo # Note that db1 will have table s1
+CALL test.show_objects('db1');
+CALL test.show_objects('db2');
+SELECT COUNT(*) FROM db1.t11;
+SELECT COUNT(*) FROM db2.t22;
+CALL db2.p1();
+SELECT db1.f1();
+
+--echo
+--echo # Connecting to slave3 ...
+--echo
+
+--echo # slave 3 is directly connected to master
+--connection slave_3
+--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 6 # 7 # 8 # 9 # 22 # 23 # 33 #
+--query_vertical SHOW SLAVE STATUS;
+
+--echo # Check the objects and other table contents in slave3
+--echo # Note that db2.t22 will be included and not db1.s1
+CALL test.show_objects('db1');
+CALL test.show_objects('db2');
+SELECT COUNT(*) FROM db1.t11;
+SELECT COUNT(*) FROM db2.t22;
+
+--echo # db1.f1 will show only 2 values
+CALL db2.p1();
+SELECT db1.f1();
+
+--echo
+--echo # Connecting to master ...
+--echo
+
+--connection master_a
+
+--echo # Table db1.s1 will not be in master
+CALL test.show_objects('db1');
+CALL test.show_objects('db2');
+
+let $master_pos = query_get_value("SHOW MASTER STATUS", Position, 1);
+
+--echo # Now perform restore from db12m.bak
+--replace_column 1 #
+RESTORE FROM 'db12m.bak' OVERWRITE;
+
+--echo
+--echo # Show the incident event issued as a result of restore. This will cause
+--echo # slave1 and slave3 to stop. slave2 will function normally
+
+--replace_column 2 # 5 #
+--disable_query_log
+eval SHOW BINLOG EVENTS FROM $master_pos;
+--enable_query_log
+
+--echo
+--echo # Connecting to slave1 ...
+--echo
+
+--connection slave_1
+source include/wait_for_slave_sql_to_stop.inc;
+
+--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 6 # 7 # 8 # 9 # 22 # 23 # 33 #
+--query_vertical SHOW SLAVE STATUS
+
+--echo
+--echo # Show the slave stopped with an error.
+LET $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
+disable_query_log;
+eval SELECT "$last_error" AS Last_SQL_Error;
+enable_query_log;
+
+SET global sql_slave_skip_counter=1;
+STOP SLAVE;
+--source include/wait_for_slave_to_stop.inc
+
+START SLAVE;
+--source include/wait_for_slave_to_start.inc
+
+# Sync with master to ensure nothing is replicated after incident event.
+sync_with_master;
+
+CALL test.show_objects('db1');
+CALL test.show_objects('db2');
+SELECT COUNT(*) FROM db1.t11;
+SELECT COUNT(*) FROM db2.t22;
+CALL db2.p1();
+SELECT db1.f1();
+
+--echo
+--echo # Connecting to slave3 ...
+--echo
+
+--connection slave_3
+source include/wait_for_slave_sql_to_stop.inc;
+
+--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 6 # 7 # 8 # 9 # 22 # 23 # 33 #
+--query_vertical SHOW SLAVE STATUS
+
+--echo
+--echo # Show the slave stopped with an error.
+LET $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
+disable_query_log;
+eval SELECT "$last_error" AS Last_SQL_Error;
+enable_query_log;
+
+SET global sql_slave_skip_counter=1;
+STOP SLAVE;
+--source include/wait_for_slave_to_stop.inc
+
+START SLAVE;
+--source include/wait_for_slave_to_start.inc
+
+# Sync with master to ensure nothing is replicated after incident event.
+sync_with_master;
+
+CALL test.show_objects('db1');
+CALL test.show_objects('db2');
+SELECT COUNT(*) FROM db1.t11;
+SELECT COUNT(*) FROM db2.t22;
+CALL db2.p1();
+SELECT db1.f1();
+
+--echo
+--echo # Connecting to slave2 ...
+--echo
+
+--connection slave_2
+
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+--replace_column 1 # 6 # 7 # 8 # 9 # 22 # 23 # 33 #
+--query_vertical SHOW SLAVE STATUS
+
+--echo
+--echo # Check the table contents in slave_2. Note that this should not be 
+--echo # affected because of restore incident event
+
+CALL test.show_objects('db1');
+CALL test.show_objects('db2');
+SELECT COUNT(*) FROM db1.t11;
+SELECT COUNT(*) FROM db2.t22;
+CALL db2.p1();
+SELECT db1.f1();
+
+--echo
+--echo # Connecting to slave1 ...
+--echo
+--connection slave_1
+
+--echo # Execute restore in slave_1 from db12s.bak
+--error ER_RESTORE_ON_SLAVE
+RESTORE FROM 'db12s.bak' OVERWRITE;
+
+let $master_before_pos = query_get_value("SHOW MASTER STATUS", Position, 1);
+
+--echo # Stop slave and then perform restore
+STOP SLAVE;
+
+# Note that restore will produce warning message because of Bug#44331.
+# Once this bug is fixed, no warning messages should be produced by restore
+
+--echo # Perform restore
+--replace_column 1 #
+RESTORE FROM 'db12s.bak' OVERWRITE;
+
+--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 6 # 7 # 8 # 9 # 22 # 23 # 33 #
+--query_vertical SHOW SLAVE STATUS
+
+--echo
+--echo # Show the incident event issued as a result of restore. This will cause
+--echo # slave2 to stop
+
+--replace_column 2 # 5 #
+--disable_query_log
+eval SHOW BINLOG EVENTS FROM $master_before_pos;
+--enable_query_log
+
+--echo # Verify objects and tables contents after restore
+CALL test.show_objects('db1');
+CALL test.show_objects('db2');
+SELECT COUNT(*) FROM db1.t11;
+SELECT COUNT(*) FROM db2.t22;
+CALL db2.p1();
+SELECT db1.f1();
+
+--echo
+--echo # Connecting to slave2 ...
+--echo
+--connection slave_2
+source include/wait_for_slave_sql_to_stop.inc;
+
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+--replace_column 1 # 6 # 7 # 8 # 9 # 22 # 23 # 33 #
+--query_vertical SHOW SLAVE STATUS
+
+--echo
+--echo # Show the slave stopped with an error.
+LET $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
+disable_query_log;
+eval SELECT "$last_error" AS Last_SQL_Error;
+enable_query_log;
+
+SET global sql_slave_skip_counter=1;
+
+STOP SLAVE;
+--source include/wait_for_slave_to_stop.inc
+
+START SLAVE;
+--source include/wait_for_slave_to_start.inc
+
+# Sync with master and verify that nothing is replicated after incident event.
+sync_with_master;
+
+CALL test.show_objects('db1');
+CALL test.show_objects('db2');
+SELECT COUNT(*) FROM db1.t11;
+SELECT COUNT(*) FROM db2.t22;
+CALL db2.p1();
+SELECT db1.f1();
+
+--echo
+--echo # Connecting to slave1 ...
+--connection slave_1
+START SLAVE;
+--source include/wait_for_slave_to_start.inc
+
+--echo
+--echo # Connecting to master ...
+--echo
+--connection master_a
+
+--echo # Verify that objects and table contents are not affected
+CALL test.show_objects('db1');
+CALL test.show_objects('db2');
+SELECT COUNT(*) FROM db1.t11;
+CALL db2.p1();
+SELECT db1.f1();
+
+--echo # Create new objects in master and verify it is replicated in slaves
+CREATE TABLE db1.m1(a CHAR(20));
+CREATE VIEW db2.v1 AS SELECT * FROM db1.m1;
+
+INSERT INTO db1.m1 VALUES('a'),('b');
+SELECT * FROM db2.v1;
+
+--echo
+--echo # Connecting to slave1 ...
+--echo
+--connection slave_1
+CALL test.show_objects('db1');
+CALL test.show_objects('db2');
+
+--echo
+--echo # Connecting to slave3 ...
+--echo
+--connection slave_3
+CALL test.show_objects('db1');
+CALL test.show_objects('db2');
+
+--echo
+--echo # Connecting to slave2 ...
+--echo
+--connection slave_2
+CALL test.show_objects('db1');
+CALL test.show_objects('db2');
+
+# Clean up
+--echo *** Clean up ***
+--connection master_a
+DROP DATABASE db1;
+DROP DATABASE db2;
+DROP PROCEDURE test.show_objects;
+--source suite/rpl/include/rpl_backup_multi_sync.inc
+--remove_file $MYSQLD_M_DATADIR/db12m.bak
+
+--connection slave_1
+STOP SLAVE;
+RESET SLAVE;
+--remove_file $MYSQLD_S_DATADIR/db12s.bak
+
+--connection slave_2
+STOP SLAVE;
+RESET SLAVE;
+--connection slave_3
+STOP SLAVE;
+RESET SLAVE;
+
+--exit
+

=== added file 'mysql-test/suite/rpl/t/rpl_backup_ptr.test'
--- a/mysql-test/suite/rpl/t/rpl_backup_ptr.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_backup_ptr.test	2009-04-29 18:20:21 +0000
@@ -0,0 +1,185 @@
+--source include/master-slave.inc
+--source include/not_embedded.inc
+
+--echo 
+--echo # Connecting to master...
+--echo
+connection master;
+
+--echo # Get master's datadir.
+let $MYSQLD_M_DATADIR= `select @@datadir`;
+
+--source suite/rpl/include/rpl_backup_basic.inc
+
+--echo # Clear all backup logs
+FLUSH BACKUP LOGS;
+PURGE BACKUP LOGS;
+
+--echo
+--echo # Connecting to slave...
+--echo
+sync_slave_with_master;
+connection slave;
+
+CALL test.show_objects('db1');
+CALL test.show_objects('db2');
+
+--echo # Turn off replication by stopping slave
+STOP SLAVE;
+--source include/wait_for_slave_to_stop.inc
+
+--echo # Check the slave has stopped from slave status
+--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 6 # 7 # 8 # 9 # 22 # 23 # 33 #
+--query_vertical SHOW SLAVE STATUS
+
+--echo # Check the objects in databases db1 and db2 in slave
+
+CALL test.show_objects('db1');
+CALL test.show_objects('db2');
+
+--echo
+--echo # Connecting to master...
+--echo
+connection master;
+
+--echo # Execute some DML and DDL operations in databases.
+
+CREATE TABLE db2.new(a CHAR(30));
+INSERT INTO db2.new VALUES('New table created'),('for'),('testing'),('PTR');
+SELECT * FROM db2.new;
+
+UPDATE db1.t11 SET c=100 WHERE b='d';
+DELETE FROM db1.t11 WHERE b='b';
+SELECT * FROM db1.t11;
+
+DELIMITER ||;
+CREATE PROCEDURE db1.p11()
+BEGIN
+ CREATE VIEW db2.vv AS SELECT * FROM db1.v1;
+END;||
+
+DELIMITER ;||
+
+CALL db1.p11();
+SELECT * FROM db1.v1;
+SELECT * FROM db2.vv;
+
+ALTER PROCEDURE db2.p1 COMMENT 'TESTING POINT IN TIME RECOVERY';
+
+--echo # Changes made in databases are
+--echo # Table 'new' created, rows from db1.t11 updated and deleted
+--echo # Procedure db1.p11 created, view db2.vv created
+--echo # db2.p1 altered
+
+CALL test.show_objects('db1');
+CALL test.show_objects('db2');
+SHOW CREATE PROCEDURE db2.p1;
+
+--echo
+--echo # Connecting to slave...
+--echo
+connection slave;
+
+--echo # Verify that no new objects are included slave
+CALL test.show_objects('db1');
+CALL test.show_objects('db2');
+SHOW CREATE PROCEDURE db2.p1;
+
+--echo
+--echo # Connecting to master...
+--echo
+connection master;
+
+--echo # Perform backup
+--replace_column 1 #
+BACKUP DATABASE db1, db2 TO 'db12m_ptr.bak';
+
+let $binlog_pos = `SELECT binlog_pos FROM mysql.backup_history`;
+let $binlog_file = query_get_value(SHOW MASTER STATUS, File, 1);
+
+DROP PROCEDURE test.show_objects;
+DROP DATABASE db1;
+DROP DATABASE db2;
+
+--echo # Turn on replication by starting slave
+--echo # Connecting to slave...
+--echo
+connection slave;
+START SLAVE;
+--source include/wait_for_slave_to_start.inc
+
+--echo # Check the slave status
+--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 6 # 7 # 8 # 9 # 22 # 23 # 33 #
+--query_vertical SHOW SLAVE STATUS
+
+--echo
+--echo # Connecting to master ...
+--echo
+--echo # Execute mysqlbinlog
+connection master;
+
+--exec $MYSQL_BINLOG  --stop-position=$binlog_pos $MYSQLD_M_DATADIR/$binlog_file |$MYSQL
+--remove_file $MYSQLD_M_DATADIR/db12m_ptr.bak
+
+--echo
+--echo ########## CHECK OBJECTS AFTER PTR IN MASTER #################
+--echo # Check that all the data contents are recovered using PTR
+CALL test.show_objects('db1');
+CALL test.show_objects('db2');
+SHOW CREATE PROCEDURE db2.p1;
+--echo
+
+--echo # Exercise objects
+INSERT INTO db2.t21 VALUES(200, 'b');
+SELECT * FROM db1.v1;
+CALL db2.p1();
+SELECT db1.f1();
+
+SELECT * FROM db1.t11;
+SELECT * FROM db2.vv;
+
+--echo
+--echo # Connecting to slave...
+--echo
+sync_slave_with_master;
+connection slave;
+
+--echo ######## CHECK DATA IS REPLICATED IN SLAVE AFTER PTR ##########
+CALL test.show_objects('db1');
+CALL test.show_objects('db2');
+SHOW CREATE PROCEDURE db2.p1;
+
+--echo # Exercise objects in slave
+INSERT INTO db2.t21 VALUES(300, 'c');
+SELECT * FROM db1.v1;
+SELECT * FROM db1.t11;
+SELECT * FROM db2.vv;
+
+CALL db2.p1();
+SELECT db1.f1();
+SHOW CREATE PROCEDURE db2.p1;
+
+--echo # Stop the slave.
+SLAVE STOP;
+--source include/wait_for_slave_to_stop.inc
+
+# Clean up section
+
+--echo # Connecting to master...
+connection master;
+FLUSH BACKUP LOGS;
+PURGE BACKUP LOGS;
+DROP DATABASE db1;
+DROP DATABASE db2;
+DROP PROCEDURE test.show_objects;
+
+--echo # Connecting to slave...
+connection slave;
+
+FLUSH BACKUP LOGS;
+PURGE BACKUP LOGS;
+DROP DATABASE db1;
+DROP DATABASE db2;
+DROP PROCEDURE test.show_objects;

=== added file 'mysql-test/suite/rpl/t/rpl_backup_shutdown.test'
--- a/mysql-test/suite/rpl/t/rpl_backup_shutdown.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_backup_shutdown.test	2009-04-29 18:20:21 +0000
@@ -0,0 +1,154 @@
+# This test is created for WL#4195.
+# This test will shutdown the master server, then restart the master server,
+# restore the backup image in new master & slave and continue replication.
+
+--source include/master-slave.inc
+--source include/not_embedded.inc
+
+--echo
+--echo # Connecting to master...
+--echo
+connection master;
+
+--echo # Get master's datadir.
+let $MYSQLD_M_DATADIR= `select @@datadir`;
+
+--echo # Create databases and objects
+--source suite/rpl/include/rpl_backup_basic.inc
+
+--echo # Clear all backup logs
+FLUSH BACKUP LOGS;
+PURGE BACKUP LOGS;
+
+--echo # Perform backup in master for future
+--replace_column 1 #
+BACKUP DATABASE db1, db2 TO 'db12m.bak';
+
+--echo # Connecting to slave...
+sync_slave_with_master;
+connection slave;
+
+--echo # Get slave's datadir.
+let $MYSQLD_S_DATADIR= `select @@datadir`;
+
+--echo # Remove all entries in the backup logs.
+FLUSH BACKUP LOGS;
+PURGE BACKUP LOGS;
+
+--echo # Check databases and objects in slave
+CALL test.show_objects('db1');
+CALL test.show_objects('db2');
+SELECT * FROM db1.t11;
+SELECT * FROM db1.t12;
+SELECT * FROM db2.t21;
+
+--echo # Connecting to master...
+connection master;
+
+--copy_file $MYSQLD_M_DATADIR/db12m.bak $MYSQLTEST_VARDIR/tmp/db12m.bak
+--copy_file $MYSQLD_M_DATADIR/db12m.bak $MYSQLD_S_DATADIR/db12s.bak
+
+--echo # Drop the databases
+DROP DATABASE db1;
+DROP DATABASE db2;
+
+# Stop master server
+--echo --> Stop master server ...
+--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+wait
+EOF
+--shutdown_server 10
+--source include/wait_until_disconnected.inc
+
+--echo --> Start master server ...
+--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+restart
+EOF
+--enable_reconnect
+--source include/wait_until_connected_again.inc
+
+SHOW DATABASES LIKE 'db%';
+
+--echo # Perform Restore
+--replace_column 1 #
+RESTORE FROM 'db12m.bak';
+
+--echo # Slave will be stopped as result of restore incident event
+--echo # Connecting to slave...
+connection slave;
+source include/wait_for_slave_sql_to_stop.inc;
+
+--echo # Check the slave status
+--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 6 # 7 # 8 # 9 # 22 # 23 # 33 #
+--query_vertical SHOW SLAVE STATUS
+
+SET global sql_slave_skip_counter=1;
+--echo # Note that slave is stopped with an error
+STOP SLAVE;
+--source include/wait_for_slave_to_stop.inc
+
+--echo # Perform restore in slave to have sync in master and slave state
+--replace_column 1 #
+RESTORE FROM 'db12s.bak';
+
+START SLAVE;
+--source include/wait_for_slave_to_start.inc
+
+--echo # Check databases are restored in slave
+SHOW DATABASES;
+
+--echo # Connecting to master 
+--echo
+connection master;
+
+--echo # Exercise objects
+CALL test.show_objects('db1');
+CALL test.show_objects('db2');
+INSERT INTO db2.t21 VALUES(200,'b');
+CALL db2.p1();
+SELECT db1.f1();
+SELECT * FROM db2.t21;
+
+--echo
+--echo # Connecting to slave...
+--echo
+sync_slave_with_master;
+connection slave;
+
+--echo # Check the objects are replicated in slave
+CALL db2.p1();
+SELECT db1.f1();
+SHOW DATABASES;
+
+--echo # Exercise objects in slave
+INSERT INTO db2.t21 VALUES(300,'b');
+CALL db2.p1();
+SELECT db1.f1();
+SELECT * FROM db2.t21;
+
+--echo # Stop the slave.
+SLAVE STOP;
+--source include/wait_for_slave_to_stop.inc
+
+# Clean up section
+
+--echo # Connecting to master...
+connection master;
+FLUSH BACKUP LOGS;
+PURGE BACKUP LOGS;
+DROP DATABASE db1;
+DROP DATABASE db2;
+DROP PROCEDURE test.show_objects;
+--remove_file $MYSQLD_M_DATADIR/db12m.bak
+
+--echo # Connecting to slave...
+connection slave;
+
+FLUSH BACKUP LOGS;
+PURGE BACKUP LOGS;
+DROP DATABASE db1;
+DROP DATABASE db2;
+DROP PROCEDURE test.show_objects;
+--remove_file $MYSQLD_S_DATADIR/db12s.bak
+--remove_file $MYSQLTEST_VARDIR/tmp/db12m.bak

Thread
bzr commit into mysql-6.0-backup branch (hema:2700) WL#4195Hema Sridharan29 Apr