~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: brian
  • Date: 2008-06-25 05:29:13 UTC
  • Revision ID: brian@localhost.localdomain-20080625052913-6upwo0jsrl4lnapl
clean slate

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
-- source include/have_debug.inc
 
2
-- source include/have_log_bin.inc
 
3
-- source include/have_binlog_format_mixed_or_statement.inc
 
4
#
 
5
# bug#27571 asynchronous setting mysql_$query()'s local error and 
 
6
#           Query_log_event::error_code
 
7
#
 
8
 
 
9
--disable_warnings
 
10
drop table if exists t1,t2;
 
11
--enable_warnings
 
12
 
 
13
#
 
14
#  Checking that killing upon successful row-loop does not affect binlogging
 
15
#
 
16
 
 
17
create table t1  (a int) engine=MyISAM;
 
18
insert into t1 set a=1;
 
19
reset master;
 
20
 
 
21
update t1 set a=2 /* will be "killed" after work has been done */;
 
22
 
 
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
 
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
system rm $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_ln/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=107 $MYSQLTEST_VARDIR/log/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
system rm $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog;
 
66
 
 
67
 
 
68
drop table t1,t2;
 
69
 
 
70
--echo end of the tests