List:Commits« Previous MessageNext Message »
From:Marc Alff Date:November 2 2011 11:57pm
Subject:bzr push into mysql-trunk branch (marc.alff:3426 to 3427)
View as plain text  
 3427 Marc Alff	2011-11-02 [merge]
      Merge from trunk + pfs_benchmark-t.cc

    added:
      include/mysql/psi/psi_abi_v0.h
      include/mysql/psi/psi_abi_v0.h.pp
    modified:
      cmake/abi_check.cmake
      include/mysql/psi/psi.h
      include/mysql/psi/psi_abi_v1.h.pp
      include/mysql/psi/psi_abi_v2.h.pp
      mysql-test/r/mysqld--help-notwin.result
      mysql-test/r/mysqld--help-win.result
      mysql-test/r/query_cache.result
      mysql-test/suite/perfschema/r/nesting.result
      mysql-test/suite/perfschema/t/nesting.test
      mysql-test/t/query_cache.test
      sql/mysqld.cc
      sql/sql_class.h
      sql/sql_parse.cc
      storage/perfschema/unittest/pfs_benchmark-t.cc
 3426 Marc Alff	2011-11-02 [merge]
      Merge mysql-trunk --> mysql-trunk-pfs-tuning

    removed:
      storage/perfschema/table_file_summary.cc
      storage/perfschema/table_file_summary.h
    added:
      include/mysql_com_server.h
      mysql-test/suite/perfschema/r/nesting.result
      mysql-test/suite/perfschema/t/nesting.test
      mysql-test/suite/rpl/r/rpl_rotate_purge_deadlock.result
      mysql-test/suite/rpl/t/rpl_rotate_purge_deadlock-master.opt
      mysql-test/suite/rpl/t/rpl_rotate_purge_deadlock.test
      storage/perfschema/table_file_summary_by_event_name.cc
      storage/perfschema/table_file_summary_by_event_name.h
      storage/perfschema/table_file_summary_by_instance.cc
      storage/perfschema/table_file_summary_by_instance.h
    modified:
      include/CMakeLists.txt
      include/mysql.h.pp
      include/mysql/psi/mysql_idle.h
      include/mysql/psi/psi.h
      include/mysql_com.h
      mysql-test/CMakeLists.txt
      mysql-test/collections/default.experimental
      mysql-test/extra/rpl_tests/rpl_parallel_load.test
      mysql-test/include/index_merge1.inc
      mysql-test/include/index_merge2.inc
      mysql-test/include/index_merge_ror.inc
      mysql-test/include/subquery_mat.inc
      mysql-test/include/subquery_sj.inc
      mysql-test/r/derived.result
      mysql-test/r/func_rollback.result
      mysql-test/r/func_time.result
      mysql-test/r/index_merge_innodb.result
      mysql-test/r/mysqld--help-notwin.result
      mysql-test/r/mysqld--help-win.result
      mysql-test/r/optimizer_switch.result
      mysql-test/r/signal.result
      mysql-test/r/sp-error.result
      mysql-test/r/sp.result
      mysql-test/r/subquery_all.result
      mysql-test/r/subquery_all_bka.result
      mysql-test/r/subquery_all_bka_nixbnl.result
      mysql-test/r/subquery_mat.result
      mysql-test/r/subquery_mat_all.result
      mysql-test/r/subquery_sj_all.result
      mysql-test/r/subquery_sj_all_bka.result
      mysql-test/r/subquery_sj_all_bka_nixbnl.result
      mysql-test/r/subquery_sj_all_bkaunique.result
      mysql-test/r/subquery_sj_dupsweed.result
      mysql-test/r/subquery_sj_dupsweed_bka.result
      mysql-test/r/subquery_sj_dupsweed_bka_nixbnl.result
      mysql-test/r/subquery_sj_dupsweed_bkaunique.result
      mysql-test/r/subquery_sj_firstmatch.result
      mysql-test/r/subquery_sj_firstmatch_bka.result
      mysql-test/r/subquery_sj_firstmatch_bka_nixbnl.result
      mysql-test/r/subquery_sj_firstmatch_bkaunique.result
      mysql-test/r/subquery_sj_loosescan.result
      mysql-test/r/subquery_sj_loosescan_bka.result
      mysql-test/r/subquery_sj_loosescan_bka_nixbnl.result
      mysql-test/r/subquery_sj_loosescan_bkaunique.result
      mysql-test/r/subquery_sj_mat.result
      mysql-test/r/subquery_sj_mat_bka.result
      mysql-test/r/subquery_sj_mat_bka_nixbnl.result
      mysql-test/r/subquery_sj_mat_bkaunique.result
      mysql-test/r/subquery_sj_mat_nosj.result
      mysql-test/r/subquery_sj_none.result
      mysql-test/r/subquery_sj_none_bka.result
      mysql-test/r/subquery_sj_none_bka_nixbnl.result
      mysql-test/r/subquery_sj_none_bkaunique.result
      mysql-test/r/view_grant.result
      mysql-test/suite/funcs_1/r/storedproc.result
      mysql-test/suite/opt_trace/r/bugs_no_prot_all.result
      mysql-test/suite/opt_trace/r/bugs_ps_prot_all.result
      mysql-test/suite/opt_trace/r/general_no_prot_all.result
      mysql-test/suite/opt_trace/r/general_ps_prot_all.result
      mysql-test/suite/opt_trace/r/range_no_prot.result
      mysql-test/suite/opt_trace/r/range_ps_prot.result
      mysql-test/suite/perfschema/include/event_aggregate_setup.inc
      mysql-test/suite/perfschema/r/event_aggregate.result
      mysql-test/suite/perfschema/r/event_aggregate_no_a.result
      mysql-test/suite/perfschema/r/event_aggregate_no_a_no_h.result
      mysql-test/suite/perfschema/r/event_aggregate_no_a_no_u.result
      mysql-test/suite/perfschema/r/event_aggregate_no_a_no_u_no_h.result
      mysql-test/suite/perfschema/r/event_aggregate_no_h.result
      mysql-test/suite/perfschema/r/event_aggregate_no_u.result
      mysql-test/suite/perfschema/r/event_aggregate_no_u_no_h.result
      mysql-test/suite/perfschema/r/ortho_iter.result
      mysql-test/suite/perfschema/r/pfs_upgrade.result
      mysql-test/suite/perfschema/r/privilege_table_io.result
      mysql-test/suite/perfschema/r/relaylog.result
      mysql-test/suite/perfschema/r/schema.result
      mysql-test/suite/perfschema/r/start_server_innodb.result
      mysql-test/suite/perfschema/r/start_server_no_account.result
      mysql-test/suite/perfschema/r/start_server_no_cond_class.result
      mysql-test/suite/perfschema/r/start_server_no_cond_inst.result
      mysql-test/suite/perfschema/r/start_server_no_file_class.result
      mysql-test/suite/perfschema/r/start_server_no_file_inst.result
      mysql-test/suite/perfschema/r/start_server_no_host.result
      mysql-test/suite/perfschema/r/start_server_no_mutex_class.result
      mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result
      mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result
      mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result
      mysql-test/suite/perfschema/r/start_server_no_setup_actors.result
      mysql-test/suite/perfschema/r/start_server_no_setup_objects.result
      mysql-test/suite/perfschema/r/start_server_no_socket_class.result
      mysql-test/suite/perfschema/r/start_server_no_socket_inst.result
      mysql-test/suite/perfschema/r/start_server_no_stage_class.result
      mysql-test/suite/perfschema/r/start_server_no_stages_history.result
      mysql-test/suite/perfschema/r/start_server_no_stages_history_long.result
      mysql-test/suite/perfschema/r/start_server_no_statements_history.result
      mysql-test/suite/perfschema/r/start_server_no_statements_history_long.result
      mysql-test/suite/perfschema/r/start_server_no_table_hdl.result
      mysql-test/suite/perfschema/r/start_server_no_table_inst.result
      mysql-test/suite/perfschema/r/start_server_no_thread_class.result
      mysql-test/suite/perfschema/r/start_server_no_thread_inst.result
      mysql-test/suite/perfschema/r/start_server_no_user.result
      mysql-test/suite/perfschema/r/start_server_no_waits_history.result
      mysql-test/suite/perfschema/r/start_server_no_waits_history_long.result
      mysql-test/suite/perfschema/r/start_server_nothing.result
      mysql-test/suite/perfschema/r/start_server_off.result
      mysql-test/suite/perfschema/r/start_server_on.result
      mysql-test/suite/perfschema/r/table_aggregate_global_2u_2t.result
      mysql-test/suite/perfschema/r/table_aggregate_global_2u_3t.result
      mysql-test/suite/perfschema/r/table_aggregate_global_4u_2t.result
      mysql-test/suite/perfschema/r/table_aggregate_global_4u_3t.result
      mysql-test/suite/perfschema/r/table_aggregate_hist_2u_2t.result
      mysql-test/suite/perfschema/r/table_aggregate_hist_2u_3t.result
      mysql-test/suite/perfschema/r/table_aggregate_hist_4u_2t.result
      mysql-test/suite/perfschema/r/table_aggregate_hist_4u_3t.result
      mysql-test/suite/perfschema/r/table_aggregate_off.result
      mysql-test/suite/perfschema/r/table_aggregate_thread_2u_2t.result
      mysql-test/suite/perfschema/r/table_aggregate_thread_2u_3t.result
      mysql-test/suite/perfschema/r/table_aggregate_thread_4u_2t.result
      mysql-test/suite/perfschema/r/table_aggregate_thread_4u_3t.result
      mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_2t.result
      mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_3t.result
      mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_2t.result
      mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_3t.result
      mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_2t.result
      mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_3t.result
      mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_2t.result
      mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_3t.result
      mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_2t.result
      mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_3t.result
      mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_2t.result
      mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_3t.result
      mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_2t.result
      mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_3t.result
      mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_2t.result
      mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_3t.result
      mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_2t.result
      mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_3t.result
      mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_2t.result
      mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_3t.result
      mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_2t.result
      mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_3t.result
      mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_2t.result
      mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_3t.result
      mysql-test/suite/perfschema/r/table_schema.result
      mysql-test/suite/rpl/r/rpl_checksum.result
      mysql-test/suite/rpl/r/rpl_log_pos.result
      mysql-test/suite/rpl/r/rpl_manual_change_index_file.result
      mysql-test/suite/rpl/t/rpl_checksum.test
      mysql-test/suite/rpl/t/rpl_log_pos.test
      mysql-test/suite/rpl/t/rpl_manual_change_index_file.test
      mysql-test/suite/rpl/t/rpl_packet.test
      mysql-test/suite/rpl/t/rpl_row_event_max_size.test
      mysql-test/suite/sys_vars/r/sort_buffer_size_basic_32.result*
      mysql-test/suite/sys_vars/r/sort_buffer_size_basic_64.result
      mysql-test/t/derived.test
      mysql-test/t/func_time.test
      mysql-test/t/index_merge_innodb.test
      mysql-test/t/signal.test
      mysql-test/t/sp-error.test
      scripts/mysql_system_tables.sql
      sql-common/my_time.c
      sql/binlog.cc
      sql/binlog.h
      sql/log.cc
      sql/log.h
      sql/mysqld.cc
      sql/mysqld.h
      sql/net_serv.cc
      sql/rpl_master.cc
      sql/sp_head.cc
      sql/sql_class.cc
      sql/sql_class.h
      sql/sql_const.h
      sql/sql_join_cache.cc
      sql/sql_parse.cc
      sql/sql_reload.cc
      sql/sql_select.cc
      sql/sql_select.h
      sql/sys_vars.cc
      storage/innobase/fil/fil0fil.c
      storage/innobase/fsp/fsp0fsp.c
      storage/innobase/include/buf0buf.h
      storage/innobase/include/fil0fil.h
      storage/innobase/include/fsp0fsp.h
      storage/innobase/lock/lock0lock.c
      storage/innobase/row/row0umod.c
      storage/innobase/srv/srv0start.c
      storage/perfschema/CMakeLists.txt
      storage/perfschema/pfs.cc
      storage/perfschema/pfs_engine_table.cc
      storage/perfschema/pfs_instr.cc
      storage/perfschema/pfs_instr.h
      storage/perfschema/pfs_stat.h
      storage/perfschema/pfs_visitor.cc
      storage/perfschema/pfs_visitor.h
      storage/perfschema/table_helper.h
      storage/perfschema/table_socket_summary_by_instance.cc
