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; # Get master's datadir. CREATE DATABASE db1; USE db1; CREATE TABLE t11(id INT NOT NULL PRIMARY KEY, name VARCHAR(10)); CREATE TABLE t12(a CHAR(5)); INSERT INTO t11 VALUES(1,'jon'),(2,'jil'),(5,'jack'),(6,'ku'); INSERT INTO t12 VALUES('a'),('b'); # Exercise all objects in master before performing backup USE db1; SELECT * FROM db1.t11 ORDER BY id; id name 1 jon 2 jil 5 jack 6 ku SELECT * FROM db1.t12; a a b # connecting to slave... # Get slave's datadir. # Remove all entries in the backup logs. FLUSH BACKUP LOGS; PURGE BACKUP LOGS; # ------------------- START TESTS ----------------------------- # EXECUTE BACKUP OF db1 # Connecting to master .. # Perform backup BACKUP DATABASE db1 to 'db1.bak'; backup_id # # Connecting to master and perform restore of database db1 # Get master's binlog position before restore. RESTORE FROM 'db1.bak' OVERWRITE; backup_id # # Check the master status for incident event that is generated SHOW MASTER STATUS; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000002 107 # Show the incident event issued as a result of restore. 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 # Connecting to slave and checking if it has stopped replication as a # result of incident event generation 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 # Slave_IO_Running Yes Slave_SQL_Running No Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table db1.t11 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 that slave stopped with an error as a result of incident event # generated by RESTORE in master. 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; STOP SLAVE; DROP DATABASE db1; DROP DATABASE db1;