~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/kill.test

  • Committer: Brian Aker
  • Date: 2008-07-15 06:45:16 UTC
  • Revision ID: brian@tangent.org-20080715064516-fnbq7kowh7w57bxj
Merge Monty's code.

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
 
set @old_concurrent_insert= @@global.concurrent_insert;
4
 
set @@global.concurrent_insert= 0;
5
 
 
6
 
connect (con1, localhost, root,,);
7
 
connect (con2, localhost, root,,);
8
 
 
9
 
#remember id of con1
10
 
connection con1;
11
 
--disable_warnings
12
 
drop table if exists t1, t2, t3;
13
 
--enable_warnings
14
 
 
15
 
--disable_reconnect
16
 
create table t1 (kill_id int);
17
 
insert into t1 values(connection_id());
18
 
 
19
 
#kill con1
20
 
connection con2;
21
 
select ((@id := kill_id) - kill_id) from t1; 
22
 
kill @id;
23
 
 
24
 
connection con1;
25
 
--sleep 2
26
 
 
27
 
--disable_query_log
28
 
--disable_result_log
29
 
# One of the following statements should fail
30
 
--error 0,2006,2013
31
 
select 1;
32
 
--error 0,2006,2013
33
 
select 1;
34
 
--enable_query_log
35
 
--enable_result_log
36
 
 
37
 
--enable_reconnect
38
 
# this should work, and we should have a new connection_id()
39
 
select ((@id := kill_id) - kill_id) from t1;
40
 
select @id != connection_id();
41
 
 
42
 
#make sure the server is still alive
43
 
connection con2;
44
 
select 4;
45
 
drop table t1;
46
 
connection default;
47
 
 
48
 
--error ER_NOT_SUPPORTED_YET
49
 
kill (select count(*) from mysql.user);
50
 
 
51
 
#
52
 
# BUG#14851: killing long running subquery processed via a temporary table.
53
 
#
54
 
create table t1 (id int primary key);
55
 
create table t2 (id int not null);
56
 
 
57
 
connect (conn1, localhost, root,,);
58
 
connection conn1;
59
 
 
60
 
let $1 = 4096;
61
 
while ($1)
62
 
{
63
 
  eval insert into t1 values ($1);
64
 
  dec $1;
65
 
}
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
 
# This is a very long running query. If this test start failing, it may
76
 
# be necessary to change to an even longer query.
77
 
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);
78
 
 
79
 
connection conn2;
80
 
select ((@id := kill_id) - kill_id) from t3;
81
 
kill @id;
82
 
 
83
 
connection conn1;
84
 
reap;
85
 
 
86
 
connection default;
87
 
 
88
 
drop table t1, t2, t3;
89
 
 
90
 
# End of 4.1 tests
91
 
 
92
 
#
93
 
# test of blocking of sending ERROR after OK or EOF
94
 
#
95
 
connection con1;
96
 
select get_lock("a", 10);
97
 
connection con2;
98
 
let $ID= `select connection_id()`;
99
 
send select get_lock("a", 10);
100
 
real_sleep 2;
101
 
connection con1;
102
 
disable_query_log;
103
 
eval kill query $ID;
104
 
enable_query_log;
105
 
connection con2;
106
 
reap;
107
 
select 1;
108
 
connection con1;
109
 
select RELEASE_LOCK("a");
110
 
 
111
 
create table t1(f1 int);
112
 
 
113
 
 
114
 
# Test UPDATE
115
 
insert into t1 values(0);
116
 
connection con2;
117
 
send update t1 set f1= bug27563();
118
 
real_sleep 2;
119
 
connection con1;
120
 
disable_query_log;
121
 
eval kill query $ID;
122
 
enable_query_log;
123
 
connection con2;
124
 
--error 1317
125
 
reap;
126
 
select @a;
127
 
connection con1;
128
 
select * from t1;
129
 
 
130
 
# Test DELETE
131
 
insert into t1 values(1);
132
 
connection con2;
133
 
send delete from t1 where bug27563() is null;
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
 
connection con1;
144
 
select * from t1;
145
 
 
146
 
# Test SELECT
147
 
connection con2;
148
 
send select * from t1 where f1= bug27563();
149
 
real_sleep 2;
150
 
connection con1;
151
 
disable_query_log;
152
 
eval kill query $ID;
153
 
enable_query_log;
154
 
connection con2;
155
 
--error 1317
156
 
reap;
157
 
select @a;
158
 
 
159
 
 
160
 
###########################################################################
161
 
 
162
 
--echo #
163
 
--echo # Bug#19723: kill of active connection yields different error code
164
 
--echo # depending on platform.
165
 
--echo #
166
 
 
167
 
--echo
168
 
--echo # Connection: con2.
169
 
--connection con2
170
 
 
171
 
KILL CONNECTION_ID();
172
 
 
173
 
--echo # CR_SERVER_LOST, CR_SERVER_GONE_ERROR, depending on the timing 
174
 
--echo # of close of the connection socket
175
 
--error 2013, 2006 
176
 
SELECT 1;
177
 
--connection default
178
 
 
179
 
###########################################################################
180
 
 
181
 
# Restore global concurrent_insert value. Keep in the end of the test file.
182
 
set @@global.concurrent_insert= @old_concurrent_insert;