=== modified file 'cmake/abi_check.cmake'
--- a/cmake/abi_check.cmake	2011-06-30 15:50:45 +0000
+++ b/cmake/abi_check.cmake	2011-11-02 23:29:01 +0000
@@ -39,6 +39,7 @@ IF(CMAKE_COMPILER_IS_GNUCC AND RUN_ABI_C
     ${CMAKE_SOURCE_DIR}/include/mysql/plugin_audit.h
     ${CMAKE_SOURCE_DIR}/include/mysql/plugin_ftparser.h
     ${CMAKE_SOURCE_DIR}/include/mysql.h
+    ${CMAKE_SOURCE_DIR}/include/mysql/psi/psi_abi_v0.h
     ${CMAKE_SOURCE_DIR}/include/mysql/psi/psi_abi_v1.h
     ${CMAKE_SOURCE_DIR}/include/mysql/psi/psi_abi_v2.h
     ${CMAKE_SOURCE_DIR}/include/mysql/client_plugin.h

=== modified file 'include/mysql/psi/psi.h'
--- a/include/mysql/psi/psi.h	2011-11-02 13:43:41 +0000
+++ b/include/mysql/psi/psi.h	2011-11-02 23:56:22 +0000
@@ -83,6 +83,12 @@ struct PSI_thread;
 struct PSI_file;
 
 /**
+  Interface for an instrumented socket descriptor.
+  This is an opaque structure.
+*/
+struct PSI_socket;
+
+/**
   Interface for an instrumented table operation.
   This is an opaque structure.
 */
@@ -95,10 +101,10 @@ struct PSI_table_locker;
 struct PSI_statement_locker;
 
 /**
-  Interface for an instrumented socket descriptor.
+  Interface for an instrumented idle operation.
   This is an opaque structure.
 */
-struct PSI_socket;
+struct PSI_idle_locker;
 
 /** Entry point for the performance schema interface. */
 struct PSI_bootstrap
@@ -261,12 +267,6 @@ struct PSI_bootstrap
 #endif
 
 /**
-  Interface for an instrumented idle operation.
-  This is an opaque structure.
-*/
-struct PSI_idle_locker;
-
-/**
   Interface for an instrumented mutex operation.
   This is an opaque structure.
 */

=== added file 'include/mysql/psi/psi_abi_v0.h'
--- a/include/mysql/psi/psi_abi_v0.h	1970-01-01 00:00:00 +0000
+++ b/include/mysql/psi/psi_abi_v0.h	2011-11-02 23:29:01 +0000
@@ -0,0 +1,24 @@
+/* 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,
+  51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
+
+/**
+  @file mysql/psi/psi_abi_v0.h
+  ABI check for mysql/psi/psi.h, when compiling without instrumentation.
+  This file is only used to automate detection of changes between versions.
+  Do not include this file, include mysql/psi/psi.h instead.
+*/
+#define _global_h
+#include "mysql/psi/psi.h"
+

=== added file 'include/mysql/psi/psi_abi_v0.h.pp'
--- a/include/mysql/psi/psi_abi_v0.h.pp	1970-01-01 00:00:00 +0000
+++ b/include/mysql/psi/psi_abi_v0.h.pp	2011-11-02 23:29:01 +0000
@@ -0,0 +1,32 @@
+#include "mysql/psi/psi.h"
+C_MODE_START
+struct TABLE_SHARE;
+struct PSI_mutex;
+struct PSI_rwlock;
+struct PSI_cond;
+struct PSI_table_share;
+struct PSI_table;
+struct PSI_thread;
+struct PSI_file;
+struct PSI_socket;
+struct PSI_table_locker;
+struct PSI_statement_locker;
+struct PSI_idle_locker;
+struct PSI_bootstrap
+{
+  void* (*get_interface)(int version);
+};
+struct PSI_none
+{
+  int opaque;
+};
+typedef struct PSI_none PSI;
+struct PSI_stage_info_none
+{
+  unsigned int m_key;
+  const char *m_name;
+  int m_flags;
+};
+typedef struct PSI_stage_info_none PSI_stage_info;
+extern MYSQL_PLUGIN_IMPORT PSI *PSI_server;
+C_MODE_END

=== modified file 'include/mysql/psi/psi_abi_v1.h.pp'
--- a/include/mysql/psi/psi_abi_v1.h.pp	2011-09-26 23:52:40 +0000
+++ b/include/mysql/psi/psi_abi_v1.h.pp	2011-11-02 23:56:22 +0000
@@ -8,14 +8,14 @@ struct PSI_table_share;
 struct PSI_table;
 struct PSI_thread;
 struct PSI_file;
+struct PSI_socket;
 struct PSI_table_locker;
 struct PSI_statement_locker;
-struct PSI_socket;
+struct PSI_idle_locker;
 struct PSI_bootstrap
 {
   void* (*get_interface)(int version);
 };
-struct PSI_idle_locker;
 struct PSI_mutex_locker;
 struct PSI_rwlock_locker;
 struct PSI_cond_locker;

=== modified file 'include/mysql/psi/psi_abi_v2.h.pp'
--- a/include/mysql/psi/psi_abi_v2.h.pp	2011-06-06 20:16:03 +0000
+++ b/include/mysql/psi/psi_abi_v2.h.pp	2011-11-02 23:29:01 +0000
@@ -8,14 +8,14 @@ struct PSI_table_share;
 struct PSI_table;
 struct PSI_thread;
 struct PSI_file;
+struct PSI_socket;
 struct PSI_table_locker;
 struct PSI_statement_locker;
-struct PSI_socket;
+struct PSI_idle_locker;
 struct PSI_bootstrap
 {
   void* (*get_interface)(int version);
 };
-struct PSI_idle_locker;
 struct PSI_mutex_locker;
 struct PSI_rwlock_locker;
 struct PSI_cond_locker;

=== modified file 'mysql-test/r/mysqld--help-notwin.result'
--- a/mysql-test/r/mysqld--help-notwin.result	2011-10-31 08:11:22 +0000
+++ b/mysql-test/r/mysqld--help-notwin.result	2011-11-02 16:07:18 +0000
@@ -978,7 +978,7 @@ performance-schema-max-rwlock-instances 
 performance-schema-max-socket-classes 10
 performance-schema-max-socket-instances 1000
 performance-schema-max-stage-classes 150
-performance-schema-max-statement-classes 166
+performance-schema-max-statement-classes 167
 performance-schema-max-table-handles 10000
 performance-schema-max-table-instances 1000
 performance-schema-max-thread-classes 50

=== modified file 'mysql-test/r/mysqld--help-win.result'
--- a/mysql-test/r/mysqld--help-win.result	2011-10-31 08:11:22 +0000
+++ b/mysql-test/r/mysqld--help-win.result	2011-11-02 16:07:18 +0000
@@ -982,7 +982,7 @@ performance-schema-max-rwlock-instances 
 performance-schema-max-socket-classes 10
 performance-schema-max-socket-instances 1000
 performance-schema-max-stage-classes 150
-performance-schema-max-statement-classes 166
+performance-schema-max-statement-classes 167
 performance-schema-max-table-handles 10000
 performance-schema-max-table-instances 1000
 performance-schema-max-thread-classes 50

=== modified file 'mysql-test/r/query_cache.result'
--- a/mysql-test/r/query_cache.result	2011-10-05 13:16:38 +0000
+++ b/mysql-test/r/query_cache.result	2011-11-02 13:28:15 +0000
@@ -1583,6 +1583,58 @@ show status like 'Qcache_free_blocks';
 Variable_name	Value
 Qcache_free_blocks	0
 Restore default values.
+drop database if exists db1;
+drop database if exists db2;
+set GLOBAL query_cache_size=15*1024*1024;
+create database db1;
+use db1;
+create table t1(c1 int)engine=myisam;
+insert into t1(c1) values (1);
+select * from db1.t1 f;
+c1
+1
+show status like 'Qcache_queries_in_cache';
+Variable_name	Value
+Qcache_queries_in_cache	1
+create database db2;
+rename table db1.t1 to db2.t2;
+drop database db1;
+show status like 'Qcache_queries_in_cache';
+Variable_name	Value
+Qcache_queries_in_cache	0
+drop database db2;
+set global query_cache_size=default;
+drop database if exists db1;
+drop database if exists db3;
+set GLOBAL query_cache_size=15*1024*1024;
+create database db1;
+create database db3;
+use db1;
+create table t1(c1 int) engine=myisam;
+use db3;
+create table t1(c1 int) engine=myisam;
+use db1;
+insert into t1(c1) values (1);
+use mysql;
+select * from db1.t1;
+c1
+1
+select c1+1 from db1.t1;
+c1+1
+2
+select * from db3.t1;
+c1
+show status like 'Qcache_queries_in_cache';
+Variable_name	Value
+Qcache_queries_in_cache	3
+create database db2;
+rename table db1.t1 to db2.t2;
+drop database db1;
+show status like 'Qcache_queries_in_cache';
+Variable_name	Value
+Qcache_queries_in_cache	1
+drop database db2;
+drop database db3;
 set GLOBAL query_cache_type=default;
 set GLOBAL query_cache_limit=default;
 set GLOBAL query_cache_min_res_unit=default;
@@ -1609,7 +1661,7 @@ c1
 2
 SHOW STATUS LIKE 'Qcache_hits';
 Variable_name	Value
-Qcache_hits	1
+Qcache_hits	0
 DROP TABLE t1;
 SET GLOBAL concurrent_insert= @save_concurrent_insert;
 SET GLOBAL query_cache_size= default;
@@ -1639,7 +1691,7 @@ a
 COMMIT;
 SHOW STATUS LIKE 'Qcache_queries_in_cache';
 Variable_name	Value
-Qcache_queries_in_cache	2
+Qcache_queries_in_cache	0
 SHOW STATUS LIKE "Qcache_hits";
 Variable_name	Value
 Qcache_hits	0
@@ -1661,7 +1713,7 @@ a
 COMMIT;
 SHOW STATUS LIKE "Qcache_hits";
 Variable_name	Value
-Qcache_hits	2
+Qcache_hits	0
 DROP TABLE t1;
 SET GLOBAL query_cache_size= default;
 End of 5.0 tests

=== modified file 'mysql-test/suite/perfschema/r/nesting.result'
--- a/mysql-test/suite/perfschema/r/nesting.result	2011-11-01 16:33:58 +0000
+++ b/mysql-test/suite/perfschema/r/nesting.result	2011-11-02 16:07:18 +0000
@@ -79,111 +79,128 @@ and (end_event_id <= @marker_end)
 ) all_events
 order by relative_event_id asc;
 relative_event_id	relative_end_event_id	event_name	comment	nesting_event_type	relative_nesting_event_id
