List:Commits« Previous MessageNext Message »
From:Marc Alff Date:August 10 2011 6:27am
Subject:bzr push into mysql-trunk-wl5378 branch (marc.alff:3371 to 3372) WL#5378
View as plain text  
 3372 Marc Alff	2011-08-10
      WL#5378 PERFORMANCE_SCHEMA SUMMARY BY USER / HOST
      
      Improved test robustness for tests that are sensitive to connections.
      
      Fixed an issue found by QA:
      some threads would be removed from information_schema.processlist,
      but not from performance_schema.threads.
      
      The issue was that destroy_thread() could get stuck inside lf_hash_put_pins(),
      because of leaks with PINS used by the LF_HASH,
      and never actually free the instrumented thread.
      
      The root cause is that lf_hash_search() can return NULL and still keep pined pins.
      Fixed this by adding calls to lf_hash_search_unpin().

    added:
      mysql-test/suite/perfschema/include/no_protocol.inc
      mysql-test/suite/perfschema/include/wait_for_pfs_thread_count.inc
    modified:
      mysql-test/suite/perfschema/include/connection_setup.inc
      mysql-test/suite/perfschema/include/event_aggregate_setup.inc
      mysql-test/suite/perfschema/include/stage_setup.inc
      mysql-test/suite/perfschema/include/table_aggregate_setup.inc
      mysys/my_thr_init.c
      storage/perfschema/pfs_account.cc
      storage/perfschema/pfs_host.cc
      storage/perfschema/pfs_instr.cc
      storage/perfschema/pfs_instr_class.cc
      storage/perfschema/pfs_setup_actor.cc
      storage/perfschema/pfs_setup_object.cc
      storage/perfschema/pfs_user.cc
 3371 Marc Alff	2011-08-05 [merge]
      Merge mysql-trunk --> mysql-trunk-wl5378

    modified:
      mysql-test/collections/default.experimental
      mysql-test/suite/innodb/r/innodb-analyze.result
      mysql-test/suite/innodb/t/innodb-analyze.test
      mysql-test/suite/perfschema/include/table_io_setup_helper.inc
      mysql-test/suite/perfschema/r/csv_table_io.result
      mysql-test/suite/perfschema/r/indexed_table_io.result
      mysql-test/suite/perfschema/r/innodb_table_io.result
      mysql-test/suite/perfschema/r/memory_table_io.result
      mysql-test/suite/perfschema/r/merge_table_io.result
      mysql-test/suite/perfschema/r/multi_table_io.result
      mysql-test/suite/perfschema/r/myisam_table_io.result
      mysql-test/suite/perfschema/r/part_table_io.result
      mysql-test/suite/perfschema/r/privilege_table_io.result
      mysql-test/suite/perfschema/r/rollback_table_io.result
      mysql-test/suite/perfschema/r/temp_table_io.result
      mysql-test/suite/perfschema/r/trigger_table_io.result
      mysql-test/suite/perfschema/r/view_table_io.result
      mysql-test/suite/sys_vars/r/innodb_stats_sample_pages_basic.result
      mysys/my_init.c
      mysys/mysys_priv.h
      storage/innobase/handler/ha_innodb.cc
=== modified file 'mysql-test/suite/perfschema/include/connection_setup.inc'
--- a/mysql-test/suite/perfschema/include/connection_setup.inc	2011-07-29 17:59:40 +0000
+++ b/mysql-test/suite/perfschema/include/connection_setup.inc	2011-08-10 06:26:45 +0000
@@ -63,14 +63,8 @@
 
 --source include/not_embedded.inc
 --source include/have_perfschema.inc
-
-# The file with expected results fits only to a run without
-# ps-protocol/sp-protocol/cursor-protocol/view-protocol.
-if (`SELECT $PS_PROTOCOL + $SP_PROTOCOL + $CURSOR_PROTOCOL
-            + $VIEW_PROTOCOL > 0`)
-{
-   --skip Test requires: ps-protocol/sp-protocol/cursor-protocol/view-protocol disabled
-}
+--source ../include/no_protocol.inc
+--source ../include/wait_for_pfs_thread_count.inc
 
 --disable_query_log
 

=== modified file 'mysql-test/suite/perfschema/include/event_aggregate_setup.inc'
--- a/mysql-test/suite/perfschema/include/event_aggregate_setup.inc	2011-07-29 17:59:40 +0000
+++ b/mysql-test/suite/perfschema/include/event_aggregate_setup.inc	2011-08-10 06:26:45 +0000
@@ -77,14 +77,8 @@
 
 --source include/not_embedded.inc
 --source include/have_perfschema.inc
-
-# The file with expected results fits only to a run without
-# ps-protocol/sp-protocol/cursor-protocol/view-protocol.
-if (`SELECT $PS_PROTOCOL + $SP_PROTOCOL + $CURSOR_PROTOCOL
-            + $VIEW_PROTOCOL > 0`)
-{
-   --skip Test requires: ps-protocol/sp-protocol/cursor-protocol/view-protocol disabled
-}
+--source ../include/no_protocol.inc
+--source ../include/wait_for_pfs_thread_count.inc
 
 --disable_query_log
 

