Debian Codegraph @

mysql-test/suite/perfschema/r/socket_instances_func_win.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 # Establish local TCP/IP connection (con1,localhost,root,,test,,)
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 # Switch to connection default
18 # Establish second local TCP/IP connection (con1,localhost,root,,test,,)
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 # Switch to connection default
28 # EVENT_NAME is the "wait/io/socket/*" instrument identifier.
29 SELECT COUNT(*) = 0 AS "Expect 1"
30 FROM performance_schema.socket_instances
31 WHERE EVENT_NAME NOT LIKE 'wait/io/socket/%';
32 Expect 1
33 1
34 # OBJECT_INSTANCE_BEGIN is an arbitrary identifier, guaranteed to be unique.
35 SELECT COUNT(*) = COUNT(DISTINCT OBJECT_INSTANCE_BEGIN) AS "Expect 1"
36 FROM performance_schema.socket_instances;
37 Expect 1
38 1
39 # SOCKET_ID is the internal file handle assigned to the socket.
40 SELECT COUNT(*) = COUNT(DISTINCT SOCKET_ID) AS "Expect 1"
41 FROM performance_schema.socket_instances;
42 Expect 1
43 1
44 # Characteristics per our thread
45 # There must be only one entry with our thread_id
46 SELECT COUNT(*) = 1 AS 'Expect 1'
47 FROM performance_schema.socket_instances
48 WHERE THREAD_ID = @thread_id;
49 Expect 1
50 1
51 # TCP/IP connections should have a unique port number
52 # Connection 1 (tcp/ip)
53 SELECT COUNT(*) = 1 AS 'Expect 1'
54 FROM performance_schema.socket_instances
55 WHERE PORT = @port;
56 Expect 1
57 1
58 # Connection 2 (tcp/ip)
59 SELECT COUNT(*) = 1 AS 'Expect 1'
60 FROM performance_schema.socket_instances
61 WHERE PORT = @port;
62 Expect 1
63 1
64 # Check the content for the default connection (tcpip)
65 SELECT EVENT_NAME = 'wait/io/socket/sql/client_connection'
66 AND (IP LIKE '%127.0.0.1' OR IP = '::1') AS 'Expect 1'
67 FROM performance_schema.socket_instances
68 WHERE THREAD_ID = @thread_id;
69 Expect 1
70 1
71 # Characteristics of 'server_tcpip_socket' entry
72 # Server listening socket, TCP/IP
73 # There is only one entry with 'wait/io/socket/sql/server_tcpip_socket'.
74 # It shares the same thread id as 'wait/io/socket/sql/server_unix_socket'.
75 SELECT COUNT(*) = 1 AS 'Expect 1'
76 FROM performance_schema.socket_instances
77 WHERE EVENT_NAME = 'wait/io/socket/sql/server_tcpip_socket';
78 Expect 1
79 1
80 # Get the 'server_tcpip_socket' thread id
81 SELECT THREAD_ID INTO @thread_id
82 FROM performance_schema.socket_instances
83 WHERE EVENT_NAME = 'wait/io/socket/sql/server_tcpip_socket';
84 # Check the content.
85 SELECT THREAD_ID = @thread_id
86 AND (IP = '0.0.0.0' OR IP = '::')
87 AND PORT = @port
88 AND STATE = 'ACTIVE' AS 'Expect 1'
89 FROM performance_schema.socket_instances
90 WHERE EVENT_NAME = 'wait/io/socket/sql/server_tcpip_socket';
91 Expect 1
92 1
93 # Check content for client connection 1 (tcpip)
94 SELECT EVENT_NAME = 'wait/io/socket/sql/client_connection'
95 AND (IP LIKE '%127.0.0.1' OR IP = '::1')
96 AND PORT = @port
97 AS 'Expect 1'
98 FROM performance_schema.socket_instances
99 WHERE THREAD_ID = @thread_id;
100 Expect 1
101 1
102 # Characteristics of entries with THREAD_ID of con1
103 # There is only one entry with this id.
104 SELECT COUNT(*) = 1 AS 'Expect 1'
105 FROM performance_schema.socket_instances
106 WHERE THREAD_ID = @thread_id;
107 Expect 1
108 1
109 # Check content for client connection 2 (tcpip)
110 SELECT EVENT_NAME = 'wait/io/socket/sql/client_connection'
111 AND (IP LIKE '%127.0.0.1' OR IP = '::1')
112 AND PORT = @port
113 AS 'Expect 1'
114 FROM performance_schema.socket_instances
115 WHERE THREAD_ID = @thread_id;
116 Expect 1
117 1
118 # Characteristics of entries with THREAD_ID of con2
119 # There is only one entry with this id.
120 SELECT COUNT(*) = 1 AS 'Expect 1'
121 FROM performance_schema.socket_instances
122 WHERE THREAD_ID = @thread_id;
123 Expect 1
124 1
125 # Show differences to socket_instances before con1, con2 and con3 connecting
126 SELECT EVENT_NAME, IP
127 FROM performance_schema.socket_instances
128 WHERE (EVENT_NAME,OBJECT_INSTANCE_BEGIN,THREAD_ID,SOCKET_ID,IP,PORT,STATE)
129 NOT IN (SELECT EVENT_NAME,OBJECT_INSTANCE_BEGIN,THREAD_ID,SOCKET_ID,IP,PORT,STATE
130 FROM my_socket_instances)
131 ORDER BY THREAD_ID;
132 EVENT_NAME IP
133 wait/io/socket/sql/client_connection <LOCALHOST>
134 wait/io/socket/sql/client_connection <LOCALHOST>
135 # Disconnect con1 and con2
136 # After waiting a bit we should have no differences to socket_instances
137 # before con1, con2 connecting.
138 SELECT *
139 FROM performance_schema.socket_instances
140 WHERE (EVENT_NAME,OBJECT_INSTANCE_BEGIN,THREAD_ID,SOCKET_ID,IP,PORT,STATE)
141 NOT IN (SELECT EVENT_NAME,OBJECT_INSTANCE_BEGIN,THREAD_ID,SOCKET_ID,IP,PORT,STATE
142 FROM my_socket_instances)
143 ORDER BY THREAD_ID;
144 EVENT_NAME OBJECT_INSTANCE_BEGIN THREAD_ID SOCKET_ID IP PORT STATE