-0	14	statement/sql/select	select "MARKER_BEGIN" as marker	NULL	NULL
-1	3	stage/sql/init	(stage)	STATEMENT	0
+0	17	statement/sql/select	select "MARKER_BEGIN" as marker	NULL	NULL
+1	5	stage/sql/init	(stage)	STATEMENT	0
 2	2	wait/io/socket/sql/client_connection	recv	STAGE	1
-3	3	wait/io/file/sql/query_log	write	STAGE	1
-4	4	stage/sql/checking permissions	(stage)	STATEMENT	0
-5	5	stage/sql/Opening tables	(stage)	STATEMENT	0
-6	6	stage/sql/init	(stage)	STATEMENT	0
-7	7	stage/sql/optimizing	(stage)	STATEMENT	0
-8	8	stage/sql/executing	(stage)	STATEMENT	0
-9	9	stage/sql/end	(stage)	STATEMENT	0
-10	10	stage/sql/query end	(stage)	STATEMENT	0
-11	11	stage/sql/closing tables	(stage)	STATEMENT	0
-12	13	stage/sql/freeing items	(stage)	STATEMENT	0
-13	13	wait/io/socket/sql/client_connection	send	STAGE	12
-14	14	stage/sql/cleaning up	(stage)	STATEMENT	0
-15	15	idle	idle	NULL	NULL
-16	30	statement/sql/select	select "This is simple statement one" as payload	NULL	NULL
-17	19	stage/sql/init	(stage)	STATEMENT	16
-18	18	wait/io/socket/sql/client_connection	recv	STAGE	17
-19	19	wait/io/file/sql/query_log	write	STAGE	17
-20	20	stage/sql/checking permissions	(stage)	STATEMENT	16
-21	21	stage/sql/Opening tables	(stage)	STATEMENT	16
-22	22	stage/sql/init	(stage)	STATEMENT	16
-23	23	stage/sql/optimizing	(stage)	STATEMENT	16
-24	24	stage/sql/executing	(stage)	STATEMENT	16
-25	25	stage/sql/end	(stage)	STATEMENT	16
-26	26	stage/sql/query end	(stage)	STATEMENT	16
-27	27	stage/sql/closing tables	(stage)	STATEMENT	16
-28	29	stage/sql/freeing items	(stage)	STATEMENT	16
-29	29	wait/io/socket/sql/client_connection	send	STAGE	28
-30	30	stage/sql/cleaning up	(stage)	STATEMENT	16
-31	31	idle	idle	NULL	NULL
-32	46	statement/sql/select	select "This is simple statement two" as payload	NULL	NULL
-33	35	stage/sql/init	(stage)	STATEMENT	32
-34	34	wait/io/socket/sql/client_connection	recv	STAGE	33
-35	35	wait/io/file/sql/query_log	write	STAGE	33
-36	36	stage/sql/checking permissions	(stage)	STATEMENT	32
-37	37	stage/sql/Opening tables	(stage)	STATEMENT	32
-38	38	stage/sql/init	(stage)	STATEMENT	32
-39	39	stage/sql/optimizing	(stage)	STATEMENT	32
-40	40	stage/sql/executing	(stage)	STATEMENT	32
-41	41	stage/sql/end	(stage)	STATEMENT	32
-42	42	stage/sql/query end	(stage)	STATEMENT	32
-43	43	stage/sql/closing tables	(stage)	STATEMENT	32
-44	45	stage/sql/freeing items	(stage)	STATEMENT	32
-45	45	wait/io/socket/sql/client_connection	send	STAGE	44
-46	46	stage/sql/cleaning up	(stage)	STATEMENT	32
-47	47	idle	idle	NULL	NULL
-48	61	statement/sql/select	select "This is the first part of a multi query" as payload;
+3	3	wait/synch/mutex/sql/THD::LOCK_thd_data	lock	STAGE	1
+4	4	wait/synch/mutex/sql/THD::LOCK_thd_data	lock	STAGE	1
+5	5	wait/io/file/sql/query_log	write	STAGE	1
+6	6	stage/sql/checking permissions	(stage)	STATEMENT	0
+7	7	stage/sql/Opening tables	(stage)	STATEMENT	0
+8	8	stage/sql/init	(stage)	STATEMENT	0
+9	9	stage/sql/optimizing	(stage)	STATEMENT	0
+10	10	stage/sql/executing	(stage)	STATEMENT	0
+11	11	stage/sql/end	(stage)	STATEMENT	0
+12	12	stage/sql/query end	(stage)	STATEMENT	0
+13	13	stage/sql/closing tables	(stage)	STATEMENT	0
+14	15	stage/sql/freeing items	(stage)	STATEMENT	0
+15	15	wait/io/socket/sql/client_connection	send	STAGE	14
+16	17	stage/sql/cleaning up	(stage)	STATEMENT	0
+17	17	wait/synch/mutex/sql/THD::LOCK_thd_data	lock	STAGE	16
+18	18	idle	idle	NULL	NULL
+19	36	statement/sql/select	select "This is simple statement one" as payload	NULL	NULL
+20	24	stage/sql/init	(stage)	STATEMENT	19
+21	21	wait/io/socket/sql/client_connection	recv	STAGE	20
+22	22	wait/synch/mutex/sql/THD::LOCK_thd_data	lock	STAGE	20
+23	23	wait/synch/mutex/sql/THD::LOCK_thd_data	lock	STAGE	20
+24	24	wait/io/file/sql/query_log	write	STAGE	20
+25	25	stage/sql/checking permissions	(stage)	STATEMENT	19
+26	26	stage/sql/Opening tables	(stage)	STATEMENT	19
+27	27	stage/sql/init	(stage)	STATEMENT	19
+28	28	stage/sql/optimizing	(stage)	STATEMENT	19
+29	29	stage/sql/executing	(stage)	STATEMENT	19
+30	30	stage/sql/end	(stage)	STATEMENT	19
+31	31	stage/sql/query end	(stage)	STATEMENT	19
+32	32	stage/sql/closing tables	(stage)	STATEMENT	19
+33	34	stage/sql/freeing items	(stage)	STATEMENT	19
+34	34	wait/io/socket/sql/client_connection	send	STAGE	33
+35	36	stage/sql/cleaning up	(stage)	STATEMENT	19
+36	36	wait/synch/mutex/sql/THD::LOCK_thd_data	lock	STAGE	35
+37	37	idle	idle	NULL	NULL
+38	55	statement/sql/select	select "This is simple statement two" as payload	NULL	NULL
+39	43	stage/sql/init	(stage)	STATEMENT	38
+40	40	wait/io/socket/sql/client_connection	recv	STAGE	39
+41	41	wait/synch/mutex/sql/THD::LOCK_thd_data	lock	STAGE	39
+42	42	wait/synch/mutex/sql/THD::LOCK_thd_data	lock	STAGE	39
+43	43	wait/io/file/sql/query_log	write	STAGE	39
+44	44	stage/sql/checking permissions	(stage)	STATEMENT	38
+45	45	stage/sql/Opening tables	(stage)	STATEMENT	38
+46	46	stage/sql/init	(stage)	STATEMENT	38
+47	47	stage/sql/optimizing	(stage)	STATEMENT	38
+48	48	stage/sql/executing	(stage)	STATEMENT	38
+49	49	stage/sql/end	(stage)	STATEMENT	38
+50	50	stage/sql/query end	(stage)	STATEMENT	38
+51	51	stage/sql/closing tables	(stage)	STATEMENT	38
+52	53	stage/sql/freeing items	(stage)	STATEMENT	38
+53	53	wait/io/socket/sql/client_connection	send	STAGE	52
+54	55	stage/sql/cleaning up	(stage)	STATEMENT	38
+55	55	wait/synch/mutex/sql/THD::LOCK_thd_data	lock	STAGE	54
+56	56	idle	idle	NULL	NULL
+57	72	statement/sql/select	select "This is the first part of a multi query" as payload;
 select "And this is the second part of a multi query" as payload;
 select "With a third part to make things complete" as payload	NULL	NULL
