mariadb/mysql-test/t/binlog_row_mix_innodb_myisam.test
unknown e653222d30 Bug#17642 mysqlbinlog: Restore from row-based binlog fails
Problem: mysqlbinlog_base64 failed sporadically.

Reason: Missing "flush logs" before running $MYSQL_BINLOG,
which could start dumping the log file before server
has finished writting into it.
Fix:
- implementing --force-if-open option to "mysqlbinlog"
- adding --disable-force-if-open to make $MYSQL_BINLOG
  fail on non-closed log files, to garantee that nobody
  will forget "flush logs" in the future.
- adding "flush logs" into all affected tests.


client/mysqlbinlog.cc:
  Implementing --force-if-open option with TRUE by default
mysql-test/mysql-test-run.pl:
  Using --disable-force-if-open for all tests to avoid
  sporadic test failures because of running "mysqlbinlog"
  on a non-flushed binlog files.
mysql-test/r/binlog_row_mix_innodb_myisam.result:
  FLush log before running dumping.
mysql-test/r/binlog_stm_mix_innodb_myisam.result:
  FLush log before running dumping.
mysql-test/r/mysqlbinlog.result:
  FLush log before running dumping.
mysql-test/r/mysqlbinlog2.result:
  FLush log before running dumping.
mysql-test/r/mysqlbinlog_base64.result:
  FLush log before running dumping.
mysql-test/r/user_var-binlog.result:
  FLush log before running dumping.
mysql-test/t/binlog_row_mix_innodb_myisam.test:
  FLush log before running dumping.
mysql-test/t/binlog_stm_mix_innodb_myisam.test:
  FLush log before running dumping.
mysql-test/t/mysqlbinlog.test:
  FLush log before running dumping.
  
  Adding new tests:
  - checking that $MYSQL_BINLOG returns an error on a non-closed binlog
  file because of --disable-force-if-open
  - checking that it does not return an error with --force-if-open
mysql-test/t/mysqlbinlog2.test:
  FLush log before running dumping.
mysql-test/t/mysqlbinlog_base64.test:
  FLush log before running dumping.
mysql-test/t/user_var-binlog.test:
  FLush log before running dumping.
2006-12-14 14:05:25 +04:00

32 lines
1.3 KiB
Text

# 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_row.inc
# Bug#18326: Do not lock table for writing during prepare of statement
# The use of the ps protocol causes extra table maps in the binlog, so
# we disable the ps-protocol for this statement.
--disable_ps_protocol
-- source extra/binlog_tests/mix_innodb_myisam_binlog.test
--enable_ps_protocol
# 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=516 $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;