List:Commits« Previous MessageNext Message »
From:Christopher Powers Date:August 15 2011 6:32am
Subject:bzr push into mysql-trunk branch (chris.powers:3365 to 3367)
View as plain text  
 3367 Christopher Powers	2011-08-15
      Remove Windows debug code

    modified:
      storage/perfschema/pfs.cc
 3366 Christopher Powers	2011-08-15
      WL#4896 "Performance Schema Net IO"
      
      Fixed bug where sockets with disabled thread instrumentation were not removed from
      socket_instances after being disconnected.
      
      Updates from ML for socket_summary_by_instance.

    removed:
      mysql-test/collections/mysql-trunk-wl4896.push
    added:
      mysql-test/suite/perfschema/include/socket_check1.inc
    modified:
      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/disabled.def
      mysql-test/suite/perfschema/t/socket_summary_by_instance_func.test
      storage/perfschema/pfs.cc
 3365 Christopher Powers	2011-08-14
      WL#4896 "Performance Schema Net IO"
      
      Isolated regression test

    added:
      mysql-test/collections/mysql-trunk-wl4896.push
      mysql-test/suite/perfschema/include/socket_event_dbg.inc
      mysql-test/suite/perfschema/include/socket_summary_check_dbg.inc
      mysql-test/suite/perfschema/r/socket_summary_by_instance_func_dbg.result
      mysql-test/suite/perfschema/t/socket_summary_by_instance_func_dbg.test
    modified:
      mysql-test/suite/perfschema/t/disabled.def
      mysql-test/suite/perfschema/t/socket_summary_by_instance_func.test
=== removed file 'mysql-test/collections/mysql-trunk-wl4896.push'
--- a/mysql-test/collections/mysql-trunk-wl4896.push	2011-08-15 01:05:55 +0000
+++ b/mysql-test/collections/mysql-trunk-wl4896.push	1970-01-01 00:00:00 +0000
@@ -1,2 +0,0 @@
-perl mysql-test-run.pl --timer --force --parallel=auto --comment=n_mix --vardir=var-n_mix --mysqld=--binlog-format=mixed --skip-ndb --suite=perfschema socket_summary_by_instance_func_dbg.test
-

=== added file 'mysql-test/suite/perfschema/include/socket_check1.inc'
--- a/mysql-test/suite/perfschema/include/socket_check1.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/include/socket_check1.inc	2011-08-15 06:26:10 +0000
@@ -0,0 +1,117 @@
+# Example how to use this auxiliary script
+#-----------------------------------------
+#
+### The table/tables used in $part must have the right content.
+### $title_prefix is used for the generation of titles
+#
+# let $title_prefix= 4.3;
+### $check_num is used for the generation of titles and gets incremented after
+### every call of the current script.
+# let $check_num= 1;
+### $column_list is used for the generation of error information and valid for
+### every sub test.
+# let $column_list=
+# t2.COUNT_READ - t1.COUNT_READ AS D_COUNT_READ,
+# t2.COUNT_READ                 AS S2_COUNT_READ,
+# t1.COUNT_READ                 AS S1_COUNT_READ,
+# t2.SUM_NUMBER_OF_BYTES_READ - t1.SUM_NUMBER_OF_BYTES_READ AS D_SUM_NUMBER_OF_BYTES_READ,
+# t2.SUM_NUMBER_OF_BYTES_READ                               AS S2_SUM_NUMBER_OF_BYTES_READ,
+# t1.SUM_NUMBER_OF_BYTES_READ                               AS S1_SUM_NUMBER_OF_BYTES_READ,
+# t2.COUNT_WRITE - t1.COUNT_WRITE AS D_COUNT_WRITE,
+# t2.COUNT_WRITE                  AS S2_COUNT_WRITE,
+# t1.COUNT_WRITE                  AS S1_COUNT_WRITE,
+# t2.SUM_NUMBER_OF_BYTES_WRITE - t1.SUM_NUMBER_OF_BYTES_WRITE AS D_UM_NUMBER_OF_BYTES_WRITE,
+# t2.SUM_NUMBER_OF_BYTES_WRITE                                AS S2_SUM_NUMBER_OF_BYTES_WRITE,
+# t1.SUM_NUMBER_OF_BYTES_WRITE                                AS S1_SUM_NUMBER_OF_BYTES_WRITE,
+# t2.COUNT_MISC - t1.COUNT_MISC AS D_COUNT_MISC,
+# t2.COUNT_MISC                 AS S2_COUNT_MISC,
+# t1.COUNT_MISC                 AS S1_COUNT_MISC;
+### $part is used for the generation of "check" statements + error information
+### and valid for every sub test.
+# let $part=
+# FROM mysqltest.socket_summary_by_instance_detail t1
+# JOIN mysqltest.socket_summary_by_instance_detail t2
+# USING (EVENT_NAME, OBJECT_INSTANCE_BEGIN, run)
+# WHERE OBJECT_INSTANCE_BEGIN <> @default_object_instance_begin
+#   AND EVENT_NAME LIKE ('%client_connection')
+#   AND run = 1;
+#
+# --echo # $title_prefix Check the differences caused by SQL statement
+#
+# let stmt1= SELECT col2 FROM does_not_exist;
+# let stmt2= SELECT col2 FROM does_not_exist WHERE col1 = 0;
+# let $my_rules=
+# t2.COUNT_READ                - t1.COUNT_READ                = 0  AND
+# t2.SUM_NUMBER_OF_BYTES_READ  - t1.SUM_NUMBER_OF_BYTES_READ  = LENGTH('$stmt2') - LENGTH('$stmt1') AND
+# t2.COUNT_WRITE               - t1.COUNT_WRITE               = 0  AND
+# t2.SUM_NUMBER_OF_BYTES_WRITE - t1.SUM_NUMBER_OF_BYTES_WRITE = 0  AND
+# t2.COUNT_MISC                - t1.COUNT_MISC                = 0;
+# --source ../include/socket_check1.inc
+#
+# let stmt1= ....
+# let stmt2= ....
+# let $my_rules= ...
+# --source ../include/socket_check1.inc
+#
+# ...
+#
+
+--echo # $title_prefix.$check_num Compare impact of statements
+--echo #       $stmt2
+--echo #       $stmt1
+
+# MLML: Disable this later
+if (`SELECT CONCAT("$stmt1","$stmt2","$my_rules") LIKE '%_not_set%'`)
+{
+   --echo # INTERNAL ERROR:
+   --echo # At least one of the variables has no value (is like '%_not_set')
+   --echo # stmt1 : $stmt1
+   --echo # stmt2 : $stmt2
+   --echo # my_rules : $my_rules
+   --echo # Sorry, have to abort
+   exit;
+}
+
+if(`SELECT ($my_rules) <> 1
+    $part
+    AND t2.statement = '$stmt2' AND t1.statement = '$stmt1'`)
+{
+   --disable_abort_on_error
+   --enable_query_log
+   --enable_result_log
+   --echo # The compared statistics looks suspicious
+   --echo # We expect
+   --echo $my_rules
+   --echo
+   --horizontal_results
+   eval
+   SELECT $my_rules AS Expect_1
+   $part
+   AND t2.statement = '$stmt2' AND t1.statement = '$stmt1';
+   --echo
+   --vertical_results
+   eval
+   SELECT $column_list
+   $part
+   AND t1.statement = '$stmt1' AND t2.statement = '$stmt2';
+   --echo
+   --horizontal_results
+
+   eval
+   SELECT LPAD(COUNT_READ, 8, ' ') AS CNT_READ, LPAD(SUM_NUMBER_OF_BYTES_READ,  10,' ') AS BYTES_READ,
+          LPAD(COUNT_WRITE,9, ' ') AS CNT_WRITE,LPAD(SUM_NUMBER_OF_BYTES_WRITE, 11,' ') AS BYTES_WRITE,
+          LPAD(COUNT_MISC, 8, ' ') AS CNT_MISC, statement
+   FROM mysqltest.socket_summary_by_instance_detail
+   WHERE OBJECT_INSTANCE_BEGIN <> @default_object_instance_begin
+     AND EVENT_NAME LIKE ('%client_connection')
+     AND run = 1
+     AND statement IN('$stmt2','$stmt1');
+}
+# Initialize all variables which depend on the statements to be checked.
+# This prevents that we run with wrong data.
+let $stmt1=    stmt1_not_set;
+let $stmt2=    stmt2_not_set;
+let $my_rules= my_rules_not_set;
+inc $check_num;
+
+

=== modified file 'mysql-test/suite/perfschema/include/socket_event.inc'
--- a/mysql-test/suite/perfschema/include/socket_event.inc	2011-07-30 02:47:07 +0000
+++ b/mysql-test/suite/perfschema/include/socket_event.inc	2011-08-15 06:26:10 +0000
@@ -80,12 +80,28 @@ if(!$is_connect)
 # changes to the statistics of the additional connection after this point of time.
 #=================================================================================
 --connection default
