Debian Codegraph @

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

raw
1 #==============================================================================
2 # Establish the level of IPV6 support
3 #==============================================================================
4 #==============================================================================
5 # Get hostname, port number
6 #==============================================================================
7 SELECT @@hostname INTO @MY_HOSTNAME;
8 SELECT @@port INTO @MY_MASTER_PORT;
9 #==============================================================================
10 # 1.0 Get the default connection object_instance_begin, thread id and verify
11 # the expected number of client connections.
12 #==============================================================================
13
14 # 1.1 Confirm only one client connection
15
16 SELECT COUNT(*) INTO @my_client_connections
17 FROM performance_schema.socket_instances
18 WHERE EVENT_NAME LIKE "%client_connection%";
19
20 # 1.2 Get the default THREAD_ID;
21
22 SELECT THREAD_ID INTO @my_thread_id
23 FROM performance_schema.threads
24 WHERE PROCESSLIST_ID = CONNECTION_ID();
25
26 # 1.3 Get the default OBJECT_INSTANCE_BEGIN
27
28 SELECT OBJECT_INSTANCE_BEGIN INTO @my_object_instance_begin
29 FROM performance_schema.socket_instances
30 WHERE THREAD_ID = @my_thread_id;
31 #==============================================================================
32 # 2.0 ESTABLISH TCP/IP CONNECTION 1
33 # Connect with IP = localhost (127.0.0.1 or ::1)
34 #==============================================================================
35
36 # 2.1 Get the connection thread id
37
38 SELECT THREAD_ID INTO @my_thread_id
39 FROM performance_schema.threads
40 WHERE PROCESSLIST_ID = CONNECTION_ID();
41
42 # 2.2 Get the connection object instance begin
43
44 SELECT OBJECT_INSTANCE_BEGIN INTO @my_object_instance_begin
45 FROM performance_schema.socket_instances
46 WHERE THREAD_ID = @my_thread_id;
47
48 # 2.3 Get the connection port
49
50 SELECT PORT INTO @my_port
51 FROM performance_schema.socket_instances
52 WHERE THREAD_ID = @my_thread_id;
53
54 # 2.4 Verify that the connection is 127.0.0.1 or ::1
55
56 SELECT COUNT(*) = 1 AS 'Expect 1'
57 FROM performance_schema.socket_instances
58 WHERE EVENT_NAME LIKE '%client_connection%'
59 AND (IP LIKE '%127.0.0.1' OR IP LIKE '%::1')
60 AND PORT= @con1_port
61 AND OBJECT_INSTANCE_BEGIN= @con1_object_id;
62 Expect 1
63 1
64
65 # 2.5 Verify that the same connection is in the summary instance table
66
67 SELECT COUNT(*) = 1 AS 'Expect 1'
68 FROM performance_schema.socket_summary_by_instance
69 WHERE EVENT_NAME LIKE '%client_connection%'
70 AND OBJECT_INSTANCE_BEGIN= @con1_object_id;
71 Expect 1
72 1
73
74 # Switch to connection default
75
76 #==============================================================================
77 # 3.0 ESTABLISH TCP/IP CONNECTION 2
78 # Connect with IP = localhost (127.0.0.1 or ::1)
79 #==============================================================================
80
81 # 3.1 Get the connection thread id
82
83 SELECT THREAD_ID INTO @my_thread_id
84 FROM performance_schema.threads
85 WHERE PROCESSLIST_ID = CONNECTION_ID();
86
87 # 3.2 Get the connection object instance begin
88
89 SELECT OBJECT_INSTANCE_BEGIN INTO @my_object_instance_begin
90 FROM performance_schema.socket_instances
91 WHERE THREAD_ID = @my_thread_id;
92
93 # 3.3 Get the connection port
94
95 SELECT PORT INTO @my_port
96 FROM performance_schema.socket_instances
97 WHERE THREAD_ID = @my_thread_id;
98
99 # 3.4 Verify that the connection is 127.0.0.1 or ::1
100
101 SELECT COUNT(*) = 1 AS 'Expect 1'
102 FROM performance_schema.socket_instances
103 WHERE EVENT_NAME LIKE '%client_connection%'
104 AND (IP LIKE '%127.0.0.1' OR IP LIKE '%::1')
105 AND PORT= @con2_port
106 AND OBJECT_INSTANCE_BEGIN= @con2_object_id;
107 Expect 1
108 1
109
110 # 3.5 Verify that the same connection is in the summary instance table
111
112 SELECT COUNT(*) = 1 AS 'Expect 1'
113 FROM performance_schema.socket_summary_by_instance
114 WHERE EVENT_NAME LIKE '%client_connection%'
115 AND OBJECT_INSTANCE_BEGIN= @con2_object_id;
116 Expect 1
117 1
118
119 # 3.6 Verify that the connection is 127.0.0.1 or ::1
120
121 SELECT COUNT(*) = 1 AS 'Expect 1'
122 FROM performance_schema.socket_instances
123 WHERE EVENT_NAME LIKE '%client_connection%'
124 AND (IP LIKE '%127.0.0.1' OR IP LIKE '%::1')
125 AND PORT= @con2_port
126 AND OBJECT_INSTANCE_BEGIN= @con2_object_id;
127 Expect 1
128 1
129 #==============================================================================
130 # 4.0 Verify both connections exist in the instance tables
131 #==============================================================================
132
133 # 4.1 Verify that there are two TCP/IP connections in the socket instance table
134
135 SELECT COUNT(*) = 2 AS 'Expect 1'
136 FROM performance_schema.socket_instances
137 WHERE EVENT_NAME LIKE '%client_connection%'
138 AND OBJECT_INSTANCE_BEGIN <> @default_object_instance_begin
139 AND (IP LIKE '%127.0.0.1' OR IP LIKE '%::1');
140 Expect 1
141 1
142
143 # 4.2 Verify that there are two TCP/IP connections in the summary instance table
144
145 SELECT COUNT(*) = 2 AS 'Expect 1'
146 FROM performance_schema.socket_summary_by_instance
147 WHERE EVENT_NAME LIKE '%client_connection%'
148 AND OBJECT_INSTANCE_BEGIN <> @default_object_instance_begin;
149 Expect 1
150 1
151 #==============================================================================
152 # 5.0 Drop the client connections
153 #==============================================================================
154 # 5.1 Disconnect con1
155 # 5.2 Disconnect con2
156 #==============================================================================
157 # 6.0 Verify sockets were removed from the instance tables
158 #==============================================================================
159
160 # 6.1 Verify that there are no TCP/IP connections in the socket instance table
161
162 SELECT COUNT(*) = 0 AS 'Expect 1'
163 FROM performance_schema.socket_instances
164 WHERE EVENT_NAME LIKE '%client_connection%'
165 AND OBJECT_INSTANCE_BEGIN <> @default_object_instance_begin
166 AND (IP LIKE '%127.0.0.1' OR IP LIKE '%::1');
167 Expect 1
168 1
169
170 # 6.2 Verify that there are no TCP/IP connections in the summary instance table
171
172 SELECT COUNT(*) = 0 AS 'Expect 1'
173 FROM performance_schema.socket_summary_by_instance
174 WHERE EVENT_NAME LIKE '%client_connection%'
175 AND OBJECT_INSTANCE_BEGIN <> @default_object_instance_begin;
176 Expect 1
177 1