-49	51	stage/sql/init	(stage)	STATEMENT	48
-50	50	wait/io/socket/sql/client_connection	recv	STAGE	49
-51	51	wait/io/file/sql/query_log	write	STAGE	49
-52	52	stage/sql/checking permissions	(stage)	STATEMENT	48
-53	53	stage/sql/Opening tables	(stage)	STATEMENT	48
-54	54	stage/sql/init	(stage)	STATEMENT	48
-55	55	stage/sql/optimizing	(stage)	STATEMENT	48
-56	56	stage/sql/executing	(stage)	STATEMENT	48
-57	57	stage/sql/end	(stage)	STATEMENT	48
-58	58	stage/sql/query end	(stage)	STATEMENT	48
-59	59	stage/sql/closing tables	(stage)	STATEMENT	48
-60	61	stage/sql/freeing items	(stage)	STATEMENT	48
-61	61	wait/io/socket/sql/client_connection	send	STAGE	60
-62	74	statement/sql/select	select "And this is the second part of a multi query" as payload;
+58	62	stage/sql/init	(stage)	STATEMENT	57
+59	59	wait/io/socket/sql/client_connection	recv	STAGE	58
+60	60	wait/synch/mutex/sql/THD::LOCK_thd_data	lock	STAGE	58
+61	61	wait/synch/mutex/sql/THD::LOCK_thd_data	lock	STAGE	58
+62	62	wait/io/file/sql/query_log	write	STAGE	58
+63	63	stage/sql/checking permissions	(stage)	STATEMENT	57
+64	64	stage/sql/Opening tables	(stage)	STATEMENT	57
+65	65	stage/sql/init	(stage)	STATEMENT	57
+66	66	stage/sql/optimizing	(stage)	STATEMENT	57
+67	67	stage/sql/executing	(stage)	STATEMENT	57
+68	68	stage/sql/end	(stage)	STATEMENT	57
+69	69	stage/sql/query end	(stage)	STATEMENT	57
+70	70	stage/sql/closing tables	(stage)	STATEMENT	57
+71	72	stage/sql/freeing items	(stage)	STATEMENT	57
+72	72	wait/io/socket/sql/client_connection	send	STAGE	71
+73	86	statement/sql/select	select "And this is the second part of a multi query" as payload;
 select "With a third part to make things complete" as payload	NULL	NULL