-if($my_errno)
+# Variants:
+#----------
+# 1. Connect failed ($my_errno <> 0) 
+#    no entry in performance_schema.threads -> wait_till_sleep.inc cannot be used
+#    Just 3 seconds sleep
+# 2. Connect with success ($my_errno = 0) 
+#    entry in performance_schema.threads -> wait_till_sleep.inc can be used
+#    Additional 3 second sleep
+# 3. SQL command failed ($my_errno <> 0)
+#    entry in performance_schema.threads -> wait_till_sleep.inc can be used
+if($is_connect)
 {
-   # Wait a bit and hope that the counter maintenence is finished.
-   --sleep 3
+   if(!$my_errno)
+   {
+      --source ../include/wait_till_sleep.inc
+   }
+   if($my_errno)
+   {
+      --sleep 6
+   }
 }
-if(!$my_errno)
+if(!$is_connect)
 {
    --source ../include/wait_till_sleep.inc
 }
@@ -119,13 +135,29 @@ WHERE run IS NULL;
 
 if($is_connect)
 {
+   # Only in case the connect was successful ($my_errno = 0) than we have to disconnect.
    if(!$my_errno)
    {
-      --connection con1
       --disconnect con1
-      --source include/wait_until_disconnected.inc
-      --connection default
+      # Wait till the connection using the DB = 'mysqltest' or
+      # 'mysqlsupertest' has disappeared
+      let $wait_timeout= 5;
+      let $wait_condition=
+      SELECT COUNT(*) = 0
+      FROM performance_schema.threads
+      WHERE processlist_db IN ('mysqltest','mysqlsupertest');
+      --source include/wait_condition.inc
+      if (!$success)
+      {
+         --echo # Error: The disconnect of the connection with processlist_db
+         --echo #        IN ('mysqltest','mysqlsupertest') failed
+         SELECT * FROM performance_schema.threads
+         WHERE processlist_db IN ('mysqltest','mysqlsupertest');
+         --echo # abort
+         exit;
+      }
    }
+   --sleep 3
 }
 inc $loop_round;
 

=== modified file 'mysql-test/suite/perfschema/include/socket_summary_check.inc'
--- a/mysql-test/suite/perfschema/include/socket_summary_check.inc	2011-08-09 23:42:16 +0000
+++ b/mysql-test/suite/perfschema/include/socket_summary_check.inc	2011-08-15 06:26:10 +0000
@@ -47,6 +47,7 @@
 # Insert the current state into mysqltest.my_socket_summary_by_instance.
 eval $insert_after;
 --enable_query_log
+--enable_result_log
 
 
 # 1. The content of socket_summary_by_instance must be consistent to the
@@ -76,8 +77,8 @@ if(`SELECT COUNT(*) $part1`)
 #
 #    If we run this check sufficient frequent than AVG_TIMER_* can be removed from other checks.
 #-----------------------------------------------------------------------------------------------
-let $my_lo= 0.99;
-let $my_hi= 1.01;
+let $my_lo= 0.98;
+let $my_hi= 1.02;
 
 let $my_rules=
 COUNT_STAR  * AVG_TIMER_WAIT  BETWEEN SUM_TIMER_WAIT  * $my_lo AND SUM_TIMER_WAIT  * $my_hi AND
@@ -101,16 +102,18 @@ if(`SELECT SUM($my_rules) <> COUNT(*) FR
    SELECT EVENT_NAME, OBJECT_INSTANCE_BEGIN,
       $part
    FROM mysqltest.my_socket_summary_by_instance
-   WHERE pk = 'After'
+   WHERE pk = 'After' AND NOT ($my_rules)
    ORDER BY EVENT_NAME, OBJECT_INSTANCE_BEGIN;
 
-   -- echo # Debug 2a: Dump socket_summary_by_instance
+   --echo # Debug 2a: Dump socket_summary_by_instance
    eval
    SELECT EVENT_NAME, OBJECT_INSTANCE_BEGIN,
       $part
    FROM performance_schema.socket_summary_by_instance
    ORDER BY EVENT_NAME, OBJECT_INSTANCE_BEGIN;
    --echo # abort 2
+   # MLML? SHOW STATUS LIKE 'Performance_schema_socket_%_lost';
+   SHOW STATUS LIKE 'Performance_schema_%_lost';
 #  exit;
 }
 
@@ -148,8 +151,9 @@ if(`SELECT SUM($my_rules) <> COUNT(*) FR
    SELECT EVENT_NAME, OBJECT_INSTANCE_BEGIN,
       $part
    FROM mysqltest.my_socket_summary_by_instance
-   WHERE pk = 'After'
+   WHERE pk = 'After' AND NOT ($my_rules)
    ORDER BY EVENT_NAME, OBJECT_INSTANCE_BEGIN;
+   
    --echo # abort 3
 #  exit;
 }

=== modified file 'mysql-test/suite/perfschema/include/wait_till_sleep.inc'
--- a/mysql-test/suite/perfschema/include/wait_till_sleep.inc	2011-07-30 02:47:07 +0000
+++ b/mysql-test/suite/perfschema/include/wait_till_sleep.inc	2011-08-15 06:26:10 +0000
@@ -3,16 +3,16 @@
 let $wait_timeout= 5;
 let $wait_condition=
 SELECT COUNT(*) = 1
-FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE DB IN ('mysqltest','mysqlsupertest') AND Command = 'Sleep';
+FROM performance_schema.threads
+WHERE processlist_db IN ('mysqltest','mysqlsupertest')
+  AND processlist_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;
+   --echo # Error: We did not reach the expected state where processlist_command = 'Sleep'
+   SELECT * FROM performance_schema.threads
+   WHERE processlist_db IN ('mysqltest','mysqlsupertest');
+   --echo # abort
+   exit;
 }
 

=== modified file 'mysql-test/suite/perfschema/r/socket_summary_by_instance_func.result'
--- a/mysql-test/suite/perfschema/r/socket_summary_by_instance_func.result	2011-08-11 00:12:28 +0000
+++ b/mysql-test/suite/perfschema/r/socket_summary_by_instance_func.result	2011-08-15 06:26:10 +0000
@@ -39,32 +39,63 @@ DROP USER 'root0123456789'@'localhost';
 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.
+# 3.3 Check a SELECT ending with server sending an error message.
+#     The statement has the same length like in 3.2 but the error
+#     message is now different and much longer.
+SELECT col2 FROM does_not_exist WHERE col1 A 0;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'A 0' at line 1
+# 3.4 Check a SELECT ending with server sending an error message.
+#     Statement and error message are a bit longer than in 3.1
+#     because the table name is longer.
+SELECT col2 FROM does_not_exist0123;
+ERROR 42S02: Table 'mysqltest.does_not_exist0123' doesn't exist
+# 3.5 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.
+# 3.6 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;
+SELECT col2 AS 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.
+# 3.7 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.
+# 3.8 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.
+# 3.9 Check a SELECT earning one row with one string 1024 char long.
 SELECT col2 FROM mysqltest.my_aux WHERE col1 = 3;
 col2
 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa!
 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+# 3.10 Check a SELECT earning two rows with an empty string
+SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1
+UNION ALL
+SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1;
+col2
+
+
+SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1
+UNION DISTINCT
+SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1;
+col2
+
+SELECT col2 FROM mysqltest.my_aux WHERE col1 = 3
+UNION ALL
+SELECT col2 FROM mysqltest.my_aux WHERE col1 = 3;
+col2
+aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa!
 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa!
 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+SELECT col2 FROM mysqltest.my_aux WHERE col1 < 3;
+col2
+
+a
 # 4. Check delta details
-# 4.1 Check that increased COUNT_* leads to increased
+# 4.1 Check that
 #     - increased COUNT_* leads to increased
 #       SUM_TIMER_* and SUM_NUMBER_OF_BYTES_*
 #     - no change in COUNT_* leads to no change in
@@ -73,12 +104,295 @@ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 #     Everything except "client_connection" for default connection
 #     because the default connection runs include/wait_till_sleep.inc
 #     which means a varying amount of statements.
