# Test if master cuts binlog at InnoDB crash's recovery,
# after we crashed intentionally in rpl_crash_binlog_innodb_1a.test
# (1a and 1b are two tests, 1b should NOT be run if 1a has not be run
# just before). So don't run 1b alone.
# We need InnoDB in the master, and a debug build in the master.

# We don't use master-slave.inc because it would RESET MASTER.
connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,);
connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT,);

source include/have_debug.inc
source include/have_innodb.inc
require_os unix ;

connection master;
# check that transaction was rolled back on master
select * from t1;
insert into t1 values (5);
select * from t1;
save_master_pos;

# Check that slave did not receive the spurious INSERT statement
connection slave;
select * from t1;
start slave;
sync_with_master;
select * from t1;
# Check that the spurious statement is NOT in the master's binlog anymore
# LOAD_FILE() needs a file readable by all
system chmod ugo+r $MYSQL_TEST_DIR/var/log/master-bin.000002 ;
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
eval set @a=load_file("$MYSQL_TEST_DIR/var/log/master-bin.000002");
select length(@a);
select @a like "%values (4)%";

connection master;
drop table if exists t1;
sync_slave_with_master;