Debian Codegraph @

mysql-test/suite/perfschema/r/socket_instances_func.result

raw
1 # Take a snapshot of SOCKET_INSTANCES
2 CREATE TEMPORARY TABLE my_socket_instances AS
3 SELECT * FROM performance_schema.socket_instances;
4 # Get thread id of the default connection
5 SELECT THREAD_ID INTO @thread_id
6 FROM performance_schema.threads
7 WHERE PROCESSLIST_ID = CONNECTION_ID();
8 connect con1,$my_localhost,root,,test,,$MASTER_MYPORT;
9 # Store the thread id of connection 1 (tcp/ip)
10 SELECT THREAD_ID INTO @thread_id
11 FROM performance_schema.threads
12 WHERE PROCESSLIST_ID = CONNECTION_ID();
13 # Store the port of connection 1 (tcp/ip)
14 SELECT PORT INTO @port
15 FROM performance_schema.socket_instances
16 WHERE THREAD_ID = @thread_id;
17 connection default;
18 connect con2,$my_localhost,root,,test,,$MASTER_MYPORT;
19 # Store the thread_id of connection 2 (tcp/ip)
20 SELECT THREAD_ID INTO @thread_id
21 FROM performance_schema.threads
22 WHERE PROCESSLIST_ID = CONNECTION_ID();
23 # Store the port of connection 2 (tcp/ip)
24 SELECT PORT INTO @port
25 FROM performance_schema.socket_instances
26 WHERE THREAD_ID = @thread_id;
27 connection default;
28 connect con3,localhost,root,,test,,;
29 # Store the thread id of connection 3 (unix domain)
30 SELECT THREAD_ID INTO @thread_id
31 FROM performance_schema.threads
32 WHERE PROCESSLIST_ID = CONNECTION_ID();
33 # Store the port of connection 3 (unix domain)
34 SELECT PORT INTO @port
35 FROM performance_schema.socket_instances
36 WHERE THREAD_ID = @thread_id;
37 connection default;
38 # EVENT_NAME is the "wait/io/socket/*" instrument identifier.
39 SELECT COUNT(*) = 0 AS "Expect 1"
40 FROM performance_schema.socket_instances
41 WHERE EVENT_NAME NOT LIKE 'wait/io/socket/%';
42 Expect 1
43 1
44 # OBJECT_INSTANCE_BEGIN is an arbitrary identifier, guaranteed to be unique.
45 SELECT COUNT(*) = COUNT(DISTINCT OBJECT_INSTANCE_BEGIN) AS "Expect 1"
46 FROM performance_schema.socket_instances;
47 Expect 1
48 1
49 # SOCKET_ID is the internal file handle assigned to the socket.
50 SELECT COUNT(*) = COUNT(DISTINCT SOCKET_ID) AS "Expect 1"
51 FROM performance_schema.socket_instances;
52 Expect 1
53 1
54 # Characteristics per our thread
55 # There must be only one entry with our thread_id
56 SELECT COUNT(*) = 1 AS 'Expect 1'
57 FROM performance_schema.socket_instances
58 WHERE THREAD_ID = @thread_id;
59 Expect 1
60 1
61 # TCP/IP connections should have a unique port number
62 # Connection 1 (tcp/ip)
63 SELECT COUNT(*) = 1 AS 'Expect 1'
64 FROM performance_schema.socket_instances
65 WHERE PORT = @port;
66 Expect 1
67 1
68 # Connection 2 (tcp/ip)
69 SELECT COUNT(*) = 1 AS 'Expect 1'
70 FROM performance_schema.socket_instances
71 WHERE PORT = @port;
72 Expect 1
73 1
74 # Check the content for the default connection (unix domain)
75 SELECT COUNT(*) = 1 as 'Expect 1'
76 FROM performance_schema.socket_instances
77 WHERE EVENT_NAME = 'wait/io/socket/sql/client_connection'
78 AND PORT = 0 AND THREAD_ID = @thread_id;
79 Expect 1
80 1
81 # Characteristics of 'server_tcpip_socket' entry
82 # Server listening socket, TCP/IP
83 # There are two entries with 'wait/io/socket/sql/server_tcpip_socket',
84 # for [::] and for 0.0.0.0.
85 # They share the same thread id with 'wait/io/socket/sql/server_unix_socket'.
86 SELECT COUNT(*) = 2 AS 'Expect 2'
87 FROM performance_schema.socket_instances
88 WHERE EVENT_NAME = 'wait/io/socket/sql/server_tcpip_socket';
89 Expect 2
90 1
91 # Get the 'server_tcpip_socket' thread id
92 SELECT DISTINCT THREAD_ID INTO @thread_id
93 FROM performance_schema.socket_instances
94 WHERE EVENT_NAME = 'wait/io/socket/sql/server_tcpip_socket';
95 # Check the content.
96 SELECT THREAD_ID = @thread_id
97 AND (IP = '0.0.0.0' OR IP = '::')
98 AND PORT = @port
99 AND STATE = 'ACTIVE' AS 'Expect 1'
100 FROM performance_schema.socket_instances
101 WHERE EVENT_NAME = 'wait/io/socket/sql/server_tcpip_socket';
102 Expect 1
103 1
104 1
105 # Characteristics of 'server_unix_socket' entry
106 # Server listening socket, unix domain (socket file)
107 # There is only one entry with 'wait/io/socket/sql/server_unix_socket'.
108 # It shares the same thread id as 'wait/io/socket/sql/server_tcpip_socket'.
109 SELECT COUNT(*) = 1 AS 'Expect 1'
110 FROM performance_schema.socket_instances
111 WHERE EVENT_NAME = 'wait/io/socket/sql/server_unix_socket';
112 Expect 1
113 1
114 # Get the 'server_unix_socket' thread id
115 SELECT THREAD_ID INTO @thread_id
116 FROM performance_schema.socket_instances
117 WHERE EVENT_NAME = 'wait/io/socket/sql/server_unix_socket';
118 # Check the content.
119 SELECT THREAD_ID = @thread_id
120 AND IP = ''
121 AND PORT = 0
122 AND STATE = 'ACTIVE' AS 'Expect 1'
123 FROM performance_schema.socket_instances
124 WHERE EVENT_NAME = 'wait/io/socket/sql/server_unix_socket';
125 Expect 1
126 1
127 # Server listening sockets (TCP and Unix) are handled on the same thread
128 SELECT COUNT(*) = 3 AS 'Expect 3'
129 FROM performance_schema.socket_instances
130 WHERE THREAD_ID = @thread_id;
131 Expect 3
132 1
133 SELECT COUNT(*) = 3 AS 'Expect 3'
134 FROM performance_schema.socket_instances
135 WHERE THREAD_ID = @thread_id;
136 Expect 3
137 1
138 #Compare server listener socket thread ids
139 select @match_thread_id;
140 @match_thread_id
141 1
142 # Check content for client connection 1 (tcpip)
143 SELECT EVENT_NAME = 'wait/io/socket/sql/client_connection'
144 AND (IP LIKE '%127.0.0.1' OR IP = '::1')
145 AND PORT = @port
146 AS 'Expect 1'
147 FROM performance_schema.socket_instances
148 WHERE THREAD_ID = @thread_id;
149 Expect 1
150 1
151 # Characteristics of entries with THREAD_ID of con1
152 # There is only one entry with this id.
153 SELECT COUNT(*) = 1 AS 'Expect 1'
154 FROM performance_schema.socket_instances
155 WHERE THREAD_ID = @thread_id;
156 Expect 1
157 1
158 # Check content for client connection 2 (tcpip)
159 SELECT EVENT_NAME = 'wait/io/socket/sql/client_connection'
160 AND (IP LIKE '%127.0.0.1' OR IP = '::1')
161 AND PORT = @port
162 AS 'Expect 1'
163 FROM performance_schema.socket_instances
164 WHERE THREAD_ID = @thread_id;
165 Expect 1
166 1
167 # Characteristics of entries with THREAD_ID of con2
168 # There is only one entry with this id.
169 SELECT COUNT(*) = 1 AS 'Expect 1'
170 FROM performance_schema.socket_instances
171 WHERE THREAD_ID = @thread_id;
172 Expect 1
173 1
174 # Check the content for client connection 3 (unix domain).
175 SELECT EVENT_NAME = 'wait/io/socket/sql/client_connection'
176 AND IP = ''
177 AND PORT = 0
178 AS 'Expect 1'
179 FROM performance_schema.socket_instances
180 WHERE THREAD_ID = @thread_id;
181 Expect 1
182 1
183 # Characteristics of entries with THREAD_ID of con3
184 # There is only one entry with this id.
185 SELECT COUNT(*) = 1 AS 'Expect 1'
186 FROM performance_schema.socket_instances
187 WHERE THREAD_ID = @thread_id;
188 Expect 1
189 1
190 # Show differences to socket_instances before con1, con2 and con3 connecting
191 SELECT EVENT_NAME, IP
192 FROM performance_schema.socket_instances
193 WHERE (EVENT_NAME,OBJECT_INSTANCE_BEGIN,THREAD_ID,SOCKET_ID,IP,PORT,STATE)
194 NOT IN (SELECT EVENT_NAME,OBJECT_INSTANCE_BEGIN,THREAD_ID,SOCKET_ID,IP,PORT,STATE
195 FROM my_socket_instances)
196 ORDER BY THREAD_ID;
197 EVENT_NAME IP
198 wait/io/socket/sql/client_connection <LOCALHOST>
199 wait/io/socket/sql/client_connection <LOCALHOST>
200 wait/io/socket/sql/client_connection
201 connection default;
202 connection con1;
203 disconnect con1;
204 connection con2;
205 disconnect con2;
206 connection con3;
207 disconnect con3;
208 connection default;
209 # After waiting a bit we should have no differences to socket_instances
210 # before con1, con2, con3 connecting.
211 SELECT *
212 FROM performance_schema.socket_instances
213 WHERE (EVENT_NAME,OBJECT_INSTANCE_BEGIN,THREAD_ID,SOCKET_ID,IP,PORT,STATE)
214 NOT IN (SELECT EVENT_NAME,OBJECT_INSTANCE_BEGIN,THREAD_ID,SOCKET_ID,IP,PORT,STATE
215 FROM my_socket_instances)
216 ORDER BY THREAD_ID;
217 EVENT_NAME OBJECT_INSTANCE_BEGIN THREAD_ID SOCKET_ID IP PORT STATE