mySQL 5.0.11 sources for tomato
[tomato.git] / release / src / router / mysql / mysql-test / suite / binlog / r / binlog_killed.result
blob72fda535b6f77e4a64c78e0ee5aac06c57ae73d1
1 create table t1 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB;
2 create table t2 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=MyISAM;
3 create table t3 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB;
4 select get_lock("a", 20);
5 get_lock("a", 20)
7 reset master;
8 insert into t2 values (null, null), (null, get_lock("a", 10));
9 select @result /* must be zero either way */;
10 @result
12 select RELEASE_LOCK("a");
13 RELEASE_LOCK("a")
15 delete from t1;
16 delete from t2;
17 insert into t1 values (1,1),(2,2);
18 begin;
19 update t1 set b=11 where a=2;
20 begin;
21 update t1 set b=b+10;
22 kill query ID;
23 rollback;
24 rollback;
25 select * from t1  order by a /* must be the same as before (1,1),(2,2) */;
26 a       b
27 1       1
28 2       2
29 begin;
30 delete from t1 where a=2;
31 begin;
32 delete from t1 where a=2;
33 kill query ID;
34 rollback;
35 rollback;
36 select * from t1 order by a /* must be the same as before (1,1),(2,2) */;
37 a       b
38 1       1
39 2       2
40 drop table if exists t4;
41 create table t4 (a int, b int) engine=innodb;
42 insert into t4 values (3, 3);
43 begin;
44 insert into t1 values (3, 3);
45 begin;
46 insert into t1 select * from t4 for update;
47 kill query ID;
48 rollback;
49 rollback;
50 select * from t1 /* must be the same as before (1,1),(2,2) */;
51 a       b
52 1       1
53 2       2
54 drop table t4;
55 create table t4 (a int, b int) ENGINE=MyISAM /* for killing update and delete */;
56 create function bug27563(n int) 
57 RETURNS int(11)
58 DETERMINISTIC
59 begin
60 if @b > 0 then
61 select get_lock("a", 20)  into @a;
62 else 
63 set @b= 1;
64 end if;
65 return n;
66 end|
67 delete from t4;
68 insert into t4 values (1,1), (1,1);
69 reset master;
70 select get_lock("a", 20);
71 get_lock("a", 20)
73 set @b= 0;
74 update t4 set b=b + bug27563(b);
75 select count(*) FROM INFORMATION_SCHEMA.PROCESSLIST where state='User lock';
76 count(*)
78 kill query ID;
79 ERROR 70100: Query execution was interrupted
80 select * from t4 order by b /* must be (1,1), (1,2) */;
81 a       b
82 1       1
83 1       2
84 select @b  /* must be 1 at the end of a stmt calling bug27563() */;
87 must have the update query event more to FD
88 show binlog events from <binlog_start>;
89 Log_name        Pos     Event_type      Server_id       End_log_pos     Info
90 master-bin.000001       #       User var        #       #       @`b`=0
91 master-bin.000001       #       Query   #       #       use `test`; update t4 set b=b + bug27563(b)
92 select
93 (@a:=load_file("MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
94 is not null;
95 (@a:=load_file("MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
96 is not null
98 select 0 /* must return 0 to mean the killed query is in */;
101 select RELEASE_LOCK("a");
102 RELEASE_LOCK("a")
104 delete from t4;
105 insert into t4 values (1,1), (2,2);
106 reset master;
107 select get_lock("a", 20);
108 get_lock("a", 20)
110 set @b= 0;
111 delete from t4 where b=bug27563(1) or b=bug27563(2);
112 select count(*) FROM INFORMATION_SCHEMA.PROCESSLIST where state='User lock';
113 count(*)
115 kill query ID;
116 ERROR 70100: Query execution was interrupted
117 select count(*) from t4 /* must be 1 */;
118 count(*)
120 select @b  /* must be 1 at the end of a stmt calling bug27563() */;
123 must have the delete query event more to FD
124 show binlog events from <binlog_start>;
125 Log_name        Pos     Event_type      Server_id       End_log_pos     Info
126 master-bin.000001       #       User var        #       #       @`b`=0
127 master-bin.000001       #       Query   #       #       use `test`; delete from t4 where b=bug27563(1) or b=bug27563(2)
128 select
129 (@a:=load_file("MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
130 is not null;
131 (@a:=load_file("MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
132 is not null
134 select 0 /* must return 0 to mean the killed query is in */;
137 select RELEASE_LOCK("a");
138 RELEASE_LOCK("a")
140 drop table t4;
141 drop function bug27563;
142 drop table t1,t2,t3;
143 end of the tests