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 connection default;
77 #==============================================================================
78 # 3.0 ESTABLISH TCP/IP CONNECTION 2
79 # Connect with IP = localhost (127.0.0.1 or ::1)
80 #==============================================================================
81 #
82 # 3.1 Get the connection thread id
83 #
84 SELECT THREAD_ID INTO @my_thread_id
85 FROM performance_schema.threads
86 WHERE PROCESSLIST_ID = CONNECTION_ID();
87 #
88 # 3.2 Get the connection object instance begin
89 #
90 SELECT OBJECT_INSTANCE_BEGIN INTO @my_object_instance_begin
91 FROM performance_schema.socket_instances
92 WHERE THREAD_ID = @my_thread_id;
93 #
94 # 3.3 Get the connection port
95 #
96 SELECT PORT INTO @my_port
97 FROM performance_schema.socket_instances
98 WHERE THREAD_ID = @my_thread_id;
99 #
100 # 3.4 Verify that the connection is 127.0.0.1 or ::1
101 #
102 SELECT COUNT(*) = 1 AS 'Expect 1'
103 FROM performance_schema.socket_instances
104 WHERE EVENT_NAME LIKE '%client_connection%'
105 AND (IP LIKE '%127.0.0.1' OR IP LIKE '%::1')
106 AND PORT= @con2_port
107 AND OBJECT_INSTANCE_BEGIN= @con2_object_id;
108 Expect 1
109 1
110 #
111 # 3.5 Verify that the same connection is in the summary instance table
112 #
113 SELECT COUNT(*) = 1 AS 'Expect 1'
114 FROM performance_schema.socket_summary_by_instance
115 WHERE EVENT_NAME LIKE '%client_connection%'
116 AND OBJECT_INSTANCE_BEGIN= @con2_object_id;
117 Expect 1
118 1
119 #
120 # 3.6 Verify that the connection is 127.0.0.1 or ::1
121 #
122 SELECT COUNT(*) = 1 AS 'Expect 1'
123 FROM performance_schema.socket_instances
124 WHERE EVENT_NAME LIKE '%client_connection%'
125 AND (IP LIKE '%127.0.0.1' OR IP LIKE '%::1')
126 AND PORT= @con2_port
127 AND OBJECT_INSTANCE_BEGIN= @con2_object_id;
128 Expect 1
129 1
130 #==============================================================================
131 # 4.0 Verify both connections exist in the instance tables
132 #==============================================================================
133 connection default;
134 #
135 # 4.1 Verify that there are two TCP/IP connections in the socket instance table
136 #
137 SELECT COUNT(*) = 2 AS 'Expect 2'
138 FROM performance_schema.socket_instances
139 WHERE EVENT_NAME LIKE '%client_connection%'
140 AND OBJECT_INSTANCE_BEGIN <> @default_object_instance_begin
141 AND (IP LIKE '%127.0.0.1' OR IP LIKE '%::1');
142 Expect 2
143 1
144 #
145 # 4.2 Verify that there are two TCP/IP connections in the summary instance table
146 #
147 SELECT COUNT(*) = 2 AS 'Expect 2'
148 FROM performance_schema.socket_summary_by_instance
149 WHERE EVENT_NAME LIKE '%client_connection%'
150 AND OBJECT_INSTANCE_BEGIN <> @default_object_instance_begin;
151 Expect 2
152 1
153 #==============================================================================
154 # 5.0 Drop the client connections
155 #==============================================================================
156 # 5.1 Disconnect con1
157 connection con1;
158 disconnect con1;
159 # 5.2 Disconnect con2
160 connection con2;
161 disconnect con2;
162 connection default;
163 #==============================================================================
164 # 6.0 Verify sockets were removed from the instance tables
165 #==============================================================================
166 #
167 # 6.1 Verify that there are no TCP/IP connections in the socket instance table
168 #
169 #
170 # 6.2 Verify that there are no TCP/IP connections in the summary instance table
171 #