~ubuntu-branches/ubuntu/precise/mysql-5.1/precise

« back to all changes in this revision

Viewing changes to mysql-test/suite/binlog/t/binlog_killed_simulate.test

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Tretkowski
  • Date: 2010-03-17 14:56:02 UTC
  • Revision ID: james.westby@ubuntu.com-20100317145602-x7e30l1b2sb5s6w6
Tags: upstream-5.1.45
ImportĀ upstreamĀ versionĀ 5.1.45

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
-- source include/have_debug.inc
 
2
-- source include/have_binlog_format_mixed_or_statement.inc
 
3
#
 
4
# bug#27571 asynchronous setting mysql_$query()'s local error and 
 
5
#           Query_log_event::error_code
 
6
#
 
7
 
 
8
--disable_warnings
 
9
drop table if exists t1,t2;
 
10
--enable_warnings
 
11
 
 
12
#
 
13
#  Checking that killing upon successful row-loop does not affect binlogging
 
14
#
 
15
 
 
16
create table t1  (a int) engine=MyISAM;
 
17
insert into t1 set a=1;
 
18
reset master;
 
19
 
 
20
update t1 set a=2 /* will be "killed" after work has been done */;
 
21
 
 
22
# a proof the query is binlogged with no error
 
23
#todo: introduce a suite private macro that provides numeric values
 
24
#      for some constants like the offset of the first real event
 
25
#      that is different between severs versions.
 
26
let $MYSQLD_DATADIR= `select @@datadir`;
 
27
--exec $MYSQL_BINLOG --force-if-open --start-position=106 $MYSQLD_DATADIR/master-bin.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;
 
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
 
 
51
# a proof the query is binlogged with an error
 
52
 
 
53
source include/show_binlog_events.inc;
 
54
 
 
55
--exec $MYSQL_BINLOG --force-if-open --start-position=98 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
 
56
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
 
57
eval select
 
58
(@a:=load_file("$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
 
59
is not null;
 
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 */;
 
63
 
 
64
# cleanup for the sub-case
 
65
remove_file $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog;
 
66
 
 
67
 
 
68
drop table t1,t2;
 
69
 
 
70
--echo end of the tests