List:Commits« Previous MessageNext Message »
From:Marc Alff Date:July 16 2010 2:44pm
Subject:bzr push into mysql-trunk-bugfixing branch (marc.alff:3119 to 3124) Bug#53255
View as plain text  
 3124 Marc Alff	2010-07-16
      Bug#53255 Installed psi headers in wrong directory
      
      Backport from mysql-next-mr (5.6) to mysql-trunk (5.5)

    modified:
      include/Makefile.am
 3123 Marc Alff	2010-07-16
      Bug#53392 Tests: perfschema.query_cache fails
      
      Backport from mysql-next-mr (5.6) to mysql-trunk (5.5)

    modified:
      mysql-test/suite/perfschema/r/query_cache.result
      mysql-test/suite/perfschema/t/query_cache.test
 3122 Marc Alff	2010-07-16
      Bug#53394 Tests: perfschema.myisam_file_io fails
      
      Backport from mysql-next-mr (5.6) to mysql-trunk (5.5)

    modified:
      mysql-test/suite/perfschema/r/myisam_file_io.result
      mysql-test/suite/perfschema/t/myisam_file_io.test
 3121 Marc Alff	2010-07-16
      Bug#54467 performance schema complains of wrong structure in bootstrap mode
      
      Backport from mysql-next-mr (5.6) to mysql-trunk (5.5)

    modified:
      sql/mysqld.cc
 3120 Marc Alff	2010-07-16
      Bug#54782 Performance schema per thread accounting and thread cache
      
      Backport from mysql-next-mr (5.6) to mysql-trunk (5.5)

    added:
      mysql-test/suite/perfschema/r/thread_cache.result
      mysql-test/suite/perfschema/t/thread_cache.test
    modified:
      sql/mysqld.cc
 3119 Marc Alff	2010-07-15
      Bug#52134 performance schema file io, symlink in path
      
      Backport from mysql-next-mr (5.6) to mysql-trunk (5.5)

    modified:
      storage/perfschema/pfs_instr.cc
=== modified file 'include/Makefile.am'
--- a/include/Makefile.am	2010-07-15 11:13:30 +0000
+++ b/include/Makefile.am	2010-07-16 14:43:04 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2000-2006 MySQL AB, 2009 Sun Microsystems, Inc
+# Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Library General Public
@@ -15,6 +15,8 @@
 # Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
 # MA 02111-1307, USA
 
+pkgpsiincludedir =      $(pkgincludedir)/psi
+
 BUILT_SOURCES =		$(HEADERS_GEN_MAKE) link_sources probes_mysql_nodtrace.h
 HEADERS_GEN_CONFIGURE =		mysql_version.h
 HEADERS_GEN_MAKE =		my_config.h
@@ -25,8 +27,6 @@ pkginclude_HEADERS =	$(HEADERS_ABI) my_d
 			my_xml.h mysql_embed.h mysql/services.h \
 			mysql/service_my_snprintf.h mysql/service_thd_alloc.h \
 		  	my_pthread.h my_no_pthread.h \
-			mysql/psi/psi.h mysql/psi/mysql_thread.h \
-			mysql/psi/mysql_file.h \
 			decimal.h errmsg.h my_global.h my_net.h \
 			my_getopt.h sslopt-longopts.h my_dir.h \
 			sslopt-vars.h sslopt-case.h sql_common.h keycache.h \
@@ -47,6 +47,9 @@ noinst_HEADERS =	config-win.h lf.h my_bi
 			atomic/gcc_builtins.h my_libwrap.h my_stacktrace.h \
 			atomic/solaris.h mysql/innodb_priv.h
 
+pkgpsiinclude_HEADERS = mysql/psi/psi.h mysql/psi/mysql_thread.h \
+			mysql/psi/mysql_file.h
+
 EXTRA_DIST =        mysql.h.pp mysql/plugin.h.pp probes_mysql.d.base \
 			CMakeLists.txt \
 			mysql/psi/psi_abi_v1.h.pp \

=== modified file 'mysql-test/suite/perfschema/r/myisam_file_io.result'
--- a/mysql-test/suite/perfschema/r/myisam_file_io.result	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/r/myisam_file_io.result	2010-07-16 14:21:07 +0000
@@ -4,6 +4,7 @@ update performance_schema.SETUP_INSTRUME
 update performance_schema.SETUP_CONSUMERS
 set enabled='YES';
 truncate table performance_schema.EVENTS_WAITS_HISTORY_LONG;
+flush status;
 drop table if exists test.no_index_tab;
 create table test.no_index_tab ( a varchar(255), b int ) engine=myisam;
 insert into no_index_tab set a = 'foo', b = 1;

=== modified file 'mysql-test/suite/perfschema/r/query_cache.result'
--- a/mysql-test/suite/perfschema/r/query_cache.result	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/r/query_cache.result	2010-07-16 14:28:19 +0000
@@ -4,6 +4,7 @@ insert into t1 values (1), (2), (3);
 SET GLOBAL query_cache_size=1355776;
 flush query cache;
 reset query cache;
+flush status;
 select * from t1;
 a
 1