-63	64	stage/sql/init	(stage)	STATEMENT	62
-64	64	wait/io/file/sql/query_log	write	STAGE	63
-65	65	stage/sql/checking permissions	(stage)	STATEMENT	62
-66	66	stage/sql/Opening tables	(stage)	STATEMENT	62
-67	67	stage/sql/init	(stage)	STATEMENT	62
-68	68	stage/sql/optimizing	(stage)	STATEMENT	62
-69	69	stage/sql/executing	(stage)	STATEMENT	62
-70	70	stage/sql/end	(stage)	STATEMENT	62
-71	71	stage/sql/query end	(stage)	STATEMENT	62
-72	72	stage/sql/closing tables	(stage)	STATEMENT	62
-73	74	stage/sql/freeing items	(stage)	STATEMENT	62
-74	74	wait/io/socket/sql/client_connection	send	STAGE	73
-75	88	statement/sql/select	select "With a third part to make things complete" as payload	NULL	NULL
-76	77	stage/sql/init	(stage)	STATEMENT	75
-77	77	wait/io/file/sql/query_log	write	STAGE	76
-78	78	stage/sql/checking permissions	(stage)	STATEMENT	75
-79	79	stage/sql/Opening tables	(stage)	STATEMENT	75
-80	80	stage/sql/init	(stage)	STATEMENT	75
-81	81	stage/sql/optimizing	(stage)	STATEMENT	75
-82	82	stage/sql/executing	(stage)	STATEMENT	75
-83	83	stage/sql/end	(stage)	STATEMENT	75
-84	84	stage/sql/query end	(stage)	STATEMENT	75
-85	85	stage/sql/closing tables	(stage)	STATEMENT	75
-86	87	stage/sql/freeing items	(stage)	STATEMENT	75
-87	87	wait/io/socket/sql/client_connection	send	STAGE	86
-88	88	stage/sql/cleaning up	(stage)	STATEMENT	75
-89	89	idle	idle	NULL	NULL
-90	104	statement/sql/select	select "MARKER_END" as marker	NULL	NULL
-91	93	stage/sql/init	(stage)	STATEMENT	90
-92	92	wait/io/socket/sql/client_connection	recv	STAGE	91
-93	93	wait/io/file/sql/query_log	write	STAGE	91
-94	94	stage/sql/checking permissions	(stage)	STATEMENT	90
-95	95	stage/sql/Opening tables	(stage)	STATEMENT	90
-96	96	stage/sql/init	(stage)	STATEMENT	90
-97	97	stage/sql/optimizing	(stage)	STATEMENT	90
-98	98	stage/sql/executing	(stage)	STATEMENT	90
-99	99	stage/sql/end	(stage)	STATEMENT	90
-100	100	stage/sql/query end	(stage)	STATEMENT	90
-101	101	stage/sql/closing tables	(stage)	STATEMENT	90
-102	103	stage/sql/freeing items	(stage)	STATEMENT	90
-103	103	wait/io/socket/sql/client_connection	send	STAGE	102
-104	104	stage/sql/cleaning up	(stage)	STATEMENT	90
+74	76	stage/sql/init	(stage)	STATEMENT	73
+75	75	wait/synch/mutex/sql/THD::LOCK_thd_data	lock	STAGE	74
+76	76	wait/io/file/sql/query_log	write	STAGE	74
+77	77	stage/sql/checking permissions	(stage)	STATEMENT	73
+78	78	stage/sql/Opening tables	(stage)	STATEMENT	73
+79	79	stage/sql/init	(stage)	STATEMENT	73
+80	80	stage/sql/optimizing	(stage)	STATEMENT	73
+81	81	stage/sql/executing	(stage)	STATEMENT	73
+82	82	stage/sql/end	(stage)	STATEMENT	73
+83	83	stage/sql/query end	(stage)	STATEMENT	73
+84	84	stage/sql/closing tables	(stage)	STATEMENT	73
+85	86	stage/sql/freeing items	(stage)	STATEMENT	73
+86	86	wait/io/socket/sql/client_connection	send	STAGE	85
+87	102	statement/sql/select	select "With a third part to make things complete" as payload	NULL	NULL
+88	90	stage/sql/init	(stage)	STATEMENT	87
+89	89	wait/synch/mutex/sql/THD::LOCK_thd_data	lock	STAGE	88
+90	90	wait/io/file/sql/query_log	write	STAGE	88
+91	91	stage/sql/checking permissions	(stage)	STATEMENT	87
+92	92	stage/sql/Opening tables	(stage)	STATEMENT	87
+93	93	stage/sql/init	(stage)	STATEMENT	87
+94	94	stage/sql/optimizing	(stage)	STATEMENT	87
+95	95	stage/sql/executing	(stage)	STATEMENT	87
+96	96	stage/sql/end	(stage)	STATEMENT	87
+97	97	stage/sql/query end	(stage)	STATEMENT	87
+98	98	stage/sql/closing tables	(stage)	STATEMENT	87
+99	100	stage/sql/freeing items	(stage)	STATEMENT	87
+100	100	wait/io/socket/sql/client_connection	send	STAGE	99
+101	102	stage/sql/cleaning up	(stage)	STATEMENT	87
+102	102	wait/synch/mutex/sql/THD::LOCK_thd_data	lock	STAGE	101
+103	103	idle	idle	NULL	NULL
+104	121	statement/sql/select	select "MARKER_END" as marker	NULL	NULL
+105	109	stage/sql/init	(stage)	STATEMENT	104
+106	106	wait/io/socket/sql/client_connection	recv	STAGE	105
+107	107	wait/synch/mutex/sql/THD::LOCK_thd_data	lock	STAGE	105
+108	108	wait/synch/mutex/sql/THD::LOCK_thd_data	lock	STAGE	105
+109	109	wait/io/file/sql/query_log	write	STAGE	105
+110	110	stage/sql/checking permissions	(stage)	STATEMENT	104
+111	111	stage/sql/Opening tables	(stage)	STATEMENT	104
+112	112	stage/sql/init	(stage)	STATEMENT	104
+113	113	stage/sql/optimizing	(stage)	STATEMENT	104
+114	114	stage/sql/executing	(stage)	STATEMENT	104
+115	115	stage/sql/end	(stage)	STATEMENT	104
+116	116	stage/sql/query end	(stage)	STATEMENT	104
+117	117	stage/sql/closing tables	(stage)	STATEMENT	104
+118	119	stage/sql/freeing items	(stage)	STATEMENT	104
+119	119	wait/io/socket/sql/client_connection	send	STAGE	118
+120	121	stage/sql/cleaning up	(stage)	STATEMENT	104
+121	121	wait/synch/mutex/sql/THD::LOCK_thd_data	lock	STAGE	120