=== added file 'mysql-test/suite/perfschema/include/no_protocol.inc'
--- a/mysql-test/suite/perfschema/include/no_protocol.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/include/no_protocol.inc	2011-08-10 06:26:45 +0000
@@ -0,0 +1,25 @@
+# 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
+
+# Tests for the performance schema
+
+# The file with expected results fits only to a run without
+# ps-protocol/sp-protocol/cursor-protocol/view-protocol.
+if (`SELECT $PS_PROTOCOL + $SP_PROTOCOL + $CURSOR_PROTOCOL
+            + $VIEW_PROTOCOL > 0`)
+{
+   --skip Test requires: ps-protocol/sp-protocol/cursor-protocol/view-protocol disabled
+}
+

=== modified file 'mysql-test/suite/perfschema/include/stage_setup.inc'
--- a/mysql-test/suite/perfschema/include/stage_setup.inc	2011-07-21 16:27:14 +0000
+++ b/mysql-test/suite/perfschema/include/stage_setup.inc	2011-08-10 06:26:45 +0000
@@ -39,14 +39,7 @@
 
 --source include/not_embedded.inc
 --source include/have_perfschema.inc
-
-# The file with expected results fits only to a run without
-# ps-protocol/sp-protocol/cursor-protocol/view-protocol.
-if (`SELECT $PS_PROTOCOL + $SP_PROTOCOL + $CURSOR_PROTOCOL
-            + $VIEW_PROTOCOL > 0`)
-{
-   --skip Test requires: ps-protocol/sp-protocol/cursor-protocol/view-protocol disabled
-}
+--source ../include/no_protocol.inc
 
 --disable_query_log
 

=== modified file 'mysql-test/suite/perfschema/include/table_aggregate_setup.inc'
--- a/mysql-test/suite/perfschema/include/table_aggregate_setup.inc	2011-07-25 17:40:58 +0000
+++ b/mysql-test/suite/perfschema/include/table_aggregate_setup.inc	2011-08-10 06:26:45 +0000
@@ -82,6 +82,8 @@
 
 --source include/not_embedded.inc
 --source include/have_perfschema.inc
+--source ../include/no_protocol.inc
+--source ../include/wait_for_pfs_thread_count.inc
 
 --disable_query_log
 grant ALL on *.* to user1@localhost;

=== added file 'mysql-test/suite/perfschema/include/wait_for_pfs_thread_count.inc'
--- a/mysql-test/suite/perfschema/include/wait_for_pfs_thread_count.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/include/wait_for_pfs_thread_count.inc	2011-08-10 06:26:45 +0000
@@ -0,0 +1,35 @@
+# 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
+
+# Tests for the performance schema
+# This helper can be used to enforce that no threads from previous
+# tests are still running, which can impact some test scripts.
+
+# Wait until there is only one session left, this one.
+
+let $wait_condition=
+  select count(*) = 1 from information_schema.processlist;
+--source include/wait_condition.inc
+
+# Threads are removed from information_schema.processlist
+# very soon, but continue to execute in the server,
+# before finally be removed from performance_schema.threads.
+# Because instrumentation is optional, we use "<=" here.
+
+let $wait_condition=
+  select count(*) <= 1 from performance_schema.threads
+  where `TYPE`='FOREGROUND';
+--source include/wait_condition.inc
+

=== modified file 'mysys/my_thr_init.c'
--- a/mysys/my_thr_init.c	2011-06-30 15:50:45 +0000
+++ b/mysys/my_thr_init.c	2011-08-10 06:26:45 +0000
@@ -382,8 +382,7 @@ void my_thread_end(void)
     This must be done before trashing st_my_thread_var,
     because the LF_HASH depends on it.
   */
-  if (PSI_server)
-    PSI_server->delete_current_thread();
+  PSI_CALL(delete_current_thread)();
 #endif
 
   if (tmp && tmp->init)

=== modified file 'storage/perfschema/pfs_account.cc'
--- a/storage/perfschema/pfs_account.cc	2011-07-29 17:59:40 +0000
+++ b/storage/perfschema/pfs_account.cc	2011-08-10 06:26:45 +0000
@@ -237,6 +237,8 @@ search:
     return pfs;
   }
 
+  lf_hash_search_unpin(pins);
+
   PFS_scan scan;
   uint random= randomized_index(username, account_max);
 
@@ -541,8 +543,9 @@ void purge_account(PFS_thread *thread, P
       }
       account->m_lock.allocated_to_free();
     }
-    lf_hash_search_unpin(pins);
   }
+
+  lf_hash_search_unpin(pins);
 }
 
 /** Purge non connected user@host, reset stats of connected user@host. */

=== modified file 'storage/perfschema/pfs_host.cc'
--- a/storage/perfschema/pfs_host.cc	2011-05-18 23:29:02 +0000
+++ b/storage/perfschema/pfs_host.cc	2011-08-10 06:26:45 +0000
@@ -226,6 +226,8 @@ search:
     return pfs;
   }
 
