--source include/have_binlog_format_mixed.inc
--source include/master-slave.inc

#
# BUG#12987771: REPLICATED STATEMENTS ARE DUPLICATED IN THE SLAVE GENERAL LOG 
#
--connection slave

--source include/stop_slave.inc

SET @old_log_output= @@log_output;
SET GLOBAL log_output= 'TABLE';
TRUNCATE mysql.general_log;

--source include/start_slave.inc

--connection master
CREATE TABLE t1 (i int NOT NULL PRIMARY KEY);

--source include/sync_slave_sql_with_master.inc 

--let $assert_cond= [SELECT count(*) as N FROM mysql.general_log WHERE argument="CREATE TABLE t1 (i int NOT NULL PRIMARY KEY)", N, 1] = 1
--let $assert_text= The slave thread does not write the same statement twice to the general log
--source include/assert.inc

--connection master
DROP TABLE t1;
--source include/sync_slave_sql_with_master.inc

--source include/stop_slave.inc

SET GLOBAL log_output= @old_log_output;
TRUNCATE mysql.general_log;
--source include/start_slave.inc

--source include/rpl_end.inc