-# 4.3 Check the connects
-# 4.3.1 Successful connects with different length of user 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
-# 5. Cleanup
+# 4.3 Check the differences caused by SQL statements
+# 4.3.1 Compare impact of statements
+#       SELECT col2 FROM does_not_exist WHERE col1 = 0
+#       SELECT col2 FROM does_not_exist
+# 4.3.2 Compare impact of statements
+#       SELECT col2 FROM does_not_exist WHERE col1 A 0
+#       SELECT col2 FROM does_not_exist WHERE col1 = 0
+# 4.3.3 Compare impact of statements
+#       SELECT col2 FROM does_not_exist0123
+#       SELECT col2 FROM does_not_exist
+# 4.3.4 Compare impact of statements
+#       SELECT col2 AS my_lovely_col FROM mysqltest.my_aux WHERE col1 = 0
+#       SELECT col2 FROM mysqltest.my_aux WHERE col1 = 0
+# 4.3.5 Compare impact of statements
+#       SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1
+#       SELECT col2 FROM mysqltest.my_aux WHERE col1 = 0
+# 4.3.6 Compare impact of statements
+#       SELECT col2 FROM mysqltest.my_aux WHERE col1 = 2
+#       SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1
+# 4.3.7 Compare impact of statements
+#       SELECT col2 FROM mysqltest.my_aux WHERE col1 = 3
+#       SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1
+# 4.3.8 Compare impact of statements
+#       SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1
+UNION ALL
+SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1
+#       SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1
+# The compared statistics looks suspicious
+# We expect
+0
+
+SELECT 0 AS Expect_1
+FROM mysqltest.socket_summary_by_instance_detail t1
+JOIN mysqltest.socket_summary_by_instance_detail t2
+USING (EVENT_NAME, OBJECT_INSTANCE_BEGIN, run)
+WHERE OBJECT_INSTANCE_BEGIN <> @default_object_instance_begin
+AND EVENT_NAME LIKE ('%client_connection')
+AND run = 1
+AND t2.statement = 'SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1
+UNION ALL
+SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1' AND t1.statement = 'SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1';
+Expect_1
+0
+
+SELECT t2.COUNT_READ - t1.COUNT_READ AS D_COUNT_READ,
+t2.COUNT_READ                 AS S2_COUNT_READ,
+t1.COUNT_READ                 AS S1_COUNT_READ,
+t2.SUM_NUMBER_OF_BYTES_READ - t1.SUM_NUMBER_OF_BYTES_READ AS D_SUM_NUMBER_OF_BYTES_READ,
+t2.SUM_NUMBER_OF_BYTES_READ                               AS S2_SUM_NUMBER_OF_BYTES_READ,
+t1.SUM_NUMBER_OF_BYTES_READ                               AS S1_SUM_NUMBER_OF_BYTES_READ,
+t2.COUNT_WRITE - t1.COUNT_WRITE AS D_COUNT_WRITE,
+t2.COUNT_WRITE                  AS S2_COUNT_WRITE,
+t1.COUNT_WRITE                  AS S1_COUNT_WRITE,
+t2.SUM_NUMBER_OF_BYTES_WRITE - t1.SUM_NUMBER_OF_BYTES_WRITE AS D_UM_NUMBER_OF_BYTES_WRITE,
+t2.SUM_NUMBER_OF_BYTES_WRITE                                AS S2_SUM_NUMBER_OF_BYTES_WRITE,
+t1.SUM_NUMBER_OF_BYTES_WRITE                                AS S1_SUM_NUMBER_OF_BYTES_WRITE,
+t2.COUNT_MISC - t1.COUNT_MISC AS D_COUNT_MISC,
+t2.COUNT_MISC                 AS S2_COUNT_MISC,
+t1.COUNT_MISC                 AS S1_COUNT_MISC
+FROM mysqltest.socket_summary_by_instance_detail t1
+JOIN mysqltest.socket_summary_by_instance_detail t2
+USING (EVENT_NAME, OBJECT_INSTANCE_BEGIN, run)
+WHERE OBJECT_INSTANCE_BEGIN <> @default_object_instance_begin
+AND EVENT_NAME LIKE ('%client_connection')
+AND run = 1
+AND t1.statement = 'SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1' AND t2.statement = 'SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1
+UNION ALL
+SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1';
+ERROR 22003: BIGINT UNSIGNED value is out of range in '(`mysqltest`.`t2`.`SUM_NUMBER_OF_BYTES_WRITE` - `mysqltest`.`t1`.`SUM_NUMBER_OF_BYTES_WRITE`)'
+
+SELECT LPAD(COUNT_READ, 8, ' ') AS CNT_READ, LPAD(SUM_NUMBER_OF_BYTES_READ,  10,' ') AS BYTES_READ,
+LPAD(COUNT_WRITE,9, ' ') AS CNT_WRITE,LPAD(SUM_NUMBER_OF_BYTES_WRITE, 11,' ') AS BYTES_WRITE,
+LPAD(COUNT_MISC, 8, ' ') AS CNT_MISC, statement
+FROM mysqltest.socket_summary_by_instance_detail
+WHERE OBJECT_INSTANCE_BEGIN <> @default_object_instance_begin
+AND EVENT_NAME LIKE ('%client_connection')
+AND run = 1
+AND statement IN('SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1
+UNION ALL
+SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1','SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1');
+CNT_READ	BYTES_READ	CNT_WRITE	BYTES_WRITE	CNT_MISC	statement
+       2	        53	        1	         83	       2	SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1
+       2	       112	        1	         67	       2	SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1
+UNION ALL
+SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1
+# 4.3.9 Compare impact of statements
+#       SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1
+UNION DISTINCT
+SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1
+#       SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1
+# The compared statistics looks suspicious
+# We expect
+0
+
+SELECT 0 AS Expect_1
+FROM mysqltest.socket_summary_by_instance_detail t1
+JOIN mysqltest.socket_summary_by_instance_detail t2
+USING (EVENT_NAME, OBJECT_INSTANCE_BEGIN, run)
+WHERE OBJECT_INSTANCE_BEGIN <> @default_object_instance_begin
+AND EVENT_NAME LIKE ('%client_connection')
+AND run = 1
+AND t2.statement = 'SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1
+UNION DISTINCT
+SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1' AND t1.statement = 'SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1';
+Expect_1
+0
+
+SELECT t2.COUNT_READ - t1.COUNT_READ AS D_COUNT_READ,
+t2.COUNT_READ                 AS S2_COUNT_READ,
+t1.COUNT_READ                 AS S1_COUNT_READ,
+t2.SUM_NUMBER_OF_BYTES_READ - t1.SUM_NUMBER_OF_BYTES_READ AS D_SUM_NUMBER_OF_BYTES_READ,
+t2.SUM_NUMBER_OF_BYTES_READ                               AS S2_SUM_NUMBER_OF_BYTES_READ,
+t1.SUM_NUMBER_OF_BYTES_READ                               AS S1_SUM_NUMBER_OF_BYTES_READ,
+t2.COUNT_WRITE - t1.COUNT_WRITE AS D_COUNT_WRITE,
+t2.COUNT_WRITE                  AS S2_COUNT_WRITE,
+t1.COUNT_WRITE                  AS S1_COUNT_WRITE,
+t2.SUM_NUMBER_OF_BYTES_WRITE - t1.SUM_NUMBER_OF_BYTES_WRITE AS D_UM_NUMBER_OF_BYTES_WRITE,
+t2.SUM_NUMBER_OF_BYTES_WRITE                                AS S2_SUM_NUMBER_OF_BYTES_WRITE,
+t1.SUM_NUMBER_OF_BYTES_WRITE                                AS S1_SUM_NUMBER_OF_BYTES_WRITE,
+t2.COUNT_MISC - t1.COUNT_MISC AS D_COUNT_MISC,
+t2.COUNT_MISC                 AS S2_COUNT_MISC,
+t1.COUNT_MISC                 AS S1_COUNT_MISC
+FROM mysqltest.socket_summary_by_instance_detail t1
+JOIN mysqltest.socket_summary_by_instance_detail t2
+USING (EVENT_NAME, OBJECT_INSTANCE_BEGIN, run)
+WHERE OBJECT_INSTANCE_BEGIN <> @default_object_instance_begin
+AND EVENT_NAME LIKE ('%client_connection')
+AND run = 1
+AND t1.statement = 'SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1' AND t2.statement = 'SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1
+UNION DISTINCT
+SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1';
+ERROR 22003: BIGINT UNSIGNED value is out of range in '(`mysqltest`.`t2`.`SUM_NUMBER_OF_BYTES_WRITE` - `mysqltest`.`t1`.`SUM_NUMBER_OF_BYTES_WRITE`)'
+
+SELECT LPAD(COUNT_READ, 8, ' ') AS CNT_READ, LPAD(SUM_NUMBER_OF_BYTES_READ,  10,' ') AS BYTES_READ,
+LPAD(COUNT_WRITE,9, ' ') AS CNT_WRITE,LPAD(SUM_NUMBER_OF_BYTES_WRITE, 11,' ') AS BYTES_WRITE,
+LPAD(COUNT_MISC, 8, ' ') AS CNT_MISC, statement
+FROM mysqltest.socket_summary_by_instance_detail
+WHERE OBJECT_INSTANCE_BEGIN <> @default_object_instance_begin
+AND EVENT_NAME LIKE ('%client_connection')
+AND run = 1
+AND statement IN('SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1
+UNION DISTINCT
+SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1','SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1');
+CNT_READ	BYTES_READ	CNT_WRITE	BYTES_WRITE	CNT_MISC	statement
+       2	        53	        1	         83	       2	SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1
+       2	       117	        1	         62	       2	SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1
+UNION DISTINCT
+SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1
+# 4.3.10 Compare impact of statements
+#       SELECT col2 FROM mysqltest.my_aux WHERE col1 = 3
+UNION ALL
+SELECT col2 FROM mysqltest.my_aux WHERE col1 = 3
+#       SELECT col2 FROM mysqltest.my_aux WHERE col1 = 3
+# The compared statistics looks suspicious
+# We expect
+0
+
+SELECT 0 AS Expect_1
+FROM mysqltest.socket_summary_by_instance_detail t1
+JOIN mysqltest.socket_summary_by_instance_detail t2
+USING (EVENT_NAME, OBJECT_INSTANCE_BEGIN, run)
+WHERE OBJECT_INSTANCE_BEGIN <> @default_object_instance_begin
+AND EVENT_NAME LIKE ('%client_connection')
+AND run = 1
+AND t2.statement = 'SELECT col2 FROM mysqltest.my_aux WHERE col1 = 3
+UNION ALL
+SELECT col2 FROM mysqltest.my_aux WHERE col1 = 3' AND t1.statement = 'SELECT col2 FROM mysqltest.my_aux WHERE col1 = 3';
+Expect_1
+0
+
+SELECT t2.COUNT_READ - t1.COUNT_READ AS D_COUNT_READ,
+t2.COUNT_READ                 AS S2_COUNT_READ,
+t1.COUNT_READ                 AS S1_COUNT_READ,
+t2.SUM_NUMBER_OF_BYTES_READ - t1.SUM_NUMBER_OF_BYTES_READ AS D_SUM_NUMBER_OF_BYTES_READ,
+t2.SUM_NUMBER_OF_BYTES_READ                               AS S2_SUM_NUMBER_OF_BYTES_READ,
+t1.SUM_NUMBER_OF_BYTES_READ                               AS S1_SUM_NUMBER_OF_BYTES_READ,
+t2.COUNT_WRITE - t1.COUNT_WRITE AS D_COUNT_WRITE,
+t2.COUNT_WRITE                  AS S2_COUNT_WRITE,
+t1.COUNT_WRITE                  AS S1_COUNT_WRITE,
+t2.SUM_NUMBER_OF_BYTES_WRITE - t1.SUM_NUMBER_OF_BYTES_WRITE AS D_UM_NUMBER_OF_BYTES_WRITE,
+t2.SUM_NUMBER_OF_BYTES_WRITE                                AS S2_SUM_NUMBER_OF_BYTES_WRITE,
+t1.SUM_NUMBER_OF_BYTES_WRITE                                AS S1_SUM_NUMBER_OF_BYTES_WRITE,
+t2.COUNT_MISC - t1.COUNT_MISC AS D_COUNT_MISC,
+t2.COUNT_MISC                 AS S2_COUNT_MISC,
+t1.COUNT_MISC                 AS S1_COUNT_MISC
+FROM mysqltest.socket_summary_by_instance_detail t1
+JOIN mysqltest.socket_summary_by_instance_detail t2
+USING (EVENT_NAME, OBJECT_INSTANCE_BEGIN, run)
+WHERE OBJECT_INSTANCE_BEGIN <> @default_object_instance_begin
+AND EVENT_NAME LIKE ('%client_connection')
+AND run = 1
+AND t1.statement = 'SELECT col2 FROM mysqltest.my_aux WHERE col1 = 3' AND t2.statement = 'SELECT col2 FROM mysqltest.my_aux WHERE col1 = 3
+UNION ALL
+SELECT col2 FROM mysqltest.my_aux WHERE col1 = 3';
+D_COUNT_READ	0
+S2_COUNT_READ	2
+S1_COUNT_READ	2
+D_SUM_NUMBER_OF_BYTES_READ	59
+S2_SUM_NUMBER_OF_BYTES_READ	112
+S1_SUM_NUMBER_OF_BYTES_READ	53
+D_COUNT_WRITE	0
+S2_COUNT_WRITE	1
+S1_COUNT_WRITE	1
+D_UM_NUMBER_OF_BYTES_WRITE	1010
+S2_SUM_NUMBER_OF_BYTES_WRITE	2119
+S1_SUM_NUMBER_OF_BYTES_WRITE	1109
+D_COUNT_MISC	0
+S2_COUNT_MISC	2
+S1_COUNT_MISC	2
+
+SELECT LPAD(COUNT_READ, 8, ' ') AS CNT_READ, LPAD(SUM_NUMBER_OF_BYTES_READ,  10,' ') AS BYTES_READ,
+LPAD(COUNT_WRITE,9, ' ') AS CNT_WRITE,LPAD(SUM_NUMBER_OF_BYTES_WRITE, 11,' ') AS BYTES_WRITE,
+LPAD(COUNT_MISC, 8, ' ') AS CNT_MISC, statement
+FROM mysqltest.socket_summary_by_instance_detail
+WHERE OBJECT_INSTANCE_BEGIN <> @default_object_instance_begin
+AND EVENT_NAME LIKE ('%client_connection')
+AND run = 1
+AND statement IN('SELECT col2 FROM mysqltest.my_aux WHERE col1 = 3
+UNION ALL
+SELECT col2 FROM mysqltest.my_aux WHERE col1 = 3','SELECT col2 FROM mysqltest.my_aux WHERE col1 = 3');
+CNT_READ	BYTES_READ	CNT_WRITE	BYTES_WRITE	CNT_MISC	statement
+       2	        53	        1	       1109	       2	SELECT col2 FROM mysqltest.my_aux WHERE col1 = 3
+       2	       112	        1	       2119	       2	SELECT col2 FROM mysqltest.my_aux WHERE col1 = 3
+UNION ALL
+SELECT col2 FROM mysqltest.my_aux WHERE col1 = 3
+# 4.3.11 Compare impact of statements
+#       SELECT col2 FROM mysqltest.my_aux WHERE col1 < 3
+#       SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1
+# The compared statistics looks suspicious
+# We expect
+0
+
+SELECT 0 AS Expect_1
+FROM mysqltest.socket_summary_by_instance_detail t1
+JOIN mysqltest.socket_summary_by_instance_detail t2
+USING (EVENT_NAME, OBJECT_INSTANCE_BEGIN, run)
+WHERE OBJECT_INSTANCE_BEGIN <> @default_object_instance_begin
+AND EVENT_NAME LIKE ('%client_connection')
+AND run = 1
+AND t2.statement = 'SELECT col2 FROM mysqltest.my_aux WHERE col1 < 3' AND t1.statement = 'SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1';
+Expect_1
+0
+
+SELECT t2.COUNT_READ - t1.COUNT_READ AS D_COUNT_READ,
+t2.COUNT_READ                 AS S2_COUNT_READ,
+t1.COUNT_READ                 AS S1_COUNT_READ,
+t2.SUM_NUMBER_OF_BYTES_READ - t1.SUM_NUMBER_OF_BYTES_READ AS D_SUM_NUMBER_OF_BYTES_READ,
+t2.SUM_NUMBER_OF_BYTES_READ                               AS S2_SUM_NUMBER_OF_BYTES_READ,
+t1.SUM_NUMBER_OF_BYTES_READ                               AS S1_SUM_NUMBER_OF_BYTES_READ,
+t2.COUNT_WRITE - t1.COUNT_WRITE AS D_COUNT_WRITE,
+t2.COUNT_WRITE                  AS S2_COUNT_WRITE,
+t1.COUNT_WRITE                  AS S1_COUNT_WRITE,
+t2.SUM_NUMBER_OF_BYTES_WRITE - t1.SUM_NUMBER_OF_BYTES_WRITE AS D_UM_NUMBER_OF_BYTES_WRITE,
+t2.SUM_NUMBER_OF_BYTES_WRITE                                AS S2_SUM_NUMBER_OF_BYTES_WRITE,
+t1.SUM_NUMBER_OF_BYTES_WRITE                                AS S1_SUM_NUMBER_OF_BYTES_WRITE,
+t2.COUNT_MISC - t1.COUNT_MISC AS D_COUNT_MISC,
+t2.COUNT_MISC                 AS S2_COUNT_MISC,
+t1.COUNT_MISC                 AS S1_COUNT_MISC
+FROM mysqltest.socket_summary_by_instance_detail t1
+JOIN mysqltest.socket_summary_by_instance_detail t2
+USING (EVENT_NAME, OBJECT_INSTANCE_BEGIN, run)
+WHERE OBJECT_INSTANCE_BEGIN <> @default_object_instance_begin
+AND EVENT_NAME LIKE ('%client_connection')
+AND run = 1
+AND t1.statement = 'SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1' AND t2.statement = 'SELECT col2 FROM mysqltest.my_aux WHERE col1 < 3';
+D_COUNT_READ	0
+S2_COUNT_READ	2
+S1_COUNT_READ	2
+D_SUM_NUMBER_OF_BYTES_READ	0
+S2_SUM_NUMBER_OF_BYTES_READ	53
+S1_SUM_NUMBER_OF_BYTES_READ	53
+D_COUNT_WRITE	0
+S2_COUNT_WRITE	1
+S1_COUNT_WRITE	1
+D_UM_NUMBER_OF_BYTES_WRITE	6
+S2_SUM_NUMBER_OF_BYTES_WRITE	89
+S1_SUM_NUMBER_OF_BYTES_WRITE	83
+D_COUNT_MISC	0
+S2_COUNT_MISC	2
+S1_COUNT_MISC	2
+
+SELECT LPAD(COUNT_READ, 8, ' ') AS CNT_READ, LPAD(SUM_NUMBER_OF_BYTES_READ,  10,' ') AS BYTES_READ,
+LPAD(COUNT_WRITE,9, ' ') AS CNT_WRITE,LPAD(SUM_NUMBER_OF_BYTES_WRITE, 11,' ') AS BYTES_WRITE,
+LPAD(COUNT_MISC, 8, ' ') AS CNT_MISC, statement
+FROM mysqltest.socket_summary_by_instance_detail
+WHERE OBJECT_INSTANCE_BEGIN <> @default_object_instance_begin
+AND EVENT_NAME LIKE ('%client_connection')
+AND run = 1
+AND statement IN('SELECT col2 FROM mysqltest.my_aux WHERE col1 < 3','SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1');
+CNT_READ	BYTES_READ	CNT_WRITE	BYTES_WRITE	CNT_MISC	statement
+       2	        53	        1	         83	       2	SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1
+       2	        53	        1	         89	       2	SELECT col2 FROM mysqltest.my_aux WHERE col1 < 3

=== modified file 'mysql-test/suite/perfschema/t/disabled.def'
--- a/mysql-test/suite/perfschema/t/disabled.def	2011-08-15 01:05:55 +0000
+++ b/mysql-test/suite/perfschema/t/disabled.def	2011-08-15 06:26:10 +0000
@@ -24,5 +24,5 @@
 #  Do not use any TAB characters for whitespace.
 #
 ##############################################################################
-#socket_summary_by_instance_func        : WL#4896 "Performance Schema Net IO" - Disable until debugged
+socket_summary_by_instance_func_dbg        : WL#4896 "Performance Schema Net IO" - For debugging only
 

=== modified file 'mysql-test/suite/perfschema/t/socket_summary_by_instance_func.test'
--- a/mysql-test/suite/perfschema/t/socket_summary_by_instance_func.test	2011-08-15 01:05:55 +0000
+++ b/mysql-test/suite/perfschema/t/socket_summary_by_instance_func.test	2011-08-15 06:26:10 +0000
@@ -27,16 +27,16 @@
 # Set IP address defaults with respect to IPV6 support
 #
 # Set this to enable debugging output
-let $my_socket_debug=0;
+let $my_socket_debug= 0;
 #
 # Determine if IPV6 supported
 #
-let $check_ipv6_just_check=1;
+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;
+let $check_ipv4_mapped_just_check= 1;
 --source include/check_ipv4_mapped.inc
 #
 # Set the localhost IP default to use when establishing connections
@@ -50,10 +50,10 @@ if($check_ipv4_mapped_supported)
   let $my_localhost=::ffff:127.0.0.1;
 }
 #
-let $my_socket_debug=0;
+let $my_socket_debug= 0;
 if($my_socket_debug)
 {
-  --echo IPV6=$check_ipv6_supported, IPV4_MAPPED=$check_ipv4_mapped_supported, LOCALHOST=$my_localhost
+  --echo IPV6=$check_ipv6_supported, IPV4_MAPPED = $check_ipv4_mapped_supported, LOCALHOST = $my_localhost
 }
 #===================================
 
@@ -83,7 +83,8 @@ let $print_details= 1;
 #
 # Number of attempts within the test checking the stability of counter increments.
 #
-let $loop_rounds= 3;
+# let $loop_rounds= 10;
+let $loop_rounds= 1;
 
 #
 # Additional SCHEMA used for
@@ -95,6 +96,14 @@ CREATE SCHEMA mysqltest;
 CREATE SCHEMA mysqlsupertest;
 
 #
+# Disable the instrumentation for connection default.
+# This connection observes the impact of the acting connections
+# and should not have an impact on statistics.
+#
+# UPDATE performance_schema.threads
+# SET INSTRUMENTED='NO' WHERE PROCESSLIST_ID = CONNECTION_ID();
+
+#
 # Clear summary tables of previous entries
 #
 TRUNCATE performance_schema.socket_summary_by_instance;
@@ -122,7 +131,7 @@ FROM performance_schema.socket_summary_b
 WHERE 1 = 2;
 
 ALTER TABLE mysqltest.socket_summary_by_instance_detail
-ADD statement VARCHAR(300), ADD run INTEGER;
+ADD statement VARCHAR(500), ADD run INTEGER;
 
 #
 # Auxiliary SQL functions used to shorten some commands.
@@ -227,9 +236,30 @@ eval $truncate;
 eval $insert_before;
 --disconnect default
 --connect (default,localhost,root,,,,)
+# --echo ########### Disconnect/Connect
+# --enable_query_log
 eval $insert_after;
 eval $get_object_instance_begin;
 SET @default_object_instance_begin = @con1_object_instance_begin;
+# SELECT @default_object_instance_begin;
+# SELECT * FROM performance_schema.threads;
+# SELECT * FROM performance_schema.socket_summary_by_instance
+# WHERE OBJECT_INSTANCE_BEGIN <> @default_object_instance_begin;
+UPDATE performance_schema.threads
+SET INSTRUMENTED='NO' WHERE PROCESSLIST_ID = CONNECTION_ID();
+TRUNCATE TABLE performance_schema.socket_summary_by_instance;
+TRUNCATE TABLE performance_schema.socket_summary_by_event_name;
+# TRUNCATE TABLE performance_schema.socket_summary_by_instance;
+# TRUNCATE TABLE performance_schema.socket_summary_by_event_name;
+# sleep 3;
+# SELECT * FROM performance_schema.socket_summary_by_instance
+# WHERE OBJECT_INSTANCE_BEGIN <> @default_object_instance_begin;
+# SELECT * FROM performance_schema.socket_summary_by_instance;
+# SELECT * FROM mysqltest.socket_summary_by_instance_detail;
+# SELECT * FROM information_schema.processlist;
+# SELECT * FROM performance_schema.threads;
+# exit;
+--disable_query_log
 
 --echo # 1. Check the base line
 #==============================
@@ -304,7 +334,10 @@ DROP USER 'root0123456789'@'localhost';
 --source ../include/wait_till_sleep.inc
 --disable_query_log
 
+# MLML: Experiment
+let $loop_rounds= 10;
 --echo # 3 Check SELECTs
+# Attention: Don't use any double quotes within the statements.
 let $is_connect= 0;
 eval $get_object_instance_begin;
 --echo # 3.1 Check a SELECT ending with server sending an error message.
@@ -314,45 +347,78 @@ let $statement= SELECT col2 FROM does_no
 --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.
+--echo # 3.3 Check a SELECT ending with server sending an error message.
+--echo #     The statement has the same length like in 3.2 but the error
+--echo #     message is now different and much longer.
+#=======================================================================
+let $statement= SELECT col2 FROM does_not_exist WHERE col1 A 0;
+--source ../include/socket_event.inc
+
+--echo # 3.4 Check a SELECT ending with server sending an error message.
+--echo #     Statement and error message are a bit longer than in 3.1
+--echo #     because the table name is longer.
+#=======================================================================
+let $statement= SELECT col2 FROM does_not_exist0123;
+--source ../include/socket_event.inc
+
+--echo # 3.5 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 # 3.6 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;
+let $statement= SELECT col2 AS 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.
+--echo # 3.7 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.
+--echo # 3.8 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.
+--echo # 3.9 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 # 3.10 Check a SELECT earning two rows with an empty string
+#==========================================================================
+let $statement= SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1
+UNION ALL
+SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1;
+--source ../include/socket_event.inc
+
+let $statement= SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1
+UNION DISTINCT
+SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1;
+--source ../include/socket_event.inc
+
+let $statement= SELECT col2 FROM mysqltest.my_aux WHERE col1 = 3
+UNION ALL
+SELECT col2 FROM mysqltest.my_aux WHERE col1 = 3;
+--source ../include/socket_event.inc
+
+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
+#        = The INSERT which computes the diff would have been failed.
+--echo # 4.1 Check that
 --echo #     - increased COUNT_* leads to increased
 --echo #       SUM_TIMER_* and SUM_NUMBER_OF_BYTES_*
 --echo #     - no change in COUNT_* leads to no change in
@@ -361,7 +427,9 @@ let $statement= SELECT col2 FROM mysqlte
 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))
