1 # include/socket_event.inc
3 # Auxiliary routine running
4 # - some statement in connection con1
7 # $loop_rounds times and checking if the changes to values caused by the action
11 # 1. Have socket_summary_by_instance_func running
12 # 2a. Have a connection con1
13 # @con1_object_instance_begin needs to be the OBJECT_INSTANCE_BEGIN
14 # value of the "client_connction" entry belonging to con1 within
15 # socket_summary_by_instance.
16 # $statement needs to contain the statement to be executed by con1.
18 # 2b. Have assigned values to the following variables
19 # $connect_host $connect_db $connect_user
25 while($loop_round <= $loop_rounds)
30 # Collect the current state
31 #==========================
39 let $statement= Connect (con*,$connect_host,$connect_user,,$connect_db,,);
40 # Some statements fail with ER_ACCESS_DENIED_ERROR
41 --disable_abort_on_error
42 --connect (con$loop_round,$connect_host,$connect_user,,$connect_db,,)
43 --enable_abort_on_error
44 let $my_errno= $mysql_errno;
48 # We are aware that this additional statement is overhead.
49 # But it ensures that SUM_NUMBER_OF_BYTES_READ and
50 # SUM_NUMBER_OF_BYTES_WRITE are updated.
51 # And this avoids the instabilities found when running
52 # the connect without this additional statement.
60 # Print the statement outcome once.
67 # One of the statements to be checked is expected to fail with ER_NO_SUCH_TABLE.
68 --disable_abort_on_error
71 --enable_abort_on_error
76 # Wait till the operation is really finished. We expect that there will be no
77 # changes to the statistics of the additional connection after this point of time.
78 #=================================================================================
82 # 1. Connect failed ($my_errno <> 0)
83 # no entry in performance_schema.threads -> wait_till_sleep.inc cannot be used
84 # short life entry in socket_summary_by_instance -> wait till it doesn't exist
85 # 2. Connect with success ($my_errno = 0)
86 # entry in performance_schema.threads -> wait_till_sleep.inc can be used
87 # entry in socket_summary_by_instance -> wait till it does exist
88 # 3. SQL command failed ($my_errno <> 0)
89 # entry in performance_schema.threads -> wait_till_sleep.inc can be used
93 FROM performance_schema.socket_summary_by_instance
94 WHERE EVENT_NAME LIKE
'%client_connection'
95 AND OBJECT_INSTANCE_BEGIN <> @default_object_instance_begin;
99 # Wait till the new connection is visible in performance_schema.threads
100 # and processlist_command is 'Sleep'.
101 --source ../include/wait_till_sleep.inc
103 # A successful connect causes that a new second row in
104 # performance_schema.socket_summary_by_instance shows up.
105 # Wait till this row is there.
106 let $wait_timeout= 10;
110 --source include/wait_condition.inc
113 --echo # Error: We did not reach the expected state where a
new
114 --echo # row in socket_summary_by_instance is visible
124 # Experiments with high parallel load showed that there is a very
125 # period of time where a "client_connection" entry for a failing
126 # Connect is visible.
127 # We hope that sleep 1 is long enough so that PERFORMANCE_SCHEMA
128 # can remove this row before we collect the after action state.
133 --source include/wait_condition.inc
136 --echo # Error: We did not reach the expected state.
137 --echo #
A failing connect causes a
"client_connection" entry
138 --echo # within socket_summary_by_instance having an extreme
139 --echo #
short lifetime.
140 --echo # This
entry must have now disappeared.
152 --source ../include/wait_till_sleep.inc
157 # 1. Check statistics in general
158 #-------------------------------
159 # ../include/socket_summary_check.inc also inserts the 'After' state into
160 # mysqltest.my_socket_summary_by_instance.
161 --source ../include/socket_summary_check.inc
167 eval $get_object_instance_begin;
168 eval $insert_pseudo_before;
172 # Correct the values of the columns statement and run
174 UPDATE mysqltest.socket_summary_by_instance_detail
176 WHERE statement IS NULL;
178 UPDATE mysqltest.socket_summary_by_instance_detail
179 SET
run = $loop_round
184 # Only in case the connect was successful ($my_errno = 0) than we have to disconnect.
187 --disconnect con$loop_round
188 # Wait till the connection using the DB = 'mysqltest' or
189 # 'mysqlsupertest' has disappeared from performance_schema.threads
191 FROM performance_schema.threads
192 WHERE processlist_db IN (
'mysqltest',
'mysqlsupertest');
193 let $wait_timeout= 10;
197 --source include/wait_condition.inc
200 --echo # Error: The disconnect of the connection with processlist_db
201 --echo # IN (
'mysqltest',
'mysqlsupertest') failed
207 # Wait in addition till the corresponding 'client_connection' entry of
208 # the connection using the DB = 'mysqltest' or 'mysqlsupertest' has disappeared.
210 FROM performance_schema.socket_summary_by_instance
211 WHERE EVENT_NAME LIKE
'%client_connection'
212 AND OBJECT_INSTANCE_BEGIN <> @default_object_instance_begin;
213 let $wait_timeout= 10;
217 --source include/wait_condition.inc
220 --echo # Error: The
entry of the disconnectd connection with processlist_db
221 --echo # IN (
'mysqltest',
'mysqlsupertest') did not disappear