~linuxjedi/drizzle/trunk-bug-667053

« back to all changes in this revision

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