List:Commits« Previous MessageNext Message »
From:Christopher Powers Date:July 30 2011 2:48am
Subject:bzr push into mysql-trunk branch (chris.powers:3337 to 3338) WL#4896
View as plain text  
 3338 Christopher Powers	2011-07-29
      WL#4896 "Performance Schema Net IO"
      
      - Fixed stat error associated with IDLE wait times
      - Added socket_summary_by_instance_func.test

    added:
      mysql-test/suite/perfschema/include/socket_event.inc
      mysql-test/suite/perfschema/include/socket_summary_check.inc
      mysql-test/suite/perfschema/include/wait_till_sleep.inc
      mysql-test/suite/perfschema/r/socket_summary_by_instance_func.result
      mysql-test/suite/perfschema/t/socket_summary_by_instance_func.test
    modified:
      storage/perfschema/pfs.cc*
 3337 Christopher Powers	2011-07-28
      WL#4896 "Performance Schema Net IO"
      
      Better handling of IPV4 mapped to IPV6 in test cases

    added:
      mysql-test/include/check_ipv4_mapped.inc
    modified:
      mysql-test/suite/perfschema/r/socket_instances_func.result
      mysql-test/suite/perfschema/r/socket_instances_func_win.result
      mysql-test/suite/perfschema/t/socket_instances_func.test
      mysql-test/suite/perfschema/t/socket_instances_func_win.test
=== added file 'mysql-test/suite/perfschema/include/socket_event.inc'
--- a/mysql-test/suite/perfschema/include/socket_event.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/include/socket_event.inc	2011-07-30 02:47:07 +0000
@@ -0,0 +1,136 @@
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; version 2 of
+# the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+# 02110-1301  USA
+#
+
+# include/socket_event.inc
+#
+# Auxiliary routine
+# - running some statement in connection con1
+#   and checking the changes for the client_connction" entry belonging to con1
+#   within socket_summary_by_instance and
+# - checking if the changes to values caused by the statement execution are
+#   reasonable and stable
+#
+# Requirements:
+# 1. Have socket_summary_by_instance_func running
+# 2. Have a connection con1
+#    @con1_object_instance_begin needs to be the OBJECT_INSTANCE_BEGIN
+#    value of the "client_connction" entry belonging to con1 within
+#    socket_summary_by_instance.
+# 3. $statement needs to contain the statement to be executed by con1.
+#
+
+let $my_errno= 0;
+
+let $loop_round= 1;
+while($loop_round <= $loop_rounds)
+{
+
+--disable_query_log
+
+# Collect the current state
+#==========================
+eval $truncate;
+eval $insert_before;
+
+# Run the operation
+#==================
+if($is_connect)
+{
+   let $statement= Connect (con1,$connect_host,$connect_user,,$connect_db,,);
+   # Some statements fail with ER_ACCESS_DENIED_ERROR
+   --disable_abort_on_error
+   --connect (con1,$connect_host,$connect_user,,$connect_db,,)
+   --enable_abort_on_error
+   let $my_errno= $mysql_errno;
+}
+if(!$is_connect)
+{
+   --connection con1
+   # Print the statement outcome once.
+   if($loop_round == 1)
+   {
+   --enable_query_log
+   --enable_result_log
+   --horizontal_results
+   }
+   # One of the statements to be checked is expected to fail with ER_NO_SUCH_TABLE.
+   --disable_abort_on_error
+   eval $statement;
+   --enable_abort_on_error
+   --disable_query_log
+   --disable_result_log
+}
+
+# Wait till the operation is really finished. We expect that there will be no
+# changes to the statistics of the additional connection after this point of time.
+#=================================================================================
+--connection default
+if($my_errno)
+{
+   # Wait a bit and hope that the counter maintenence is finished.
+   --sleep 3
+}
+if(!$my_errno)
+{
+   --source ../include/wait_till_sleep.inc
+}
+
+# Various checks
+#===============
+# 1. Check statistics in general
+#-------------------------------
+# ../include/socket_summary_check.inc also inserts the 'After' state into
+# mysqltest.my_socket_summary_by_instance.
+--source ../include/socket_summary_check.inc
+--disable_query_log
+--disable_result_log
+
+if($is_connect)
+{
+   eval $get_object_instance_begin;
+   eval $insert_pseudo_before;
+}
+
+eval $insert_delta;
+# Correct the values of the columns statement and run
+eval
+UPDATE mysqltest.socket_summary_by_instance_detail
+SET statement = '$statement'
+WHERE statement IS NULL;
+eval
+UPDATE mysqltest.socket_summary_by_instance_detail
+SET run = $loop_round
+WHERE run IS NULL;
+
+if($is_connect)
+{
+   if(!$my_errno)
+   {
+      --connection con1
+      --disconnect con1
+      --source include/wait_until_disconnected.inc
+      --connection default
+   }
+}
+inc $loop_round;
+
+}
+
+--enable_query_log
+--enable_result_log
+