+  lf_hash_search_unpin(pins);
+
   PFS_scan scan;
   uint random= randomized_index(hostname, host_max);
 
@@ -349,8 +351,9 @@ void purge_host(PFS_thread *thread, PFS_
                      host->m_key.m_hash_key, host->m_key.m_key_length);
       host->m_lock.allocated_to_free();
     }
-    lf_hash_search_unpin(pins);
   }
+
+  lf_hash_search_unpin(pins);
 }
 
 /** Purge non connected hosts, reset stats of connected hosts. */

=== modified file 'storage/perfschema/pfs_instr.cc'
--- a/storage/perfschema/pfs_instr.cc	2011-07-29 09:10:56 +0000
+++ b/storage/perfschema/pfs_instr.cc	2011-08-10 06:26:45 +0000
@@ -1109,6 +1109,7 @@ find_or_create_file(PFS_thread *thread,
   uint retry_count= 0;
   const uint retry_max= 3;
 search:
+
   entry= reinterpret_cast<PFS_file**>
     (lf_hash_search(&filename_hash, pins,
                     normalized_filename, normalized_length));
@@ -1120,6 +1121,8 @@ search:
     return pfs;
   }
 
+  lf_hash_search_unpin(pins);
+
   /* filename is not constant, just using it for noise on create */
   uint random= randomized_index(filename, file_max);
 

=== modified file 'storage/perfschema/pfs_instr_class.cc'
--- a/storage/perfschema/pfs_instr_class.cc	2011-08-03 15:07:17 +0000
+++ b/storage/perfschema/pfs_instr_class.cc	2011-08-10 06:26:45 +0000
@@ -1065,6 +1065,8 @@ search:
     return pfs;
   }
 
+  lf_hash_search_unpin(pins);
+
   if (retry_count == 0)
   {
     lookup_setup_object(thread,
@@ -1189,11 +1191,12 @@ void drop_table_share(PFS_thread *thread
   if (entry && (entry != MY_ERRPTR))
   {
     PFS_table_share *pfs= *entry;
-    lf_hash_search_unpin(pins);
     lf_hash_delete(&table_share_hash, pins,
                    pfs->m_key.m_hash_key, pfs->m_key.m_key_length);
     pfs->m_lock.allocated_to_free();
   }
+
+  lf_hash_search_unpin(pins);
 }
 
 /**

=== modified file 'storage/perfschema/pfs_setup_actor.cc'
--- a/storage/perfschema/pfs_setup_actor.cc	2011-07-07 19:06:44 +0000
+++ b/storage/perfschema/pfs_setup_actor.cc	2011-08-10 06:26:45 +0000
@@ -241,6 +241,8 @@ int delete_setup_actor(const String *use
     pfs->m_lock.allocated_to_free();
   }
 
+  lf_hash_search_unpin(pins);
+
   return 0;
 }
 
@@ -322,9 +324,12 @@ void lookup_setup_actor(PFS_thread *thre
 
     if (entry && (entry != MY_ERRPTR))
     {
+      lf_hash_search_unpin(pins);
       *enabled= true;
       return;
     }
+
+    lf_hash_search_unpin(pins);
   }
   *enabled= false;
   return;

=== modified file 'storage/perfschema/pfs_setup_object.cc'
--- a/storage/perfschema/pfs_setup_object.cc	2011-07-18 09:49:22 +0000
+++ b/storage/perfschema/pfs_setup_object.cc	2011-08-10 06:26:45 +0000
@@ -234,6 +234,8 @@ int delete_setup_object(enum_object_type
     pfs->m_lock.allocated_to_free();
   }
 
+  lf_hash_search_unpin(pins);
+
   setup_objects_version++;
   return 0;
 }
@@ -328,8 +330,11 @@ void lookup_setup_object(PFS_thread *thr
       pfs= *entry;
       *enabled= pfs->m_enabled;
       *timed= pfs->m_timed;
+      lf_hash_search_unpin(pins);
       return;
     }
+
+    lf_hash_search_unpin(pins);
   }
   *enabled= false;
   *timed= false;

=== modified file 'storage/perfschema/pfs_user.cc'
--- a/storage/perfschema/pfs_user.cc	2011-05-18 23:29:02 +0000
+++ b/storage/perfschema/pfs_user.cc	2011-08-10 06:26:45 +0000
@@ -227,6 +227,8 @@ search:
     return pfs;
   }
 
+  lf_hash_search_unpin(pins);
+
   PFS_scan scan;
   uint random= randomized_index(username, user_max);
 
@@ -350,8 +352,9 @@ void purge_user(PFS_thread *thread, PFS_
                      user->m_key.m_hash_key, user->m_key.m_key_length);
       user->m_lock.allocated_to_free();
     }
-    lf_hash_search_unpin(pins);
   }
+
+  lf_hash_search_unpin(pins);
 }
 
 /** Purge non connected users, reset stats of connected users. */

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk-wl5378 branch (marc.alff:3371 to 3372) WL#5378Marc Alff10 Aug