Skip to content

Commit b3d6cbc

Browse files
committed
cleanup: binlog.binlog_killed_simulate
1 parent 0d897c2 commit b3d6cbc

File tree

2 files changed

+15
-38
lines changed

2 files changed

+15
-38
lines changed
Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
1-
drop table if exists t1,t2;
21
create table t1 (a int) engine=MyISAM;
32
insert into t1 set a=1;
43
reset master;
54
update t1 set a=2 /* will be "killed" after work has been done */;
6-
select
7-
(@a:=load_file("MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
8-
is not null;
9-
(@a:=load_file("MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
10-
is not null
11-
1
12-
select 1 /* must return 1 as query completed before got killed*/;
13-
1
5+
set @a:=load_file("MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog");
6+
select @a like '%#%error_code=0%' /* must return 1 as query completed before got killed*/;
7+
@a like '%#%error_code=0%'
148
1
159
create table t2 (a int, b int) ENGINE=MyISAM;
1610
reset master;
@@ -22,14 +16,9 @@ master-bin.000001 # Gtid # # BEGIN GTID #-#-#
2216
master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#
2317
master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE `t2` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a`, `b`) ;file_id=#
2418
master-bin.000001 # Query # # COMMIT
25-
select
26-
(@a:=load_file("MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
27-
is not null;
28-
(@a:=load_file("MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
29-
is not null
30-
1
31-
select 0 /* must return 0 to mean the killed query is in */;
32-
0
19+
set @a:=load_file("MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog");
20+
select @a like '%#%error_code=0%' /* must return 0 to mean the killed query is in */;
21+
@a like '%#%error_code=0%'
3322
0
3423
drop table t1,t2;
3524
end of the tests

mysql-test/suite/binlog/t/binlog_killed_simulate.test

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@
66
# Query_log_event::error_code
77
#
88

9-
--disable_warnings
10-
drop table if exists t1,t2;
11-
--enable_warnings
12-
139
#
1410
# Checking that killing upon successful row-loop does not affect binlogging
1511
#
@@ -21,20 +17,16 @@ reset master;
2117
update t1 set a=2 /* will be "killed" after work has been done */;
2218

2319
# a proof the query is binlogged with no error
24-
let $MYSQLD_DATADIR= `select @@datadir`;
25-
--exec $MYSQL_BINLOG --force-if-open --start-position=$binlog_start_pos $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
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
2622
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
27-
eval select
28-
(@a:=load_file("$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
29-
is not null;
23+
eval set @a:=load_file("$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog");
3024
--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*/;
25+
select @a like '%#%error_code=0%' /* must return 1 as query completed before got killed*/;
3326

3427
# cleanup for the sub-case
3528
remove_file $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog;
3629

37-
3830
#
3931
# Checking that killing inside of row-loop for LOAD DATA into
4032
# non-transactional table affects binlogging
@@ -46,21 +38,17 @@ reset master;
4638
load data infile '../../std_data/rpl_loaddata.dat' into table t2 /* will be "killed" in the middle */;
4739

4840
# a proof the query is binlogged with an error
49-
--let $binlog_load_data= query_get_value(SHOW BINLOG EVENTS, Pos, 5)
50-
--let $binlog_end= query_get_value(SHOW BINLOG EVENTS, Pos, 6)
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)
5143
source include/show_binlog_events.inc;
5244

53-
5445
--mkdir $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571
55-
--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/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
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
5647

5748
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
58-
eval select
59-
(@a:=load_file("$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
60-
is not null;
49+
eval set @a:=load_file("$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog");
6150
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
62-
let $error_code= `select @a like "%#%error_code=0%" /* must return 0*/`;
63-
eval select $error_code /* must return 0 to mean the killed query is in */;
51+
select @a like '%#%error_code=0%' /* must return 0 to mean the killed query is in */;
6452

6553
# cleanup for the sub-case
6654
remove_file $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog;

0 commit comments

Comments
 (0)