=== modified file 'mysql-test/suite/perfschema/t/nesting.test'
--- a/mysql-test/suite/perfschema/t/nesting.test	2011-11-01 16:33:58 +0000
+++ b/mysql-test/suite/perfschema/t/nesting.test	2011-11-02 16:07:18 +0000
@@ -2,6 +2,9 @@
 
 --source include/not_embedded.inc
 --source include/have_perfschema.inc
+# On windows, the socket instrumentation collects an extra "opt"
+# event, which changes the test output.
+--source include/not_windows.inc
 --source ../include/no_protocol.inc
 --source ../include/wait_for_pfs_thread_count.inc
 
@@ -30,8 +33,11 @@ update performance_schema.setup_instrume
 
 update performance_schema.setup_instruments set enabled='YES', timed='YES'
   where name in ('idle',
+                 'wait/io/table/sql/handler',
+                 'wait/lock/table/sql/handler',
                  'wait/io/socket/sql/client_connection',
                  'wait/synch/rwlock/sql/LOCK_grant',
+                 'wait/synch/mutex/sql/THD::LOCK_thd_data',
                  'wait/io/file/sql/query_log');
 
 update performance_schema.setup_instruments set enabled='YES', timed='YES'

=== modified file 'mysql-test/t/query_cache.test'
--- a/mysql-test/t/query_cache.test	2011-10-05 13:16:38 +0000
+++ b/mysql-test/t/query_cache.test	2011-11-02 13:28:15 +0000
@@ -1193,47 +1193,48 @@ set global query_cache_type=0;
 show status like 'Qcache_free_blocks';
 
 --echo Restore default values.
-# Bug#28211 RENAME DATABASE and query cache don't play nicely together
-#
-# TODO: enable these tests when RENAME DATABASE is implemented.
-# --disable_warnings
-# drop database if exists db1;
-# drop database if exists db2;
-# --enable_warnings
-# set GLOBAL query_cache_size=15*1024*1024;
-# create database db1;
-# use db1;
-# create table t1(c1 int)engine=myisam;
-# insert into t1(c1) values (1);
-# select * from db1.t1 f;
-# show status like 'Qcache_queries_in_cache';
-# rename schema db1 to db2;
-# show status like 'Qcache_queries_in_cache';
-# drop database db2;
-# set global query_cache_size=default;
-#
-# --disable_warnings
-# drop database if exists db1;
-# drop database if exists db3;
-# --enable_warnings
-# set GLOBAL query_cache_size=15*1024*1024;
-# create database db1;
-# create database db3;
-# use db1;
-# create table t1(c1 int) engine=myisam;
-# use db3;
-# create table t1(c1 int) engine=myisam;
-# use db1;
-# insert into t1(c1) values (1);
-# use mysql;
-# select * from db1.t1;
-# select c1+1 from db1.t1;
-# select * from db3.t1;
-# show status like 'Qcache_queries_in_cache';
-# rename schema db1 to db2;
-# show status like 'Qcache_queries_in_cache';
-# drop database db2;
-# drop database db3;
+ --disable_warnings
+ drop database if exists db1;
+ drop database if exists db2;
+ --enable_warnings
+ set GLOBAL query_cache_size=15*1024*1024;
+ create database db1;
+ use db1;
+ create table t1(c1 int)engine=myisam;
+ insert into t1(c1) values (1);
+ select * from db1.t1 f;
+ show status like 'Qcache_queries_in_cache';
+ create database db2;
+ rename table db1.t1 to db2.t2;
+ drop database db1;
+ show status like 'Qcache_queries_in_cache';
+ drop database db2;
+ set global query_cache_size=default;
+
+ --disable_warnings
+ drop database if exists db1;
+ drop database if exists db3;
+ --enable_warnings
+ set GLOBAL query_cache_size=15*1024*1024;
+ create database db1;
+ create database db3;
+ use db1;
+ create table t1(c1 int) engine=myisam;
+ use db3;
+ create table t1(c1 int) engine=myisam;
+ use db1;
+ insert into t1(c1) values (1);
+ use mysql;
+ select * from db1.t1;
+ select c1+1 from db1.t1;
+ select * from db3.t1;
+ show status like 'Qcache_queries_in_cache';
+ create database db2;
+ rename table db1.t1 to db2.t2; 
+ drop database db1;
+ show status like 'Qcache_queries_in_cache';
+ drop database db2;
+ drop database db3;
 
 set GLOBAL query_cache_type=default;
 set GLOBAL query_cache_limit=default;

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2011-11-01 16:33:58 +0000
+++ b/sql/mysqld.cc	2011-11-02 23:29:01 +0000
@@ -695,7 +695,9 @@ void set_remaining_args(int argc, char *
   remaining_argv= argv;
 }
 
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
 PSI_statement_info stmt_info_new_packet;
+#endif
 
 void net_before_header_psi(struct st_net *net, void *user_data, size_t /* unused: count */)
 {

=== modified file 'sql/sql_class.h'
--- a/sql/sql_class.h	2011-11-01 16:33:58 +0000
+++ b/sql/sql_class.h	2011-11-02 23:29:01 +0000
@@ -2362,12 +2362,16 @@ public:
 
   /** Current statement instrumentation. */
   PSI_statement_locker *m_statement_psi;
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
   /** Current statement instrumentation state. */
   PSI_statement_locker_state m_statement_state;
+#endif
   /** Idle instrumentation. */
   PSI_idle_locker *m_idle_psi;
+#ifdef HAVE_PSI_IDLE_INTERFACE
   /** Idle instrumentation state. */
   PSI_idle_locker_state m_idle_state;
+#endif
   /** True if the server code is IDLE for this connection. */
   bool m_server_idle;
 

=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc	2011-11-02 11:37:46 +0000
+++ b/sql/sql_parse.cc	2011-11-02 18:11:26 +0000
@@ -854,12 +854,20 @@ bool do_command(THD *thd)
 		       net->error,
 		       vio_description(net->vio)));
 
+    /* Instrument this broken statement as "statement/com/error" */
+    thd->m_statement_psi= MYSQL_REFINE_STATEMENT(thd->m_statement_psi,
+                                                 com_statement_info[COM_END].m_key);
+
     /* Check if we can continue without closing the connection */
 
     /* The error must be set. */
     DBUG_ASSERT(thd->is_error());
     thd->protocol->end_statement();
 
+    /* Mark the statement completed. */
+    MYSQL_END_STATEMENT(thd->m_statement_psi, thd->get_stmt_da());
+    thd->m_statement_psi= NULL;
+
     if (net->error != 3)
     {
       return_value= TRUE;                       // We have to close it.
@@ -906,7 +914,7 @@ bool do_command(THD *thd)
   return_value= dispatch_command(command, thd, packet+1, (uint) (packet_length-1));
 
 out:
-  /* The statement instrumentation is closed in dispatch_command() */
+  /* The statement instrumentation must be closed in all cases. */
   DBUG_ASSERT(thd->m_statement_psi == NULL);
   DBUG_RETURN(return_value);
 }
@@ -1207,6 +1215,7 @@ bool dispatch_command(enum enum_server_c
 
 /* PSI end */
       MYSQL_END_STATEMENT(thd->m_statement_psi, thd->get_stmt_da());
+      thd->m_statement_psi= NULL;
 
 /* DTRACE end */
       if (MYSQL_QUERY_DONE_ENABLED())
@@ -1582,16 +1591,16 @@ bool dispatch_command(enum enum_server_c
 
   THD_STAGE_INFO(thd, stage_cleaning_up);
 
-  /* Performance Schema Interface instrumentation, end */
-  MYSQL_END_STATEMENT(thd->m_statement_psi, thd->get_stmt_da());
-  thd->m_statement_psi= NULL;
-
   thd->reset_query();
   thd->set_command(COM_SLEEP);
   dec_thread_running();
   thd->packet.shrink(thd->variables.net_buffer_length);	// Reclaim some memory
   free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC));
 
