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;
DROP TABLE IF EXISTS test.t1;

**** Create Table for Test 1 ****

CREATE TABLE t1 ( a INT ) ENGINE=innodb;
commit;

**** Drop Table on slave for Test 1 ****

DROP TABLE t1;

**** Insert data on master for Test 1 ****

BEGIN;
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (2);
INSERT INTO t1 VALUES (3);
COMMIT;

**** Connect to slave and show status Test 1 ****

SHOW SLAVE STATUS;
Slave_IO_State	#
Master_Host	127.0.0.1
Master_User	root
Master_Port	MASTER_MYPORT
Connect_Retry	1
Master_Log_File	master-bin.000001
Read_Master_Log_Pos	609
Relay_Log_File	slave-relay-bin.000003
Relay_Log_Pos	437
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	1146
Last_Error	Error 'Table 'test.t1' doesn't exist' on opening table `test`.`t1`
Skip_Counter	0
Exec_Master_Log_Pos	295
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	#

**** Stop slave and set skip for Test 1 ****

STOP SLAVE;
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;

**** Start slave and show status for Test 1 ****

START SLAVE;
SHOW SLAVE STATUS;
Slave_IO_State	#
Master_Host	127.0.0.1
Master_User	root
Master_Port	MASTER_MYPORT
Connect_Retry	1
Master_Log_File	master-bin.000001
Read_Master_Log_Pos	609
Relay_Log_File	slave-relay-bin.000003
Relay_Log_Pos	437
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	1146
Last_Error	Error 'Table 'test.t1' doesn't exist' on opening table `test`.`t1`
Skip_Counter	0
Exec_Master_Log_Pos	295
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	#

**** cleanup for Test 1 ****

drop table if exists t1;
commit;
drop table if exists t1;
commit;
RESET MASTER;
STOP SLAVE;
RESET SLAVE;
START SLAVE;

**** Create Tables for Test 2 ****

CREATE TABLE t1 ( a INT ) ENGINE=innodb;
CREATE TABLE t2 ( a INT AUTO_INCREMENT, KEY (a) ) ENGINE=innodb;
commit;

**** Create trigger for Test 2 ****

create trigger t1_ai after insert on t1 for each row
begin
insert into t2 values (NULL);
end|

**** Drop Table t1 on slave for Test 2 ****

DROP TABLE t1;

**** Insert data on master for Test 2 ****

BEGIN;
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (2);
COMMIT;
SELECT * FROM t1 ORDER BY a;
a	1
a	2
SELECT * FROM t2 ORDER BY a;
a	1
a	2

**** Connect to slave and show status Test 2 ****

SHOW SLAVE STATUS;
Slave_IO_State	#
Master_Host	127.0.0.1
Master_User	root
Master_Port	MASTER_MYPORT
Connect_Retry	1
Master_Log_File	master-bin.000001
Read_Master_Log_Pos	899
Relay_Log_File	slave-relay-bin.000003
Relay_Log_Pos	654
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	1146
Last_Error	Error 'Table 'test.t1' doesn't exist' on opening table `test`.`t1`
Skip_Counter	0
Exec_Master_Log_Pos	512
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	#

**** Stop slave and set skip for Test 2 ****

STOP SLAVE;
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;

**** Start slave and show status for Test 2 ****

START SLAVE;
SHOW SLAVE STATUS;
Slave_IO_State	#
Master_Host	127.0.0.1
Master_User	root
Master_Port	MASTER_MYPORT
Connect_Retry	1
Master_Log_File	master-bin.000001
Read_Master_Log_Pos	899
Relay_Log_File	slave-relay-bin.000003
Relay_Log_Pos	654
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	1146
Last_Error	Error 'Table 'test.t1' doesn't exist' on opening table `test`.`t1`
Skip_Counter	0
Exec_Master_Log_Pos	512
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	#
SELECT * FROM t2 ORDER BY a;

**** Stop slave and set skip for Test 2 ****

STOP SLAVE;
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;

**** Start slave and show status for Test 2 ****

START SLAVE;
SHOW SLAVE STATUS;
Slave_IO_State	#
Master_Host	127.0.0.1
Master_User	root
Master_Port	MASTER_MYPORT
Connect_Retry	1
Master_Log_File	master-bin.000001
Read_Master_Log_Pos	899
Relay_Log_File	slave-relay-bin.000003
Relay_Log_Pos	654
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	1146
Last_Error	Error 'Table 'test.t1' doesn't exist' on opening table `test`.`t1`
Skip_Counter	0
Exec_Master_Log_Pos	512
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	#
SELECT * FROM t2 ORDER BY a;

**** Stop slave and set skip for Test 2 ****

STOP SLAVE;
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;

**** Start slave and show status for Test 2 ****

START SLAVE;
SHOW SLAVE STATUS;
Slave_IO_State	#
Master_Host	127.0.0.1
Master_User	root
Master_Port	MASTER_MYPORT
Connect_Retry	1
Master_Log_File	master-bin.000001
Read_Master_Log_Pos	899
Relay_Log_File	slave-relay-bin.000003
Relay_Log_Pos	654
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	1146
Last_Error	Error 'Table 'test.t1' doesn't exist' on opening table `test`.`t1`
Skip_Counter	0
Exec_Master_Log_Pos	512
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	#
SELECT * FROM t2 ORDER BY a;

**** cleanup for Test 2 ****

drop table if exists t1;
drop table if exists t2;
commit;
drop table if exists t1;
drop table if exists t2;
commit;
RESET MASTER;
STOP SLAVE;
RESET SLAVE;
START SLAVE;
reset master;
create table t1(n int) engine=innodb;
insert into t1 values (1);
drop table t1;
SHOW BINLOG EVENTS FROM 0;
Log_name	master-bin.000001
Pos	4
Event_type	Format_desc
Server_id	1
End_log_pos	102
Info	Server ver: 5.1.15-beta-log, Binlog ver: 4
Log_name	master-bin.000001
Pos	102
Event_type	Query
Server_id	1
End_log_pos	201
Info	use `test`; create table t1(n int) engine=innodb
Log_name	master-bin.000001
Pos	201
Event_type	Table_map
Server_id	1
End_log_pos	39
Info	table_id: 20 (test.t1)
Log_name	master-bin.000001
Pos	240
Event_type	Write_rows
Server_id	1
End_log_pos	73
Info	table_id: 20 flags: STMT_END_F
Log_name	master-bin.000001
Pos	274
Event_type	Xid
Server_id	1
End_log_pos	301
Info	COMMIT /* xid=71 */
Log_name	master-bin.000001
Pos	301
Event_type	Query
Server_id	1
End_log_pos	377
Info	use `test`; drop table t1
