~ubuntu-branches/ubuntu/trusty/drizzle/trusty

« back to all changes in this revision

Viewing changes to tests/t/kill.test

  • Committer: Bazaar Package Importer
  • Author(s): Monty Taylor
  • Date: 2010-03-18 12:12:31 UTC
  • Revision ID: james.westby@ubuntu.com-20100318121231-k6g1xe6cshbwa0f8
Tags: upstream-2010.03.1347
ImportĀ upstreamĀ versionĀ 2010.03.1347

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Disable concurrent inserts to avoid test failures when reading the
 
2
# connection id which was inserted into a table by another thread.
 
3
connect (con1, localhost, root,,);
 
4
connect (con2, localhost, root,,);
 
5
 
 
6
#remember id of con1
 
7
connection con1;
 
8
--disable_warnings
 
9
drop table if exists t1, t2, t3;
 
10
--enable_warnings
 
11
 
 
12
--disable_reconnect
 
13
create table t1 (kill_id int);
 
14
insert into t1 values(connection_id());
 
15
 
 
16
#kill con1
 
17
connection con2;
 
18
select ((@id := kill_id) - kill_id) from t1; 
 
19
kill @id;
 
20
 
 
21
connection con1;
 
22
--sleep 2
 
23
 
 
24
--disable_query_log
 
25
--disable_result_log
 
26
# One of the following statements should fail
 
27
--error 0,5,20,23
 
28
select 1;
 
29
--error 0,5,20,23
 
30
select 1;
 
31
--enable_query_log
 
32
--enable_result_log
 
33
 
 
34
--enable_reconnect
 
35
# this should work, and we should have a new connection_id()
 
36
select ((@id := kill_id) - kill_id) from t1;
 
37
select @id != connection_id();
 
38
 
 
39
#make sure the server is still alive
 
40
connection con2;
 
41
select 4;
 
42
drop table t1;
 
43
connection default;
 
44
 
 
45
#
 
46
# BUG#14851: killing long running subquery processed via a temporary table.
 
47
#
 
48
create table t1 (id int primary key);
 
49
create table t2 (id int not null);
 
50
 
 
51
connect (conn1, localhost, root,,);
 
52
connection conn1;
 
53
 
 
54
-- disable_result_log
 
55
-- disable_query_log
 
56
begin;
 
57
let $1 = 4096;
 
58
while ($1)
 
59
{
 
60
  eval insert into t1 values ($1);
 
61
  dec $1;
 
62
}
 
63
commit;
 
64
-- enable_query_log
 
65
-- enable_result_log
 
66
 
 
67
insert into t2 select id from t1;
 
68
 
 
69
create table t3 (kill_id int);
 
70
insert into t3 values(connection_id());
 
71
connect (conn2, localhost, root,,);
 
72
connection conn2;
 
73
 
 
74
connection conn1;
 
75
-- disable_result_log
 
76
# This is a very long running query. If this test start failing, it may
 
77
# be necessary to change to an even longer query.
 
78
send select id from t1 where id in (select distinct a.id from t2 a, t2 b, t2 c, t2 d group by a.id, b.id, c.id, d.id having a.id between 10 and 20);
 
79
-- enable_result_log
 
80
 
 
81
connection conn2;
 
82
select ((@id := kill_id) - kill_id) from t3;
 
83
-- sleep 1
 
84
kill @id;
 
85
 
 
86
connection conn1;
 
87
-- error 1053,2013,1104
 
88
reap;
 
89
 
 
90
connection default;
 
91
 
 
92
drop table t1, t2, t3;
 
93
 
 
94
# End of 4.1 tests
 
95
 
 
96
# Fix issue with kill $
 
97
#create table t1(f1 int);
 
98
#
 
99
## Test UPDATE
 
100
#insert into t1 values(0);
 
101
#connection con2;
 
102
#send update t1 set f1= bug27563();
 
103
#real_sleep 2;
 
104
#connection con1;
 
105
#disable_query_log;
 
106
#kill query $ID;
 
107
#enable_query_log;
 
108
#connection con2;
 
109
#--error 1317
 
110
#reap;
 
111
#select @a;
 
112
#connection con1;
 
113
#select * from t1;
 
114
#
 
115
## Test DELETE
 
116
#insert into t1 values(1);
 
117
#connection con2;
 
118
#send delete from t1 where bug27563() is null;
 
119
#real_sleep 2;
 
120
#connection con1;
 
121
#disable_query_log;
 
122
#eval kill query $ID;
 
123
#enable_query_log;
 
124
#connection con2;
 
125
#--error 1317
 
126
#reap;
 
127
#select @a;
 
128
#connection con1;
 
129
#select * from t1;
 
130
#
 
131
## Test SELECT
 
132
#connection con2;
 
133
#send select * from t1 where f1= bug27563();
 
134
#real_sleep 2;
 
135
#connection con1;
 
136
#disable_query_log;
 
137
#eval kill query $ID;
 
138
#enable_query_log;
 
139
#connection con2;
 
140
#--error 1317
 
141
#reap;
 
142
#select @a;
 
143
#
 
144
#
 
145
###########################################################################
 
146
 
 
147
--echo #
 
148
--echo # Bug#19723: kill of active connection yields different error code
 
149
--echo # depending on platform.
 
150
--echo #
 
151
 
 
152
--echo
 
153
--echo # Connection: con2.
 
154
--connection con2
 
155
 
 
156
KILL CONNECTION_ID();
 
157
 
 
158
--echo # CR_SERVER_LOST, CR_SERVER_GONE_ERROR, depending on the timing 
 
159
--echo # of close of the connection socket
 
160
--error 5, 20, 23
 
161
SELECT 1;
 
162
--connection default
 
163
 
 
164
###########################################################################