+  /* Performance Schema Interface instrumentation, end */
+  MYSQL_END_STATEMENT(thd->m_statement_psi, thd->get_stmt_da());
+  thd->m_statement_psi= NULL;
+
   /* DTRACE instrumentation, end */
   if (MYSQL_QUERY_DONE_ENABLED() || MYSQL_COMMAND_DONE_ENABLED())
   {

=== modified file 'storage/perfschema/unittest/pfs_benchmark-t.cc'
--- a/storage/perfschema/unittest/pfs_benchmark-t.cc	2011-10-27 23:08:08 +0000
+++ b/storage/perfschema/unittest/pfs_benchmark-t.cc	2011-11-02 23:56:22 +0000
@@ -24,13 +24,8 @@
 #define DISABLE_PSI_TABLE
 #define DISABLE_PSI_STAGE
 #define DISABLE_PSI_STATEMENT
-
-  Define this to measure the cost of performance_schema disabled
-#define USE_NOOP
-
 */
 
-
 #include "my_global.h"
 #include "my_pthread.h"
 #include "pfs_timer.h"
@@ -49,6 +44,8 @@
 
 #include <string.h> /* memset */
 
+static bool bench_pfs_enabled= false;
+
 static PFS_mutex_class *bench_mutex_class= NULL;
 static mysql_mutex_t bench_mutex;
 static PSI_mutex_key bench_mutex_key;
@@ -89,7 +86,7 @@ static PSI_thread_info all_bench_threads
 // static PSI_table_share *bench_table_share= NULL;
 static PSI_table *bench_table_handle= NULL;
 
-static void setup()
+static void setup(bool pfs_enabled)
 {
   PFS_global_param param;
 
@@ -124,14 +121,17 @@ static void setup()
   param.m_events_statements_history_sizing= 0;
   param.m_events_statements_history_long_sizing= 0;
 
-#ifndef USE_NOOP
-  PSI_bootstrap *boot;
-  boot= initialize_performance_schema(& param);
-  ok(boot != NULL, "boot");
-  ok(boot->get_interface != NULL, "boot->get_interface");
+  bench_pfs_enabled= pfs_enabled;
 
-  PSI_server= (PSI*) boot->get_interface(PSI_CURRENT_VERSION);
-#endif
+  if (pfs_enabled)
+  {
+    PSI_bootstrap *boot;
+    boot= initialize_performance_schema(& param);
+    ok(boot != NULL, "boot");
+    ok(boot->get_interface != NULL, "boot->get_interface");
+
+    PSI_server= (PSI*) boot->get_interface(PSI_CURRENT_VERSION);
+  }
 
   ok(PSI_server != NULL, "current version");
 
@@ -142,23 +142,23 @@ static void setup()
   PSI_server->register_thread("unittest", all_bench_threads, 1);
 
   PSI_thread *psi= PSI_server->new_thread(key_thread_main, NULL, 0);
-  ok(psi != NULL, "main thread");
+  ok(!pfs_enabled || psi != NULL, "main thread");
   PSI_server->set_thread(psi);
 
   mysql_mutex_init(bench_mutex_key, & bench_mutex, MY_MUTEX_INIT_FAST);
   bench_mutex_class= find_mutex_class(bench_mutex_key);
-  ok(bench_mutex_class != NULL, "mutex class");
+  ok(!pfs_enabled || bench_mutex_class != NULL, "mutex class");
 
   mysql_rwlock_init(bench_rwlock_key, & bench_rwlock);
   bench_rwlock_class= find_rwlock_class(bench_rwlock_key);
-  ok(bench_rwlock_class != NULL, "rwlock class");
+  ok(!pfs_enabled || bench_rwlock_class != NULL, "rwlock class");
 
   mysql_cond_init(bench_cond_key, & bench_cond, NULL);
   bench_cond_class= find_cond_class(bench_cond_key);
-  ok(bench_cond_class != NULL, "cond class");
+  ok(!pfs_enabled || bench_cond_class != NULL, "cond class");
 
   bench_file_class= find_file_class(bench_file_key);
-  ok(bench_file_class != NULL, "file class");
+  ok(!pfs_enabled || bench_file_class != NULL, "file class");
 }
 
 static void teardown()
@@ -169,7 +169,7 @@ static void teardown()
   shutdown_performance_schema();
 }
 
