1
-- source include/have_debug.inc
2
-- source include/have_log_bin.inc
3
-- source include/have_binlog_format_mixed_or_statement.inc
5
# bug#27571 asynchronous setting mysql_$query()'s local error and
6
# Query_log_event::error_code
10
drop table if exists t1,t2;
14
# Checking that killing upon successful row-loop does not affect binlogging
17
create table t1 (a int) engine=MyISAM;
18
insert into t1 set a=1;
21
update t1 set a=2 /* will be "killed" after work has been done */;
23
# a proof the query is binlogged with no error
24
#todo: introduce a suite private macro that provides numeric values
25
# for some constants like the offset of the first real event
26
# that is different between severs versions.
27
--exec $MYSQL_BINLOG --force-if-open --start-position=107 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
28
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
30
(@a:=load_file("$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
32
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
33
let $error_code= `select @a like "%#%error_code=0%" /* must return 1 */`;
34
eval select $error_code /* must return 1 as query completed before got killed*/;
36
# cleanup for the sub-case
37
system rm $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog;
41
# Checking that killing inside of row-loop for LOAD DATA into
42
# non-transactional table affects binlogging
45
create table t2 (a int, b int) ENGINE=MyISAM;
47
--error ER_QUERY_INTERRUPTED
48
load data infile '../std_data_ln/rpl_loaddata.dat' into table t2 /* will be "killed" in the middle */;
51
# a proof the query is binlogged with an error
53
source include/show_binlog_events.inc;
55
--exec $MYSQL_BINLOG --force-if-open --start-position=107 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
56
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
58
(@a:=load_file("$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
60
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
61
let $error_code= `select @a like "%#%error_code=0%" /* must return 0*/`;
62
eval select $error_code /* must return 0 to mean the killed query is in */;
64
# cleanup for the sub-case
65
system rm $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog;
70
--echo end of the tests