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