=== added file 'mysql-test/suite/perfschema/include/socket_summary_check.inc'
--- a/mysql-test/suite/perfschema/include/socket_summary_check.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/include/socket_summary_check.inc	2011-07-30 02:47:07 +0000
@@ -0,0 +1,240 @@
+# Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; version 2 of
+# the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+# 02110-1301  USA
+#
+
+#
+# include/socket_summary_check.inc
+#
+# Auxiliary routine to be sourced by socket_summary_by_instance_func.test
+# or other routines sourced within this script.
+#
+# Purpose
+#    Various checks for the content of the table socket_summary_by_instance.
+#
+# It is intentional that we do not try to cram as much checks as possible into
+# one single SQL statement.
+# Reasons:
+# - We check performance_schema here and NOT something like optimizer.
+# - This test should work even if some other feature has become buggy.
+# - In case some check gives unexpected results than we print the
+#   relevant content of the table and the values which we expect.
+#   In case of all checks in one statement such a printout would be too huge.
+#
+# IMPORTANT:
+#   The maximum number of rows which the table socket_summary_by_instance
+#   can keep is limited via the system variables max_socket_classes and
+#   max_socket_instances.  We are running with the default values here.
+#   They are sufficient high so that these limits cannot harm the current test.
+#   FIXME: Check at the beginning of the test that the limits are sufficient
+#          for the current test.
+#
+
+--disable_query_log
+# Insert the current state into mysqltest.my_socket_summary_by_instance.
+eval $insert_after;
+--enable_query_log
+
+
+# 1. The content of socket_summary_by_instance must be consistent to the
+#    content of socket_instances
+#-----------------------------------------------------------------------
+let $part1=
+FROM performance_schema.socket_summary_by_instance
+WHERE (EVENT_NAME,OBJECT_INSTANCE_BEGIN)
+      NOT IN (SELECT EVENT_NAME,OBJECT_INSTANCE_BEGIN
+FROM performance_schema.socket_instances);
+if(`SELECT COUNT(*) $part1`)
+{
+   --echo # There is an inconsistency between the content of the tables
+   --echo # socket_instances and socket_summary_by_instance
+   --echo #
+   eval
+   SELECT 'not in socket_instances' AS state, EVENT_NAME, OBJECT_INSTANCE_BEGIN
+   $part1;
+   --echo # abort 1
+   exit;
+}
+
+--vertical_results
+
+
+# 2. The computation of statistics must be roughly correct.
+#
+#    If we run this check sufficient frequent than AVG_TIMER_* can be removed from other checks.
+#-----------------------------------------------------------------------------------------------
+let $my_rules=
+COUNT_STAR  * AVG_TIMER_WAIT  BETWEEN SUM_TIMER_WAIT  * 0.99 AND SUM_TIMER_WAIT  * 1.01 AND
+COUNT_READ  * AVG_TIMER_READ  BETWEEN SUM_TIMER_READ  * 0.99 AND SUM_TIMER_READ  * 1.01 AND
+COUNT_WRITE * AVG_TIMER_WRITE BETWEEN SUM_TIMER_WRITE * 0.99 AND SUM_TIMER_WRITE * 1.01 AND
+COUNT_MISC  * AVG_TIMER_MISC  BETWEEN SUM_TIMER_MISC  * 0.99 AND SUM_TIMER_MISC  * 1.01;
+let $part=
+SUM_TIMER_WAIT  * 0.99, COUNT_STAR  * AVG_TIMER_WAIT,  SUM_TIMER_WAIT  * 1.01,
+SUM_TIMER_READ  * 0.99, COUNT_READ  * AVG_TIMER_READ,  SUM_TIMER_READ  * 1.01,
+SUM_TIMER_WRITE * 0.99, COUNT_WRITE * AVG_TIMER_WRITE, SUM_TIMER_WRITE * 1.01,
+SUM_TIMER_MISC  * 0.99, COUNT_MISC  * AVG_TIMER_MISC,  SUM_TIMER_MISC  * 1.01;
+
+if(`SELECT SUM($my_rules) <> COUNT(*) FROM mysqltest.my_socket_summary_by_instance
+    WHERE pk = 'After'`)
+{
+   --echo # The statistics looks suspicious.
+   --echo # We expect
+   --echo #    $my_rules
+   eval
+   SELECT EVENT_NAME, OBJECT_INSTANCE_BEGIN,
+      $part
+   FROM mysqltest.my_socket_summary_by_instance
+   WHERE pk = 'After'
+   ORDER BY EVENT_NAME, OBJECT_INSTANCE_BEGIN;
+   --echo # abort 2
+   exit;
+}
+
+
+# 3. Check the relation between AVG_*, MIN_TIMER_* and MAX_TIMER_*
+#
+#    If we run this check sufficient frequent than only the following
+#    additional checks are required:
+#    a) If (SUM_TIMER_*(new) - SUM_TIMER_*(old) < MIN_TIMER_*(old))
+#       than MIN_TIMER_*(new) = SUM_TIMER_*(new) - SUM_TIMER_*(old).
+#    b) If (SUM_TIMER_*(new) - SUM_TIMER_*(old) > MAX_TIMER_*(old))
+#       than MAX_TIMER_*(new) = SUM_TIMER_*(new) - SUM_TIMER_*(old).
+#    in order to remove MIN_TIMER_* and MAX_TIMER_* from other checks
+#    Between the states "new" and "old" must be exact one statement.
+#-----------------------------------------------------------------------------------------------
+let $my_rules=
+AVG_TIMER_WAIT  >= MIN_TIMER_WAIT  AND MAX_TIMER_WAIT  >= AVG_TIMER_WAIT  AND
+AVG_TIMER_READ  >= MIN_TIMER_READ  AND MAX_TIMER_READ  >= AVG_TIMER_READ  AND
+AVG_TIMER_WRITE >= MIN_TIMER_WRITE AND MAX_TIMER_WRITE >= AVG_TIMER_WRITE AND
+AVG_TIMER_MISC  >= MIN_TIMER_MISC  AND MAX_TIMER_MISC  >= AVG_TIMER_MISC;
+let $part=
+MIN_TIMER_WAIT,  AVG_TIMER_WAIT,  MAX_TIMER_WAIT,
+MIN_TIMER_READ,  AVG_TIMER_READ,  MAX_TIMER_READ,
+MIN_TIMER_WRITE, AVG_TIMER_WRITE, MAX_TIMER_WRITE,
+MIN_TIMER_MISC,  AVG_TIMER_MISC,  MAX_TIMER_MISC;
+
+if(`SELECT SUM($my_rules) <> COUNT(*) FROM mysqltest.my_socket_summary_by_instance
+    WHERE pk = 'After'`)
+{
+   --echo # The statistics looks suspicious.
+   --echo # We expect
+   --echo #    $my_rules
+   eval
+   SELECT EVENT_NAME, OBJECT_INSTANCE_BEGIN,
+      $part
+   FROM mysqltest.my_socket_summary_by_instance
+   WHERE pk = 'After'
+   ORDER BY EVENT_NAME, OBJECT_INSTANCE_BEGIN;
+   --echo # abort 3
+   exit;
+}
+
+
+# 4. Check the aggregate columns COUNT_STAR and SUM_TIMER_WAIT
+#
+#    The specification says:
+#    The columns COUNT_STAR, SUM/MIN/AVG/MAX TIMER_WAIT aggregates all operations.
+#
+#    If we run this check sufficient frequent than COUNT_STAR and SUM_TIMER_WAIT
+#    can be removed from other checks.
+#---------------------------------------------------------------------------------
+let $my_rules=
+COUNT_STAR     = COUNT_READ     + COUNT_WRITE     + COUNT_MISC      AND
+SUM_TIMER_WAIT = SUM_TIMER_READ + SUM_TIMER_WRITE + SUM_TIMER_MISC;
+let $part=
+COUNT_STAR, COUNT_READ + COUNT_WRITE + COUNT_MISC, COUNT_READ, COUNT_WRITE, COUNT_MISC,
+SUM_TIMER_WAIT, SUM_TIMER_READ + SUM_TIMER_WRITE + SUM_TIMER_MISC, SUM_TIMER_READ,
+SUM_TIMER_WRITE, SUM_TIMER_MISC;
+
+if(`SELECT SUM($my_rules) <> COUNT(*) FROM mysqltest.my_socket_summary_by_instance
+    WHERE pk = 'After'`)
+{
+   --echo # The statistics looks suspicious.
+   --echo # We expect
+   --echo #    $my_rules
+   --echo #
+   eval
+   SELECT EVENT_NAME, OBJECT_INSTANCE_BEGIN,
+      $part
+   FROM mysqltest.my_socket_summary_by_instance
+   WHERE pk = 'After'
+   ORDER BY EVENT_NAME, OBJECT_INSTANCE_BEGIN;
+   --echo # abort 4
+   exit;
+}
+
+
+# 5. Check the aggregate column MIN_TIMER_WAIT
+#
+#    If we run this check sufficient frequent than MIN_TIMER_WAIT
+#    can be removed from other checks.
+#---------------------------------------------------------------------------------
+let $my_rules=
+MIN_TIMER_WAIT >= mysqltest.min_of_triple(MIN_TIMER_READ,MIN_TIMER_WRITE,MIN_TIMER_MISC);
+let $part=
+MIN_TIMER_WAIT,
+mysqltest.min_of_triple(MIN_TIMER_READ, MIN_TIMER_WRITE, MIN_TIMER_MISC) AS "Min_of_Triple",
+MIN_TIMER_READ, MIN_TIMER_WRITE, MIN_TIMER_MISC;
+
+if(`SELECT SUM($my_rules) <> COUNT(*) FROM mysqltest.my_socket_summary_by_instance
+    WHERE pk = 'After'`)
+{
+   --echo # The statistics looks suspicious.
+   --echo # We expect
+   --echo #    $my_rules
+   --echo #
+   eval
+   SELECT EVENT_NAME, OBJECT_INSTANCE_BEGIN,
+      $part
+   FROM mysqltest.my_socket_summary_by_instance
+   WHERE pk = 'After'
+   ORDER BY EVENT_NAME, OBJECT_INSTANCE_BEGIN;
+   --echo # abort 5
+   exit;
+}
+
+
+# 6. Check the aggregate column MAX_TIMER_WAIT
+#
+#    If we run this check sufficient frequent than MAX_TIMER_WAIT
+#    can be removed from other checks.
+#---------------------------------------------------------------------------------
+let $my_rules=
+MAX_TIMER_WAIT >= mysqltest.max_of_triple(MAX_TIMER_READ,MAX_TIMER_WRITE,MAX_TIMER_MISC);
+let $part=
+MAX_TIMER_WAIT,
+mysqltest.max_of_triple(MAX_TIMER_READ, MAX_TIMER_WRITE, MAX_TIMER_MISC) AS "Max_of_Triple",
+MAX_TIMER_READ, MAX_TIMER_WRITE, MAX_TIMER_MISC;
+
+if(`SELECT SUM($my_rules) <> COUNT(*) FROM mysqltest.my_socket_summary_by_instance
+    WHERE pk = 'After'`)
+{
+   --echo # The statistics looks suspicious.
+   --echo # We expect
+   --echo #    $my_rules
+   --echo #
+   eval
+   SELECT EVENT_NAME, OBJECT_INSTANCE_BEGIN,
+      $part
+   FROM mysqltest.my_socket_summary_by_instance
+   WHERE pk = 'After'
+   ORDER BY EVENT_NAME, OBJECT_INSTANCE_BEGIN;
+   --echo # abort 6
+   exit;
+}
+
+--horizontal_results
+

=== added file 'mysql-test/suite/perfschema/include/wait_till_sleep.inc'
--- a/mysql-test/suite/perfschema/include/wait_till_sleep.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/include/wait_till_sleep.inc	2011-07-30 02:47:07 +0000
@@ -0,0 +1,18 @@
+# Wait till the action of the connection using the DB = 'mysqltest' or
+# 'mysqlsupertest' is finished ( Command = 'Sleep').
+let $wait_timeout= 5;
+let $wait_condition=
+SELECT COUNT(*) = 1
+FROM INFORMATION_SCHEMA.PROCESSLIST
+WHERE DB IN ('mysqltest','mysqlsupertest') AND Command = 'Sleep';
+--source include/wait_condition.inc
+if (!$success)
+{
+  --echo # Error: We did not reach the expected state where Command = 'Sleep'
+  --echo #        The current (maybe better) state is:
+  SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST
+  WHERE DB IN ('mysqltest','mysqlsupertest');
+  --echo # abort
+  exit;
+}
+

=== added file 'mysql-test/suite/perfschema/r/socket_summary_by_instance_func.result'
--- a/mysql-test/suite/perfschema/r/socket_summary_by_instance_func.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/r/socket_summary_by_instance_func.result	2011-07-30 02:47:07 +0000
@@ -0,0 +1,316 @@
+# The logging of commands and result sets is mostly disabled.
+# There are some messages which help to observe the progress of the test.
+# In case some check fails
+# - a message about this will be printed
+# - some SQL commands which show the unexpected state will be executed
+#   (logging enabled)
+# - the test might abort
+#
+# 0. Build or set prequisites
+# 1. Check the base line
+# 2. Check connect
+# 2.1 Connect fails because the user is unknown
+#     length of user name = 4 character
+#     length of default db = 9 character
+ERROR 28000: Access denied for user 'boot'@'localhost' (using password: NO)
+# 2.2 Connect fails because the user is unknown
+#     length of user name = 14 character (10 more than in 2.1)
+#     length of default db = 9 character
+ERROR 28000: Access denied for user 'boot0123456789'@'localhost' (using password: NO)
+# 2.3 Connect should pass, host = localhost
+#     length of user name  = 4 character
+#     length of default db = 9 character
+# 2.4 Connect should pass, host = localhost
+#     length of user name  = 4 character
+#     length of default db = 14 character (5 more than 2.3)
+# 3 Check SELECTs
+# 3.1 Check a SELECT ending with server sending an error message.
+#     Error message is short (unknown table).
+SELECT col2 FROM does_not_exist;
+ERROR 42S02: Table 'mysqltest.does_not_exist' doesn't exist
+# 3.2 Check a SELECT ending with server sending an error message.
+#     Error message is longer (syntax error).
+#     Now the statement is a bit longer but the error message
+#     length does again not depend on statement.
+SELECT col2 FROM does_not_exist WHERE col1 = 0;
+ERROR 42S02: Table 'mysqltest.does_not_exist' doesn't exist
+# 3.3 Check a SELECT earning an empty result set.
+SELECT col2 FROM mysqltest.my_aux WHERE col1 = 0;
+col2
+# 3.4 Check a SELECT earning an empty result set.
+#     Short column name is replaced by longer alias.
+SELECT col2 "my_lovely_col" FROM mysqltest.my_aux WHERE col1 = 0;
+my_lovely_col
+# 3.5 Check a SELECT earning one row with an empty string.
+SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1;
+col2
+
+# 3.6 Check a SELECT earning one row with one string one char long.
+SELECT col2 FROM mysqltest.my_aux WHERE col1 = 2;
+col2
+a
+# 3.7 Check a SELECT earning one row with one string 1024 char long.
+SELECT col2 FROM mysqltest.my_aux WHERE col1 = 3;
+col2
+aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa!
 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+# 4. Check delta details