+ (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
@@ -369,8 +437,13 @@ AND
 AND
 ((COUNT_MISC = 0 AND SUM_TIMER_MISC = 0)
   OR
- (COUNT_MISC > 0));
-#(COUNT_MISC > 0 AND SUM_TIMER_MISC > 0));
+ (COUNT_MISC > 0 AND SUM_TIMER_MISC > 0)
+  OR
+ (COUNT_MISC > 0 AND SUM_TIMER_MISC = 0));
+
+# In case of SQL statements and the instance for the connection which runs the
+# statement COUNT_MISC is 1 AND SUM_TIMER_MISC is 0 !!
+# MLML: Ask Chris, if this is really correct.
 
 if(`SELECT COUNT(*) FROM mysqltest.socket_summary_by_instance_detail
     WHERE NOT ( $my_rules )`)
@@ -382,15 +455,16 @@ if(`SELECT COUNT(*) FROM mysqltest.socke
    --echo #    $my_rules
    --echo #
    eval
-   SELECT EVENT_NAME, lpad(OBJECT_INSTANCE_BEGIN,20,' ') as OBJECT_INSTANCE,
-   lpad(COUNT_READ,7, ' ')  as CREAD,  lpad(SUM_TIMER_READ,12,' ')  as TREAD, lpad(SUM_NUMBER_OF_BYTES_READ,7,' ')  as BREAD,
-   lpad(COUNT_WRITE,7, ' ') as CWRITE, lpad(SUM_TIMER_WRITE,12,' ') as TWRITE,lpad(SUM_NUMBER_OF_BYTES_WRITE,7,' ') as BWRITE,
-   lpad(COUNT_MISC,7,' ')   as CMISC,  lpad(SUM_TIMER_MISC,13,' ')  as TMISC,
-   rpad(statement,50,' ') as STATEMENT, lpad(run, 5, ' ') as RUN
-   FROM mysqltest.socket_summary_by_instance_detail order by EVENT_NAME, OBJECT_INSTANCE_BEGIN;
-
-
+   SELECT EVENT_NAME, LPAD(OBJECT_INSTANCE_BEGIN,20,' ') AS OBJECT_INSTANCE,
+   LPAD(COUNT_READ,7,' ')  AS CREAD,  LPAD(SUM_TIMER_READ,12,' ')  AS TREAD, LPAD(SUM_NUMBER_OF_BYTES_READ,7,' ')  AS BREAD,
+   LPAD(COUNT_WRITE,7,' ') AS CWRITE, LPAD(SUM_TIMER_WRITE,12,' ') AS TWRITE,LPAD(SUM_NUMBER_OF_BYTES_WRITE,7,' ') AS BWRITE,
+   LPAD(COUNT_MISC,7,' ')  AS CMISC,  LPAD(SUM_TIMER_MISC,13,' ')  AS TMISC,
+   RPAD(statement,50,' ')  AS STATEMENT, LPAD(run, 5, ' ') AS RUN
+   FROM mysqltest.socket_summary_by_instance_detail
+   WHERE NOT ( $my_rules )
+   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
@@ -410,24 +484,28 @@ if(`SELECT COUNT(*) FROM mysqltest.socke
 #   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;
-
+# MLML: IMHO the most reasonable rule
+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;
+
+# Comment(ML):
+#    In case we do not get the results somehow deterministic than we
+#    we should go with the less strict check based on CV.
+#
 # Compute coefficient of variation (CV) to detect 'notable' variances in the
 # byte count and operation counts. The acceptable range for the CV is purely
 # subjective, however, the CV is a dimensionless quantity therefore valid
 # across platforms.
-
-let $my_rules=
-STD(COUNT_READ)/AVG(COUNT_READ)                               <= 0.2 AND
-STD(SUM_NUMBER_OF_BYTES_READ)/AVG(SUM_NUMBER_OF_BYTES_READ)   <= 0.2 AND
-STD(COUNT_WRITE)/AVG(COUNT_WRITE)                             <= 0.2 AND
-STD(SUM_NUMBER_OF_BYTES_WRITE)/AVG(SUM_NUMBER_OF_BYTES_WRITE) <= 0.2 AND
-STD(COUNT_MISC)/AVG(COUNT_MISC)                               <= 0.4;
+# let $my_rules=
+# STD(COUNT_READ)/AVG(COUNT_READ)                               <= 0.2 AND
+# STD(SUM_NUMBER_OF_BYTES_READ)/AVG(SUM_NUMBER_OF_BYTES_READ)   <= 0.2 AND
+# STD(COUNT_WRITE)/AVG(COUNT_WRITE)                             <= 0.2 AND
+# STD(SUM_NUMBER_OF_BYTES_WRITE)/AVG(SUM_NUMBER_OF_BYTES_WRITE) <= 0.2 AND
+# STD(COUNT_MISC)/AVG(COUNT_MISC)                               <= 0.4;
 
 let $part=
 FROM mysqltest.socket_summary_by_instance_detail
@@ -444,10 +522,25 @@ if(`SELECT COUNT(statement) $part`)
    --echo #    $my_rules
    --echo # for GROUP BY EVENT_NAME, statement
    select @default_object_instance_begin as 'Default Object Instance';
+   # eval
+   # SELECT EVENT_NAME, statement
+   # $part
+   # ORDER BY EVENT_NAME, statement;
+
+   --echo MLML: Experiment
    eval
-   SELECT EVENT_NAME, statement
+   SELECT EVENT_NAME, statement,
+   $my_rules AS my_col
    $part
    ORDER BY EVENT_NAME, statement;
+
+   # eval
+   # SELECT * FROM mysqltest.socket_summary_by_instance_detail
+   # WHERE EVENT_NAME, statement IN
+   #       (SELECT EVENT_NAME, statement
+   #        $part)
+   # ORDER BY EVENT_NAME, statement;
+
    eval
    SELECT object_instance_begin, $counter_column_list, EVENT_NAME, statement, run
    FROM mysqltest.socket_summary_by_instance_detail t1
@@ -457,12 +550,12 @@ if(`SELECT COUNT(statement) $part`)
    ORDER BY EVENT_NAME, statement, run;
 
    --echo Debug 4.2a - Dump mysqltest.socket_summary_by_instance_detail
-   SELECT EVENT_NAME, lpad(OBJECT_INSTANCE_BEGIN,20,' ') as OBJECT_INSTANCE,
-   lpad(COUNT_READ,7,' ')  as CREAD,  lpad(SUM_TIMER_READ,12,' ')  as TREAD, lpad(SUM_NUMBER_OF_BYTES_READ,7,' ')  as BREAD,
-   lpad(COUNT_WRITE,7,' ') as CWRITE, lpad(SUM_TIMER_WRITE,12,' ') as TWRITE,lpad(SUM_NUMBER_OF_BYTES_WRITE,7,' ') as BWRITE,
-   lpad(COUNT_MISC,7,' ')  as CMISC,  lpad(SUM_TIMER_MISC,13,' ')  as TMISC,
-   rpad(statement,50,' ') as STATEMENT, lpad(run, 5, ' ') as RUN
-   FROM mysqltest.socket_summary_by_instance_detail order by EVENT_NAME, statement, run;
+   SELECT EVENT_NAME, LPAD(OBJECT_INSTANCE_BEGIN,20,' ') AS OBJECT_INSTANCE,
+   LPAD(COUNT_READ,7, ' ')  AS CREAD,  LPAD(SUM_TIMER_READ,12,' ')  AS TREAD, LPAD(SUM_NUMBER_OF_BYTES_READ,7,' ')  AS BREAD,
+   LPAD(COUNT_WRITE,7, ' ') AS CWRITE, LPAD(SUM_TIMER_WRITE,12,' ') AS TWRITE,LPAD(SUM_NUMBER_OF_BYTES_WRITE,7,' ') AS BWRITE,
+   LPAD(COUNT_MISC,7,' ')   AS CMISC,  LPAD(SUM_TIMER_MISC,13,' ')  AS TMISC,
+   RPAD(statement,50,' ') AS STATEMENT, LPAD(run, 5, ' ') AS RUN
+   FROM mysqltest.socket_summary_by_instance_detail ORDER BY EVENT_NAME, statement, run;
 
    --echo Debug 4.2b - Std dev and coefficient of variation for mysqltest.socket_summary_by_instance_detail
    select rpad(EVENT_NAME,39,' ') as EVENT_NAME1, rpad(statement,49,' ') as STATEMENT1,
@@ -477,12 +570,218 @@ if(`SELECT COUNT(statement) $part`)
    group by EVENT_NAME1, STATEMENT1;
 }
 
