# This is a wrapper for binlog.test so that the same test case can be used # For both statement and row based bin logs 9/19/2005 [jbm] -- source include/have_binlog_format_mixed_or_statement.inc -- source extra/binlog_tests/mix_innodb_myisam_binlog.test # This piece below cannot be put into # extra/binlog_tests/mix_innodb_myisam_binlog.test # because the argument of --start-position differs between statement- # and row-based (and "eval --exec" doesn't work). # we check that the error code of the "ROLLBACK" event is 0 and not # ER_SERVER_SHUTDOWN (i.e. disconnection just rolls back transaction # and does not make slave to stop) flush logs; --exec $MYSQL_BINLOG --start-position=555 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR eval select (@a:=load_file("$MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output")) is not null; --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR eval select @a like "%#%error_code=0%ROLLBACK/*!*/;%ROLLBACK /* added by mysqlbinlog */;%", @a not like "%#%error_code=%error_code=%"; drop table t1, t2; # # Bug #27417 thd->no_trans_update.stmt lost value inside of SF-exec-stack # bug #28960 non-trans temp table changes with insert .. select # not binlogged after rollback # # testing appearence of insert into temp_table in binlog. # There are two branches of execution that require different setup. ## send_eof() branch # prepare create table tt (a int unique); create table ti (a int) engine=innodb; reset master; show master status; # action begin; insert into ti values (1); insert into ti values (2) ; insert into tt select * from ti; rollback; # check select count(*) from tt /* 2 */; show master status; --replace_column 2 # 5 # show binlog events from 106; select count(*) from ti /* zero */; insert into ti select * from tt; select * from ti /* that is what slave would miss - a bug */; ## send_error() branch delete from ti; delete from tt where a=1; reset master; show master status; # action begin; insert into ti values (1); insert into ti values (2) /* to make the dup error in the following */; --error ER_DUP_ENTRY insert into tt select * from ti /* one affected and error */; rollback; # check show master status; --replace_column 2 # 5 # show binlog events from 106; select count(*) from ti /* zero */; insert into ti select * from tt; select * from tt /* that is what otherwise slave missed - the bug */; drop table ti,tt; # # Bug #27417 thd->no_trans_update.stmt lost value inside of SF-exec-stack # # Testing asserts: if there is a side effect of modifying non-transactional # table thd->no_trans_update.stmt must be TRUE; # the assert is active with debug build # --disable_warnings drop function if exists bug27417; drop table if exists t1,t2; --enable_warnings # side effect table CREATE TABLE t1 (a int NOT NULL auto_increment primary key) ENGINE=MyISAM; # target tables CREATE TABLE t2 (a int NOT NULL auto_increment, PRIMARY KEY (a)); delimiter |; create function bug27417(n int) RETURNS int(11) begin insert into t1 values (null); return n; end| delimiter ;| reset master; # execute insert into t2 values (bug27417(1)); insert into t2 select bug27417(2); reset master; --error ER_DUP_ENTRY insert into t2 values (bug27417(2)); #TODO: Andrei: enable this test after 23333 is pushed #show master status; /* only (!) with fixes for #23333 will show there is the query */; select count(*) from t1 /* must be 3 */; reset master; select count(*) from t2; delete from t2 where a=bug27417(3); select count(*) from t2 /* nothing got deleted */; #TODO: Andrei: enable this test after 23333 is pushed #show master status; /* the query must be in regardless of #23333 */; select count(*) from t1 /* must be 5 */; --enable_info delete t2 from t2 where t2.a=bug27417(100) /* must not affect t2 */; --disable_info select count(*) from t1 /* must be 7 */; drop function bug27417; drop table t1,t2; --echo end of tests