+# 4.1 Check that increased COUNT_* leads to increased
+#     - increased COUNT_* leads to increased
+#       SUM_TIMER_* and SUM_NUMBER_OF_BYTES_*
+#     - no change in COUNT_* leads to no change in
+#       SUM_TIMER_* and SUM_NUMBER_OF_BYTES_*
+# 4.2 Results must be stable
+#     Everything except "client_connection" for default connection
+#     because the default connection runs include/wait_till_sleep.inc
+#     which means a varying amount of statements.
+# The statistics looks suspicious.
+# We expect
+#    COUNT(DISTINCT COUNT_READ)                = 1 AND
+COUNT(DISTINCT SUM_NUMBER_OF_BYTES_READ)  = 1 AND
+COUNT(DISTINCT COUNT_WRITE)               = 1 AND
+COUNT(DISTINCT SUM_NUMBER_OF_BYTES_WRITE) = 1 AND
+COUNT(DISTINCT COUNT_MISC)                = 1
+# for GROUP BY EVENT_NAME, statement
+SELECT EVENT_NAME, statement
+FROM mysqltest.socket_summary_by_instance_detail
+WHERE OBJECT_INSTANCE_BEGIN <> @default_object_instance_begin
+GROUP BY EVENT_NAME, statement
+HAVING (COUNT(DISTINCT COUNT_READ)                = 1 AND
+COUNT(DISTINCT SUM_NUMBER_OF_BYTES_READ)  = 1 AND
+COUNT(DISTINCT COUNT_WRITE)               = 1 AND
+COUNT(DISTINCT SUM_NUMBER_OF_BYTES_WRITE) = 1 AND
+COUNT(DISTINCT COUNT_MISC)                = 1) <> 1
+ORDER BY EVENT_NAME, statement;
+EVENT_NAME	statement
+wait/io/socket/sql/client_connection	Connect (con1,localhost,root,,mysqlsupertest,,)
+SELECT COUNT_READ,  SUM_NUMBER_OF_BYTES_READ,
+COUNT_WRITE, SUM_NUMBER_OF_BYTES_WRITE,
+COUNT_MISC,  Statement, EVENT_NAME, statement, run
+FROM mysqltest.socket_summary_by_instance_detail t1
+WHERE (EVENT_NAME, statement) IN
+(SELECT EVENT_NAME, statement FROM mysqltest.socket_summary_by_instance_detail
+WHERE OBJECT_INSTANCE_BEGIN <> @default_object_instance_begin
+GROUP BY EVENT_NAME, statement
+HAVING (COUNT(DISTINCT COUNT_READ)                = 1 AND
+COUNT(DISTINCT SUM_NUMBER_OF_BYTES_READ)  = 1 AND
+COUNT(DISTINCT COUNT_WRITE)               = 1 AND
+COUNT(DISTINCT SUM_NUMBER_OF_BYTES_WRITE) = 1 AND
+COUNT(DISTINCT COUNT_MISC)                = 1) <> 1)
+AND OBJECT_INSTANCE_BEGIN <> @default_object_instance_begin
+ORDER BY EVENT_NAME, statement, run;
+COUNT_READ	SUM_NUMBER_OF_BYTES_READ	COUNT_WRITE	SUM_NUMBER_OF_BYTES_WRITE	COUNT_MISC	Statement	EVENT_NAME	statement	run
+3	79	2	101	1	Connect (con1,localhost,root,,mysqlsupertest,,)	wait/io/socket/sql/client_connection	Connect (con1,localhost,root,,mysqlsupertest,,)	1
+3	79	2	101	1	Connect (con1,localhost,root,,mysqlsupertest,,)	wait/io/socket/sql/client_connection	Connect (con1,localhost,root,,mysqlsupertest,,)	2
+4	79	2	101	2	Connect (con1,localhost,root,,mysqlsupertest,,)	wait/io/socket/sql/client_connection	Connect (con1,localhost,root,,mysqlsupertest,,)	3
+# 4.3 Check the connects
+# 4.3.1 Failing connects with different length of user name
+#       FIXME: To be implemented after the bug fixes
+SELECT t2.COUNT_READ                - t1.COUNT_READ,
+t2.SUM_NUMBER_OF_BYTES_READ  - t1.SUM_NUMBER_OF_BYTES_READ,
+t2.COUNT_WRITE               - t1.COUNT_WRITE,
+t2.SUM_NUMBER_OF_BYTES_WRITE - t1.SUM_NUMBER_OF_BYTES_WRITE,
+t2.COUNT_MISC                - t1.COUNT_MISC, EVENT_NAME
+FROM mysqltest.socket_summary_by_instance_detail t2
+JOIN mysqltest.socket_summary_by_instance_detail t1
+USING (EVENT_NAME,run)
+WHERE t2.OBJECT_INSTANCE_BEGIN <> @default_object_instance_begin
+AND t1.OBJECT_INSTANCE_BEGIN <> @default_object_instance_begin
+AND t2.statement LIKE 'Connect%abc0123456789,%'
+  AND t1.statement LIKE 'Connect%abc,%'
+  AND run = 1;
+t2.COUNT_READ                - t1.COUNT_READ	t2.SUM_NUMBER_OF_BYTES_READ  - t1.SUM_NUMBER_OF_BYTES_READ	t2.COUNT_WRITE               - t1.COUNT_WRITE	t2.SUM_NUMBER_OF_BYTES_WRITE - t1.SUM_NUMBER_OF_BYTES_WRITE	t2.COUNT_MISC                - t1.COUNT_MISC	EVENT_NAME
+SELECT COUNT_READ,  SUM_NUMBER_OF_BYTES_READ,
+COUNT_WRITE, SUM_NUMBER_OF_BYTES_WRITE,
+COUNT_MISC,  Statement, EVENT_NAME
+FROM mysqltest.socket_summary_by_instance_detail t2
+WHERE
+t2.statement LIKE 'Connect%abc0123456789,%'
+  AND run = 1;
+COUNT_READ	SUM_NUMBER_OF_BYTES_READ	COUNT_WRITE	SUM_NUMBER_OF_BYTES_WRITE	COUNT_MISC	Statement	EVENT_NAME
+SELECT COUNT_READ,  SUM_NUMBER_OF_BYTES_READ,
+COUNT_WRITE, SUM_NUMBER_OF_BYTES_WRITE,
+COUNT_MISC,  Statement, EVENT_NAME
+FROM mysqltest.socket_summary_by_instance_detail t2
+WHERE t2.OBJECT_INSTANCE_BEGIN <> @default_object_instance_begin
+AND t2.statement LIKE 'Connect%abc0123456789,%'
+  AND run = 1;
+COUNT_READ	SUM_NUMBER_OF_BYTES_READ	COUNT_WRITE	SUM_NUMBER_OF_BYTES_WRITE	COUNT_MISC	Statement	EVENT_NAME
+SELECT COUNT_READ,  SUM_NUMBER_OF_BYTES_READ,
+COUNT_WRITE, SUM_NUMBER_OF_BYTES_WRITE,
+COUNT_MISC,  Statement, EVENT_NAME
+FROM mysqltest.socket_summary_by_instance_detail t1
+WHERE t1.OBJECT_INSTANCE_BEGIN <> @default_object_instance_begin
+AND t1.statement LIKE 'Connect%abc,%'
+  AND run = 1;
+COUNT_READ	SUM_NUMBER_OF_BYTES_READ	COUNT_WRITE	SUM_NUMBER_OF_BYTES_WRITE	COUNT_MISC	Statement	EVENT_NAME
+# 4.3.2 Failing (->2.1) vs. passing (-> 2.3) connect
+#       FIXME: To be implemented after the bug fixes
+# 4.3.3 2.3 vs. 2.4
+#       FIXME: To be implemented after the bug fixes
+# 4.4 Check the differences caused by SQL statements
+#       FIXME: To be implemented after the bug fixes
+# Dump detailed differences after - before statement execution
+# 1. The statement executing connection and hopefully noone else
+SELECT EVENT_NAME,
+COUNT_READ,  SUM_NUMBER_OF_BYTES_READ,
+COUNT_WRITE, SUM_NUMBER_OF_BYTES_WRITE,
+COUNT_MISC,  statement
+FROM mysqltest.socket_summary_by_instance_detail
+WHERE EVENT_NAME LIKE '%client_connection%'
+     AND OBJECT_INSTANCE_BEGIN <> @default_object_instance_begin
+ORDER BY statement, run;
+EVENT_NAME	COUNT_READ	SUM_NUMBER_OF_BYTES_READ	COUNT_WRITE	SUM_NUMBER_OF_BYTES_WRITE	COUNT_MISC	statement
+wait/io/socket/sql/client_connection	3	79	2	101	1	Connect (con1,localhost,root,,mysqlsupertest,,)
+wait/io/socket/sql/client_connection	3	79	2	101	1	Connect (con1,localhost,root,,mysqlsupertest,,)
+wait/io/socket/sql/client_connection	4	79	2	101	2	Connect (con1,localhost,root,,mysqlsupertest,,)
+wait/io/socket/sql/client_connection	3	74	2	101	1	Connect (con1,localhost,root,,mysqltest,,)
+wait/io/socket/sql/client_connection	3	74	2	101	1	Connect (con1,localhost,root,,mysqltest,,)
+wait/io/socket/sql/client_connection	3	74	2	101	1	Connect (con1,localhost,root,,mysqltest,,)
+wait/io/socket/sql/client_connection	3	69	1	87	1	SELECT col2 "my_lovely_col" FROM mysqltest.my_aux WHERE col1 = 0
+wait/io/socket/sql/client_connection	3	69	1	87	1	SELECT col2 "my_lovely_col" FROM mysqltest.my_aux WHERE col1 = 0
+wait/io/socket/sql/client_connection	3	69	1	87	1	SELECT col2 "my_lovely_col" FROM mysqltest.my_aux WHERE col1 = 0
+wait/io/socket/sql/client_connection	3	36	1	59	1	SELECT col2 FROM does_not_exist
+wait/io/socket/sql/client_connection	3	36	1	59	1	SELECT col2 FROM does_not_exist
+wait/io/socket/sql/client_connection	3	36	1	59	1	SELECT col2 FROM does_not_exist
+wait/io/socket/sql/client_connection	3	51	1	59	1	SELECT col2 FROM does_not_exist WHERE col1 = 0
+wait/io/socket/sql/client_connection	3	51	1	59	1	SELECT col2 FROM does_not_exist WHERE col1 = 0
+wait/io/socket/sql/client_connection	3	51	1	59	1	SELECT col2 FROM does_not_exist WHERE col1 = 0
+wait/io/socket/sql/client_connection	3	53	1	78	1	SELECT col2 FROM mysqltest.my_aux WHERE col1 = 0
+wait/io/socket/sql/client_connection	3	53	1	78	1	SELECT col2 FROM mysqltest.my_aux WHERE col1 = 0
+wait/io/socket/sql/client_connection	3	53	1	78	1	SELECT col2 FROM mysqltest.my_aux WHERE col1 = 0
+wait/io/socket/sql/client_connection	3	53	1	83	1	SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1
+wait/io/socket/sql/client_connection	3	53	1	83	1	SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1
+wait/io/socket/sql/client_connection	3	53	1	83	1	SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1
+wait/io/socket/sql/client_connection	3	53	1	84	1	SELECT col2 FROM mysqltest.my_aux WHERE col1 = 2
+wait/io/socket/sql/client_connection	3	53	1	84	1	SELECT col2 FROM mysqltest.my_aux WHERE col1 = 2
+wait/io/socket/sql/client_connection	3	53	1	84	1	SELECT col2 FROM mysqltest.my_aux WHERE col1 = 2
+wait/io/socket/sql/client_connection	3	53	1	1109	1	SELECT col2 FROM mysqltest.my_aux WHERE col1 = 3
+wait/io/socket/sql/client_connection	3	53	1	1109	1	SELECT col2 FROM mysqltest.my_aux WHERE col1 = 3
+wait/io/socket/sql/client_connection	3	53	1	1109	1	SELECT col2 FROM mysqltest.my_aux WHERE col1 = 3
+# 2. The connection default
+SELECT EVENT_NAME,
+COUNT_READ,  SUM_NUMBER_OF_BYTES_READ,
+COUNT_WRITE, SUM_NUMBER_OF_BYTES_WRITE,
+COUNT_MISC,  statement
+FROM mysqltest.socket_summary_by_instance_detail
+WHERE OBJECT_INSTANCE_BEGIN = @default_object_instance_begin
+ORDER BY statement,run;
+EVENT_NAME	COUNT_READ	SUM_NUMBER_OF_BYTES_READ	COUNT_WRITE	SUM_NUMBER_OF_BYTES_WRITE	COUNT_MISC	statement
+wait/io/socket/sql/client_connection	3	124	1	50	1	Connect (con1,localhost,boot,,mysqltest,,)
+wait/io/socket/sql/client_connection	3	124	1	50	1	Connect (con1,localhost,boot,,mysqltest,,)
+wait/io/socket/sql/client_connection	3	124	1	50	1	Connect (con1,localhost,boot,,mysqltest,,)
+wait/io/socket/sql/client_connection	3	124	1	50	1	Connect (con1,localhost,boot0123456789,,mysqltest,,)
+wait/io/socket/sql/client_connection	3	124	1	50	1	Connect (con1,localhost,boot0123456789,,mysqltest,,)
+wait/io/socket/sql/client_connection	3	124	1	50	1	Connect (con1,localhost,boot0123456789,,mysqltest,,)
+wait/io/socket/sql/client_connection	7	267	3	179	1	Connect (con1,localhost,root,,mysqlsupertest,,)
+wait/io/socket/sql/client_connection	7	267	3	179	1	Connect (con1,localhost,root,,mysqlsupertest,,)
+wait/io/socket/sql/client_connection	7	267	3	179	1	Connect (con1,localhost,root,,mysqlsupertest,,)
+wait/io/socket/sql/client_connection	7	267	3	179	1	Connect (con1,localhost,root,,mysqltest,,)
+wait/io/socket/sql/client_connection	7	267	3	179	1	Connect (con1,localhost,root,,mysqltest,,)
+wait/io/socket/sql/client_connection	7	267	3	179	1	Connect (con1,localhost,root,,mysqltest,,)
+wait/io/socket/sql/client_connection	7	267	3	179	1	SELECT col2 "my_lovely_col" FROM mysqltest.my_aux WHERE col1 = 0
+wait/io/socket/sql/client_connection	7	267	3	179	1	SELECT col2 "my_lovely_col" FROM mysqltest.my_aux WHERE col1 = 0
+wait/io/socket/sql/client_connection	7	267	3	179	1	SELECT col2 "my_lovely_col" FROM mysqltest.my_aux WHERE col1 = 0
+wait/io/socket/sql/client_connection	7	267	3	179	1	SELECT col2 FROM does_not_exist
+wait/io/socket/sql/client_connection	7	267	3	179	1	SELECT col2 FROM does_not_exist
+wait/io/socket/sql/client_connection	7	267	3	179	1	SELECT col2 FROM does_not_exist
+wait/io/socket/sql/client_connection	7	267	3	179	1	SELECT col2 FROM does_not_exist WHERE col1 = 0
+wait/io/socket/sql/client_connection	7	267	3	179	1	SELECT col2 FROM does_not_exist WHERE col1 = 0
+wait/io/socket/sql/client_connection	7	267	3	179	1	SELECT col2 FROM does_not_exist WHERE col1 = 0
+wait/io/socket/sql/client_connection	7	267	3	179	1	SELECT col2 FROM mysqltest.my_aux WHERE col1 = 0
+wait/io/socket/sql/client_connection	7	267	3	179	1	SELECT col2 FROM mysqltest.my_aux WHERE col1 = 0
+wait/io/socket/sql/client_connection	7	267	3	179	1	SELECT col2 FROM mysqltest.my_aux WHERE col1 = 0
+wait/io/socket/sql/client_connection	7	267	3	179	1	SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1
+wait/io/socket/sql/client_connection	7	267	3	179	1	SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1
+wait/io/socket/sql/client_connection	7	267	3	179	1	SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1
+wait/io/socket/sql/client_connection	7	267	3	179	1	SELECT col2 FROM mysqltest.my_aux WHERE col1 = 2
+wait/io/socket/sql/client_connection	7	267	3	179	1	SELECT col2 FROM mysqltest.my_aux WHERE col1 = 2
+wait/io/socket/sql/client_connection	7	267	3	179	1	SELECT col2 FROM mysqltest.my_aux WHERE col1 = 2
+wait/io/socket/sql/client_connection	8	267	3	179	2	SELECT col2 FROM mysqltest.my_aux WHERE col1 = 3
+wait/io/socket/sql/client_connection	7	267	3	179	1	SELECT col2 FROM mysqltest.my_aux WHERE col1 = 3
+wait/io/socket/sql/client_connection	7	267	3	179	1	SELECT col2 FROM mysqltest.my_aux WHERE col1 = 3
+# 3. The "server_unix_socket"
+SELECT EVENT_NAME,
+COUNT_READ,  SUM_NUMBER_OF_BYTES_READ,
+COUNT_WRITE, SUM_NUMBER_OF_BYTES_WRITE,
+COUNT_MISC,  statement
+FROM mysqltest.socket_summary_by_instance_detail
+WHERE EVENT_NAME LIKE '%server_unix_socket%'
+   ORDER BY statement,run;
+EVENT_NAME	COUNT_READ	SUM_NUMBER_OF_BYTES_READ	COUNT_WRITE	SUM_NUMBER_OF_BYTES_WRITE	COUNT_MISC	statement
+wait/io/socket/sql/server_unix_socket	0	0	0	0	1	Connect (con1,localhost,boot,,mysqltest,,)
+wait/io/socket/sql/server_unix_socket	0	0	0	0	1	Connect (con1,localhost,boot,,mysqltest,,)
+wait/io/socket/sql/server_unix_socket	0	0	0	0	1	Connect (con1,localhost,boot,,mysqltest,,)
+wait/io/socket/sql/server_unix_socket	0	0	0	0	1	Connect (con1,localhost,boot0123456789,,mysqltest,,)
+wait/io/socket/sql/server_unix_socket	0	0	0	0	1	Connect (con1,localhost,boot0123456789,,mysqltest,,)
+wait/io/socket/sql/server_unix_socket	0	0	0	0	1	Connect (con1,localhost,boot0123456789,,mysqltest,,)
+wait/io/socket/sql/server_unix_socket	0	0	0	0	1	Connect (con1,localhost,root,,mysqlsupertest,,)
+wait/io/socket/sql/server_unix_socket	0	0	0	0	1	Connect (con1,localhost,root,,mysqlsupertest,,)
+wait/io/socket/sql/server_unix_socket	0	0	0	0	1	Connect (con1,localhost,root,,mysqlsupertest,,)
+wait/io/socket/sql/server_unix_socket	0	0	0	0	1	Connect (con1,localhost,root,,mysqltest,,)
+wait/io/socket/sql/server_unix_socket	0	0	0	0	1	Connect (con1,localhost,root,,mysqltest,,)
+wait/io/socket/sql/server_unix_socket	0	0	0	0	1	Connect (con1,localhost,root,,mysqltest,,)
+wait/io/socket/sql/server_unix_socket	0	0	0	0	0	SELECT col2 "my_lovely_col" FROM mysqltest.my_aux WHERE col1 = 0
+wait/io/socket/sql/server_unix_socket	0	0	0	0	0	SELECT col2 "my_lovely_col" FROM mysqltest.my_aux WHERE col1 = 0
+wait/io/socket/sql/server_unix_socket	0	0	0	0	0	SELECT col2 "my_lovely_col" FROM mysqltest.my_aux WHERE col1 = 0
+wait/io/socket/sql/server_unix_socket	0	0	0	0	0	SELECT col2 FROM does_not_exist
+wait/io/socket/sql/server_unix_socket	0	0	0	0	0	SELECT col2 FROM does_not_exist
+wait/io/socket/sql/server_unix_socket	0	0	0	0	0	SELECT col2 FROM does_not_exist
+wait/io/socket/sql/server_unix_socket	0	0	0	0	0	SELECT col2 FROM does_not_exist WHERE col1 = 0
+wait/io/socket/sql/server_unix_socket	0	0	0	0	0	SELECT col2 FROM does_not_exist WHERE col1 = 0
+wait/io/socket/sql/server_unix_socket	0	0	0	0	0	SELECT col2 FROM does_not_exist WHERE col1 = 0
+wait/io/socket/sql/server_unix_socket	0	0	0	0	0	SELECT col2 FROM mysqltest.my_aux WHERE col1 = 0
+wait/io/socket/sql/server_unix_socket	0	0	0	0	0	SELECT col2 FROM mysqltest.my_aux WHERE col1 = 0
+wait/io/socket/sql/server_unix_socket	0	0	0	0	0	SELECT col2 FROM mysqltest.my_aux WHERE col1 = 0
+wait/io/socket/sql/server_unix_socket	0	0	0	0	0	SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1
+wait/io/socket/sql/server_unix_socket	0	0	0	0	0	SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1
+wait/io/socket/sql/server_unix_socket	0	0	0	0	0	SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1
+wait/io/socket/sql/server_unix_socket	0	0	0	0	0	SELECT col2 FROM mysqltest.my_aux WHERE col1 = 2
+wait/io/socket/sql/server_unix_socket	0	0	0	0	0	SELECT col2 FROM mysqltest.my_aux WHERE col1 = 2
+wait/io/socket/sql/server_unix_socket	0	0	0	0	0	SELECT col2 FROM mysqltest.my_aux WHERE col1 = 2
+wait/io/socket/sql/server_unix_socket	0	0	0	0	0	SELECT col2 FROM mysqltest.my_aux WHERE col1 = 3
+wait/io/socket/sql/server_unix_socket	0	0	0	0	0	SELECT col2 FROM mysqltest.my_aux WHERE col1 = 3
+wait/io/socket/sql/server_unix_socket	0	0	0	0	0	SELECT col2 FROM mysqltest.my_aux WHERE col1 = 3
+# 4. The "server_tcpip_socket"
+SELECT EVENT_NAME,
+COUNT_READ,  SUM_NUMBER_OF_BYTES_READ,
+COUNT_WRITE, SUM_NUMBER_OF_BYTES_WRITE,
+COUNT_MISC,  statement
+FROM mysqltest.socket_summary_by_instance_detail
+WHERE EVENT_NAME LIKE '%server_tcpip_socket%'
+   ORDER BY statement,run;
+EVENT_NAME	COUNT_READ	SUM_NUMBER_OF_BYTES_READ	COUNT_WRITE	SUM_NUMBER_OF_BYTES_WRITE	COUNT_MISC	statement
+wait/io/socket/sql/server_tcpip_socket	0	0	0	0	0	Connect (con1,localhost,boot,,mysqltest,,)
+wait/io/socket/sql/server_tcpip_socket	0	0	0	0	0	Connect (con1,localhost,boot,,mysqltest,,)
+wait/io/socket/sql/server_tcpip_socket	0	0	0	0	0	Connect (con1,localhost,boot,,mysqltest,,)
+wait/io/socket/sql/server_tcpip_socket	0	0	0	0	0	Connect (con1,localhost,boot0123456789,,mysqltest,,)
+wait/io/socket/sql/server_tcpip_socket	0	0	0	0	0	Connect (con1,localhost,boot0123456789,,mysqltest,,)
+wait/io/socket/sql/server_tcpip_socket	0	0	0	0	0	Connect (con1,localhost,boot0123456789,,mysqltest,,)
+wait/io/socket/sql/server_tcpip_socket	0	0	0	0	0	Connect (con1,localhost,root,,mysqlsupertest,,)
+wait/io/socket/sql/server_tcpip_socket	0	0	0	0	0	Connect (con1,localhost,root,,mysqlsupertest,,)
+wait/io/socket/sql/server_tcpip_socket	0	0	0	0	0	Connect (con1,localhost,root,,mysqlsupertest,,)
+wait/io/socket/sql/server_tcpip_socket	0	0	0	0	0	Connect (con1,localhost,root,,mysqltest,,)
+wait/io/socket/sql/server_tcpip_socket	0	0	0	0	0	Connect (con1,localhost,root,,mysqltest,,)
+wait/io/socket/sql/server_tcpip_socket	0	0	0	0	0	Connect (con1,localhost,root,,mysqltest,,)
+wait/io/socket/sql/server_tcpip_socket	0	0	0	0	0	SELECT col2 "my_lovely_col" FROM mysqltest.my_aux WHERE col1 = 0
+wait/io/socket/sql/server_tcpip_socket	0	0	0	0	0	SELECT col2 "my_lovely_col" FROM mysqltest.my_aux WHERE col1 = 0
+wait/io/socket/sql/server_tcpip_socket	0	0	0	0	0	SELECT col2 "my_lovely_col" FROM mysqltest.my_aux WHERE col1 = 0
+wait/io/socket/sql/server_tcpip_socket	0	0	0	0	0	SELECT col2 FROM does_not_exist
+wait/io/socket/sql/server_tcpip_socket	0	0	0	0	0	SELECT col2 FROM does_not_exist
+wait/io/socket/sql/server_tcpip_socket	0	0	0	0	0	SELECT col2 FROM does_not_exist
+wait/io/socket/sql/server_tcpip_socket	0	0	0	0	0	SELECT col2 FROM does_not_exist WHERE col1 = 0
+wait/io/socket/sql/server_tcpip_socket	0	0	0	0	0	SELECT col2 FROM does_not_exist WHERE col1 = 0
+wait/io/socket/sql/server_tcpip_socket	0	0	0	0	0	SELECT col2 FROM does_not_exist WHERE col1 = 0
+wait/io/socket/sql/server_tcpip_socket	0	0	0	0	0	SELECT col2 FROM mysqltest.my_aux WHERE col1 = 0
+wait/io/socket/sql/server_tcpip_socket	0	0	0	0	0	SELECT col2 FROM mysqltest.my_aux WHERE col1 = 0
+wait/io/socket/sql/server_tcpip_socket	0	0	0	0	0	SELECT col2 FROM mysqltest.my_aux WHERE col1 = 0
+wait/io/socket/sql/server_tcpip_socket	0	0	0	0	0	SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1
+wait/io/socket/sql/server_tcpip_socket	0	0	0	0	0	SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1
+wait/io/socket/sql/server_tcpip_socket	0	0	0	0	0	SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1
+wait/io/socket/sql/server_tcpip_socket	0	0	0	0	0	SELECT col2 FROM mysqltest.my_aux WHERE col1 = 2
+wait/io/socket/sql/server_tcpip_socket	0	0	0	0	0	SELECT col2 FROM mysqltest.my_aux WHERE col1 = 2
+wait/io/socket/sql/server_tcpip_socket	0	0	0	0	0	SELECT col2 FROM mysqltest.my_aux WHERE col1 = 2
+wait/io/socket/sql/server_tcpip_socket	0	0	0	0	0	SELECT col2 FROM mysqltest.my_aux WHERE col1 = 3
+wait/io/socket/sql/server_tcpip_socket	0	0	0	0	0	SELECT col2 FROM mysqltest.my_aux WHERE col1 = 3
+wait/io/socket/sql/server_tcpip_socket	0	0	0	0	0	SELECT col2 FROM mysqltest.my_aux WHERE col1 = 3
+# 5. Cleanup