+# Initialize variables
+let $my_rules= my_rules_not_set;
+let $stmt1=    stmt1_not_set;
+let $stmt2=    stmt2_not_set;
+# $title_prefix is used for the generation of titles
+let $title_prefix= 4.3;
+# $check_num is used for the generation of titles and gets incremented after
+# every call of the current script.
+let $check_num= 1;
+# $column_list is used for the generation of error information and valid for
+# every sub test.
+let $column_list=
+t2.COUNT_READ - t1.COUNT_READ AS D_COUNT_READ,
+t2.COUNT_READ                 AS S2_COUNT_READ,
+t1.COUNT_READ                 AS S1_COUNT_READ,
+t2.SUM_NUMBER_OF_BYTES_READ - t1.SUM_NUMBER_OF_BYTES_READ AS D_SUM_NUMBER_OF_BYTES_READ,
+t2.SUM_NUMBER_OF_BYTES_READ                               AS S2_SUM_NUMBER_OF_BYTES_READ,
+t1.SUM_NUMBER_OF_BYTES_READ                               AS S1_SUM_NUMBER_OF_BYTES_READ,
+t2.COUNT_WRITE - t1.COUNT_WRITE AS D_COUNT_WRITE,
+t2.COUNT_WRITE                  AS S2_COUNT_WRITE,
+t1.COUNT_WRITE                  AS S1_COUNT_WRITE,
+t2.SUM_NUMBER_OF_BYTES_WRITE - t1.SUM_NUMBER_OF_BYTES_WRITE AS D_UM_NUMBER_OF_BYTES_WRITE,
+t2.SUM_NUMBER_OF_BYTES_WRITE                                AS S2_SUM_NUMBER_OF_BYTES_WRITE,
+t1.SUM_NUMBER_OF_BYTES_WRITE                                AS S1_SUM_NUMBER_OF_BYTES_WRITE,
+t2.COUNT_MISC - t1.COUNT_MISC AS D_COUNT_MISC,
+t2.COUNT_MISC                 AS S2_COUNT_MISC,
+t1.COUNT_MISC                 AS S1_COUNT_MISC;
+# $part is used for the generation of "check" statements + error information
+# and valid for every sub test.
+let $part=
+FROM mysqltest.socket_summary_by_instance_detail t1
+JOIN mysqltest.socket_summary_by_instance_detail t2
+USING (EVENT_NAME, OBJECT_INSTANCE_BEGIN, run)
+WHERE OBJECT_INSTANCE_BEGIN <> @default_object_instance_begin
+  AND EVENT_NAME LIKE ('%client_connection')
+  AND run = 1;
+
+--echo # $title_prefix Check the differences caused by SQL statements
+#            --> Statement NOT LIKE '%Connect%'
+
+let stmt1= SELECT col2 FROM does_not_exist;
+let stmt2= SELECT col2 FROM does_not_exist WHERE col1 = 0;
+#
+# CNT_READ BYTES_READ CNT_WRITE BYTES_WRITE CNT_MISC statement
+#        3         36         1         59         1 SELECT col2 FROM does_not_exist
+#        3         51         1         59         1 SELECT col2 FROM does_not_exist WHERE col1 = 0
+# The string of the statement gets charged into SUM_NUMBER_OF_BYTES_READ.
+# The server error message gets charged into SUM_NUMBER_OF_BYTES_WRITE.
+#
+let $my_rules=
+t2.COUNT_READ                - t1.COUNT_READ                = 0  AND
+t2.SUM_NUMBER_OF_BYTES_READ  - t1.SUM_NUMBER_OF_BYTES_READ  = LENGTH('$stmt2') - LENGTH('$stmt1') AND
+t2.COUNT_WRITE               - t1.COUNT_WRITE               = 0  AND
+t2.SUM_NUMBER_OF_BYTES_WRITE - t1.SUM_NUMBER_OF_BYTES_WRITE = 0  AND
+t2.COUNT_MISC                - t1.COUNT_MISC                = 0;
+--source ../include/socket_check1.inc
+
+let $stmt1= SELECT col2 FROM does_not_exist WHERE col1 = 0;
+let $stmt2= SELECT col2 FROM does_not_exist WHERE col1 A 0;
+#
+# CNT_READ BYTES_READ CNT_WRITE BYTES_WRITE CNT_MISC statement
+#        3         51         1         59         1 SELECT col2 FROM does_not_exist WHERE col1 = 0
+#        3         51         1        162         1 SELECT col2 FROM does_not_exist WHERE col1 A 0
+# Both statements have the same length and fail. But the second statement
+# caused a longer error message.
+let $my_rules=
+t2.COUNT_READ                - t1.COUNT_READ                = 0  AND
+t2.SUM_NUMBER_OF_BYTES_READ  - t1.SUM_NUMBER_OF_BYTES_READ  = LENGTH('$stmt2') - LENGTH('$stmt1') AND
+t2.COUNT_WRITE               - t1.COUNT_WRITE               = 0  AND
+t2.SUM_NUMBER_OF_BYTES_WRITE - t1.SUM_NUMBER_OF_BYTES_WRITE > 0  AND
+t2.COUNT_MISC                - t1.COUNT_MISC                = 0;
+--source ../include/socket_check1.inc
+
+let $stmt1= SELECT col2 FROM does_not_exist;
+let $stmt2= SELECT col2 FROM does_not_exist0123;
+# CNT_READ BYTES_READ CNT_WRITE BYTES_WRITE CNT_MISC statement
+#        3         36         1          59        1 SELECT col2 FROM does_not_exist
+#        3         40         1          63        1 SELECT col2 FROM does_not_exist0123
+#    Statements differ in table name length and table name is part of error message.
+let $my_rules=
+t2.COUNT_READ                - t1.COUNT_READ                = 0  AND
+t2.SUM_NUMBER_OF_BYTES_READ  - t1.SUM_NUMBER_OF_BYTES_READ  = LENGTH('$stmt2') - LENGTH('$stmt1') AND
+t2.COUNT_WRITE               - t1.COUNT_WRITE               = 0  AND
+t2.SUM_NUMBER_OF_BYTES_WRITE - t1.SUM_NUMBER_OF_BYTES_WRITE = LENGTH('$stmt2') - LENGTH('$stmt1') AND
+t2.COUNT_MISC                - t1.COUNT_MISC                = 0;
+--source ../include/socket_check1.inc
+
+# How to enforce the debug info is printed?
+# let $my_rules= 0;
+# This will cause that suite/perfschema/include/socket_check1.inc conclude that
+# check failed and it will print debug information.
+# let $stmt1= SELECT col2 FROM does_not_exist WHERE col1 = 0;
+# let $stmt2= SELECT col2 FROM does_not_exist WHERE col1 A 0;
+# let $my_rules= 0;
+# --source ../include/socket_check1.inc
+
+let $stmt2= SELECT col2 AS my_lovely_col FROM mysqltest.my_aux WHERE col1 = 0;
+let $stmt1= SELECT col2 FROM mysqltest.my_aux WHERE col1 = 0;
+# CNT_READ BYTES_READ CNT_WRITE BYTES_WRITE CNT_MISC statement
+#        3         53         1          78        1 SELECT col2 FROM mysqltest.my_aux WHERE col1 = 0
+#        3         70         1          87        1 SELECT col2 AS my_lovely_col FROM mysqltest.my_aux WHERE col1 = 0
+# Both statements get an empty result set. But the length of the statements and
+# the result set column names differs.
+let $my_rules=
+t2.COUNT_READ                - t1.COUNT_READ                = 0  AND
+t2.SUM_NUMBER_OF_BYTES_READ  - t1.SUM_NUMBER_OF_BYTES_READ  = LENGTH('$stmt2') - LENGTH('$stmt1') AND
+t2.COUNT_WRITE               - t1.COUNT_WRITE               = 0  AND
+t2.SUM_NUMBER_OF_BYTES_WRITE - t1.SUM_NUMBER_OF_BYTES_WRITE = LENGTH('my_lovely_col') - LENGTH('col2') AND
+t2.COUNT_MISC                - t1.COUNT_MISC                = 0;
+--source ../include/socket_check1.inc
+
+let $stmt2= SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1;
+let $stmt1= SELECT col2 FROM mysqltest.my_aux WHERE col1 = 0;
+# CNT_READ BYTES_READ CNT_WRITE BYTES_WRITE CNT_MISC statement
+#        3         53         1          78        1 SELECT col2 FROM mysqltest.my_aux WHERE col1 = 0
+#        3         53         1          83        1 SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1
+# stmt1 gets an empty result set
+# stmt1 gets one row containing an empty result string
+let $my_rules=
+t2.COUNT_READ                - t1.COUNT_READ                = 0  AND
+t2.SUM_NUMBER_OF_BYTES_READ  - t1.SUM_NUMBER_OF_BYTES_READ  = LENGTH('$stmt2') - LENGTH('$stmt1') AND
+t2.COUNT_WRITE               - t1.COUNT_WRITE               = 0  AND
+t2.SUM_NUMBER_OF_BYTES_WRITE - t1.SUM_NUMBER_OF_BYTES_WRITE > 0  AND
+t2.COUNT_MISC                - t1.COUNT_MISC                = 0;
+--source ../include/socket_check1.inc
+
+let $stmt2= SELECT col2 FROM mysqltest.my_aux WHERE col1 = 2;
+let $stmt1= SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1;
+# CNT_READ BYTES_READ CNT_WRITE BYTES_WRITE CNT_MISC statement
+#        3         53         1          83        1 SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1
+#        3         53         1          84        1 SELECT col2 FROM mysqltest.my_aux WHERE col1 = 2
+# stmt2 one row containing a string 1 byte long
+# stmt1 one row containing an empty string
+let $my_rules=
+t2.COUNT_READ                - t1.COUNT_READ                = 0  AND
+t2.SUM_NUMBER_OF_BYTES_READ  - t1.SUM_NUMBER_OF_BYTES_READ  = LENGTH('$stmt2') - LENGTH('$stmt1') AND
+t2.COUNT_WRITE               - t1.COUNT_WRITE               = 0  AND
+t2.SUM_NUMBER_OF_BYTES_WRITE - t1.SUM_NUMBER_OF_BYTES_WRITE = 1  AND
+t2.COUNT_MISC                - t1.COUNT_MISC                = 0;
+--source ../include/socket_check1.inc
+
+let $stmt2= SELECT col2 FROM mysqltest.my_aux WHERE col1 = 3;
+let $stmt1= SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1;
+# CNT_READ BYTES_READ CNT_WRITE BYTES_WRITE CNT_MISC statement
+#        3         53         1          83        1 SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1
+#        3         53         1        1109        1 SELECT col2 FROM mysqltest.my_aux WHERE col1 = 3
+# stmt2 one row containing a string 1024 byte long
+# stmt1 one row containing an empty string
+let $my_rules=
+t2.COUNT_READ                - t1.COUNT_READ                = 0  AND
+t2.SUM_NUMBER_OF_BYTES_READ  - t1.SUM_NUMBER_OF_BYTES_READ  = LENGTH('$stmt2') - LENGTH('$stmt1') AND
+t2.COUNT_WRITE               - t1.COUNT_WRITE               = 0  AND
+t2.SUM_NUMBER_OF_BYTES_WRITE - t1.SUM_NUMBER_OF_BYTES_WRITE = 1024 + 2 AND
+t2.COUNT_MISC                - t1.COUNT_MISC                = 0;
+--source ../include/socket_check1.inc
+
+let $stmt2= SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1
+UNION ALL
+SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1;
+let $stmt1= SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1;
+# CNT_READ BYTES_READ CNT_WRITE BYTES_WRITE CNT_MISC statement
+#        3         53         1          83        1 SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1
+#        3        112         1          67        1 SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1
+#                                                    UNION ALL
+#                                                    SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1
+# MLML: The BYTES_WRITE seem to be wrong.
+let $my_rules= 0;
+--source ../include/socket_check1.inc
+
+let $stmt2= SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1
+UNION DISTINCT
+SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1;
+let $stmt1= SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1;
+# CNT_READ BYTES_READ CNT_WRITE BYTES_WRITE CNT_MISC statement
+#        3         53         1          83        1 SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1
+#        3        117         1          62        1 SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1
+#                                                    UNION DISTINCT
+#                                                    SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1
+# MLML: The BYTES_WRITE seem to be wrong.
+let $my_rules= 0;
+--source ../include/socket_check1.inc
+
+let $stmt2= SELECT col2 FROM mysqltest.my_aux WHERE col1 = 3
+UNION ALL
+SELECT col2 FROM mysqltest.my_aux WHERE col1 = 3;
+let $stmt1= SELECT col2 FROM mysqltest.my_aux WHERE col1 = 3;
+# CNT_READ BYTES_READ CNT_WRITE BYTES_WRITE CNT_MISC statement
+#        3         53         1        1109        1 SELECT col2 FROM mysqltest.my_aux WHERE col1 = 3
+#        3        112         1        2119        1 SELECT col2 FROM mysqltest.my_aux WHERE col1 = 3
+#                                                    UNION ALL
+#                                                    SELECT col2 FROM mysqltest.my_aux WHERE col1 = 3
+let $my_rules= 0;
+--source ../include/socket_check1.inc
+
+let $stmt2= SELECT col2 FROM mysqltest.my_aux WHERE col1 < 3;
+let $stmt1= SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1;
+# CNT_READ BYTES_READ CNT_WRITE BYTES_WRITE CNT_MISC statement
+#        3         53         1          83        1 SELECT col2 FROM mysqltest.my_aux WHERE col1 = 1
+#        3         53         1          89        1 SELECT col2 FROM mysqltest.my_aux WHERE col1 < 3
+# stmt2 Gives one row with string 1 byte long and one row with an empty string.
+# stmt1 Gives one row with an empty string.
+# BYTES_WRITE might be ok here.
+let $my_rules= 0;
+--source ../include/socket_check1.inc
+
+exit;
+if(0)
+{
 --echo # 4.3 Check the connects
 --echo # 4.3.1 Successful connects with different length of user name
 #            --> t2.statement LIKE 'Connect%root0123456789,%'
 #            --> t1.statement LIKE 'Connect%root012345,%'
-if(1)
-{
 # There is no client_connection entry for a connect which fails.
 
 let $my_val=
@@ -502,7 +801,7 @@ WHERE t2.OBJECT_INSTANCE_BEGIN <> @defau
   AND t1.OBJECT_INSTANCE_BEGIN <> @default_object_instance_begin
   AND t2.statement LIKE 'Connect%root0123456789,%'
   AND t1.statement LIKE 'Connect%root012345,%'
-  AND t1.EVENT_NAME NOT LIKE '%server_unix_socket%'
+  AND t1.EVENT_NAME LIKE '%client_connection%'
   AND run = 1;
 
 #eval
@@ -610,7 +909,9 @@ if($print_details)
    --horizontal_results
    --echo # Dump detailed differences after - before statement execution
    --echo # 1. The statement executing connection and hopefully noone else
-   SELECT EVENT_NAME,
+   SELECT @default_object_instance_begin;
+   # SELECT EVENT_NAME,
+   SELECT EVENT_NAME, OBJECT_INSTANCE_BEGIN,
           COUNT_READ,  SUM_NUMBER_OF_BYTES_READ,
           COUNT_WRITE, SUM_NUMBER_OF_BYTES_WRITE,
           COUNT_MISC,  statement

=== modified file 'storage/perfschema/pfs.cc'
--- a/storage/perfschema/pfs.cc	2011-08-11 16:07:45 +0000
+++ b/storage/perfschema/pfs.cc	2011-08-15 06:29:18 +0000
@@ -2850,49 +2850,61 @@ get_thread_socket_locker_v1(PSI_socket_l
     if (unlikely(pfs_thread == NULL))
       return NULL;
 
+    /*
+      If instrumentation for this thread has been disabled, then return a null
+      locker *unless* this is a socket close, in which case end_socket_wait()
+      will later call destroy_socket().
+    */
     if (!pfs_thread->m_enabled)
-      return NULL;
-
-    state->m_thread= reinterpret_cast<PSI_thread *> (pfs_thread);
-    flags= STATE_FLAG_THREAD;
-
-    /* Sockets in IDLE state are timed separately */
-    if (pfs_socket->m_timed)
-      flags|= STATE_FLAG_TIMED;
-
-    if (flag_events_waits_current)
     {
-      if (unlikely(pfs_thread->m_events_waits_count >= WAIT_STACK_SIZE))
-      {
-        locker_lost++;
+      if (op == PSI_SOCKET_CLOSE)
+        flags= 0;
+      else
         return NULL;
-      }
-      PFS_events_waits *wait= &pfs_thread->m_events_waits_stack[pfs_thread->m_events_waits_count];
-      state->m_wait= wait;
-      flags|= STATE_FLAG_EVENT;
+    }
+    else
+    {
+      state->m_thread= reinterpret_cast<PSI_thread *> (pfs_thread);
+      flags= STATE_FLAG_THREAD;
 
-      PFS_events_waits *parent_event= wait - 1;
-      wait->m_event_type= EVENT_TYPE_WAIT;
-      wait->m_nesting_event_id= parent_event->m_event_id;
-      wait->m_nesting_event_id= parent_event->m_event_type;
-      wait->m_thread=       pfs_thread;
-      wait->m_class=        pfs_socket->m_class;
-      wait->m_timer_start=  0;
-      wait->m_timer_end=    0;
-      wait->m_object_instance_addr= pfs_socket->m_identity;
-      wait->m_weak_socket=  pfs_socket;
-      wait->m_weak_version= pfs_socket->get_version();
-      wait->m_event_id=     pfs_thread->m_event_id++;
-      wait->m_operation=    socket_operation_map[static_cast<int>(op)];
-      wait->m_wait_class=   WAIT_CLASS_SOCKET;
+      /* Sockets in IDLE state are timed separately */
+      if (pfs_socket->m_timed)
+        flags|= STATE_FLAG_TIMED;
 
-      pfs_thread->m_events_waits_count++;
+      if (flag_events_waits_current)
+      {
+        if (unlikely(pfs_thread->m_events_waits_count >= WAIT_STACK_SIZE))
+        {
+          locker_lost++;
+          return NULL;
+        }
+        PFS_events_waits *wait= &pfs_thread->m_events_waits_stack[pfs_thread->m_events_waits_count];
+        state->m_wait= wait;
+        flags|= STATE_FLAG_EVENT;
+
+        PFS_events_waits *parent_event= wait - 1;
+        wait->m_event_type= EVENT_TYPE_WAIT;
+        wait->m_nesting_event_id= parent_event->m_event_id;
+        wait->m_nesting_event_id= parent_event->m_event_type;
+        wait->m_thread=       pfs_thread;
+        wait->m_class=        pfs_socket->m_class;
+        wait->m_timer_start=  0;
+        wait->m_timer_end=    0;
+        wait->m_object_instance_addr= pfs_socket->m_identity;
+        wait->m_weak_socket=  pfs_socket;
+        wait->m_weak_version= pfs_socket->get_version();
+        wait->m_event_id=     pfs_thread->m_event_id++;
+        wait->m_operation=    socket_operation_map[static_cast<int>(op)];
+        wait->m_wait_class=   WAIT_CLASS_SOCKET;
+
+        pfs_thread->m_events_waits_count++;
+      }
     }
   }
   else
   {
     /* Sockets in IDLE state are counted but not timed */
-  if (pfs_socket->m_timed)
+    if (pfs_socket->m_timed)
     {
       flags= STATE_FLAG_TIMED;
     }
@@ -3173,7 +3185,7 @@ start_idle_wait_v1(PSI_idle_locker_state
 
 /**
   Implementation of the mutex instrumentation interface.
-  @sa PSI_v1::end_mutex_wait.
+  @sa PSI_v1::end_idle_wait.
 */
 static void end_idle_wait_v1(PSI_idle_locker* locker)
 {

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (chris.powers:3365 to 3367) Christopher Powers16 Aug