-void benchmark_mutex(bool timed, uint count, const char *test)
+void benchmark_mutex(uint count, const char *test)
 {
   ulonglong timer_start;
   ulonglong timer_end;
@@ -192,12 +192,12 @@ void benchmark_mutex(bool timed, uint co
   timer_cycles= timer_end-timer_start;
   // ok(get_work_done() == count, "work done");
 
-  diag("MUTEX benchmark: %s (%s), %d calls, %13llu cycles, %13llu avg",
-       test, (timed ? "timed" : "counted"),
+  diag("MUTEX benchmark: %s, %d calls, %13llu cycles, %13llu avg",
+       test,
        count, timer_cycles, timer_cycles/count);
 }
 
-void benchmark_rwlock(bool timed, uint count, const char *test)
+void benchmark_rwlock(uint count, const char *test)
 {
   ulonglong timer_start;
   ulonglong timer_end;
@@ -220,12 +220,12 @@ void benchmark_rwlock(bool timed, uint c
   timer_cycles= timer_end-timer_start;
   // ok(get_work_done() == count, "work done");
 
-  diag("RWLOCK benchmark: %s (%s), %d calls, %13llu cycles, %13llu avg",
-       test, (timed ? "timed" : "counted"),
+  diag("RWLOCK benchmark: %s, %d calls, %13llu cycles, %13llu avg",
+       test,
        count, timer_cycles, timer_cycles/count);
 }
 
-void benchmark_cond(bool timed, uint count, const char *test)
+void benchmark_cond(uint count, const char *test)
 {
   ulonglong timer_start;
   ulonglong timer_end;
@@ -252,12 +252,12 @@ void benchmark_cond(bool timed, uint cou
   mysql_mutex_unlock(mutex);
   // ok(get_work_done() == count, "work done");
 
-  diag("COND benchmark: %s (%s), %d calls, %13llu cycles, %13llu avg",
-       test, (timed ? "timed" : "counted"),
+  diag("COND benchmark: %s, %d calls, %13llu cycles, %13llu avg",
+       test,
        count, timer_cycles, timer_cycles/count);
 }
 
-void benchmark_file_read(bool timed, uint count, const char *test)
+void benchmark_file_read(uint count, const char *test)
 {
   ulonglong timer_start;
   ulonglong timer_end;
@@ -331,12 +331,12 @@ void benchmark_file_read(bool timed, uin
 
   timer_cycles= timer_end-timer_start;
 
-  diag("FILE READ benchmark: %s (%s), %d calls, %13llu cycles, %13llu avg",
-       test, (timed ? "timed" : "counted"),
+  diag("FILE READ benchmark: %s, %d calls, %13llu cycles, %13llu avg",
+       test,
        count, timer_cycles, timer_cycles/count);
 }
 
-void benchmark_file_open(bool timed, uint count, const char *test)
+void benchmark_file_open(uint count, const char *test)
 {
   ulonglong timer_start;
   ulonglong timer_end;
@@ -385,12 +385,12 @@ void benchmark_file_open(bool timed, uin
   timer_end= my_timer_cycles();
   timer_cycles= timer_end-timer_start;
 
-  diag("FILE OPEN benchmark: %s (%s), %d calls, %13llu cycles, %13llu avg",
-       test, (timed ? "timed" : "counted"),
+  diag("FILE OPEN benchmark: %s, %d calls, %13llu cycles, %13llu avg",
+       test,
        count, timer_cycles, timer_cycles/count);
 }
 
-void benchmark_table_open(bool timed, uint count, const char *test)
+void benchmark_table_open(uint count, const char *test)
 {
   ulonglong timer_start;
   ulonglong timer_end;
@@ -416,12 +416,12 @@ void benchmark_table_open(bool timed, ui
   timer_cycles= timer_end-timer_start;
   // ok(get_work_done() == count, "work done");
 
-  diag("TABLE_IO benchmark: %s (%s), %d calls, %13llu cycles, %13llu avg",
-       test, (timed ? "timed" : "counted"),
+  diag("TABLE_IO benchmark: %s, %d calls, %13llu cycles, %13llu avg",
+       test,
        count, timer_cycles, timer_cycles/count);
 }
 
-void benchmark_table_io(bool timed, uint count, const char *test)
+void benchmark_table_io(uint count, const char *test)
 {
   ulonglong timer_start;
   ulonglong timer_end;
@@ -447,12 +447,12 @@ void benchmark_table_io(bool timed, uint
   timer_cycles= timer_end-timer_start;
   // ok(get_work_done() == count, "work done");
 
-  diag("TABLE_IO benchmark: %s (%s), %d calls, %13llu cycles, %13llu avg",
-       test, (timed ? "timed" : "counted"),
+  diag("TABLE_IO benchmark: %s, %d calls, %13llu cycles, %13llu avg",
+       test,
        count, timer_cycles, timer_cycles/count);
 }
 
-void benchmark_table_lock(bool timed, uint count, const char *test)
+void benchmark_table_lock(uint count, const char *test)
 {
   ulonglong timer_start;
   ulonglong timer_end;
@@ -478,90 +478,111 @@ void benchmark_table_lock(bool timed, ui
   timer_cycles= timer_end-timer_start;
   // ok(get_work_done() == count, "work done");
 
-  diag("TABLE_LOCK benchmark: %s (%s), %d calls, %13llu cycles, %13llu avg",
-       test, (timed ? "timed" : "counted"),
+  diag("TABLE_LOCK benchmark: %s, %d calls, %13llu cycles, %13llu avg",
+       test,
        count, timer_cycles, timer_cycles/count);
 }
 
-void benchmark_all(bool timed, const char *test)
+void benchmark_all(bool enabled, bool timed, const char *test)
 {
   /* The setup may have changed. */
   update_instruments_derived_flags();
 
-  benchmark_mutex(timed, 1, test);
-  benchmark_rwlock(timed, 1, test);
-  benchmark_cond(timed, 1, test);
+  char msg[80];
+
+  if (enabled)
+  {
+    sprintf(msg, "%s (enabled, %s)",
+            test,
+            (timed ? "timed" : "untimed"));
+  }
+  else
+  {
+    sprintf(msg, "%s (disabled)", test);
+  }
+
+  benchmark_mutex(1, msg);
+  benchmark_rwlock(1, msg);
+  benchmark_cond(1, msg);
 /*
-  benchmark_file_read(timed, 1, test);
-  benchmark_file_open(timed, 1, test);
+  benchmark_file_read(1, msg);
+  benchmark_file_open(1, msg);
 */
-  benchmark_table_io(timed, 1, test);
-  benchmark_table_lock(timed, 1, test);
+  benchmark_table_io(1, msg);
+  benchmark_table_lock(1, msg);
 
-  benchmark_mutex(timed, 1000, test);
-  benchmark_rwlock(timed, 1000, test);
-  benchmark_cond(timed, 1000, test);
+  benchmark_mutex(1000, msg);
+  benchmark_rwlock(1000, msg);
+  benchmark_cond(1000, msg);
 /*
-  benchmark_file_read(timed, 1000, test);
-  benchmark_file_open(timed, 1000, test);
+  benchmark_file_read(1000, msg);
+  benchmark_file_open(1000, msg);
 */
-  benchmark_table_io(timed, 1000, test);
-  benchmark_table_lock(timed, 1000, test);
+  benchmark_table_io(1000, msg);
+  benchmark_table_lock(1000, msg);
 
-  benchmark_mutex(timed, 1000000, test);
-  benchmark_rwlock(timed, 1000000, test);
-  benchmark_cond(timed, 1000000, test);
+  benchmark_mutex(1000000, msg);
+  benchmark_rwlock(1000000, msg);
+  benchmark_cond(1000000, msg);
 /*
-  benchmark_file_read(timed, 1000000, test);
-  benchmark_file_open(timed, 1000000, test);
+  benchmark_file_read(1000000, msg);
+  benchmark_file_open(1000000, msg);
 */
-  benchmark_table_io(timed, 1000000, test);
-  benchmark_table_lock(timed, 1000000, test);
+  benchmark_table_io(1000000, msg);
+  benchmark_table_lock(1000000, msg);
 
-  benchmark_mutex(timed, 10000000, test);
-  benchmark_rwlock(timed, 10000000, test);
-  benchmark_cond(timed, 10000000, test);
-  benchmark_table_io(timed, 10000000, test);
-  benchmark_table_lock(timed, 10000000, test);
+/*
+  benchmark_mutex(10000000, msg);
+  benchmark_rwlock(10000000, msg);
+  benchmark_cond(10000000, msg);
+  benchmark_table_io(10000000, msg);
+  benchmark_table_lock(10000000, msg);
+*/
 }
 
-void test_all(bool timed)
+void test_all(bool enabled, bool timed)
 {
-#ifdef USE_NOOP
-  benchmark_all(false, "noop");
-#else
-  flag_events_waits_current= true;
-  flag_events_waits_history= true;
-  flag_events_waits_history_long= true;
-  flag_global_instrumentation= true;
-  flag_thread_instrumentation= true;
-
-  bench_mutex_class->m_timed= timed;
-  bench_rwlock_class->m_timed= timed;
-  bench_cond_class->m_timed= timed;
-  bench_file_class->m_timed= timed;
-
-  benchmark_all(timed, "bigbang");
-
-  flag_events_waits_history= false;
-  flag_events_waits_history_long= false;
-  benchmark_all(timed, "no history");
-
-  /* Now same as no history */
-  benchmark_all(timed, "current");
+  if (! bench_pfs_enabled)
+  {
+    benchmark_all(false, false, "noop");
+  }
+  else
+  {
+    flag_events_waits_current= true;
+    flag_events_waits_history= true;
+    flag_events_waits_history_long= true;
+    flag_global_instrumentation= true;
+    flag_thread_instrumentation= true;
+
+    bench_mutex_class->m_enabled= enabled;
+    bench_mutex_class->m_timed= timed;
+    bench_rwlock_class->m_enabled= enabled;
+    bench_rwlock_class->m_timed= timed;
+    bench_cond_class->m_enabled= enabled;
+    bench_cond_class->m_timed= timed;
+    bench_file_class->m_enabled= enabled;
+    bench_file_class->m_timed= timed;
+
+    benchmark_all(enabled, timed, "bigbang");
+
+    flag_events_waits_history_long= false;
+    benchmark_all(enabled, timed, "history");
+
+    /* Now same as no history */
+    benchmark_all(enabled, timed, "current");
 
-  flag_events_waits_current= false;
-  benchmark_all(timed, "thread_instrumentation");
+    flag_events_waits_current= false;
+    benchmark_all(enabled, timed, "thread_instrumentation");
 
-  flag_thread_instrumentation= false;
-  benchmark_all(timed, "global_instrumentation");
+    flag_thread_instrumentation= false;
+    benchmark_all(enabled, timed, "global_instrumentation");
 
-  flag_global_instrumentation= false;
-  benchmark_all(timed, "nothing");
-#endif
+    flag_global_instrumentation= false;
+    benchmark_all(enabled, timed, "nothing");
+  }
 }
 
-void do_all_tests()
+void do_print_config()
 {
 #ifdef HAVE_PSI_MUTEX_INTERFACE
   diag("MUTEX INSTRUMENTATION compiled in");
@@ -604,18 +625,25 @@ void do_all_tests()
 #else
   diag("STATEMENT INSTRUMENTATION not compiled in");
 #endif
-
-  test_all(true);
-  test_all(false);
 }
 
 int main(int, char **)
 {
   plan(8);
   MY_INIT("pfs_benchmark-t");
-  setup();
-  do_all_tests();
+
+  do_print_config();
+
+  setup(false);
+  test_all(false, false);
   teardown();
+
+  setup(true);
+  test_all(false, false);
+  test_all(true, false);
+  test_all(true, true);
+  teardown();
+
   return 0;
 }
 

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (marc.alff:3426 to 3427) Marc Alff7 Nov