=== added file 'mysql-test/suite/perfschema/t/socket_summary_by_instance_func.test'
--- a/mysql-test/suite/perfschema/t/socket_summary_by_instance_func.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/t/socket_summary_by_instance_func.test	2011-07-30 02:47:07 +0000
@@ -0,0 +1,568 @@
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; version 2 of
+# the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+# 02110-1301  USA
+#
+# Some functional checks for the content of the performance_schema table
+#    socket_summary_by_instance
+#
+# Created: mleich 2011-07-01
+#
+
+--source include/not_embedded.inc
+
+#===================================
+# Set IP address defaults with respect to IPV6 support
+#
+# Set this to enable debugging output
+let $my_socket_debug=0;
+#
+# Determine if IPV6 supported
+#
+let $check_ipv6_just_check=1;
+--source include/check_ipv6.inc
+#
+# Determine if IPV4 mapped to IPV6 supported
+#
+let $check_ipv4_mapped_just_check=1;
+--source include/check_ipv4_mapped.inc
+#
+# Set the localhost IP default to use when establishing connections
+let $my_localhost=127.0.0.1;
+if($check_ipv6_supported)
+{
+  let $my_localhost=::1;
+}
+if($check_ipv4_mapped_supported)
+{
+  let $my_localhost=::ffff:127.0.0.1;
+}
+#
+let $my_socket_debug=0;
+if($my_socket_debug)
+{
+  --echo IPV6=$check_ipv6_supported, IPV4_MAPPED=$check_ipv4_mapped_supported, LOCALHOST=$my_localhost
+}
+#===================================
+
+--echo # The logging of commands and result sets is mostly disabled.
+--echo # There are some messages which help to observe the progress of the test.
+--echo # In case some check fails
+--echo # - a message about this will be printed
+--echo # - some SQL commands which show the unexpected state will be executed
+--echo #   (logging enabled)
+--echo # - the test might abort
+--echo #
+
+--disable_query_log
+
+--echo # 0. Build or set prequisites
+#===================================
+# Set $print_details to 1 in case you want that the exact diffs caused
+# by the execution of a statement get printed.
+# Disadvantage of printing details:
+#    Even minor legimitate changes of the client - server communication can
+#    cause that the test needs maintenance.
+# Advantage:
+#    More thorough checks.
+let $print_details= 1;
+#
+# Number of attempts within the test checking the stability of counter increments.
+let $loop_rounds= 3;
+#
+# Additional SCHEMA used for
+# - detection of our "worker" session within the PROCESSLIST.
+#   No other connection should use this schema as default schema.
+# - easy cleanup because auxiliary objects are stored there
+CREATE SCHEMA mysqltest;
+CREATE SCHEMA mysqlsupertest;
+#
+# Auxiliary tables for storing current values at certain points of time.
+# We store states of performance_schema.socket_summary_by_instance here
+# in order
+# - to have initial values from before some action
+# - to minimize the impact of statements used for the checks on results.
+# CREATE TEMPORARY TABLE my_socket_summary_by_instance AS
+# would be nice but the optimizer does not support important statements.
+CREATE TABLE mysqltest.my_socket_summary_by_instance AS
+SELECT *, 'Pseudo_Before' AS pk FROM performance_schema.socket_summary_by_instance
+WHERE 1 = 0;
+CREATE TABLE mysqltest.socket_summary_by_instance_detail AS
+SELECT EVENT_NAME,OBJECT_INSTANCE_BEGIN,
+       COUNT_READ, SUM_TIMER_READ, SUM_NUMBER_OF_BYTES_READ,
+       COUNT_WRITE,SUM_TIMER_WRITE,SUM_NUMBER_OF_BYTES_WRITE,
+       COUNT_MISC, SUM_TIMER_MISC
+FROM performance_schema.socket_summary_by_instance
+WHERE 1 = 2;
+ALTER TABLE mysqltest.socket_summary_by_instance_detail
+ADD statement VARCHAR(300), ADD run INTEGER;
+#
+# Auxiliary SQL functions used to shorten some commands.
+CREATE FUNCTION mysqltest.min_of_triple
+   (f1 BIGINT UNSIGNED, f2 BIGINT UNSIGNED, f3 BIGINT UNSIGNED)
+   RETURNS BIGINT UNSIGNED
+   RETURN IF(IF(f1 < f2,f1,f2) < f3,IF(f1 < f2,f1,f2), f3);
+CREATE FUNCTION mysqltest.max_of_triple
+   (f1 BIGINT UNSIGNED, f2 BIGINT UNSIGNED, f3 BIGINT UNSIGNED)
+   RETURNS BIGINT UNSIGNED
+   RETURN IF(IF(f1 > f2,f1,f2) > f3,IF(f1 > f2,f1,f2), f3);
+#
+# Auxiliary table for experiments with SELECTs earning different result sets.
+CREATE TABLE mysqltest.my_aux (col1 INTEGER, col2 VARCHAR(1024), PRIMARY KEY(col1));
+INSERT INTO mysqltest.my_aux SET col1 = 1, col2 = REPEAT('a',0);
+INSERT INTO mysqltest.my_aux SET col1 = 2, col2 = REPEAT('a',1);
+INSERT INTO mysqltest.my_aux SET col1 = 3, col2 = REPEAT('a',1024);
+#
+# Auxiliary mysqltest variables used to shorten commands and to ensure
+# that we run all time the right operation.
+let $truncate=
+TRUNCATE TABLE mysqltest.my_socket_summary_by_instance;
+#
+let $insert_before=
+INSERT INTO mysqltest.my_socket_summary_by_instance
+SELECT *,'Before' FROM performance_schema.socket_summary_by_instance;
+#
+let $insert_after=
+INSERT INTO mysqltest.my_socket_summary_by_instance
+SELECT *,'After' FROM performance_schema.socket_summary_by_instance;
+#
+let $insert_pseudo_before=
+INSERT INTO mysqltest.my_socket_summary_by_instance
+(EVENT_NAME, OBJECT_INSTANCE_BEGIN,
+COUNT_STAR, SUM_TIMER_WAIT, MIN_TIMER_WAIT, AVG_TIMER_WAIT, MAX_TIMER_WAIT,
+COUNT_READ, SUM_TIMER_READ, MIN_TIMER_READ, AVG_TIMER_READ, MAX_TIMER_READ,
+SUM_NUMBER_OF_BYTES_READ,
+COUNT_WRITE, SUM_TIMER_WRITE, MIN_TIMER_WRITE, AVG_TIMER_WRITE, MAX_TIMER_WRITE,
+SUM_NUMBER_OF_BYTES_WRITE,
+COUNT_MISC, SUM_TIMER_MISC, MIN_TIMER_MISC, AVG_TIMER_MISC, MAX_TIMER_MISC,
+pk)
+SELECT EVENT_NAME, OBJECT_INSTANCE_BEGIN,
+0, 0, 0, 0, 0,
+0, 0, 0, 0, 0,
+0,
+0, 0, 0, 0, 0,
+0,
+0, 0, 0, 0, 0,
+'Pseudo_Before'
+FROM mysqltest.my_socket_summary_by_instance t1
+WHERE OBJECT_INSTANCE_BEGIN NOT IN
+      (SELECT OBJECT_INSTANCE_BEGIN
+       FROM mysqltest.my_socket_summary_by_instance t2
+       WHERE pk = 'Before');
+#
+let $insert_delta=
+INSERT INTO mysqltest.socket_summary_by_instance_detail
+      (EVENT_NAME,OBJECT_INSTANCE_BEGIN,
+       COUNT_READ, SUM_TIMER_READ, SUM_NUMBER_OF_BYTES_READ,
+       COUNT_WRITE,SUM_TIMER_WRITE,SUM_NUMBER_OF_BYTES_WRITE,
+       COUNT_MISC, SUM_TIMER_MISC, statement,run)
+SELECT EVENT_NAME,OBJECT_INSTANCE_BEGIN,
+       t1.COUNT_READ                - t2.COUNT_READ,
+       t1.SUM_TIMER_READ            - t2.SUM_TIMER_READ,
+       t1.SUM_NUMBER_OF_BYTES_READ  - t2.SUM_NUMBER_OF_BYTES_READ,
+       t1.COUNT_WRITE               - t2.COUNT_WRITE,
+       t1.SUM_TIMER_WRITE           - t2.SUM_TIMER_WRITE,
+       t1.SUM_NUMBER_OF_BYTES_WRITE - t2.SUM_NUMBER_OF_BYTES_WRITE,
+       t1.COUNT_MISC                - t2.COUNT_MISC,
+       t1.SUM_TIMER_MISC            - t2.SUM_TIMER_MISC,
+       NULL,NULL
+FROM mysqltest.my_socket_summary_by_instance t1
+JOIN mysqltest.my_socket_summary_by_instance t2
+USING (EVENT_NAME,OBJECT_INSTANCE_BEGIN)
+WHERE t1.pk = 'After' AND t2.pk LIKE '%Before';
+#
+let $get_object_instance_begin=
+SELECT OBJECT_INSTANCE_BEGIN INTO @con1_object_instance_begin
+FROM performance_schema.socket_summary_by_instance AS t1
+WHERE (EVENT_NAME,OBJECT_INSTANCE_BEGIN)
+      NOT IN (SELECT EVENT_NAME,OBJECT_INSTANCE_BEGIN
+              FROM mysqltest.my_socket_summary_by_instance AS t2
+              WHERE pk = 'Before');
+#
+let $column_list=
+COUNT_READ,  SUM_TIMER_READ,  SUM_NUMBER_OF_BYTES_READ,
+COUNT_WRITE, SUM_TIMER_WRITE, SUM_NUMBER_OF_BYTES_WRITE,
+COUNT_MISC,  SUM_TIMER_MISC,  Statement;
+let $counter_column_list=
+COUNT_READ,  SUM_NUMBER_OF_BYTES_READ,
+COUNT_WRITE, SUM_NUMBER_OF_BYTES_WRITE,
+COUNT_MISC,  Statement;
+
+# Determine OBJECT_INSTANCE_BEGIN of the connection default
+# which acts as the observer
+eval $truncate;
+eval $insert_before;
+--disconnect default
+--connect (default,localhost,root,,,,)
+eval $insert_after;
+eval $get_object_instance_begin;
+SET @default_object_instance_begin = @con1_object_instance_begin;
+
+--echo # 1. Check the base line
+#==============================
+--source ../include/socket_summary_check.inc
+
+--disable_query_log
+--disable_query_log
+
+--echo # 2. Check connect
+let $is_connect= 1;
+--echo # 2.1 Connect fails because the user is unknown
+--echo #     length of user name = 4 character
+--echo #     length of default db = 9 character
+#========================================================================
+let $connect_host= localhost;
+let $connect_db= mysqltest;
+let $connect_user= boot;
+--source ../include/socket_event.inc
+
+--echo # 2.2 Connect fails because the user is unknown
+--echo #     length of user name = 14 character (10 more than in 2.1)
+--echo #     length of default db = 9 character
+#========================================================================
+let $connect_host= localhost;
+let $connect_db= mysqltest;
+let $connect_user= boot0123456789;
+--source ../include/socket_event.inc
+
+--echo # 2.3 Connect should pass, host = localhost
+--echo #     length of user name  = 4 character
+--echo #     length of default db = 9 character
+#========================================================================
+let $connect_host= localhost;
+let $connect_db= mysqltest;
+let $connect_user= root;
+--source ../include/socket_event.inc
+
+--echo # 2.4 Connect should pass, host = localhost
+--echo #     length of user name  = 4 character
+--echo #     length of default db = 14 character (5 more than 2.3)
+#========================================================================
+let $connect_host= localhost;
+let $connect_db= mysqlsupertest;
+let $connect_user= root;
+--source ../include/socket_event.inc
+
+--connect (con1,$my_localhost,root,,mysqltest,,)
+--connection default
+--source ../include/wait_till_sleep.inc
+--disable_query_log
+
+--echo # 3 Check SELECTs
+let $is_connect= 0;
+eval $get_object_instance_begin;
+--echo # 3.1 Check a SELECT ending with server sending an error message.
+--echo #     Error message is short (unknown table).
+#========================================================================
+let $statement= SELECT col2 FROM does_not_exist;
+--source ../include/socket_event.inc
+
+--echo # 3.2 Check a SELECT ending with server sending an error message.
+--echo #     Error message is longer (syntax error).
+--echo #     Now the statement is a bit longer but the error message
+--echo #     length does again not depend on statement.
+#=======================================================================
+let $statement= SELECT col2 FROM does_not_exist WHERE col1 = 0;
+--source ../include/socket_event.inc
+
+--echo # 3.3 Check a SELECT earning an empty result set.
+#=======================================================
+let $statement= SELECT col2 FROM mysqltest.my_aux WHERE col1 = 0;
+--source ../include/socket_event.inc
+
+--echo # 3.4 Check a SELECT earning an empty result set.
+--echo #     Short column name is replaced by longer alias.
+#==========================================================
+let $statement= SELECT col2 "my_lovely_col" FROM mysqltest.my_aux WHERE col1 = 0;
+--source ../include/socket_event.inc
+
+--echo # 3.5 Check a SELECT earning one row with an empty string.
+#================================================================
+let $statement= SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1;
+--source ../include/socket_event.inc
+
+--echo # 3.6 Check a SELECT earning one row with one string one char long.
+#=========================================================================
+let $statement= SELECT col2 FROM mysqltest.my_aux WHERE col1 = 2;
+--source ../include/socket_event.inc
+
+--echo # 3.7 Check a SELECT earning one row with one string 1024 char long.
+#==========================================================================
+let $statement= SELECT col2 FROM mysqltest.my_aux WHERE col1 = 3;
+--source ../include/socket_event.inc
+
+--echo # 4. Check delta details
+#==========================================================================
+# 4.0 0. Negative deltas cannot have happened because the counter columns within
+#        socket_summary_by_instance_detail are defined as UNSIGNED BIGINT.
+#        = The INSERT would have been failed.
+--echo # 4.1 Check that increased COUNT_* leads to increased
+--echo #     - increased COUNT_* leads to increased
+--echo #       SUM_TIMER_* and SUM_NUMBER_OF_BYTES_*
+--echo #     - no change in COUNT_* leads to no change in
+--echo #       SUM_TIMER_* and SUM_NUMBER_OF_BYTES_*
+let $my_rules=
+((COUNT_READ = 0 AND SUM_TIMER_READ = 0 AND SUM_NUMBER_OF_BYTES_READ = 0)
+  OR
+ (COUNT_READ > 0 AND SUM_TIMER_READ > 0 AND SUM_NUMBER_OF_BYTES_READ > 0))
+AND
+((COUNT_WRITE = 0 AND SUM_TIMER_WRITE = 0 AND SUM_NUMBER_OF_BYTES_WRITE = 0)
+  OR
+ (COUNT_WRITE > 0 AND SUM_TIMER_WRITE > 0 AND SUM_NUMBER_OF_BYTES_WRITE > 0))
+AND
+((COUNT_MISC = 0 AND SUM_TIMER_MISC = 0)
+  OR
+ (COUNT_MISC > 0 AND SUM_TIMER_MISC > 0));
+if(`SELECT COUNT(*) FROM mysqltest.socket_summary_by_instance_detail
+    WHERE NOT ( $my_rules )`)
+{
+   --enable_query_log
+   --enable_result_log
+   --echo # The statistics looks suspicious.
+   --echo # We expect
+   --echo #    $my_rules
+   --echo #
+   eval
+   SELECT *
+   FROM mysqltest.socket_summary_by_instance_detail
+   ORDER BY EVENT_NAME, OBJECT_INSTANCE_BEGIN;
+}
+--echo # 4.2 Results must be stable
+--echo #     Everything except "client_connection" for default connection
+--echo #     because the default connection runs include/wait_till_sleep.inc
+--echo #     which means a varying amount of statements.
+#==========================================================================
+# This check might fail after the bug fixes
+# Enable the following lines for debugging the check
+# UPDATE mysqltest.socket_summary_by_instance_detail
+# SET COUNT_READ = 13
+# WHERE statement LIKE 'Connect%abc%'
+#   AND OBJECT_INSTANCE_BEGIN <> @default_object_instance_begin
+# LIMIT 1;
+# UPDATE mysqltest.socket_summary_by_instance_detail
+# SET COUNT_WRITE = 13
+# WHERE statement LIKE '%WHERE col1 = 3'
+#   AND OBJECT_INSTANCE_BEGIN <> @default_object_instance_begin
+#   AND EVENT_NAME LIKE '%client_connection'
+# LIMIT 1;
+let $my_rules=
+COUNT(DISTINCT COUNT_READ)                = 1 AND
+COUNT(DISTINCT SUM_NUMBER_OF_BYTES_READ)  = 1 AND
+COUNT(DISTINCT COUNT_WRITE)               = 1 AND
+COUNT(DISTINCT SUM_NUMBER_OF_BYTES_WRITE) = 1 AND
+COUNT(DISTINCT COUNT_MISC)                = 1;
+let $part=
+FROM mysqltest.socket_summary_by_instance_detail
+WHERE OBJECT_INSTANCE_BEGIN <> @default_object_instance_begin
+GROUP BY EVENT_NAME, statement
+HAVING ($my_rules) <> 1;
+if(`SELECT COUNT(statement) $part`)
+{
+   --enable_query_log
+   --enable_result_log
+   --echo # The statistics looks suspicious.
+   --echo # We expect
+   --echo #    $my_rules
+   --echo # for GROUP BY EVENT_NAME, statement
+   eval
+   SELECT EVENT_NAME, statement
+   $part
+   ORDER BY EVENT_NAME, statement;
+   eval
+   SELECT $counter_column_list, EVENT_NAME, statement, run
+   FROM mysqltest.socket_summary_by_instance_detail t1
+   WHERE (EVENT_NAME, statement) IN
+         (SELECT EVENT_NAME, statement $part)
+     AND OBJECT_INSTANCE_BEGIN <> @default_object_instance_begin
+   ORDER BY EVENT_NAME, statement, run;
+}
+
+--echo # 4.3 Check the connects
+--echo # 4.3.1 Failing connects with different length of user name
+--echo #       FIXME: To be implemented after the bug fixes
+#            --> t2.statement LIKE 'Connect%abc0123456789,%'
+#            --> t1.statement LIKE 'Connect%abc,%'
+# The difference in user name length must somewhere show up.
+if(1)
+{
+# There is no client_connection entry for a connect which fails.
+let $my_val=
+t2.COUNT_READ                - t1.COUNT_READ,
+t2.SUM_NUMBER_OF_BYTES_READ  - t1.SUM_NUMBER_OF_BYTES_READ,
+t2.COUNT_WRITE               - t1.COUNT_WRITE,
+t2.SUM_NUMBER_OF_BYTES_WRITE - t1.SUM_NUMBER_OF_BYTES_WRITE,
+t2.COUNT_MISC                - t1.COUNT_MISC;
+
+eval
+SELECT $my_val, EVENT_NAME
+FROM mysqltest.socket_summary_by_instance_detail t2
+JOIN mysqltest.socket_summary_by_instance_detail t1
+USING (EVENT_NAME,run)
+WHERE t2.OBJECT_INSTANCE_BEGIN <> @default_object_instance_begin
+  AND t1.OBJECT_INSTANCE_BEGIN <> @default_object_instance_begin
+  AND t2.statement LIKE 'Connect%abc0123456789,%'
+  AND t1.statement LIKE 'Connect%abc,%'
+  AND run = 1;
+eval
+SELECT $counter_column_list, EVENT_NAME
+FROM mysqltest.socket_summary_by_instance_detail t2
+WHERE
+      t2.statement LIKE 'Connect%abc0123456789,%'
+  AND run = 1;
+eval
+SELECT $counter_column_list, EVENT_NAME
+FROM mysqltest.socket_summary_by_instance_detail t2
+WHERE t2.OBJECT_INSTANCE_BEGIN <> @default_object_instance_begin
+  AND t2.statement LIKE 'Connect%abc0123456789,%'
+  AND run = 1;
+eval
+SELECT $counter_column_list, EVENT_NAME
+FROM mysqltest.socket_summary_by_instance_detail t1
+WHERE t1.OBJECT_INSTANCE_BEGIN <> @default_object_instance_begin
+  AND t1.statement LIKE 'Connect%abc,%'
+  AND run = 1;
+}
+
+--echo # 4.3.2 Failing (->2.1) vs. passing (-> 2.3) connect
+--echo #       FIXME: To be implemented after the bug fixes
+# The difference in fail/pass must somewhere show up.
+#==========================================================================
+
+--echo # 4.3.3 2.3 vs. 2.4
+--echo #       FIXME: To be implemented after the bug fixes
+# The difference in schema name length must somewhere show up.
+#==========================================================================
+
+
+
+--echo # 4.4 Check the differences caused by SQL statements
+#            --> Statement NOT LIKE '%Connect%'
+--echo #       FIXME: To be implemented after the bug fixes
+
+# General architecture for checking stuff:
+#
+# let $my_rules=
+# COUNT_READ                = 0                AND
+# SUM_TIMER_READ            = 0                AND
+# SUM_NUMBER_OF_BYTES_READ  = 0                AND
+# COUNT_WRITE               BETWEEN 1 AND 3    AND
+# SUM_TIMER_WRITE           > 0                AND
+# SUM_NUMBER_OF_BYTES_WRITE BETWEEN 1 AND 1000 AND
+# COUNT_MISC                = 0                AND
+# SUM_TIMER_MISC            = 0;
+#
+# let $part=
+# FROM mysqltest.socket_summary_by_instance_detail
+# WHERE OBJECT_INSTANCE_BEGIN <> @default_object_instance_begin
+# GROUP BY EVENT_NAME, statement
+# HAVING ($my_rules) <> 1;
+#
+# if(`Check if something is wrong, use $my_rules and $part here`)
+# {
+#   --enable_query_log
+#   --enable_result_log
+#   --echo # The statistics looks suspicious.
+#   --echo # We expect
+#   --echo #    $my_rules
+#   eval
+#   SELECT ..... <use $part here>
+# }
+#
+# Rough idea for "Rules" for $my_rules:
+# 1. Do not go with too exact values for the diffs between the diffs
+#
+#    n = exact value measured today
+#
+#    COUNT_READ in mysqltest.socket_summary_by_instance_detail
+#    means rather costs,
+#    difference between COUNT_READ after and before execution od connect/SQL
+#
+#    diffdiff means differences in costs between two operations.
+#    Example: First operation = SELECT with length of column alias name = 1 Byte
+#             Second operation = Same SELECT but with length of column alias name = 11 Byte
+#
+#    Generous for SUM_TIMER_*
+#    -> SUM_TIMER_READ = 0
+#    -> SUM_TIMER_READ > 0
+#
+#    Fair strict for COUNT_*
+#    -> COUNT_READ = 0
+#    -> COUNT_READ BETWEEN Minimum of(0.9 * n, n - 2)
+#                      AND Maximum_of(1.1 * n, n + 2)
+#    -> diffdiffs often = 0
+#
+#    More strict for SUM_NUMBER_OF_BYTES_READ
+#    -> SUM_NUMBER_OF_BYTES_READ = 0
+#    -> SUM_NUMBER_OF_BYTES_READ BETWEEN Minimum of(0.9 * n, n - 2)
+#                      AND Maximum_of(1.1 * n, n + 2)
+#    -> SUM_NUMBER_OF_BYTES_READ BETWEEN Minimum of(0.9 * n, n - 2)
+#    -> diffdiffs = ~ diff in lenght of SQL command or diff in
+#                     length of result set
+#
+
+if($print_details)
+{
+   --enable_query_log
+   --enable_result_log
+   --horizontal_results
+   --echo # Dump detailed differences after - before statement execution
+   --echo # 1. The statement executing connection and hopefully noone else
+   SELECT EVENT_NAME,
+          COUNT_READ,  SUM_NUMBER_OF_BYTES_READ,
+          COUNT_WRITE, SUM_NUMBER_OF_BYTES_WRITE,
+          COUNT_MISC,  statement
+   FROM mysqltest.socket_summary_by_instance_detail
+   WHERE EVENT_NAME LIKE '%client_connection%'
+     AND OBJECT_INSTANCE_BEGIN <> @default_object_instance_begin
+   ORDER BY statement, run;
+   --echo # 2. The connection default
+   SELECT EVENT_NAME,
+          COUNT_READ,  SUM_NUMBER_OF_BYTES_READ,
+          COUNT_WRITE, SUM_NUMBER_OF_BYTES_WRITE,
+          COUNT_MISC,  statement
+   FROM mysqltest.socket_summary_by_instance_detail
+   WHERE OBJECT_INSTANCE_BEGIN = @default_object_instance_begin
+   ORDER BY statement,run;
+   --echo # 3. The "server_unix_socket"
+   # WHERE OBJECT_INSTANCE_BEGIN = @con1_object_instance_begin
+   SELECT EVENT_NAME,
+          COUNT_READ,  SUM_NUMBER_OF_BYTES_READ,
+          COUNT_WRITE, SUM_NUMBER_OF_BYTES_WRITE,
+          COUNT_MISC,  statement
+   FROM mysqltest.socket_summary_by_instance_detail
+   WHERE EVENT_NAME LIKE '%server_unix_socket%'
+   ORDER BY statement,run;
+   --echo # 4. The "server_tcpip_socket"
+   SELECT EVENT_NAME,
+          COUNT_READ,  SUM_NUMBER_OF_BYTES_READ,
+          COUNT_WRITE, SUM_NUMBER_OF_BYTES_WRITE,
+          COUNT_MISC,  statement
+   FROM mysqltest.socket_summary_by_instance_detail
+   WHERE EVENT_NAME LIKE '%server_tcpip_socket%'
+   ORDER BY statement,run;
+}
+
+--echo # 5. Cleanup
+#==================
+# Cleanup
+--disable_query_log
+DROP SCHEMA mysqltest;
+DROP SCHEMA mysqlsupertest;
+--connection con1
+--disconnect con1
+--source include/wait_until_disconnected.inc
+--connection default
+--enable_query_log
+

=== modified file 'storage/perfschema/pfs.cc' (properties changed: -x to +x)
--- a/storage/perfschema/pfs.cc	2011-07-26 00:39:25 +0000
+++ b/storage/perfschema/pfs.cc	2011-07-30 02:47:07 +0000
@@ -4670,8 +4670,23 @@ static void end_socket_wait_v1(PSI_socke
   }
   else
   {
-    /* Aggregate to the socket instrument (event count and byte count) */
-    byte_stat->aggregate_counted(bytes);
+    /*
+	   A state of IDLE means that this is a recv() following an idle period.
+	   The division of the wait time between the idle period and the actual
+	   recv() is unknown, so the entire wait time will later be assigned to the
+	   global IDLE class. However, incrementing the recv() operation count
+	   without assigning any wait time will throw off the stats, so we fudge a
+	   little and assign the current min wait as a best guess.
+	*/
+	if (socket_idle)
+	{
+      byte_stat->aggregate(byte_stat->m_min, bytes);
+	}
+    else
+	{
+      /* Aggregate to the socket instrument (event count and byte count) */
+	  byte_stat->aggregate_counted(bytes);
+	}
   }
 
   /** Global thread aggregation */

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (chris.powers:3337 to 3338) WL#4896Christopher Powers3 Aug