~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
-- source include/one_thread_per_connection.inc
2
3
#
4
# Bug #8731: wait_timeout does not work on Mac OS X
5
#
6
7
8
# Connect with another connection and reset counters
9
--disable_query_log
10
connect (wait_con,localhost,root,,test,,);
11
connection wait_con;
12
set session wait_timeout=100;
13
let $retries=300;
14
set @aborted_clients= 0;
15
--enable_query_log
16
17
# Disable reconnect and do the query
18
connection default;
19
# If slow host (Valgrind...), we may have already timed out here.
20
# So force a reconnect if necessary, using a dummy query. And issue a
21
# 'flush status' to reset the 'aborted_clients' counter.
22
--enable_reconnect
23
select 0;
24
flush status;
25
--disable_reconnect
26
select 1;
27
28
# Switch to wait_con and wait until server has aborted the connection
29
--disable_query_log
30
connection wait_con;
31
while (!`select @aborted_clients`)
32
{
33
  sleep 0.1;
34
  let $aborted_clients = `SHOW STATUS LIKE 'aborted_clients'`;
35
  eval set @aborted_clients= SUBSTRING('$aborted_clients', 16)+0;
36
37
  dec $retries;
38
  if (!$retries)
39
  {
40
    Failed to detect that client has been aborted;
41
  }
42
}
43
--enable_query_log
44
# The server has disconnected, add small sleep to make sure
45
# the disconnect has reached client
46
sleep 1;
47
48
connection default;
49
# When the connection is closed in this way, the error code should
50
# be consistent see bug#2845 for an explanation
51
# depending on platform/client, either errno 2006 or 2013 can occur below
52
--error 2006,2013
53
select 2;
54
--enable_reconnect
55
select 3;
56
# Disconnect so that we will not be confused by a future abort from this
57
# connection.
58
disconnect default;
59
60
#
61
# Do the same test as above on a TCP connection
62
# (which we get by specifying a ip adress)
63
64
# Connect with another connection and reset counters
65
--disable_query_log
66
connection wait_con;
67
flush status; # Reset counters
68
let $retries=300;
69
set @aborted_clients= 0;
70
--enable_query_log
71
72
connect (con1,127.0.0.1,root,,test,$MASTER_MYPORT,);
73
--disable_reconnect
74
select 1;
75
76
# Switch to wait_con and wait until server has aborted the connection
77
--disable_query_log
78
connection wait_con;
79
while (!`select @aborted_clients`)
80
{
81
  sleep 0.1;
82
  let $aborted_clients = `SHOW STATUS LIKE 'aborted_clients'`;
83
  eval set @aborted_clients= SUBSTRING('$aborted_clients', 16)+0;
84
85
  dec $retries;
86
  if (!$retries)
87
  {
88
    Failed to detect that client has been aborted;
89
  }
90
}
91
--enable_query_log
92
# The server has disconnected, add small sleep to make sure
93
# the disconnect has reached client
94
sleep 1;
95
96
connection con1;
97
# When the connection is closed in this way, the error code should
98
# be consistent see bug#2845 for an explanation
99
# depending on platform/client, either errno 2006 or 2013 can occur below
100
--error 2006,2013
101
select 2;
102
--enable_reconnect
103
select 3;
104
disconnect con1;