1 -- source include/have_debug.inc
2 -- source include/have_binlog_format_statement.inc
4 # bug#27571 asynchronous setting mysql_$query()'s local error and
5 # Query_log_event::error_code
9 drop table if exists t1,t2;
13 # Checking that killing upon successful row-loop does not affect binlogging
16 create table t1 (a int) engine=MyISAM;
17 insert into t1 set a=1;
20 update t1 set a=2 /* will be "killed" after work has been done */;
22 # a proof the query is binlogged with no error
23 --let $binlog_load_data= query_get_value(SHOW BINLOG EVENTS, Pos, 2)
24 let $MYSQLD_DATADIR= `select @@datadir`;
25 --exec $MYSQL_BINLOG --force-if-open --start-position=$binlog_load_data $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
26 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
28 (@a:=load_file("$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
30 --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
31 let $error_code= `select @a like "%#%error_code=0%" /* must return 1 */`;
32 eval select $error_code /* must return 1 as query completed before got killed*/;
34 # cleanup for the sub-case
35 remove_file $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog;
39 # Checking that killing inside of row-loop for LOAD DATA into
40 # non-transactional table affects binlogging
43 create table t2 (a int, b int) ENGINE=MyISAM;
45 --error ER_QUERY_INTERRUPTED
46 load data infile '../../std_data/rpl_loaddata.dat' into table t2 /* will be "killed" in the middle */;
49 --let $binlog_load_data= query_get_value(SHOW BINLOG EVENTS, Pos, 2)
50 # a proof the query is binlogged with an error
51 source include/show_binlog_events.inc;
53 --mkdir $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571
54 --exec $MYSQL_BINLOG --local-load=$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571 --force-if-open --start-position=$binlog_load_data $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
55 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
57 (@a:=load_file("$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
59 --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
60 let $error_code= `select @a like "%#%error_code=0%" /* must return 0*/`;
61 eval select $error_code /* must return 0 to mean the killed query is in */;
63 # cleanup for the sub-case
64 remove_file $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog;
66 --remove_files_wildcard $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571 *
67 --rmdir $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571
71 --echo end of the tests