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