=== added file 'mysql-test/suite/perfschema/r/thread_cache.result'
--- a/mysql-test/suite/perfschema/r/thread_cache.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/r/thread_cache.result	2010-07-16 13:50:50 +0000
@@ -0,0 +1,34 @@
+SET @saved_thread_cache_size = @@global.thread_cache_size;
+set global thread_cache_size = 0;
+show variables like "thread_cache_size";
+Variable_name	Value
+thread_cache_size	0
+select @id_increment;
+@id_increment
+1
+select @thread_id_increment;
+@thread_id_increment
+1
+select @id_increment;
+@id_increment
+1
+select @thread_id_increment;
+@thread_id_increment
+1
+set global thread_cache_size = 100;
+show variables like "thread_cache_size";
+Variable_name	Value
+thread_cache_size	100
+select @id_increment;
+@id_increment
+1
+select @thread_id_increment;
+@thread_id_increment
+1
+select @id_increment;
+@id_increment
+1
+select @thread_id_increment;
+@thread_id_increment
+1
+set global thread_cache_size = @saved_thread_cache_size;

=== modified file 'mysql-test/suite/perfschema/t/myisam_file_io.test'
--- a/mysql-test/suite/perfschema/t/myisam_file_io.test	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/t/myisam_file_io.test	2010-07-16 14:21:07 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2009 Sun Microsystems, Inc
+# Copyright (c) 2009, 2010, 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
@@ -10,8 +10,8 @@
 # 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# along with this program; if not, write to the Free Software Foundation,
+# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
 
 # Tests for PERFORMANCE_SCHEMA
 
@@ -29,6 +29,9 @@ update performance_schema.SETUP_CONSUMER
 
 truncate table performance_schema.EVENTS_WAITS_HISTORY_LONG;
 
+# Reset lost counters to a known state
+flush status;
+
 # Code to test
 
 --disable_warnings

=== modified file 'mysql-test/suite/perfschema/t/query_cache.test'
--- a/mysql-test/suite/perfschema/t/query_cache.test	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/t/query_cache.test	2010-07-16 14:28:19 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2009 Sun Microsystems, Inc
+# Copyright (c) 2009, 2010, 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
@@ -10,8 +10,8 @@
 # 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# along with this program; if not, write to the Free Software Foundation,
+# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
 
 # Tests for PERFORMANCE_SCHEMA
 
@@ -33,6 +33,8 @@ SET GLOBAL query_cache_size=1355776;
 
 flush query cache;
 reset query cache;
+# Reset Qcache_* to a known state
+flush status;
 
 select * from t1;
 

=== added file 'mysql-test/suite/perfschema/t/thread_cache.test'
--- a/mysql-test/suite/perfschema/t/thread_cache.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/t/thread_cache.test	2010-07-16 13:50:50 +0000
@@ -0,0 +1,134 @@
+# Copyright (c) 2010, 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,
+# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
+
+# Tests for PERFORMANCE_SCHEMA
+
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+# Setup
+
+SET @saved_thread_cache_size = @@global.thread_cache_size;
+
+set global thread_cache_size = 0;
+
+show variables like "thread_cache_size";
+
+connect (con1, localhost, root, , );
+
+let $con1_ID=`select connection_id()`;
+
+let $con1_THREAD_ID=`select thread_id from performance_schema.PROCESSLIST
+  where ID = connection_id()`;
+
+connect (con2, localhost, root, , );
+
+let $con2_ID=`select connection_id()`;
+
+let $con2_THREAD_ID=`select thread_id from performance_schema.PROCESSLIST
+  where ID = connection_id()`;
+
+connection default;
+
+--disable_query_log
+eval select ($con2_ID - $con1_ID) into @id_increment;
+eval select ($con2_THREAD_ID - $con1_THREAD_ID) into @thread_id_increment;
+--enable_query_log
+
+# Expect 1, connection_id() is incremented for each new connection
+select @id_increment;
+# Expect 1, THREAD_ID is incremented for each new connection
+select @thread_id_increment;
+
+disconnect con2;
+
+connect (con3, localhost, root, , );
+
+let $con3_ID=`select connection_id()`;
+
+let $con3_THREAD_ID=`select thread_id from performance_schema.PROCESSLIST
+  where ID = connection_id()`;
+
+disconnect con3;
+disconnect con1;
+
+connection default;
+
+--disable_query_log
+eval select ($con3_ID - $con2_ID) into @id_increment;
+eval select ($con3_THREAD_ID - $con2_THREAD_ID) into @thread_id_increment;
+--enable_query_log
+
+select @id_increment;
+select @thread_id_increment;
+
+set global thread_cache_size = 100;
+
+show variables like "thread_cache_size";
+
+connect (con1, localhost, root, , );
+
+let $con1_ID=`select connection_id()`;
+
+let $con1_THREAD_ID=`select thread_id from performance_schema.PROCESSLIST
+  where ID = connection_id()`;
+
+connect (con2, localhost, root, , );
+
+let $con2_ID=`select connection_id()`;
+
+let $con2_THREAD_ID=`select thread_id from performance_schema.PROCESSLIST
+  where ID = connection_id()`;
+
+connection default;
+
+--disable_query_log
+eval select ($con2_ID - $con1_ID) into @id_increment;
+eval select ($con2_THREAD_ID - $con1_THREAD_ID) into @thread_id_increment;
+--enable_query_log
+
+select @id_increment;
+select @thread_id_increment;
+
+disconnect con2;
+
+connect (con3, localhost, root, , );
+
+let $con3_ID=`select connection_id()`;
+
+let $con3_THREAD_ID=`select thread_id from performance_schema.PROCESSLIST
+  where ID = connection_id()`;
+
+disconnect con3;
+disconnect con1;
+
+connection default;
+
+--disable_query_log
+eval select ($con3_ID - $con2_ID) into @id_increment;
+eval select ($con3_THREAD_ID - $con2_THREAD_ID) into @thread_id_increment;
+--enable_query_log
+
+# When caching threads, the pthread that executed con2 was parked in the
+# cache on disconnect, and then picked up con3.
+
+# Still expect a new connection_id()
+select @id_increment;
+
+# And expect a new instrumentation: the THREAD_ID of old connections should not be reused.
+select @thread_id_increment;
+
+set global thread_cache_size = @saved_thread_cache_size;
+

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2010-07-15 11:13:30 +0000
+++ b/sql/mysqld.cc	2010-07-16 14:01:47 +0000
@@ -1,4 +1,4 @@
-/* Copyright 2000-2008 MySQL AB, 2008-2009 Sun Microsystems, Inc.
+/* Copyright (c) 2000, 2010, 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
@@ -741,7 +741,15 @@ void Buffered_log::print()
     sql_print_warning("Buffered warning: %s\n", m_message.c_ptr_safe());
     break;
   case INFORMATION_LEVEL:
-    sql_print_information("Buffered information: %s\n", m_message.c_ptr_safe());
+    /*
+      Messages printed as "information" still end up in the mysqld *error* log,
+      but with a [Note] tag instead of an [ERROR] tag.
+      While this is probably fine for a human reading the log,
+      it is upsetting existing automated scripts used to parse logs,
+      because such scripts are likely to not already handle [Note] properly.
+      INFORMATION_LEVEL messages are simply silenced, on purpose,
+      to avoid un needed verbosity.
+    */
     break;
   }
 }
@@ -2068,6 +2076,16 @@ static bool cache_thread()
     /* Don't kill the thread, just put it in cache for reuse */
     DBUG_PRINT("info", ("Adding thread to cache"));
     cached_thread_count++;
+
+#ifdef HAVE_PSI_INTERFACE
+    /*
+      Delete the instrumentation for the job that just completed,
+      before parking this pthread in the cache (blocked on COND_thread_cache).
+    */
+    if (likely(PSI_server != NULL))
+      PSI_server->delete_current_thread();
+#endif
+
     while (!abort_loop && ! wake_thread && ! kill_cached_threads)
       mysql_cond_wait(&COND_thread_cache, &LOCK_thread_count);
     cached_thread_count--;
@@ -2080,6 +2098,21 @@ static bool cache_thread()
       thd= thread_cache.get();
       thd->thread_stack= (char*) &thd;          // For store_globals
       (void) thd->store_globals();
+
+#ifdef HAVE_PSI_INTERFACE
+      /*
+        Create new instrumentation for the new THD job,
+        and attach it to this running pthread.
+      */
+      if (likely(PSI_server != NULL))
+      {
+        PSI_thread *psi= PSI_server->new_thread(key_thread_one_connection,
+                                                thd, thd->thread_id);
+        if (likely(psi != NULL))
+          PSI_server->set_thread(psi);
+      }
+#endif
+
       /*
         THD::mysys_var::abort is associated with physical thread rather
         than with THD object. So we need to reset this flag before using
@@ -4252,16 +4285,6 @@ int mysqld_main(int argc, char **argv)
         buffered_logs.buffer(WARNING_LEVEL,
                              "Performance schema disabled (reason: init failed).");
       }
-      else
-      {
-        buffered_logs.buffer(INFORMATION_LEVEL,
-                             "Performance schema enabled.");
-      }
-    }
-    else
-    {
-      buffered_logs.buffer(INFORMATION_LEVEL,
-                           "Performance schema disabled (reason: start parameters).");
     }
   }
 #else
@@ -4525,7 +4548,14 @@ int mysqld_main(int argc, char **argv)
 
 #ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
   initialize_performance_schema_acl(opt_bootstrap);
-  check_performance_schema();
+  /*
+    Do not check the structure of the performance schema tables
+    during bootstrap:
+    - the tables are not supposed to exist yet, bootstrap will create them
+    - a check would print spurious error messages
+  */
+  if (! opt_bootstrap)
+    check_performance_schema();
 #endif
 
   initialize_information_schema_acl();


Attachment: [text/bzr-bundle] bzr/marc.alff@oracle.com-20100716144304-2s9nd5f3fnmm4906.bundle
Thread
bzr push into mysql-trunk-bugfixing branch (marc.alff:3119 to 3124) Bug#53255Marc Alff16 Jul