List:Commits« Previous MessageNext Message »
From:Marc Alff Date:September 20 2010 5:51pm
Subject:bzr push into mysql-next-mr branch (marc.alff:3192 to 3193)
View as plain text  
 3193 Marc Alff	2010-09-20 [merge]
      Merge mysql-next-mr --> mysql-next-mr-wl4816

    removed:
      mysql-test/suite/perfschema/r/ddl_threads.result
      mysql-test/suite/perfschema/r/dml_threads.result
      mysql-test/suite/perfschema/t/ddl_threads.test
      mysql-test/suite/perfschema/t/dml_threads.test
      mysql-test/suite/perfschema/t/schema.test
      storage/perfschema/table_threads.cc
      storage/perfschema/table_threads.h
    added:
      mysql-test/suite/perfschema/include/schema.inc
      mysql-test/suite/perfschema/r/ddl_setup_actors.result
      mysql-test/suite/perfschema/r/ddl_threads.result
      mysql-test/suite/perfschema/r/dml_setup_actors.result
      mysql-test/suite/perfschema/r/dml_threads.result
      mysql-test/suite/perfschema/r/schema_lc0.result
      mysql-test/suite/perfschema/r/schema_lc1.result
      mysql-test/suite/perfschema/r/schema_lc2.result
      mysql-test/suite/perfschema/r/setup_actors.result
      mysql-test/suite/perfschema/r/start_server_no_setup_actors.result
      mysql-test/suite/perfschema/r/threads_events.result
      mysql-test/suite/perfschema/r/threads_innodb.result
      mysql-test/suite/perfschema/r/threads_insert_delayed.result
      mysql-test/suite/perfschema/r/threads_mysql.result
      mysql-test/suite/perfschema/t/ddl_setup_actors.test
      mysql-test/suite/perfschema/t/ddl_threads.test
      mysql-test/suite/perfschema/t/dml_setup_actors.test
      mysql-test/suite/perfschema/t/dml_threads.test
      mysql-test/suite/perfschema/t/schema_lc0.test
      mysql-test/suite/perfschema/t/schema_lc1.test
      mysql-test/suite/perfschema/t/schema_lc2.test
      mysql-test/suite/perfschema/t/setup_actors.test
      mysql-test/suite/perfschema/t/start_server_no_setup_actors-master.opt
      mysql-test/suite/perfschema/t/start_server_no_setup_actors.test
      mysql-test/suite/perfschema/t/threads_innodb.test
      mysql-test/suite/perfschema/t/threads_insert_delayed.test
      mysql-test/suite/perfschema/t/threads_mysql-master.opt
      mysql-test/suite/perfschema/t/threads_mysql.test
      mysql-test/suite/sys_vars/r/pfs_setup_actors_size_basic.result
      mysql-test/suite/sys_vars/t/pfs_setup_actors_size_basic-master.opt
      mysql-test/suite/sys_vars/t/pfs_setup_actors_size_basic.test
      storage/perfschema/pfs_defaults.cc
      storage/perfschema/pfs_defaults.h
      storage/perfschema/pfs_setup_actor.cc
      storage/perfschema/pfs_setup_actor.h
      storage/perfschema/table_setup_actors.cc
      storage/perfschema/table_setup_actors.h
      storage/perfschema/table_threads.cc
      storage/perfschema/table_threads.h
    modified:
      client/CMakeLists.txt
      include/CMakeLists.txt
      include/Makefile.am
      include/mysql/psi/psi.h
      include/mysql/psi/psi_abi_v1.h.pp
      libmysqld/lib_sql.cc
      mysql-test/r/information_schema.result
      mysql-test/r/mysqld--help-notwin.result
      mysql-test/r/mysqld--help-win.result
      mysql-test/r/sp-destruct.result
      mysql-test/suite/perfschema/include/setup_helper.inc
      mysql-test/suite/perfschema/include/start_server_common.inc
      mysql-test/suite/perfschema/r/func_file_io.result
      mysql-test/suite/perfschema/r/information_schema.result
      mysql-test/suite/perfschema/r/pfs_upgrade_lc0.result
      mysql-test/suite/perfschema/r/pfs_upgrade_lc1.result
      mysql-test/suite/perfschema/r/pfs_upgrade_lc2.result
      mysql-test/suite/perfschema/r/selects.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_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_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_nothing.result
      mysql-test/suite/perfschema/r/start_server_off.result
      mysql-test/suite/perfschema/r/start_server_on.result
      mysql-test/suite/perfschema/t/disabled.def
      mysql-test/suite/perfschema/t/func_file_io.test
      mysql-test/suite/perfschema/t/selects.test
      mysql-test/suite/perfschema/t/start_server_nothing.test
      mysql-test/suite/perfschema/t/thread_cache.test
      mysql-test/t/information_schema.test
      mysql-test/t/sp-destruct.test
      scripts/CMakeLists.txt
      scripts/make_win_bin_dist
      scripts/mysql_system_tables.sql
      sql/CMakeLists.txt
      sql/event_scheduler.cc
      sql/ha_ndbcluster_binlog.cc
      sql/log.cc
      sql/mdl.cc
      sql/mdl.h
      sql/rpl_master.cc
      sql/sp.cc
      sql/sql_base.cc
      sql/sql_base.h
      sql/sql_class.cc
      sql/sql_class.h
      sql/sql_connect.cc
      sql/sql_insert.cc
      sql/sql_parse.cc
      sql/sql_prepare.cc
      sql/sql_show.cc
      sql/sql_table.cc
      sql/sys_vars.cc
      sql/table.cc
      storage/perfschema/CMakeLists.txt
      storage/perfschema/Makefile.am
      storage/perfschema/ha_perfschema.cc
      storage/perfschema/ha_perfschema.h
      storage/perfschema/pfs.cc
      storage/perfschema/pfs_engine_table.cc
      storage/perfschema/pfs_engine_table.h
      storage/perfschema/pfs_instr.cc
      storage/perfschema/pfs_instr.h
      storage/perfschema/pfs_lock.h
      storage/perfschema/pfs_server.cc
      storage/perfschema/pfs_server.h
      storage/perfschema/table_events_waits.cc
      storage/perfschema/table_events_waits.h
      storage/perfschema/table_events_waits_summary.cc
      storage/perfschema/table_events_waits_summary.h
      storage/perfschema/table_ews_global_by_event_name.cc
      storage/perfschema/table_file_instances.cc
      storage/perfschema/table_file_instances.h
      storage/perfschema/table_file_summary.cc
      storage/perfschema/table_file_summary.h
      storage/perfschema/table_performance_timers.cc
      storage/perfschema/table_setup_consumers.cc
      storage/perfschema/table_setup_instruments.cc
      storage/perfschema/table_setup_timers.cc
      storage/perfschema/table_sync_instances.cc
      storage/perfschema/table_sync_instances.h
      storage/perfschema/unittest/pfs-t.cc
      storage/perfschema/unittest/pfs_instr-oom-t.cc
      storage/perfschema/unittest/pfs_instr-t.cc
      storage/perfschema/unittest/stub_pfs_global.h
 3192 Alexander Nozdrin	2010-09-01 [merge]
      Auto-merge from mysql-trunk.

    added:
      include/mysql/service_thd_wait.h
      include/mysql/service_thread_scheduler.h
      libservices/my_thread_scheduler_service.c
      libservices/thd_wait_service.c
      sql/sql_callback.h
    modified:
      include/Makefile.am
      include/mysql/plugin.h
      include/mysql/plugin_audit.h.pp
      include/mysql/plugin_ftparser.h.pp
      include/mysql/services.h
      include/service_versions.h
      include/thr_lock.h
      include/violite.h
      libservices/CMakeLists.txt
      libservices/Makefile.am
      mysql-test/r/mysqld--help-notwin.result
      mysql-test/r/mysqld--help-win.result
      mysys/my_init.c
      mysys/thr_lock.c
      sql/authors.h
      sql/mysqld.cc
      sql/mysqld.h
      sql/scheduler.cc
      sql/scheduler.h
      sql/sql_class.cc
      sql/sql_class.h
      sql/sql_connect.cc
      sql/sql_connect.h
      sql/sql_plugin_services.h
      sql/sql_show.cc
      sql/sys_vars.cc
      storage/innobase/buf/buf0flu.c
      storage/innobase/buf/buf0rea.c
      storage/innobase/srv/srv0srv.c
      vio/vio.c
      vio/vio_priv.h
      vio/viosocket.c
      vio/viossl.c
=== modified file 'client/CMakeLists.txt'
--- a/client/CMakeLists.txt	2010-08-12 15:19:57 +0000
+++ b/client/CMakeLists.txt	2010-09-06 11:26:23 +0000
@@ -64,7 +64,10 @@ MYSQL_ADD_EXECUTABLE(mysqlslap mysqlslap
 SET_SOURCE_FILES_PROPERTIES(mysqlslap.c PROPERTIES COMPILE_FLAGS "-DTHREADS")
 TARGET_LINK_LIBRARIES(mysqlslap mysqlclient)
 
-ADD_EXECUTABLE(echo echo.c)
+# "WIN32" also covers 64 bit. "echo" is used in some files below "mysql-test/".
+IF(WIN32)
+  MYSQL_ADD_EXECUTABLE(echo echo.c)
+ENDIF(WIN32)
 
 SET_TARGET_PROPERTIES (mysqlcheck mysqldump mysqlimport mysql_upgrade mysqlshow mysqlslap 
 PROPERTIES HAS_CXX TRUE)

=== modified file 'include/CMakeLists.txt'
--- a/include/CMakeLists.txt	2010-08-12 15:27:53 +0000
+++ b/include/CMakeLists.txt	2010-09-13 10:26:57 +0000
@@ -54,6 +54,7 @@ SET(HEADERS
   keycache.h
   m_ctype.h
   my_attribute.h 
+  my_compiler.h
   ${HEADERS_GEN_CONFIGURE}
 )
 

=== modified file 'include/Makefile.am'
--- a/include/Makefile.am	2010-09-01 13:05:01 +0000
+++ b/include/Makefile.am	2010-09-13 10:36:27 +0000
@@ -32,8 +32,9 @@ pkginclude_HEADERS =	$(HEADERS_ABI) my_d
 			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 \
-			m_ctype.h my_attribute.h $(HEADERS_GEN_CONFIGURE) \
-			$(HEADERS_GEN_MAKE) probes_mysql.h probes_mysql_nodtrace.h
+			m_ctype.h my_attribute.h my_compiler.h \
+			$(HEADERS_GEN_CONFIGURE) $(HEADERS_GEN_MAKE) \
+			probes_mysql.h probes_mysql_nodtrace.h
 
 noinst_HEADERS =	lf.h my_bit.h \
 			heap.h my_bitmap.h my_uctype.h password.h \
@@ -47,7 +48,7 @@ noinst_HEADERS =	lf.h my_bit.h \
 			my_user.h my_atomic.h atomic/nolock.h \
 			atomic/rwlock.h atomic/x86-gcc.h atomic/generic-msvc.h \
 			atomic/gcc_builtins.h my_libwrap.h my_stacktrace.h \
-			atomic/solaris.h mysql/innodb_priv.h my_compiler.h
+			atomic/solaris.h mysql/innodb_priv.h
 
 pkgpsiinclude_HEADERS = mysql/psi/psi.h mysql/psi/mysql_thread.h \
 			mysql/psi/mysql_file.h \

=== modified file 'include/mysql/psi/psi.h'
--- a/include/mysql/psi/psi.h	2010-07-23 17:08:41 +0000
+++ b/include/mysql/psi/psi.h	2010-07-30 09:02:32 +0000
@@ -796,6 +796,55 @@ typedef void (*set_thread_id_v1_t)(struc
 typedef struct PSI_thread* (*get_thread_v1_t)(void);
 
 /**
+  Assign a user name to the instrumented thread.
+  @param user the user name
+  @param user_len the user name length
+*/
+typedef void (*set_thread_user_v1_t)(const char *user, int user_len);
+
+/**
+  Assign a user name and host name to the instrumented thread.
+  @param user the user name
+  @param user_len the user name length
+  @param host the host name
+  @param host_len the host name length
+*/
+typedef void (*set_thread_user_host_v1_t)(const char *user, int user_len,
+                                          const char *host, int host_len);
+
+/**
+  Assign a current database to the instrumented thread.
+  @param db the database name
+  @param db_len the database name length
+*/
+typedef void (*set_thread_db_v1_t)(const char* db, int db_len);
+
+/**
+  Assign a current command to the instrumented thread.
+  @param command the current command
+*/
+typedef void (*set_thread_command_v1_t)(int command);
+
+/**
+  Assign a start time to the instrumented thread.
+  @param start_time the thread start time
+*/
+typedef void (*set_thread_start_time_v1_t)(time_t start_time);
+
+/**
+  Assign a state to the instrumented thread.
+  @param state the thread state
+*/
+typedef void (*set_thread_state_v1_t)(const char* state);
+
+/**
+  Assign a process info to the instrumented thread.
+  @param info the process into string
+  @param info_len the process into string length
+*/
+typedef void (*set_thread_info_v1_t)(const char* info, int info_len);
+
+/**
   Attach a thread instrumentation to the running thread.
   In case of thread pools, this method should be called when
   a worker thread picks a work item and runs it.
@@ -1101,6 +1150,20 @@ struct PSI_v1
   set_thread_id_v1_t set_thread_id;
   /** @sa get_thread_v1_t. */
   get_thread_v1_t get_thread;
+  /** @sa set_thread_user_v1_t. */
+  set_thread_user_v1_t set_thread_user;
+  /** @sa set_thread_user_host_v1_t. */
+  set_thread_user_host_v1_t set_thread_user_host;
+  /** @sa set_thread_db_v1_t. */
+  set_thread_db_v1_t set_thread_db;
+  /** @sa set_thread_command_v1_t. */
+  set_thread_command_v1_t set_thread_command;
+  /** @sa set_thread_start_time_v1_t. */
+  set_thread_start_time_v1_t set_thread_start_time;
+  /** @sa set_thread_state_v1_t. */
+  set_thread_state_v1_t set_thread_state;
+  /** @sa set_thread_info_v1_t. */
+  set_thread_info_v1_t set_thread_info;
   /** @sa set_thread_v1_t. */
   set_thread_v1_t set_thread;
   /** @sa delete_current_thread_v1_t. */

=== modified file 'include/mysql/psi/psi_abi_v1.h.pp'
--- a/include/mysql/psi/psi_abi_v1.h.pp	2010-07-23 17:08:41 +0000
+++ b/include/mysql/psi/psi_abi_v1.h.pp	2010-07-30 09:02:32 +0000
@@ -203,6 +203,14 @@ typedef struct PSI_thread* (*new_thread_
 typedef void (*set_thread_id_v1_t)(struct PSI_thread *thread,
                                    unsigned long id);
 typedef struct PSI_thread* (*get_thread_v1_t)(void);
+typedef void (*set_thread_user_v1_t)(const char *user, int user_len);
+typedef void (*set_thread_user_host_v1_t)(const char *user, int user_len,
+                                          const char *host, int host_len);
+typedef void (*set_thread_db_v1_t)(const char* db, int db_len);
+typedef void (*set_thread_command_v1_t)(int command);
+typedef void (*set_thread_start_time_v1_t)(time_t start_time);
+typedef void (*set_thread_state_v1_t)(const char* state);
+typedef void (*set_thread_info_v1_t)(const char* info, int info_len);
 typedef void (*set_thread_v1_t)(struct PSI_thread *thread);
 typedef void (*delete_current_thread_v1_t)(void);
 typedef void (*delete_thread_v1_t)(struct PSI_thread *thread);
@@ -291,6 +299,13 @@ struct PSI_v1
   new_thread_v1_t new_thread;
   set_thread_id_v1_t set_thread_id;
   get_thread_v1_t get_thread;
+  set_thread_user_v1_t set_thread_user;
+  set_thread_user_host_v1_t set_thread_user_host;
+  set_thread_db_v1_t set_thread_db;
+  set_thread_command_v1_t set_thread_command;
+  set_thread_start_time_v1_t set_thread_start_time;
+  set_thread_state_v1_t set_thread_state;
+  set_thread_info_v1_t set_thread_info;
   set_thread_v1_t set_thread;
   delete_current_thread_v1_t delete_current_thread;
   delete_thread_v1_t delete_thread;

=== modified file 'libmysqld/lib_sql.cc'
--- a/libmysqld/lib_sql.cc	2010-07-23 17:51:11 +0000
+++ b/libmysqld/lib_sql.cc	2010-08-26 22:46:51 +0000
@@ -643,7 +643,7 @@ void *create_embedded_thd(int client_fla
   if (thd->variables.max_join_size == HA_POS_ERROR)
     thd->variables.option_bits |= OPTION_BIG_SELECTS;
   thd->proc_info=0;				// Remove 'login'
-  thd->command=COM_SLEEP;
+  thd->set_command(COM_SLEEP);
   thd->set_time();
   thd->init_for_queries();
   thd->client_capabilities= client_flag;

=== modified file 'mysql-test/r/information_schema.result'
--- a/mysql-test/r/information_schema.result	2010-07-23 17:51:11 +0000
+++ b/mysql-test/r/information_schema.result	2010-08-26 22:46:51 +0000
@@ -770,9 +770,9 @@ count(*)
 68
 drop view a2, a1;
 drop table t_crashme;
-select table_schema,table_name, column_name from
-information_schema.columns
-where data_type = 'longtext';
+select table_schema, table_name, column_name from information_schema.columns
+where table_schema not like 'performance_schema'
+  and data_type = 'longtext';
 table_schema	table_name	column_name
 information_schema	COLUMNS	COLUMN_DEFAULT
 information_schema	COLUMNS	COLUMN_TYPE
@@ -790,7 +790,9 @@ information_schema	TRIGGERS	ACTION_CONDI
 information_schema	TRIGGERS	ACTION_STATEMENT
 information_schema	VIEWS	VIEW_DEFINITION
 select table_name, column_name, data_type from information_schema.columns
-where data_type = 'datetime' and table_name not like 'innodb_%';
+where table_schema not like 'performance_schema'
+  and data_type = 'datetime'
+  and table_name not like 'innodb_%';
 table_name	column_name	data_type
 EVENTS	EXECUTE_AT	datetime
 EVENTS	STARTS	datetime

=== modified file 'mysql-test/r/mysqld--help-notwin.result'
--- a/mysql-test/r/mysqld--help-notwin.result	2010-09-01 13:06:14 +0000
+++ b/mysql-test/r/mysqld--help-notwin.result	2010-09-01 22:59:33 +0000
@@ -437,6 +437,8 @@ The following options may be given as th
  Maximum number of thread instruments.
  --performance-schema-max-thread-instances=# 
  Maximum number of instrumented threads.
+ --performance-schema-setup-actors-size=# 
+ Maximum number of rows in SETUP_ACTORS.
  --pid-file=name     Pid file used by safe_mysqld
  --plugin-dir=name   Directory for plugins
  --plugin-load=name  Optional semicolon-separated list of plugins to load,
@@ -864,6 +866,7 @@ performance-schema-max-table-handles 100
 performance-schema-max-table-instances 1000
 performance-schema-max-thread-classes 50
 performance-schema-max-thread-instances 1000
+performance-schema-setup-actors-size 100
 plugin-load (No default value)
 port 3306
 port-open-timeout 0

=== modified file 'mysql-test/r/mysqld--help-win.result'
--- a/mysql-test/r/mysqld--help-win.result	2010-09-01 13:06:14 +0000
+++ b/mysql-test/r/mysqld--help-win.result	2010-09-01 22:59:33 +0000
@@ -437,6 +437,8 @@ The following options may be given as th
  Maximum number of thread instruments.
  --performance-schema-max-thread-instances=# 
  Maximum number of instrumented threads.
+ --performance-schema-setup-actors-size=# 
+ Maximum number of rows in SETUP_ACTORS.
  --pid-file=name     Pid file used by safe_mysqld
  --plugin-dir=name   Directory for plugins
  --plugin-load=name  Optional semicolon-separated list of plugins to load,
@@ -868,6 +870,7 @@ performance-schema-max-table-handles 100
 performance-schema-max-table-instances 1000
 performance-schema-max-thread-classes 50
 performance-schema-max-thread-instances 1000
+performance-schema-setup-actors-size 100
 plugin-load (No default value)
 port 3306
 port-open-timeout 0

=== modified file 'mysql-test/r/sp-destruct.result'
--- a/mysql-test/r/sp-destruct.result	2010-03-03 09:24:53 +0000
+++ b/mysql-test/r/sp-destruct.result	2010-09-13 09:58:11 +0000
@@ -134,3 +134,19 @@ Warning	1405	Failed to revoke all privil
 # Restore the procs_priv table
 RENAME TABLE procs_priv_backup TO mysql.procs_priv;
 FLUSH TABLE mysql.procs_priv;
+#
+# Bug #56137 "Assertion `thd->lock == 0' failed on upgrading from
+#             5.1.50 to 5.5.6".
+#
+drop database if exists mysqltest;
+# Backup mysql.proc.
+flush table mysql.proc;
+create database mysqltest;
+# Corrupt mysql.proc to make it unusable by current version of server.
+alter table mysql.proc drop column type;
+# The below statement should not cause assertion failure.
+drop database mysqltest;
+Warnings:
+Error	1695	Column count of mysql.proc is wrong. Expected 20, found 19. The table is probably corrupted
+# Restore mysql.proc.
+drop table mysql.proc;

=== added file 'mysql-test/suite/perfschema/include/schema.inc'
--- a/mysql-test/suite/perfschema/include/schema.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/include/schema.inc	2010-09-01 22:59:33 +0000
@@ -0,0 +1,44 @@
+# Copyright (c) 2008, 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
+#    Show existing objects and information about their structure
+
+show databases like 'performance_schema';
+show create database performance_schema;
+
+use performance_schema;
+
+show tables;
+
+show create table COND_INSTANCES;
+show create table EVENTS_WAITS_CURRENT;
+show create table EVENTS_WAITS_HISTORY;
+show create table EVENTS_WAITS_HISTORY_LONG;
+show create table EVENTS_WAITS_SUMMARY_BY_INSTANCE;
+show create table EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
+show create table EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
+show create table FILE_INSTANCES;
+show create table FILE_SUMMARY_BY_EVENT_NAME;
+show create table FILE_SUMMARY_BY_INSTANCE;
+show create table MUTEX_INSTANCES;
+show create table PERFORMANCE_TIMERS;
+show create table RWLOCK_INSTANCES;
+show create table SETUP_ACTORS;
+show create table SETUP_CONSUMERS;
+show create table SETUP_INSTRUMENTS;
+show create table SETUP_TIMERS;
+show create table THREADS;
+

=== modified file 'mysql-test/suite/perfschema/include/setup_helper.inc'
--- a/mysql-test/suite/perfschema/include/setup_helper.inc	2010-08-12 15:25:01 +0000
+++ b/mysql-test/suite/perfschema/include/setup_helper.inc	2010-09-01 22:59:33 +0000
@@ -26,17 +26,17 @@ update performance_schema.SETUP_CONSUMER
 connect (con1, localhost, root, , );
 
 let $con1_THREAD_ID=`select thread_id from performance_schema.THREADS
-  where ID in (select connection_id())`;
+  where PROCESSLIST_ID = connection_id()`;
 
 connect (con2, localhost, root, , );
 
 let $con2_THREAD_ID=`select thread_id from performance_schema.THREADS
-  where ID in (select connection_id())`;
+  where PROCESSLIST_ID = connection_id()`;
 
 connect (con3, localhost, root, , );
 
 let $con3_THREAD_ID=`select thread_id from performance_schema.THREADS
-  where ID in (select connection_id())`;
+  where PROCESSLIST_ID = connection_id()`;
 
 connection default;
 

=== modified file 'mysql-test/suite/perfschema/include/start_server_common.inc'
--- a/mysql-test/suite/perfschema/include/start_server_common.inc	2010-08-12 15:25:01 +0000
+++ b/mysql-test/suite/perfschema/include/start_server_common.inc	2010-09-01 22:59:33 +0000
@@ -39,6 +39,7 @@ select * from performance_schema.FILE_SU
 select * from performance_schema.MUTEX_INSTANCES;
 select * from performance_schema.PERFORMANCE_TIMERS;
 select * from performance_schema.RWLOCK_INSTANCES;
+select * from performance_schema.SETUP_ACTORS;
 select * from performance_schema.SETUP_CONSUMERS;
 select * from performance_schema.SETUP_INSTRUMENTS;
 select * from performance_schema.SETUP_TIMERS;

=== added file 'mysql-test/suite/perfschema/r/ddl_setup_actors.result'
--- a/mysql-test/suite/perfschema/r/ddl_setup_actors.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/r/ddl_setup_actors.result	2010-05-12 14:04:32 +0000
@@ -0,0 +1,16 @@
+alter table performance_schema.SETUP_ACTORS add column foo integer;
+ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
+drop table if exists test.SETUP_ACTORS;
+create table test.SETUP_ACTORS as
+select * from performance_schema.SETUP_ACTORS;
+truncate table performance_schema.SETUP_ACTORS;
+select count(*) from performance_schema.SETUP_ACTORS;
+count(*)
+0
+insert into performance_schema.SETUP_ACTORS
+select * from test.SETUP_ACTORS;
+drop table test.SETUP_ACTORS;
+ALTER TABLE performance_schema.SETUP_ACTORS ADD INDEX test_index(HOST);
+ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
+CREATE UNIQUE INDEX test_index ON performance_schema.SETUP_ACTORS(HOST);
+ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'

=== added file 'mysql-test/suite/perfschema/r/ddl_threads.result'
--- a/mysql-test/suite/perfschema/r/ddl_threads.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/r/ddl_threads.result	2010-05-11 10:36:37 +0000
@@ -0,0 +1,8 @@
+alter table performance_schema.THREADS add column foo integer;
+ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
+truncate table performance_schema.THREADS;
+ERROR HY000: Invalid performance_schema usage.
+ALTER TABLE performance_schema.THREADS ADD INDEX test_index(PROCESSLIST_ID);
+ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
+CREATE UNIQUE INDEX test_index ON performance_schema.THREADS(PROCESSLIST_ID);
+ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'

=== removed file 'mysql-test/suite/perfschema/r/ddl_threads.result'
--- a/mysql-test/suite/perfschema/r/ddl_threads.result	2010-08-12 14:08:52 +0000
+++ b/mysql-test/suite/perfschema/r/ddl_threads.result	1970-01-01 00:00:00 +0000
@@ -1,8 +0,0 @@
-alter table performance_schema.THREADS add column foo integer;
-ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-truncate table performance_schema.THREADS;
-ERROR HY000: Invalid performance_schema usage.
-ALTER TABLE performance_schema.THREADS ADD INDEX test_index(ID);
-ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
-CREATE UNIQUE INDEX test_index ON performance_schema.THREADS(ID);
-ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'

=== added file 'mysql-test/suite/perfschema/r/dml_setup_actors.result'
--- a/mysql-test/suite/perfschema/r/dml_setup_actors.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/r/dml_setup_actors.result	2010-05-12 14:04:32 +0000
@@ -0,0 +1,60 @@
+drop table if exists test.SETUP_ACTORS;
+create table test.SETUP_ACTORS as
+select * from performance_schema.SETUP_ACTORS;
+truncate table performance_schema.SETUP_ACTORS;
+select * from performance_schema.SETUP_ACTORS;
+HOST	USER	ROLE
+select * from performance_schema.SETUP_ACTORS
+where user = '%';
+HOST	USER	ROLE
+insert into performance_schema.SETUP_ACTORS
+set user='Joe', host='localhost';
+insert into performance_schema.SETUP_ACTORS
+set user='Joe', host='%';
+insert into performance_schema.SETUP_ACTORS
+set user='%', host='server1';
+insert into performance_schema.SETUP_ACTORS
+set user='%', host='%';
+select * from performance_schema.SETUP_ACTORS
+order by USER, HOST;
+HOST	USER	ROLE
+%	%	%
+server1	%	%
+%	Joe	%
+localhost	Joe	%
+update performance_schema.SETUP_ACTORS
+set user='ILLEGAL';
+ERROR HY000: Invalid performance_schema usage.
+update performance_schema.SETUP_ACTORS
+set host='ILLEGAL';
+ERROR HY000: Invalid performance_schema usage.
+update performance_schema.SETUP_ACTORS
+set role='ILLEGAL';
+ERROR HY000: Invalid performance_schema usage.
+select * from performance_schema.SETUP_ACTORS
+order by USER, HOST;
+HOST	USER	ROLE
+%	%	%
+server1	%	%
+%	Joe	%
+localhost	Joe	%
+delete from performance_schema.SETUP_ACTORS
+where user = 'Joe' and host = 'localhost';
+select * from performance_schema.SETUP_ACTORS
+order by USER, HOST;
+HOST	USER	ROLE
+%	%	%
+server1	%	%
+%	Joe	%
+delete from performance_schema.SETUP_ACTORS;
+select * from performance_schema.SETUP_ACTORS
+order by USER, HOST;
+HOST	USER	ROLE
+LOCK TABLES performance_schema.SETUP_ACTORS READ;
+UNLOCK TABLES;
+LOCK TABLES performance_schema.SETUP_ACTORS WRITE;
+UNLOCK TABLES;
+truncate table performance_schema.SETUP_ACTORS;
+insert into performance_schema.SETUP_ACTORS
+select * from test.SETUP_ACTORS;
+drop table test.SETUP_ACTORS;

=== removed file 'mysql-test/suite/perfschema/r/dml_threads.result'
--- a/mysql-test/suite/perfschema/r/dml_threads.result	2010-08-12 15:25:01 +0000
+++ b/mysql-test/suite/perfschema/r/dml_threads.result	1970-01-01 00:00:00 +0000
@@ -1,27 +0,0 @@
-select * from performance_schema.THREADS
-where name like 'Thread/%' limit 1;
-THREAD_ID	ID	NAME
-#	#	#
-select * from performance_schema.THREADS
-where name='FOO';
-THREAD_ID	ID	NAME
-insert into performance_schema.THREADS
-set name='FOO', thread_id=1, id=2;
-ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'THREADS'
-update performance_schema.THREADS
-set thread_id=12;
-ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'THREADS'
-update performance_schema.THREADS
-set thread_id=12 where name like "FOO";
-ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'THREADS'
-delete from performance_schema.THREADS
-where id=1;
-ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'THREADS'
-delete from performance_schema.THREADS;
-ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'THREADS'
-LOCK TABLES performance_schema.THREADS READ;
-ERROR 42000: SELECT, LOCK TABLES command denied to user 'root'@'localhost' for table 'THREADS'
-UNLOCK TABLES;
-LOCK TABLES performance_schema.THREADS WRITE;
-ERROR 42000: SELECT, LOCK TABLES command denied to user 'root'@'localhost' for table 'THREADS'
-UNLOCK TABLES;

=== added file 'mysql-test/suite/perfschema/r/dml_threads.result'
--- a/mysql-test/suite/perfschema/r/dml_threads.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/r/dml_threads.result	2010-05-11 10:36:37 +0000
@@ -0,0 +1,37 @@
+select * from performance_schema.THREADS
+where name like 'Thread/%' limit 1;
+THREAD_ID	NAME	TYPE	PROCESSLIST_ID	PROCESSLIST_USER	PROCESSLIST_HOST	PROCESSLIST_DB	PROCESSLIST_COMMAND	PROCESSLIST_TIME	PROCESSLIST_STATE	PROCESSLIST_INFO	PARENT_THREAD_ID	ROLE	INSTRUMENTED
+#	#	#	#	#	#	#	#	#	#	#	#	#	#
+select * from performance_schema.THREADS
+where name='FOO';
+THREAD_ID	NAME	TYPE	PROCESSLIST_ID	PROCESSLIST_USER	PROCESSLIST_HOST	PROCESSLIST_DB	PROCESSLIST_COMMAND	PROCESSLIST_TIME	PROCESSLIST_STATE	PROCESSLIST_INFO	PARENT_THREAD_ID	ROLE	INSTRUMENTED
+insert into performance_schema.THREADS
+set name='FOO', thread_id=1, processlist_id=2;
+ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'THREADS'
+update performance_schema.THREADS
+set thread_id=12;
+ERROR HY000: Invalid performance_schema usage.
+update performance_schema.THREADS
+set thread_id=12 where PROCESSLIST_ID=connection_id();
+ERROR HY000: Invalid performance_schema usage.
+update performance_schema.THREADS
+set instrumented= 'NO' where PROCESSLIST_ID=connection_id();
+select instrumented from performance_schema.THREADS
+where PROCESSLIST_ID=connection_id();
+instrumented
+NO
+update performance_schema.THREADS
+set instrumented= 'YES' where PROCESSLIST_ID=connection_id();
+select instrumented from performance_schema.THREADS
+where PROCESSLIST_ID=connection_id();
+instrumented
+YES
+delete from performance_schema.THREADS
+where id=1;
+ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'THREADS'
+delete from performance_schema.THREADS;
+ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'THREADS'
+LOCK TABLES performance_schema.THREADS READ;
+UNLOCK TABLES;
+LOCK TABLES performance_schema.THREADS WRITE;
+UNLOCK TABLES;

=== modified file 'mysql-test/suite/perfschema/r/func_file_io.result'
--- a/mysql-test/suite/perfschema/r/func_file_io.result	2010-08-12 15:25:01 +0000
+++ b/mysql-test/suite/perfschema/r/func_file_io.result	2010-09-01 22:59:33 +0000
@@ -1,6 +1,8 @@
 UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'NO', timed = 'YES';
 UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES'
 WHERE name LIKE 'wait/io/file/%';
+update performance_schema.THREADS SET instrumented = 'YES'
+  WHERE PROCESSLIST_ID=connection_id();
 DROP TABLE IF EXISTS t1;
 CREATE TABLE t1 (id INT PRIMARY KEY, b CHAR(100) DEFAULT 'initial value')
 ENGINE=MyISAM;
@@ -94,25 +96,23 @@ FROM performance_schema.EVENTS_WAITS_SUM
 WHERE COUNT_STAR > 0
 ORDER BY SUM_TIMER_WAIT DESC
 LIMIT 10;
-SELECT i.user, SUM(TIMER_WAIT) SUM_WAIT
+SELECT p.processlist_user, SUM(TIMER_WAIT) SUM_WAIT
 # ((TIME_TO_SEC(TIMEDIFF(NOW(), i.startup_time)) * 1000) / SUM(TIMER_WAIT)) * 100 WAIT_PERCENTAGE
 FROM performance_schema.EVENTS_WAITS_HISTORY_LONG h
 INNER JOIN performance_schema.THREADS p USING (THREAD_ID)
-LEFT JOIN information_schema.PROCESSLIST i USING (ID)
-GROUP BY i.user
+GROUP BY p.processlist_user
 ORDER BY SUM_WAIT DESC
 LIMIT 20;
 SELECT h.EVENT_NAME, SUM(h.TIMER_WAIT) TOTAL_WAIT
 FROM performance_schema.EVENTS_WAITS_HISTORY_LONG h
 INNER JOIN performance_schema.THREADS p USING (THREAD_ID)
-WHERE p.ID = 1
+WHERE p.PROCESSLIST_ID = 1
 GROUP BY h.EVENT_NAME
 HAVING TOTAL_WAIT > 0;
-SELECT i.user, h.operation, SUM(NUMBER_OF_BYTES) bytes
+SELECT p.processlist_user, h.operation, SUM(NUMBER_OF_BYTES) bytes
 FROM performance_schema.EVENTS_WAITS_HISTORY_LONG h
 INNER JOIN performance_schema.THREADS p USING (THREAD_ID)
-LEFT JOIN information_schema.PROCESSLIST i USING (ID)
-GROUP BY i.user, h.operation
+GROUP BY p.processlist_user, h.operation
 HAVING BYTES > 0
-ORDER BY i.user, h.operation;
+ORDER BY p.processlist_user, h.operation;
 UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES', timed = 'YES';

=== modified file 'mysql-test/suite/perfschema/r/information_schema.result'
--- a/mysql-test/suite/perfschema/r/information_schema.result	2010-08-12 14:08:52 +0000
+++ b/mysql-test/suite/perfschema/r/information_schema.result	2010-09-01 22:59:33 +0000
@@ -15,6 +15,7 @@ performance_schema	FILE_SUMMARY_BY_INSTA
 performance_schema	MUTEX_INSTANCES	def
 performance_schema	PERFORMANCE_TIMERS	def
 performance_schema	RWLOCK_INSTANCES	def
+performance_schema	SETUP_ACTORS	def
 performance_schema	SETUP_CONSUMERS	def
 performance_schema	SETUP_INSTRUMENTS	def
 performance_schema	SETUP_TIMERS	def
@@ -36,6 +37,7 @@ FILE_SUMMARY_BY_INSTANCE	BASE TABLE	PERF
 MUTEX_INSTANCES	BASE TABLE	PERFORMANCE_SCHEMA
 PERFORMANCE_TIMERS	BASE TABLE	PERFORMANCE_SCHEMA
 RWLOCK_INSTANCES	BASE TABLE	PERFORMANCE_SCHEMA
+SETUP_ACTORS	BASE TABLE	PERFORMANCE_SCHEMA
 SETUP_CONSUMERS	BASE TABLE	PERFORMANCE_SCHEMA
 SETUP_INSTRUMENTS	BASE TABLE	PERFORMANCE_SCHEMA
 SETUP_TIMERS	BASE TABLE	PERFORMANCE_SCHEMA
@@ -57,6 +59,7 @@ FILE_SUMMARY_BY_INSTANCE	10	Dynamic
 MUTEX_INSTANCES	10	Dynamic
 PERFORMANCE_TIMERS	10	Fixed
 RWLOCK_INSTANCES	10	Dynamic
+SETUP_ACTORS	10	Fixed
 SETUP_CONSUMERS	10	Dynamic
 SETUP_INSTRUMENTS	10	Dynamic
 SETUP_TIMERS	10	Dynamic
@@ -78,6 +81,7 @@ FILE_SUMMARY_BY_INSTANCE	1000	0
 MUTEX_INSTANCES	1000	0
 PERFORMANCE_TIMERS	5	0
 RWLOCK_INSTANCES	1000	0
+SETUP_ACTORS	1	0
 SETUP_CONSUMERS	8	0
 SETUP_INSTRUMENTS	1000	0
 SETUP_TIMERS	1	0
@@ -99,6 +103,7 @@ FILE_SUMMARY_BY_INSTANCE	0	0
 MUTEX_INSTANCES	0	0
 PERFORMANCE_TIMERS	0	0
 RWLOCK_INSTANCES	0	0
+SETUP_ACTORS	0	0
 SETUP_CONSUMERS	0	0
 SETUP_INSTRUMENTS	0	0
 SETUP_TIMERS	0	0
@@ -120,6 +125,7 @@ FILE_SUMMARY_BY_INSTANCE	0	0	NULL
 MUTEX_INSTANCES	0	0	NULL
 PERFORMANCE_TIMERS	0	0	NULL
 RWLOCK_INSTANCES	0	0	NULL
+SETUP_ACTORS	0	0	NULL
 SETUP_CONSUMERS	0	0	NULL
 SETUP_INSTRUMENTS	0	0	NULL
 SETUP_TIMERS	0	0	NULL
@@ -141,6 +147,7 @@ FILE_SUMMARY_BY_INSTANCE	NULL	NULL	NULL
 MUTEX_INSTANCES	NULL	NULL	NULL
 PERFORMANCE_TIMERS	NULL	NULL	NULL
 RWLOCK_INSTANCES	NULL	NULL	NULL
+SETUP_ACTORS	NULL	NULL	NULL
 SETUP_CONSUMERS	NULL	NULL	NULL
 SETUP_INSTRUMENTS	NULL	NULL	NULL
 SETUP_TIMERS	NULL	NULL	NULL
@@ -162,6 +169,7 @@ FILE_SUMMARY_BY_INSTANCE	utf8_general_ci
 MUTEX_INSTANCES	utf8_general_ci	NULL
 PERFORMANCE_TIMERS	utf8_general_ci	NULL
 RWLOCK_INSTANCES	utf8_general_ci	NULL
+SETUP_ACTORS	utf8_general_ci	NULL
 SETUP_CONSUMERS	utf8_general_ci	NULL
 SETUP_INSTRUMENTS	utf8_general_ci	NULL
 SETUP_TIMERS	utf8_general_ci	NULL
@@ -183,6 +191,7 @@ FILE_SUMMARY_BY_INSTANCE
 MUTEX_INSTANCES	
 PERFORMANCE_TIMERS	
 RWLOCK_INSTANCES	
+SETUP_ACTORS	
 SETUP_CONSUMERS	
 SETUP_INSTRUMENTS	
 SETUP_TIMERS	

=== modified file 'mysql-test/suite/perfschema/r/pfs_upgrade_lc0.result'
--- a/mysql-test/suite/perfschema/r/pfs_upgrade_lc0.result	2010-08-12 15:25:01 +0000
+++ b/mysql-test/suite/perfschema/r/pfs_upgrade_lc0.result	2010-09-01 22:59:33 +0000
@@ -21,11 +21,12 @@ ERROR 1050 (42S01) at line 203: Table 'F
 ERROR 1050 (42S01) at line 212: Table 'MUTEX_INSTANCES' already exists
 ERROR 1050 (42S01) at line 222: Table 'PERFORMANCE_TIMERS' already exists
 ERROR 1050 (42S01) at line 232: Table 'RWLOCK_INSTANCES' already exists
-ERROR 1050 (42S01) at line 240: Table 'SETUP_CONSUMERS' already exists
-ERROR 1050 (42S01) at line 249: Table 'SETUP_INSTRUMENTS' already exists
-ERROR 1050 (42S01) at line 257: Table 'SETUP_TIMERS' already exists
-ERROR 1050 (42S01) at line 266: Table 'THREADS' already exists
-ERROR 1644 (HY000) at line 682: Unexpected content found in the performance_schema database.
+ERROR 1050 (42S01) at line 242: Table 'SETUP_ACTORS' already exists
+ERROR 1050 (42S01) at line 250: Table 'SETUP_CONSUMERS' already exists
+ERROR 1050 (42S01) at line 259: Table 'SETUP_INSTRUMENTS' already exists
+ERROR 1050 (42S01) at line 267: Table 'SETUP_TIMERS' already exists
+ERROR 1050 (42S01) at line 287: Table 'THREADS' already exists
+ERROR 1644 (HY000) at line 703: Unexpected content found in the performance_schema database.
 FATAL ERROR: Upgrade failed
 show tables like "user_table";
 Tables_in_performance_schema (user_table)
@@ -51,11 +52,12 @@ ERROR 1050 (42S01) at line 203: Table 'F
 ERROR 1050 (42S01) at line 212: Table 'MUTEX_INSTANCES' already exists
 ERROR 1050 (42S01) at line 222: Table 'PERFORMANCE_TIMERS' already exists
 ERROR 1050 (42S01) at line 232: Table 'RWLOCK_INSTANCES' already exists
-ERROR 1050 (42S01) at line 240: Table 'SETUP_CONSUMERS' already exists
-ERROR 1050 (42S01) at line 249: Table 'SETUP_INSTRUMENTS' already exists
-ERROR 1050 (42S01) at line 257: Table 'SETUP_TIMERS' already exists
-ERROR 1050 (42S01) at line 266: Table 'THREADS' already exists
-ERROR 1644 (HY000) at line 682: Unexpected content found in the performance_schema database.
+ERROR 1050 (42S01) at line 242: Table 'SETUP_ACTORS' already exists
+ERROR 1050 (42S01) at line 250: Table 'SETUP_CONSUMERS' already exists
+ERROR 1050 (42S01) at line 259: Table 'SETUP_INSTRUMENTS' already exists
+ERROR 1050 (42S01) at line 267: Table 'SETUP_TIMERS' already exists
+ERROR 1050 (42S01) at line 287: Table 'THREADS' already exists
+ERROR 1644 (HY000) at line 703: Unexpected content found in the performance_schema database.
 FATAL ERROR: Upgrade failed
 show tables like "user_view";
 Tables_in_performance_schema (user_view)
@@ -79,11 +81,12 @@ ERROR 1050 (42S01) at line 203: Table 'F
 ERROR 1050 (42S01) at line 212: Table 'MUTEX_INSTANCES' already exists
 ERROR 1050 (42S01) at line 222: Table 'PERFORMANCE_TIMERS' already exists
 ERROR 1050 (42S01) at line 232: Table 'RWLOCK_INSTANCES' already exists
-ERROR 1050 (42S01) at line 240: Table 'SETUP_CONSUMERS' already exists
-ERROR 1050 (42S01) at line 249: Table 'SETUP_INSTRUMENTS' already exists
-ERROR 1050 (42S01) at line 257: Table 'SETUP_TIMERS' already exists
-ERROR 1050 (42S01) at line 266: Table 'THREADS' already exists
-ERROR 1644 (HY000) at line 682: Unexpected content found in the performance_schema database.
+ERROR 1050 (42S01) at line 242: Table 'SETUP_ACTORS' already exists
+ERROR 1050 (42S01) at line 250: Table 'SETUP_CONSUMERS' already exists
+ERROR 1050 (42S01) at line 259: Table 'SETUP_INSTRUMENTS' already exists
+ERROR 1050 (42S01) at line 267: Table 'SETUP_TIMERS' already exists
+ERROR 1050 (42S01) at line 287: Table 'THREADS' already exists
+ERROR 1644 (HY000) at line 703: Unexpected content found in the performance_schema database.
 FATAL ERROR: Upgrade failed
 select name from mysql.proc where db='performance_schema';
 name
@@ -107,11 +110,12 @@ ERROR 1050 (42S01) at line 203: Table 'F
 ERROR 1050 (42S01) at line 212: Table 'MUTEX_INSTANCES' already exists
 ERROR 1050 (42S01) at line 222: Table 'PERFORMANCE_TIMERS' already exists
 ERROR 1050 (42S01) at line 232: Table 'RWLOCK_INSTANCES' already exists
-ERROR 1050 (42S01) at line 240: Table 'SETUP_CONSUMERS' already exists
-ERROR 1050 (42S01) at line 249: Table 'SETUP_INSTRUMENTS' already exists
-ERROR 1050 (42S01) at line 257: Table 'SETUP_TIMERS' already exists
-ERROR 1050 (42S01) at line 266: Table 'THREADS' already exists
-ERROR 1644 (HY000) at line 682: Unexpected content found in the performance_schema database.
+ERROR 1050 (42S01) at line 242: Table 'SETUP_ACTORS' already exists
+ERROR 1050 (42S01) at line 250: Table 'SETUP_CONSUMERS' already exists
+ERROR 1050 (42S01) at line 259: Table 'SETUP_INSTRUMENTS' already exists
+ERROR 1050 (42S01) at line 267: Table 'SETUP_TIMERS' already exists
+ERROR 1050 (42S01) at line 287: Table 'THREADS' already exists
+ERROR 1644 (HY000) at line 703: Unexpected content found in the performance_schema database.
 FATAL ERROR: Upgrade failed
 select name from mysql.proc where db='performance_schema';
 name
@@ -135,11 +139,12 @@ ERROR 1050 (42S01) at line 203: Table 'F
 ERROR 1050 (42S01) at line 212: Table 'MUTEX_INSTANCES' already exists
 ERROR 1050 (42S01) at line 222: Table 'PERFORMANCE_TIMERS' already exists
 ERROR 1050 (42S01) at line 232: Table 'RWLOCK_INSTANCES' already exists
-ERROR 1050 (42S01) at line 240: Table 'SETUP_CONSUMERS' already exists
-ERROR 1050 (42S01) at line 249: Table 'SETUP_INSTRUMENTS' already exists
-ERROR 1050 (42S01) at line 257: Table 'SETUP_TIMERS' already exists
-ERROR 1050 (42S01) at line 266: Table 'THREADS' already exists
-ERROR 1644 (HY000) at line 682: Unexpected content found in the performance_schema database.
+ERROR 1050 (42S01) at line 242: Table 'SETUP_ACTORS' already exists
+ERROR 1050 (42S01) at line 250: Table 'SETUP_CONSUMERS' already exists
+ERROR 1050 (42S01) at line 259: Table 'SETUP_INSTRUMENTS' already exists
+ERROR 1050 (42S01) at line 267: Table 'SETUP_TIMERS' already exists
+ERROR 1050 (42S01) at line 287: Table 'THREADS' already exists
+ERROR 1644 (HY000) at line 703: Unexpected content found in the performance_schema database.
 FATAL ERROR: Upgrade failed
 select name from mysql.event where db='performance_schema';
 name

=== modified file 'mysql-test/suite/perfschema/r/pfs_upgrade_lc1.result'
--- a/mysql-test/suite/perfschema/r/pfs_upgrade_lc1.result	2010-08-12 15:25:01 +0000
+++ b/mysql-test/suite/perfschema/r/pfs_upgrade_lc1.result	2010-09-02 00:00:20 +0000
@@ -21,11 +21,12 @@ ERROR 1050 (42S01) at line 203: Table 'f
 ERROR 1050 (42S01) at line 212: Table 'mutex_instances' already exists
 ERROR 1050 (42S01) at line 222: Table 'performance_timers' already exists
 ERROR 1050 (42S01) at line 232: Table 'rwlock_instances' already exists
-ERROR 1050 (42S01) at line 240: Table 'setup_consumers' already exists
-ERROR 1050 (42S01) at line 249: Table 'setup_instruments' already exists
-ERROR 1050 (42S01) at line 257: Table 'setup_timers' already exists
-ERROR 1050 (42S01) at line 266: Table 'threads' already exists
-ERROR 1644 (HY000) at line 682: Unexpected content found in the performance_schema database.
+ERROR 1050 (42S01) at line 242: Table 'setup_actors' already exists
+ERROR 1050 (42S01) at line 250: Table 'setup_consumers' already exists
+ERROR 1050 (42S01) at line 259: Table 'setup_instruments' already exists
+ERROR 1050 (42S01) at line 267: Table 'setup_timers' already exists
+ERROR 1050 (42S01) at line 287: Table 'threads' already exists
+ERROR 1644 (HY000) at line 703: Unexpected content found in the performance_schema database.
 FATAL ERROR: Upgrade failed
 show tables like "user_table";
 Tables_in_performance_schema (user_table)
@@ -51,11 +52,12 @@ ERROR 1050 (42S01) at line 203: Table 'f
 ERROR 1050 (42S01) at line 212: Table 'mutex_instances' already exists
 ERROR 1050 (42S01) at line 222: Table 'performance_timers' already exists
 ERROR 1050 (42S01) at line 232: Table 'rwlock_instances' already exists
-ERROR 1050 (42S01) at line 240: Table 'setup_consumers' already exists
-ERROR 1050 (42S01) at line 249: Table 'setup_instruments' already exists
-ERROR 1050 (42S01) at line 257: Table 'setup_timers' already exists
-ERROR 1050 (42S01) at line 266: Table 'threads' already exists
-ERROR 1644 (HY000) at line 682: Unexpected content found in the performance_schema database.
+ERROR 1050 (42S01) at line 242: Table 'setup_actors' already exists
+ERROR 1050 (42S01) at line 250: Table 'setup_consumers' already exists
+ERROR 1050 (42S01) at line 259: Table 'setup_instruments' already exists
+ERROR 1050 (42S01) at line 267: Table 'setup_timers' already exists
+ERROR 1050 (42S01) at line 287: Table 'threads' already exists
+ERROR 1644 (HY000) at line 703: Unexpected content found in the performance_schema database.
 FATAL ERROR: Upgrade failed
 show tables like "user_view";
 Tables_in_performance_schema (user_view)
@@ -79,11 +81,12 @@ ERROR 1050 (42S01) at line 203: Table 'f
 ERROR 1050 (42S01) at line 212: Table 'mutex_instances' already exists
 ERROR 1050 (42S01) at line 222: Table 'performance_timers' already exists
 ERROR 1050 (42S01) at line 232: Table 'rwlock_instances' already exists
-ERROR 1050 (42S01) at line 240: Table 'setup_consumers' already exists
-ERROR 1050 (42S01) at line 249: Table 'setup_instruments' already exists
-ERROR 1050 (42S01) at line 257: Table 'setup_timers' already exists
-ERROR 1050 (42S01) at line 266: Table 'threads' already exists
-ERROR 1644 (HY000) at line 682: Unexpected content found in the performance_schema database.
+ERROR 1050 (42S01) at line 242: Table 'setup_actors' already exists
+ERROR 1050 (42S01) at line 250: Table 'setup_consumers' already exists
+ERROR 1050 (42S01) at line 259: Table 'setup_instruments' already exists
+ERROR 1050 (42S01) at line 267: Table 'setup_timers' already exists
+ERROR 1050 (42S01) at line 287: Table 'threads' already exists
+ERROR 1644 (HY000) at line 703: Unexpected content found in the performance_schema database.
 FATAL ERROR: Upgrade failed
 select name from mysql.proc where db='performance_schema';
 name
@@ -107,11 +110,12 @@ ERROR 1050 (42S01) at line 203: Table 'f
 ERROR 1050 (42S01) at line 212: Table 'mutex_instances' already exists
 ERROR 1050 (42S01) at line 222: Table 'performance_timers' already exists
 ERROR 1050 (42S01) at line 232: Table 'rwlock_instances' already exists
-ERROR 1050 (42S01) at line 240: Table 'setup_consumers' already exists
-ERROR 1050 (42S01) at line 249: Table 'setup_instruments' already exists
-ERROR 1050 (42S01) at line 257: Table 'setup_timers' already exists
-ERROR 1050 (42S01) at line 266: Table 'threads' already exists
-ERROR 1644 (HY000) at line 682: Unexpected content found in the performance_schema database.
+ERROR 1050 (42S01) at line 242: Table 'setup_actors' already exists
+ERROR 1050 (42S01) at line 250: Table 'setup_consumers' already exists
+ERROR 1050 (42S01) at line 259: Table 'setup_instruments' already exists
+ERROR 1050 (42S01) at line 267: Table 'setup_timers' already exists
+ERROR 1050 (42S01) at line 287: Table 'threads' already exists
+ERROR 1644 (HY000) at line 703: Unexpected content found in the performance_schema database.
 FATAL ERROR: Upgrade failed
 select name from mysql.proc where db='performance_schema';
 name
@@ -135,11 +139,12 @@ ERROR 1050 (42S01) at line 203: Table 'f
 ERROR 1050 (42S01) at line 212: Table 'mutex_instances' already exists
 ERROR 1050 (42S01) at line 222: Table 'performance_timers' already exists
 ERROR 1050 (42S01) at line 232: Table 'rwlock_instances' already exists
-ERROR 1050 (42S01) at line 240: Table 'setup_consumers' already exists
-ERROR 1050 (42S01) at line 249: Table 'setup_instruments' already exists
-ERROR 1050 (42S01) at line 257: Table 'setup_timers' already exists
-ERROR 1050 (42S01) at line 266: Table 'threads' already exists
-ERROR 1644 (HY000) at line 682: Unexpected content found in the performance_schema database.
+ERROR 1050 (42S01) at line 242: Table 'setup_actors' already exists
+ERROR 1050 (42S01) at line 250: Table 'setup_consumers' already exists
+ERROR 1050 (42S01) at line 259: Table 'setup_instruments' already exists
+ERROR 1050 (42S01) at line 267: Table 'setup_timers' already exists
+ERROR 1050 (42S01) at line 287: Table 'threads' already exists
+ERROR 1644 (HY000) at line 703: Unexpected content found in the performance_schema database.
 FATAL ERROR: Upgrade failed
 select name from mysql.event where db='performance_schema';
 name

=== modified file 'mysql-test/suite/perfschema/r/pfs_upgrade_lc2.result'
--- a/mysql-test/suite/perfschema/r/pfs_upgrade_lc2.result	2010-08-12 15:25:01 +0000
+++ b/mysql-test/suite/perfschema/r/pfs_upgrade_lc2.result	2010-09-02 00:00:20 +0000
@@ -21,11 +21,12 @@ ERROR 1050 (42S01) at line 203: Table 'f
 ERROR 1050 (42S01) at line 212: Table 'mutex_instances' already exists
 ERROR 1050 (42S01) at line 222: Table 'performance_timers' already exists
 ERROR 1050 (42S01) at line 232: Table 'rwlock_instances' already exists
-ERROR 1050 (42S01) at line 240: Table 'setup_consumers' already exists
-ERROR 1050 (42S01) at line 249: Table 'setup_instruments' already exists
-ERROR 1050 (42S01) at line 257: Table 'setup_timers' already exists
-ERROR 1050 (42S01) at line 266: Table 'threads' already exists
-ERROR 1644 (HY000) at line 682: Unexpected content found in the performance_schema database.
+ERROR 1050 (42S01) at line 242: Table 'setup_actors' already exists
+ERROR 1050 (42S01) at line 250: Table 'setup_consumers' already exists
+ERROR 1050 (42S01) at line 259: Table 'setup_instruments' already exists
+ERROR 1050 (42S01) at line 267: Table 'setup_timers' already exists
+ERROR 1050 (42S01) at line 287: Table 'threads' already exists
+ERROR 1644 (HY000) at line 703: Unexpected content found in the performance_schema database.
 FATAL ERROR: Upgrade failed
 show tables like "user_table";
 Tables_in_performance_schema (user_table)
@@ -51,11 +52,12 @@ ERROR 1050 (42S01) at line 203: Table 'f
 ERROR 1050 (42S01) at line 212: Table 'mutex_instances' already exists
 ERROR 1050 (42S01) at line 222: Table 'performance_timers' already exists
 ERROR 1050 (42S01) at line 232: Table 'rwlock_instances' already exists
-ERROR 1050 (42S01) at line 240: Table 'setup_consumers' already exists
-ERROR 1050 (42S01) at line 249: Table 'setup_instruments' already exists
-ERROR 1050 (42S01) at line 257: Table 'setup_timers' already exists
-ERROR 1050 (42S01) at line 266: Table 'threads' already exists
-ERROR 1644 (HY000) at line 682: Unexpected content found in the performance_schema database.
+ERROR 1050 (42S01) at line 242: Table 'setup_actors' already exists
+ERROR 1050 (42S01) at line 250: Table 'setup_consumers' already exists
+ERROR 1050 (42S01) at line 259: Table 'setup_instruments' already exists
+ERROR 1050 (42S01) at line 267: Table 'setup_timers' already exists
+ERROR 1050 (42S01) at line 287: Table 'threads' already exists
+ERROR 1644 (HY000) at line 703: Unexpected content found in the performance_schema database.
 FATAL ERROR: Upgrade failed
 show tables like "user_view";
 Tables_in_performance_schema (user_view)
@@ -79,11 +81,12 @@ ERROR 1050 (42S01) at line 203: Table 'f
 ERROR 1050 (42S01) at line 212: Table 'mutex_instances' already exists
 ERROR 1050 (42S01) at line 222: Table 'performance_timers' already exists
 ERROR 1050 (42S01) at line 232: Table 'rwlock_instances' already exists
-ERROR 1050 (42S01) at line 240: Table 'setup_consumers' already exists
-ERROR 1050 (42S01) at line 249: Table 'setup_instruments' already exists
-ERROR 1050 (42S01) at line 257: Table 'setup_timers' already exists
-ERROR 1050 (42S01) at line 266: Table 'threads' already exists
-ERROR 1644 (HY000) at line 682: Unexpected content found in the performance_schema database.
+ERROR 1050 (42S01) at line 242: Table 'setup_actors' already exists
+ERROR 1050 (42S01) at line 250: Table 'setup_consumers' already exists
+ERROR 1050 (42S01) at line 259: Table 'setup_instruments' already exists
+ERROR 1050 (42S01) at line 267: Table 'setup_timers' already exists
+ERROR 1050 (42S01) at line 287: Table 'threads' already exists
+ERROR 1644 (HY000) at line 703: Unexpected content found in the performance_schema database.
 FATAL ERROR: Upgrade failed
 select name from mysql.proc where db='performance_schema';
 name
@@ -107,11 +110,12 @@ ERROR 1050 (42S01) at line 203: Table 'f
 ERROR 1050 (42S01) at line 212: Table 'mutex_instances' already exists
 ERROR 1050 (42S01) at line 222: Table 'performance_timers' already exists
 ERROR 1050 (42S01) at line 232: Table 'rwlock_instances' already exists
-ERROR 1050 (42S01) at line 240: Table 'setup_consumers' already exists
-ERROR 1050 (42S01) at line 249: Table 'setup_instruments' already exists
-ERROR 1050 (42S01) at line 257: Table 'setup_timers' already exists
-ERROR 1050 (42S01) at line 266: Table 'threads' already exists
-ERROR 1644 (HY000) at line 682: Unexpected content found in the performance_schema database.
+ERROR 1050 (42S01) at line 242: Table 'setup_actors' already exists
+ERROR 1050 (42S01) at line 250: Table 'setup_consumers' already exists
+ERROR 1050 (42S01) at line 259: Table 'setup_instruments' already exists
+ERROR 1050 (42S01) at line 267: Table 'setup_timers' already exists
+ERROR 1050 (42S01) at line 287: Table 'threads' already exists
+ERROR 1644 (HY000) at line 703: Unexpected content found in the performance_schema database.
 FATAL ERROR: Upgrade failed
 select name from mysql.proc where db='performance_schema';
 name
@@ -135,11 +139,12 @@ ERROR 1050 (42S01) at line 203: Table 'f
 ERROR 1050 (42S01) at line 212: Table 'mutex_instances' already exists
 ERROR 1050 (42S01) at line 222: Table 'performance_timers' already exists
 ERROR 1050 (42S01) at line 232: Table 'rwlock_instances' already exists
-ERROR 1050 (42S01) at line 240: Table 'setup_consumers' already exists
-ERROR 1050 (42S01) at line 249: Table 'setup_instruments' already exists
-ERROR 1050 (42S01) at line 257: Table 'setup_timers' already exists
-ERROR 1050 (42S01) at line 266: Table 'threads' already exists
-ERROR 1644 (HY000) at line 682: Unexpected content found in the performance_schema database.
+ERROR 1050 (42S01) at line 242: Table 'setup_actors' already exists
+ERROR 1050 (42S01) at line 250: Table 'setup_consumers' already exists
+ERROR 1050 (42S01) at line 259: Table 'setup_instruments' already exists
+ERROR 1050 (42S01) at line 267: Table 'setup_timers' already exists
+ERROR 1050 (42S01) at line 287: Table 'threads' already exists
+ERROR 1644 (HY000) at line 703: Unexpected content found in the performance_schema database.
 FATAL ERROR: Upgrade failed
 select name from mysql.event where db='performance_schema';
 name

=== added file 'mysql-test/suite/perfschema/r/schema_lc0.result'
--- a/mysql-test/suite/perfschema/r/schema_lc0.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/r/schema_lc0.result	2010-09-01 22:59:33 +0000
@@ -0,0 +1,218 @@
+show databases like 'performance_schema';
+Database (performance_schema)
+performance_schema
+show create database performance_schema;
+Database	Create Database
+performance_schema	CREATE DATABASE `performance_schema` /*!40100 DEFAULT CHARACTER SET utf8 */
+use performance_schema;
+show tables;
+Tables_in_performance_schema
+COND_INSTANCES
+EVENTS_WAITS_CURRENT
+EVENTS_WAITS_HISTORY
+EVENTS_WAITS_HISTORY_LONG
+EVENTS_WAITS_SUMMARY_BY_INSTANCE
+EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME
+EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
+FILE_INSTANCES
+FILE_SUMMARY_BY_EVENT_NAME
+FILE_SUMMARY_BY_INSTANCE
+MUTEX_INSTANCES
+PERFORMANCE_TIMERS
+RWLOCK_INSTANCES
+SETUP_ACTORS
+SETUP_CONSUMERS
+SETUP_INSTRUMENTS
+SETUP_TIMERS
+THREADS
+show create table COND_INSTANCES;
+Table	Create Table
+COND_INSTANCES	CREATE TABLE `COND_INSTANCES` (
+  `NAME` varchar(128) NOT NULL,
+  `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table EVENTS_WAITS_CURRENT;
+Table	Create Table
+EVENTS_WAITS_CURRENT	CREATE TABLE `EVENTS_WAITS_CURRENT` (
+  `THREAD_ID` int(11) NOT NULL,
+  `EVENT_ID` bigint(20) unsigned NOT NULL,
+  `EVENT_NAME` varchar(128) NOT NULL,
+  `SOURCE` varchar(64) DEFAULT NULL,
+  `TIMER_START` bigint(20) unsigned DEFAULT NULL,
+  `TIMER_END` bigint(20) unsigned DEFAULT NULL,
+  `TIMER_WAIT` bigint(20) unsigned DEFAULT NULL,
+  `SPINS` int(10) unsigned DEFAULT NULL,
+  `OBJECT_SCHEMA` varchar(64) DEFAULT NULL,
+  `OBJECT_NAME` varchar(512) DEFAULT NULL,
+  `OBJECT_TYPE` varchar(64) DEFAULT NULL,
+  `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL,
+  `NESTING_EVENT_ID` bigint(20) unsigned DEFAULT NULL,
+  `OPERATION` varchar(16) NOT NULL,
+  `NUMBER_OF_BYTES` bigint(20) unsigned DEFAULT NULL,
+  `FLAGS` int(10) unsigned DEFAULT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table EVENTS_WAITS_HISTORY;
+Table	Create Table
+EVENTS_WAITS_HISTORY	CREATE TABLE `EVENTS_WAITS_HISTORY` (
+  `THREAD_ID` int(11) NOT NULL,
+  `EVENT_ID` bigint(20) unsigned NOT NULL,
+  `EVENT_NAME` varchar(128) NOT NULL,
+  `SOURCE` varchar(64) DEFAULT NULL,
+  `TIMER_START` bigint(20) unsigned DEFAULT NULL,
+  `TIMER_END` bigint(20) unsigned DEFAULT NULL,
+  `TIMER_WAIT` bigint(20) unsigned DEFAULT NULL,
+  `SPINS` int(10) unsigned DEFAULT NULL,
+  `OBJECT_SCHEMA` varchar(64) DEFAULT NULL,
+  `OBJECT_NAME` varchar(512) DEFAULT NULL,
+  `OBJECT_TYPE` varchar(64) DEFAULT NULL,
+  `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL,
+  `NESTING_EVENT_ID` bigint(20) unsigned DEFAULT NULL,
+  `OPERATION` varchar(16) NOT NULL,
+  `NUMBER_OF_BYTES` bigint(20) unsigned DEFAULT NULL,
+  `FLAGS` int(10) unsigned DEFAULT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table EVENTS_WAITS_HISTORY_LONG;
+Table	Create Table
+EVENTS_WAITS_HISTORY_LONG	CREATE TABLE `EVENTS_WAITS_HISTORY_LONG` (
+  `THREAD_ID` int(11) NOT NULL,
+  `EVENT_ID` bigint(20) unsigned NOT NULL,
+  `EVENT_NAME` varchar(128) NOT NULL,
+  `SOURCE` varchar(64) DEFAULT NULL,
+  `TIMER_START` bigint(20) unsigned DEFAULT NULL,
+  `TIMER_END` bigint(20) unsigned DEFAULT NULL,
+  `TIMER_WAIT` bigint(20) unsigned DEFAULT NULL,
+  `SPINS` int(10) unsigned DEFAULT NULL,
+  `OBJECT_SCHEMA` varchar(64) DEFAULT NULL,
+  `OBJECT_NAME` varchar(512) DEFAULT NULL,
+  `OBJECT_TYPE` varchar(64) DEFAULT NULL,
+  `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL,
+  `NESTING_EVENT_ID` bigint(20) unsigned DEFAULT NULL,
+  `OPERATION` varchar(16) NOT NULL,
+  `NUMBER_OF_BYTES` bigint(20) unsigned DEFAULT NULL,
+  `FLAGS` int(10) unsigned DEFAULT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table EVENTS_WAITS_SUMMARY_BY_INSTANCE;
+Table	Create Table
+EVENTS_WAITS_SUMMARY_BY_INSTANCE	CREATE TABLE `EVENTS_WAITS_SUMMARY_BY_INSTANCE` (
+  `EVENT_NAME` varchar(128) NOT NULL,
+  `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL,
+  `COUNT_STAR` bigint(20) unsigned NOT NULL,
+  `SUM_TIMER_WAIT` bigint(20) unsigned NOT NULL,
+  `MIN_TIMER_WAIT` bigint(20) unsigned NOT NULL,
+  `AVG_TIMER_WAIT` bigint(20) unsigned NOT NULL,
+  `MAX_TIMER_WAIT` bigint(20) unsigned NOT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
+Table	Create Table
+EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME	CREATE TABLE `EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME` (
+  `THREAD_ID` int(11) NOT NULL,
+  `EVENT_NAME` varchar(128) NOT NULL,
+  `COUNT_STAR` bigint(20) unsigned NOT NULL,
+  `SUM_TIMER_WAIT` bigint(20) unsigned NOT NULL,
+  `MIN_TIMER_WAIT` bigint(20) unsigned NOT NULL,
+  `AVG_TIMER_WAIT` bigint(20) unsigned NOT NULL,
+  `MAX_TIMER_WAIT` bigint(20) unsigned NOT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
+Table	Create Table
+EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME	CREATE TABLE `EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME` (
+  `EVENT_NAME` varchar(128) NOT NULL,
+  `COUNT_STAR` bigint(20) unsigned NOT NULL,
+  `SUM_TIMER_WAIT` bigint(20) unsigned NOT NULL,
+  `MIN_TIMER_WAIT` bigint(20) unsigned NOT NULL,
+  `AVG_TIMER_WAIT` bigint(20) unsigned NOT NULL,
+  `MAX_TIMER_WAIT` bigint(20) unsigned NOT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table FILE_INSTANCES;
+Table	Create Table
+FILE_INSTANCES	CREATE TABLE `FILE_INSTANCES` (
+  `FILE_NAME` varchar(512) NOT NULL,
+  `EVENT_NAME` varchar(128) NOT NULL,
+  `OPEN_COUNT` int(10) unsigned NOT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table FILE_SUMMARY_BY_EVENT_NAME;
+Table	Create Table
+FILE_SUMMARY_BY_EVENT_NAME	CREATE TABLE `FILE_SUMMARY_BY_EVENT_NAME` (
+  `EVENT_NAME` varchar(128) NOT NULL,
+  `COUNT_READ` bigint(20) unsigned NOT NULL,
+  `COUNT_WRITE` bigint(20) unsigned NOT NULL,
+  `SUM_NUMBER_OF_BYTES_READ` bigint(20) unsigned NOT NULL,
+  `SUM_NUMBER_OF_BYTES_WRITE` bigint(20) unsigned NOT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table FILE_SUMMARY_BY_INSTANCE;
+Table	Create Table
+FILE_SUMMARY_BY_INSTANCE	CREATE TABLE `FILE_SUMMARY_BY_INSTANCE` (
+  `FILE_NAME` varchar(512) NOT NULL,
+  `EVENT_NAME` varchar(128) NOT NULL,
+  `COUNT_READ` bigint(20) unsigned NOT NULL,
+  `COUNT_WRITE` bigint(20) unsigned NOT NULL,
+  `SUM_NUMBER_OF_BYTES_READ` bigint(20) unsigned NOT NULL,
+  `SUM_NUMBER_OF_BYTES_WRITE` bigint(20) unsigned NOT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table MUTEX_INSTANCES;
+Table	Create Table
+MUTEX_INSTANCES	CREATE TABLE `MUTEX_INSTANCES` (
+  `NAME` varchar(128) NOT NULL,
+  `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL,
+  `LOCKED_BY_THREAD_ID` int(11) DEFAULT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table PERFORMANCE_TIMERS;
+Table	Create Table
+PERFORMANCE_TIMERS	CREATE TABLE `PERFORMANCE_TIMERS` (
+  `TIMER_NAME` enum('CYCLE','NANOSECOND','MICROSECOND','MILLISECOND','TICK') NOT NULL,
+  `TIMER_FREQUENCY` bigint(20) DEFAULT NULL,
+  `TIMER_RESOLUTION` bigint(20) DEFAULT NULL,
+  `TIMER_OVERHEAD` bigint(20) DEFAULT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table RWLOCK_INSTANCES;
+Table	Create Table
+RWLOCK_INSTANCES	CREATE TABLE `RWLOCK_INSTANCES` (
+  `NAME` varchar(128) NOT NULL,
+  `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL,
+  `WRITE_LOCKED_BY_THREAD_ID` int(11) DEFAULT NULL,
+  `READ_LOCKED_BY_COUNT` int(10) unsigned NOT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table SETUP_ACTORS;
+Table	Create Table
+SETUP_ACTORS	CREATE TABLE `SETUP_ACTORS` (
+  `HOST` char(60) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '%',
+  `USER` char(16) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '%',
+  `ROLE` char(16) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '%'
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table SETUP_CONSUMERS;
+Table	Create Table
+SETUP_CONSUMERS	CREATE TABLE `SETUP_CONSUMERS` (
+  `NAME` varchar(64) NOT NULL,
+  `ENABLED` enum('YES','NO') NOT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table SETUP_INSTRUMENTS;
+Table	Create Table
+SETUP_INSTRUMENTS	CREATE TABLE `SETUP_INSTRUMENTS` (
+  `NAME` varchar(128) NOT NULL,
+  `ENABLED` enum('YES','NO') NOT NULL,
+  `TIMED` enum('YES','NO') NOT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table SETUP_TIMERS;
+Table	Create Table
+SETUP_TIMERS	CREATE TABLE `SETUP_TIMERS` (
+  `NAME` varchar(64) NOT NULL,
+  `TIMER_NAME` enum('CYCLE','NANOSECOND','MICROSECOND','MILLISECOND','TICK') NOT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table THREADS;
+Table	Create Table
+THREADS	CREATE TABLE `THREADS` (
+  `THREAD_ID` int(11) NOT NULL,
+  `NAME` varchar(128) NOT NULL,
+  `TYPE` varchar(10) NOT NULL,
+  `PROCESSLIST_ID` int(11) DEFAULT NULL,
+  `PROCESSLIST_USER` varchar(16) DEFAULT NULL,
+  `PROCESSLIST_HOST` varchar(60) DEFAULT NULL,
+  `PROCESSLIST_DB` varchar(64) DEFAULT NULL,
+  `PROCESSLIST_COMMAND` varchar(16) DEFAULT NULL,
+  `PROCESSLIST_TIME` bigint(20) DEFAULT NULL,
+  `PROCESSLIST_STATE` varchar(64) DEFAULT NULL,
+  `PROCESSLIST_INFO` longtext,
+  `PARENT_THREAD_ID` int(11) DEFAULT NULL,
+  `ROLE` varchar(64) DEFAULT NULL,
+  `INSTRUMENTED` enum('YES','NO') NOT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8

=== added file 'mysql-test/suite/perfschema/r/schema_lc1.result'
--- a/mysql-test/suite/perfschema/r/schema_lc1.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/r/schema_lc1.result	2010-09-02 00:00:20 +0000
@@ -0,0 +1,218 @@
+show databases like 'performance_schema';
+Database (performance_schema)
+performance_schema
+show create database performance_schema;
+Database	Create Database
+performance_schema	CREATE DATABASE `performance_schema` /*!40100 DEFAULT CHARACTER SET utf8 */
+use performance_schema;
+show tables;
+Tables_in_performance_schema
+cond_instances
+events_waits_current
+events_waits_history
+events_waits_history_long
+events_waits_summary_by_instance
+events_waits_summary_by_thread_by_event_name
+events_waits_summary_global_by_event_name
+file_instances
+file_summary_by_event_name
+file_summary_by_instance
+mutex_instances
+performance_timers
+rwlock_instances
+setup_actors
+setup_consumers
+setup_instruments
+setup_timers
+threads
+show create table COND_INSTANCES;
+Table	Create Table
+COND_INSTANCES	CREATE TABLE `cond_instances` (
+  `NAME` varchar(128) NOT NULL,
+  `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table EVENTS_WAITS_CURRENT;
+Table	Create Table
+EVENTS_WAITS_CURRENT	CREATE TABLE `events_waits_current` (
+  `THREAD_ID` int(11) NOT NULL,
+  `EVENT_ID` bigint(20) unsigned NOT NULL,
+  `EVENT_NAME` varchar(128) NOT NULL,
+  `SOURCE` varchar(64) DEFAULT NULL,
+  `TIMER_START` bigint(20) unsigned DEFAULT NULL,
+  `TIMER_END` bigint(20) unsigned DEFAULT NULL,
+  `TIMER_WAIT` bigint(20) unsigned DEFAULT NULL,
+  `SPINS` int(10) unsigned DEFAULT NULL,
+  `OBJECT_SCHEMA` varchar(64) DEFAULT NULL,
+  `OBJECT_NAME` varchar(512) DEFAULT NULL,
+  `OBJECT_TYPE` varchar(64) DEFAULT NULL,
+  `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL,
+  `NESTING_EVENT_ID` bigint(20) unsigned DEFAULT NULL,
+  `OPERATION` varchar(16) NOT NULL,
+  `NUMBER_OF_BYTES` bigint(20) unsigned DEFAULT NULL,
+  `FLAGS` int(10) unsigned DEFAULT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table EVENTS_WAITS_HISTORY;
+Table	Create Table
+EVENTS_WAITS_HISTORY	CREATE TABLE `events_waits_history` (
+  `THREAD_ID` int(11) NOT NULL,
+  `EVENT_ID` bigint(20) unsigned NOT NULL,
+  `EVENT_NAME` varchar(128) NOT NULL,
+  `SOURCE` varchar(64) DEFAULT NULL,
+  `TIMER_START` bigint(20) unsigned DEFAULT NULL,
+  `TIMER_END` bigint(20) unsigned DEFAULT NULL,
+  `TIMER_WAIT` bigint(20) unsigned DEFAULT NULL,
+  `SPINS` int(10) unsigned DEFAULT NULL,
+  `OBJECT_SCHEMA` varchar(64) DEFAULT NULL,
+  `OBJECT_NAME` varchar(512) DEFAULT NULL,
+  `OBJECT_TYPE` varchar(64) DEFAULT NULL,
+  `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL,
+  `NESTING_EVENT_ID` bigint(20) unsigned DEFAULT NULL,
+  `OPERATION` varchar(16) NOT NULL,
+  `NUMBER_OF_BYTES` bigint(20) unsigned DEFAULT NULL,
+  `FLAGS` int(10) unsigned DEFAULT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table EVENTS_WAITS_HISTORY_LONG;
+Table	Create Table
+EVENTS_WAITS_HISTORY_LONG	CREATE TABLE `events_waits_history_long` (
+  `THREAD_ID` int(11) NOT NULL,
+  `EVENT_ID` bigint(20) unsigned NOT NULL,
+  `EVENT_NAME` varchar(128) NOT NULL,
+  `SOURCE` varchar(64) DEFAULT NULL,
+  `TIMER_START` bigint(20) unsigned DEFAULT NULL,
+  `TIMER_END` bigint(20) unsigned DEFAULT NULL,
+  `TIMER_WAIT` bigint(20) unsigned DEFAULT NULL,
+  `SPINS` int(10) unsigned DEFAULT NULL,
+  `OBJECT_SCHEMA` varchar(64) DEFAULT NULL,
+  `OBJECT_NAME` varchar(512) DEFAULT NULL,
+  `OBJECT_TYPE` varchar(64) DEFAULT NULL,
+  `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL,
+  `NESTING_EVENT_ID` bigint(20) unsigned DEFAULT NULL,
+  `OPERATION` varchar(16) NOT NULL,
+  `NUMBER_OF_BYTES` bigint(20) unsigned DEFAULT NULL,
+  `FLAGS` int(10) unsigned DEFAULT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table EVENTS_WAITS_SUMMARY_BY_INSTANCE;
+Table	Create Table
+EVENTS_WAITS_SUMMARY_BY_INSTANCE	CREATE TABLE `events_waits_summary_by_instance` (
+  `EVENT_NAME` varchar(128) NOT NULL,
+  `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL,
+  `COUNT_STAR` bigint(20) unsigned NOT NULL,
+  `SUM_TIMER_WAIT` bigint(20) unsigned NOT NULL,
+  `MIN_TIMER_WAIT` bigint(20) unsigned NOT NULL,
+  `AVG_TIMER_WAIT` bigint(20) unsigned NOT NULL,
+  `MAX_TIMER_WAIT` bigint(20) unsigned NOT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
+Table	Create Table
+EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME	CREATE TABLE `events_waits_summary_by_thread_by_event_name` (
+  `THREAD_ID` int(11) NOT NULL,
+  `EVENT_NAME` varchar(128) NOT NULL,
+  `COUNT_STAR` bigint(20) unsigned NOT NULL,
+  `SUM_TIMER_WAIT` bigint(20) unsigned NOT NULL,
+  `MIN_TIMER_WAIT` bigint(20) unsigned NOT NULL,
+  `AVG_TIMER_WAIT` bigint(20) unsigned NOT NULL,
+  `MAX_TIMER_WAIT` bigint(20) unsigned NOT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
+Table	Create Table
+EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME	CREATE TABLE `events_waits_summary_global_by_event_name` (
+  `EVENT_NAME` varchar(128) NOT NULL,
+  `COUNT_STAR` bigint(20) unsigned NOT NULL,
+  `SUM_TIMER_WAIT` bigint(20) unsigned NOT NULL,
+  `MIN_TIMER_WAIT` bigint(20) unsigned NOT NULL,
+  `AVG_TIMER_WAIT` bigint(20) unsigned NOT NULL,
+  `MAX_TIMER_WAIT` bigint(20) unsigned NOT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table FILE_INSTANCES;
+Table	Create Table
+FILE_INSTANCES	CREATE TABLE `file_instances` (
+  `FILE_NAME` varchar(512) NOT NULL,
+  `EVENT_NAME` varchar(128) NOT NULL,
+  `OPEN_COUNT` int(10) unsigned NOT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table FILE_SUMMARY_BY_EVENT_NAME;
+Table	Create Table
+FILE_SUMMARY_BY_EVENT_NAME	CREATE TABLE `file_summary_by_event_name` (
+  `EVENT_NAME` varchar(128) NOT NULL,
+  `COUNT_READ` bigint(20) unsigned NOT NULL,
+  `COUNT_WRITE` bigint(20) unsigned NOT NULL,
+  `SUM_NUMBER_OF_BYTES_READ` bigint(20) unsigned NOT NULL,
+  `SUM_NUMBER_OF_BYTES_WRITE` bigint(20) unsigned NOT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table FILE_SUMMARY_BY_INSTANCE;
+Table	Create Table
+FILE_SUMMARY_BY_INSTANCE	CREATE TABLE `file_summary_by_instance` (
+  `FILE_NAME` varchar(512) NOT NULL,
+  `EVENT_NAME` varchar(128) NOT NULL,
+  `COUNT_READ` bigint(20) unsigned NOT NULL,
+  `COUNT_WRITE` bigint(20) unsigned NOT NULL,
+  `SUM_NUMBER_OF_BYTES_READ` bigint(20) unsigned NOT NULL,
+  `SUM_NUMBER_OF_BYTES_WRITE` bigint(20) unsigned NOT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table MUTEX_INSTANCES;
+Table	Create Table
+MUTEX_INSTANCES	CREATE TABLE `mutex_instances` (
+  `NAME` varchar(128) NOT NULL,
+  `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL,
+  `LOCKED_BY_THREAD_ID` int(11) DEFAULT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table PERFORMANCE_TIMERS;
+Table	Create Table
+PERFORMANCE_TIMERS	CREATE TABLE `performance_timers` (
+  `TIMER_NAME` enum('CYCLE','NANOSECOND','MICROSECOND','MILLISECOND','TICK') NOT NULL,
+  `TIMER_FREQUENCY` bigint(20) DEFAULT NULL,
+  `TIMER_RESOLUTION` bigint(20) DEFAULT NULL,
+  `TIMER_OVERHEAD` bigint(20) DEFAULT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table RWLOCK_INSTANCES;
+Table	Create Table
+RWLOCK_INSTANCES	CREATE TABLE `rwlock_instances` (
+  `NAME` varchar(128) NOT NULL,
+  `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL,
+  `WRITE_LOCKED_BY_THREAD_ID` int(11) DEFAULT NULL,
+  `READ_LOCKED_BY_COUNT` int(10) unsigned NOT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table SETUP_ACTORS;
+Table	Create Table
+SETUP_ACTORS	CREATE TABLE `setup_actors` (
+  `HOST` char(60) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '%',
+  `USER` char(16) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '%',
+  `ROLE` char(16) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '%'
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table SETUP_CONSUMERS;
+Table	Create Table
+SETUP_CONSUMERS	CREATE TABLE `setup_consumers` (
+  `NAME` varchar(64) NOT NULL,
+  `ENABLED` enum('YES','NO') NOT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table SETUP_INSTRUMENTS;
+Table	Create Table
+SETUP_INSTRUMENTS	CREATE TABLE `setup_instruments` (
+  `NAME` varchar(128) NOT NULL,
+  `ENABLED` enum('YES','NO') NOT NULL,
+  `TIMED` enum('YES','NO') NOT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table SETUP_TIMERS;
+Table	Create Table
+SETUP_TIMERS	CREATE TABLE `setup_timers` (
+  `NAME` varchar(64) NOT NULL,
+  `TIMER_NAME` enum('CYCLE','NANOSECOND','MICROSECOND','MILLISECOND','TICK') NOT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table THREADS;
+Table	Create Table
+THREADS	CREATE TABLE `threads` (
+  `THREAD_ID` int(11) NOT NULL,
+  `NAME` varchar(128) NOT NULL,
+  `TYPE` varchar(10) NOT NULL,
+  `PROCESSLIST_ID` int(11) DEFAULT NULL,
+  `PROCESSLIST_USER` varchar(16) DEFAULT NULL,
+  `PROCESSLIST_HOST` varchar(60) DEFAULT NULL,
+  `PROCESSLIST_DB` varchar(64) DEFAULT NULL,
+  `PROCESSLIST_COMMAND` varchar(16) DEFAULT NULL,
+  `PROCESSLIST_TIME` bigint(20) DEFAULT NULL,
+  `PROCESSLIST_STATE` varchar(64) DEFAULT NULL,
+  `PROCESSLIST_INFO` longtext,
+  `PARENT_THREAD_ID` int(11) DEFAULT NULL,
+  `ROLE` varchar(64) DEFAULT NULL,
+  `INSTRUMENTED` enum('YES','NO') NOT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8

=== added file 'mysql-test/suite/perfschema/r/schema_lc2.result'
--- a/mysql-test/suite/perfschema/r/schema_lc2.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/r/schema_lc2.result	2010-09-02 00:00:20 +0000
@@ -0,0 +1,218 @@
+show databases like 'performance_schema';
+Database (performance_schema)
+performance_schema
+show create database performance_schema;
+Database	Create Database
+performance_schema	CREATE DATABASE `performance_schema` /*!40100 DEFAULT CHARACTER SET utf8 */
+use performance_schema;
+show tables;
+Tables_in_performance_schema
+COND_INSTANCES
+EVENTS_WAITS_CURRENT
+EVENTS_WAITS_HISTORY
+EVENTS_WAITS_HISTORY_LONG
+EVENTS_WAITS_SUMMARY_BY_INSTANCE
+EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME
+EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
+FILE_INSTANCES
+FILE_SUMMARY_BY_EVENT_NAME
+FILE_SUMMARY_BY_INSTANCE
+MUTEX_INSTANCES
+PERFORMANCE_TIMERS
+RWLOCK_INSTANCES
+SETUP_ACTORS
+SETUP_CONSUMERS
+SETUP_INSTRUMENTS
+SETUP_TIMERS
+THREADS
+show create table COND_INSTANCES;
+Table	Create Table
+COND_INSTANCES	CREATE TABLE `COND_INSTANCES` (
+  `NAME` varchar(128) NOT NULL,
+  `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table EVENTS_WAITS_CURRENT;
+Table	Create Table
+EVENTS_WAITS_CURRENT	CREATE TABLE `EVENTS_WAITS_CURRENT` (
+  `THREAD_ID` int(11) NOT NULL,
+  `EVENT_ID` bigint(20) unsigned NOT NULL,
+  `EVENT_NAME` varchar(128) NOT NULL,
+  `SOURCE` varchar(64) DEFAULT NULL,
+  `TIMER_START` bigint(20) unsigned DEFAULT NULL,
+  `TIMER_END` bigint(20) unsigned DEFAULT NULL,
+  `TIMER_WAIT` bigint(20) unsigned DEFAULT NULL,
+  `SPINS` int(10) unsigned DEFAULT NULL,
+  `OBJECT_SCHEMA` varchar(64) DEFAULT NULL,
+  `OBJECT_NAME` varchar(512) DEFAULT NULL,
+  `OBJECT_TYPE` varchar(64) DEFAULT NULL,
+  `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL,
+  `NESTING_EVENT_ID` bigint(20) unsigned DEFAULT NULL,
+  `OPERATION` varchar(16) NOT NULL,
+  `NUMBER_OF_BYTES` bigint(20) unsigned DEFAULT NULL,
+  `FLAGS` int(10) unsigned DEFAULT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table EVENTS_WAITS_HISTORY;
+Table	Create Table
+EVENTS_WAITS_HISTORY	CREATE TABLE `EVENTS_WAITS_HISTORY` (
+  `THREAD_ID` int(11) NOT NULL,
+  `EVENT_ID` bigint(20) unsigned NOT NULL,
+  `EVENT_NAME` varchar(128) NOT NULL,
+  `SOURCE` varchar(64) DEFAULT NULL,
+  `TIMER_START` bigint(20) unsigned DEFAULT NULL,
+  `TIMER_END` bigint(20) unsigned DEFAULT NULL,
+  `TIMER_WAIT` bigint(20) unsigned DEFAULT NULL,
+  `SPINS` int(10) unsigned DEFAULT NULL,
+  `OBJECT_SCHEMA` varchar(64) DEFAULT NULL,
+  `OBJECT_NAME` varchar(512) DEFAULT NULL,
+  `OBJECT_TYPE` varchar(64) DEFAULT NULL,
+  `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL,
+  `NESTING_EVENT_ID` bigint(20) unsigned DEFAULT NULL,
+  `OPERATION` varchar(16) NOT NULL,
+  `NUMBER_OF_BYTES` bigint(20) unsigned DEFAULT NULL,
+  `FLAGS` int(10) unsigned DEFAULT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table EVENTS_WAITS_HISTORY_LONG;
+Table	Create Table
+EVENTS_WAITS_HISTORY_LONG	CREATE TABLE `EVENTS_WAITS_HISTORY_LONG` (
+  `THREAD_ID` int(11) NOT NULL,
+  `EVENT_ID` bigint(20) unsigned NOT NULL,
+  `EVENT_NAME` varchar(128) NOT NULL,
+  `SOURCE` varchar(64) DEFAULT NULL,
+  `TIMER_START` bigint(20) unsigned DEFAULT NULL,
+  `TIMER_END` bigint(20) unsigned DEFAULT NULL,
+  `TIMER_WAIT` bigint(20) unsigned DEFAULT NULL,
+  `SPINS` int(10) unsigned DEFAULT NULL,
+  `OBJECT_SCHEMA` varchar(64) DEFAULT NULL,
+  `OBJECT_NAME` varchar(512) DEFAULT NULL,
+  `OBJECT_TYPE` varchar(64) DEFAULT NULL,
+  `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL,
+  `NESTING_EVENT_ID` bigint(20) unsigned DEFAULT NULL,
+  `OPERATION` varchar(16) NOT NULL,
+  `NUMBER_OF_BYTES` bigint(20) unsigned DEFAULT NULL,
+  `FLAGS` int(10) unsigned DEFAULT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table EVENTS_WAITS_SUMMARY_BY_INSTANCE;
+Table	Create Table
+EVENTS_WAITS_SUMMARY_BY_INSTANCE	CREATE TABLE `EVENTS_WAITS_SUMMARY_BY_INSTANCE` (
+  `EVENT_NAME` varchar(128) NOT NULL,
+  `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL,
+  `COUNT_STAR` bigint(20) unsigned NOT NULL,
+  `SUM_TIMER_WAIT` bigint(20) unsigned NOT NULL,
+  `MIN_TIMER_WAIT` bigint(20) unsigned NOT NULL,
+  `AVG_TIMER_WAIT` bigint(20) unsigned NOT NULL,
+  `MAX_TIMER_WAIT` bigint(20) unsigned NOT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
+Table	Create Table
+EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME	CREATE TABLE `EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME` (
+  `THREAD_ID` int(11) NOT NULL,
+  `EVENT_NAME` varchar(128) NOT NULL,
+  `COUNT_STAR` bigint(20) unsigned NOT NULL,
+  `SUM_TIMER_WAIT` bigint(20) unsigned NOT NULL,
+  `MIN_TIMER_WAIT` bigint(20) unsigned NOT NULL,
+  `AVG_TIMER_WAIT` bigint(20) unsigned NOT NULL,
+  `MAX_TIMER_WAIT` bigint(20) unsigned NOT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
+Table	Create Table
+EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME	CREATE TABLE `EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME` (
+  `EVENT_NAME` varchar(128) NOT NULL,
+  `COUNT_STAR` bigint(20) unsigned NOT NULL,
+  `SUM_TIMER_WAIT` bigint(20) unsigned NOT NULL,
+  `MIN_TIMER_WAIT` bigint(20) unsigned NOT NULL,
+  `AVG_TIMER_WAIT` bigint(20) unsigned NOT NULL,
+  `MAX_TIMER_WAIT` bigint(20) unsigned NOT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table FILE_INSTANCES;
+Table	Create Table
+FILE_INSTANCES	CREATE TABLE `FILE_INSTANCES` (
+  `FILE_NAME` varchar(512) NOT NULL,
+  `EVENT_NAME` varchar(128) NOT NULL,
+  `OPEN_COUNT` int(10) unsigned NOT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table FILE_SUMMARY_BY_EVENT_NAME;
+Table	Create Table
+FILE_SUMMARY_BY_EVENT_NAME	CREATE TABLE `FILE_SUMMARY_BY_EVENT_NAME` (
+  `EVENT_NAME` varchar(128) NOT NULL,
+  `COUNT_READ` bigint(20) unsigned NOT NULL,
+  `COUNT_WRITE` bigint(20) unsigned NOT NULL,
+  `SUM_NUMBER_OF_BYTES_READ` bigint(20) unsigned NOT NULL,
+  `SUM_NUMBER_OF_BYTES_WRITE` bigint(20) unsigned NOT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table FILE_SUMMARY_BY_INSTANCE;
+Table	Create Table
+FILE_SUMMARY_BY_INSTANCE	CREATE TABLE `FILE_SUMMARY_BY_INSTANCE` (
+  `FILE_NAME` varchar(512) NOT NULL,
+  `EVENT_NAME` varchar(128) NOT NULL,
+  `COUNT_READ` bigint(20) unsigned NOT NULL,
+  `COUNT_WRITE` bigint(20) unsigned NOT NULL,
+  `SUM_NUMBER_OF_BYTES_READ` bigint(20) unsigned NOT NULL,
+  `SUM_NUMBER_OF_BYTES_WRITE` bigint(20) unsigned NOT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table MUTEX_INSTANCES;
+Table	Create Table
+MUTEX_INSTANCES	CREATE TABLE `MUTEX_INSTANCES` (
+  `NAME` varchar(128) NOT NULL,
+  `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL,
+  `LOCKED_BY_THREAD_ID` int(11) DEFAULT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table PERFORMANCE_TIMERS;
+Table	Create Table
+PERFORMANCE_TIMERS	CREATE TABLE `PERFORMANCE_TIMERS` (
+  `TIMER_NAME` enum('CYCLE','NANOSECOND','MICROSECOND','MILLISECOND','TICK') NOT NULL,
+  `TIMER_FREQUENCY` bigint(20) DEFAULT NULL,
+  `TIMER_RESOLUTION` bigint(20) DEFAULT NULL,
+  `TIMER_OVERHEAD` bigint(20) DEFAULT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table RWLOCK_INSTANCES;
+Table	Create Table
+RWLOCK_INSTANCES	CREATE TABLE `RWLOCK_INSTANCES` (
+  `NAME` varchar(128) NOT NULL,
+  `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL,
+  `WRITE_LOCKED_BY_THREAD_ID` int(11) DEFAULT NULL,
+  `READ_LOCKED_BY_COUNT` int(10) unsigned NOT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table SETUP_ACTORS;
+Table	Create Table
+SETUP_ACTORS	CREATE TABLE `SETUP_ACTORS` (
+  `HOST` char(60) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '%',
+  `USER` char(16) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '%',
+  `ROLE` char(16) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '%'
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table SETUP_CONSUMERS;
+Table	Create Table
+SETUP_CONSUMERS	CREATE TABLE `SETUP_CONSUMERS` (
+  `NAME` varchar(64) NOT NULL,
+  `ENABLED` enum('YES','NO') NOT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table SETUP_INSTRUMENTS;
+Table	Create Table
+SETUP_INSTRUMENTS	CREATE TABLE `SETUP_INSTRUMENTS` (
+  `NAME` varchar(128) NOT NULL,
+  `ENABLED` enum('YES','NO') NOT NULL,
+  `TIMED` enum('YES','NO') NOT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table SETUP_TIMERS;
+Table	Create Table
+SETUP_TIMERS	CREATE TABLE `SETUP_TIMERS` (
+  `NAME` varchar(64) NOT NULL,
+  `TIMER_NAME` enum('CYCLE','NANOSECOND','MICROSECOND','MILLISECOND','TICK') NOT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table THREADS;
+Table	Create Table
+THREADS	CREATE TABLE `THREADS` (
+  `THREAD_ID` int(11) NOT NULL,
+  `NAME` varchar(128) NOT NULL,
+  `TYPE` varchar(10) NOT NULL,
+  `PROCESSLIST_ID` int(11) DEFAULT NULL,
+  `PROCESSLIST_USER` varchar(16) DEFAULT NULL,
+  `PROCESSLIST_HOST` varchar(60) DEFAULT NULL,
+  `PROCESSLIST_DB` varchar(64) DEFAULT NULL,
+  `PROCESSLIST_COMMAND` varchar(16) DEFAULT NULL,
+  `PROCESSLIST_TIME` bigint(20) DEFAULT NULL,
+  `PROCESSLIST_STATE` varchar(64) DEFAULT NULL,
+  `PROCESSLIST_INFO` longtext,
+  `PARENT_THREAD_ID` int(11) DEFAULT NULL,
+  `ROLE` varchar(64) DEFAULT NULL,
+  `INSTRUMENTED` enum('YES','NO') NOT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8

=== modified file 'mysql-test/suite/perfschema/r/selects.result'
--- a/mysql-test/suite/perfschema/r/selects.result	2010-08-12 15:25:01 +0000
+++ b/mysql-test/suite/perfschema/r/selects.result	2010-09-01 22:59:33 +0000
@@ -86,22 +86,22 @@ id	c
 13	[EVENT_ID]
 DROP TRIGGER t_ps_trigger;
 DROP PROCEDURE IF EXISTS t_ps_proc;
-CREATE PROCEDURE t_ps_proc(IN tid INT, OUT pid INT)
+CREATE PROCEDURE t_ps_proc(IN conid INT, OUT pid INT)
 BEGIN
-SELECT id FROM performance_schema.THREADS
-WHERE THREAD_ID = tid INTO pid;
+SELECT thread_id FROM performance_schema.THREADS
+WHERE PROCESSLIST_ID = conid INTO pid;
 END;
 |
-CALL t_ps_proc(0, @p_id);
+CALL t_ps_proc(connection_id(), @p_id);
 DROP FUNCTION IF EXISTS t_ps_proc;
-CREATE FUNCTION t_ps_func(tid INT) RETURNS int
+CREATE FUNCTION t_ps_func(conid INT) RETURNS int
 BEGIN
-return (SELECT id FROM performance_schema.THREADS
-WHERE THREAD_ID = tid);
+return (SELECT thread_id FROM performance_schema.THREADS
+WHERE PROCESSLIST_ID = conid);
 END;
 |
-SELECT t_ps_func(0) = @p_id;
-t_ps_func(0) = @p_id
+SELECT t_ps_func(connection_id()) = @p_id;
+t_ps_func(connection_id()) = @p_id
 1
 SELECT * FROM t_event;
 EVENT_ID

=== added file 'mysql-test/suite/perfschema/r/setup_actors.result'
--- a/mysql-test/suite/perfschema/r/setup_actors.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/r/setup_actors.result	2010-09-01 22:59:33 +0000
@@ -0,0 +1,135 @@
+select * from performance_schema.SETUP_ACTORS;
+HOST	USER	ROLE
+%	%	%
+truncate table performance_schema.SETUP_ACTORS;
+insert into performance_schema.SETUP_ACTORS
+values ('hosta', 'user1', '%');
+insert into performance_schema.SETUP_ACTORS
+values ('%', 'user2', '%');
+insert into performance_schema.SETUP_ACTORS
+values ('localhost', 'user3', '%');
+insert into performance_schema.SETUP_ACTORS
+values ('hostb', '%', '%');
+select * from performance_schema.SETUP_ACTORS
+order by USER, HOST, ROLE;
+HOST	USER	ROLE
+hostb	%	%
+hosta	user1	%
+%	user2	%
+localhost	user3	%
+grant ALL on *.* to user1@localhost;
+grant ALL on *.* to user2@localhost;
+grant ALL on *.* to user3@localhost;
+grant ALL on *.* to user4@localhost;
+grant select on test.* to user5@localhost;
+flush privileges;
+# Switch to (con1, localhost, user1, , )
+select NAME, TYPE, INSTRUMENTED, PROCESSLIST_USER, PROCESSLIST_HOST
+from performance_schema.THREADS
+where PROCESSLIST_ID = connection_id();
+NAME	TYPE	INSTRUMENTED	PROCESSLIST_USER	PROCESSLIST_HOST
+thread/sql/one_connection	FOREGROUND	NO	user1	localhost
+# Switch to connection default
+insert into performance_schema.SETUP_ACTORS
+values ('%', 'user1', '%');
+# Switch to connection con1
+select NAME, TYPE, INSTRUMENTED, PROCESSLIST_USER, PROCESSLIST_HOST
+from performance_schema.THREADS
+where PROCESSLIST_ID = connection_id();
+NAME	TYPE	INSTRUMENTED	PROCESSLIST_USER	PROCESSLIST_HOST
+thread/sql/one_connection	FOREGROUND	NO	user1	localhost
+# Disconnect con1
+# Switch to (con2, localhost, user2, , )
+select NAME, TYPE, INSTRUMENTED, PROCESSLIST_USER, PROCESSLIST_HOST
+from performance_schema.THREADS
+where PROCESSLIST_ID=connection_id();
+NAME	TYPE	INSTRUMENTED	PROCESSLIST_USER	PROCESSLIST_HOST
+thread/sql/one_connection	FOREGROUND	YES	user2	localhost
+# Disconnect con2
+# Switch to connection default
+drop table if exists test.t1;
+create table test.t1 (col1 bigint);
+lock table test.t1 write;
+# Switch to (con3, localhost, user3, , )
+select NAME, TYPE, INSTRUMENTED, PROCESSLIST_USER, PROCESSLIST_HOST
+from performance_schema.THREADS
+where PROCESSLIST_ID = connection_id();
+NAME	TYPE	INSTRUMENTED	PROCESSLIST_USER	PROCESSLIST_HOST
+thread/sql/one_connection	FOREGROUND	YES	user3	localhost
+# Send a statement to the server, but do not wait till the result
+# comes back. We will pull this later.
+insert into test.t1 set col1 = 1;
+# Switch to (con4, localhost, user4, , )
+# Poll till INFO is no more NULL and State = 'Waiting for table metadata lock'.
+select count(*) = 1
+from performance_schema.THREADS T inner join information_schema.PROCESSLIST P
+on T.PROCESSLIST_ID = P.ID and T.PROCESSLIST_USER = P.USER and
+T.PROCESSLIST_HOST = P.HOST and T.PROCESSLIST_DB = P.DB and
+T.PROCESSLIST_COMMAND = P.COMMAND and T.PROCESSLIST_INFO = P.INFO
+where T.PROCESSLIST_USER = 'user3' and T.NAME = 'thread/sql/one_connection';
+count(*) = 1
+1
+# Switch to connection default
+unlock tables;
+# Switch to connection con3 and reap the result of the no more blocked insert
+# Switch to connection default
+drop table test.t1;
+# Disconnect con3
+# Switch to connection con4
+select NAME, TYPE, INSTRUMENTED, PROCESSLIST_USER, PROCESSLIST_HOST
+from performance_schema.THREADS
+where PROCESSLIST_ID = connection_id();
+NAME	TYPE	INSTRUMENTED	PROCESSLIST_USER	PROCESSLIST_HOST
+thread/sql/one_connection	FOREGROUND	NO	user4	localhost
+# Disconnect con4
+# Switch to connection default
+insert into performance_schema.SETUP_ACTORS
+values ('localhost', '%', '%');
+select * from performance_schema.SETUP_ACTORS
+order by USER, HOST, ROLE;
+HOST	USER	ROLE
+hostb	%	%
+localhost	%	%
+%	user1	%
+hosta	user1	%
+%	user2	%
+localhost	user3	%
+# Switch to (con4b, localhost, user4, , )
+select NAME, TYPE, INSTRUMENTED, PROCESSLIST_USER, PROCESSLIST_HOST
+from performance_schema.THREADS
+where PROCESSLIST_ID = connection_id();
+NAME	TYPE	INSTRUMENTED	PROCESSLIST_USER	PROCESSLIST_HOST
+thread/sql/one_connection	FOREGROUND	YES	user4	localhost
+# Disconnect con4b
+# Switch to connection default
+insert into performance_schema.SETUP_ACTORS
+values ('%', 'user5', '%');
+create sql security definer view test.v1 as select NAME, TYPE, INSTRUMENTED, PROCESSLIST_USER, PROCESSLIST_HOST
+from performance_schema.THREADS
+where PROCESSLIST_ID = connection_id();
+# Switch to (con5, localhost, user5, , )
+select * from performance_schema.THREADS;
+ERROR 42000: SELECT command denied to user 'user5'@'localhost' for table 'THREADS'
+select * from test.v1;
+NAME	TYPE	INSTRUMENTED	PROCESSLIST_USER	PROCESSLIST_HOST
+thread/sql/one_connection	FOREGROUND	YES	user5	localhost
+# Disconnect con5
+# Switch to connection default and cleanup
+drop view test.v1;
+revoke all privileges, grant option from user1@localhost;
+revoke all privileges, grant option from user2@localhost;
+revoke all privileges, grant option from user3@localhost;
+revoke all privileges, grant option from user4@localhost;
+revoke all privileges, grant option from user5@localhost;
+drop user user1@localhost;
+drop user user2@localhost;
+drop user user3@localhost;
+drop user user4@localhost;
+drop user user5@localhost;
+flush privileges;
+truncate table performance_schema.SETUP_ACTORS;
+insert into performance_schema.SETUP_ACTORS
+values ('%', '%', '%');
+select * from performance_schema.SETUP_ACTORS;
+HOST	USER	ROLE
+%	%	%

=== modified file 'mysql-test/suite/perfschema/r/start_server_no_cond_class.result'
--- a/mysql-test/suite/perfschema/r/start_server_no_cond_class.result	2010-08-27 21:51:59 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_cond_class.result	2010-09-01 22:59:33 +0000
@@ -30,6 +30,7 @@ select * from performance_schema.FILE_SU
 select * from performance_schema.MUTEX_INSTANCES;
 select * from performance_schema.PERFORMANCE_TIMERS;
 select * from performance_schema.RWLOCK_INSTANCES;
+select * from performance_schema.SETUP_ACTORS;
 select * from performance_schema.SETUP_CONSUMERS;
 select * from performance_schema.SETUP_INSTRUMENTS;
 select * from performance_schema.SETUP_TIMERS;
@@ -52,6 +53,7 @@ performance_schema_max_table_handles	100
 performance_schema_max_table_instances	1000
 performance_schema_max_thread_classes	50
 performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
 show engine PERFORMANCE_SCHEMA status;
 show status like "performance_schema%";
 show variables like "performance_schema_max_cond_classes";

=== modified file 'mysql-test/suite/perfschema/r/start_server_no_cond_inst.result'
--- a/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result	2010-08-27 21:51:59 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result	2010-09-01 22:59:33 +0000
@@ -30,6 +30,7 @@ select * from performance_schema.FILE_SU
 select * from performance_schema.MUTEX_INSTANCES;
 select * from performance_schema.PERFORMANCE_TIMERS;
 select * from performance_schema.RWLOCK_INSTANCES;
+select * from performance_schema.SETUP_ACTORS;
 select * from performance_schema.SETUP_CONSUMERS;
 select * from performance_schema.SETUP_INSTRUMENTS;
 select * from performance_schema.SETUP_TIMERS;
@@ -52,6 +53,7 @@ performance_schema_max_table_handles	100
 performance_schema_max_table_instances	1000
 performance_schema_max_thread_classes	50
 performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
 show engine PERFORMANCE_SCHEMA status;
 show status like "performance_schema%";
 show variables like "performance_schema_max_cond_classes";

=== modified file 'mysql-test/suite/perfschema/r/start_server_no_file_class.result'
--- a/mysql-test/suite/perfschema/r/start_server_no_file_class.result	2010-08-27 21:51:59 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_file_class.result	2010-09-01 22:59:33 +0000
@@ -30,6 +30,7 @@ select * from performance_schema.FILE_SU
 select * from performance_schema.MUTEX_INSTANCES;
 select * from performance_schema.PERFORMANCE_TIMERS;
 select * from performance_schema.RWLOCK_INSTANCES;
+select * from performance_schema.SETUP_ACTORS;
 select * from performance_schema.SETUP_CONSUMERS;
 select * from performance_schema.SETUP_INSTRUMENTS;
 select * from performance_schema.SETUP_TIMERS;
@@ -52,6 +53,7 @@ performance_schema_max_table_handles	100
 performance_schema_max_table_instances	1000
 performance_schema_max_thread_classes	50
 performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
 show engine PERFORMANCE_SCHEMA status;
 show status like "performance_schema%";
 show variables like "performance_schema_max_file_classes";

=== modified file 'mysql-test/suite/perfschema/r/start_server_no_file_inst.result'
--- a/mysql-test/suite/perfschema/r/start_server_no_file_inst.result	2010-08-27 21:51:59 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_file_inst.result	2010-09-01 22:59:33 +0000
@@ -30,6 +30,7 @@ select * from performance_schema.FILE_SU
 select * from performance_schema.MUTEX_INSTANCES;
 select * from performance_schema.PERFORMANCE_TIMERS;
 select * from performance_schema.RWLOCK_INSTANCES;
+select * from performance_schema.SETUP_ACTORS;
 select * from performance_schema.SETUP_CONSUMERS;
 select * from performance_schema.SETUP_INSTRUMENTS;
 select * from performance_schema.SETUP_TIMERS;
@@ -52,6 +53,7 @@ performance_schema_max_table_handles	100
 performance_schema_max_table_instances	1000
 performance_schema_max_thread_classes	50
 performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
 show engine PERFORMANCE_SCHEMA status;
 show status like "performance_schema%";
 show variables like "performance_schema_max_file_classes";

=== modified file 'mysql-test/suite/perfschema/r/start_server_no_mutex_class.result'
--- a/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result	2010-08-27 21:51:59 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result	2010-09-01 22:59:33 +0000
@@ -30,6 +30,7 @@ select * from performance_schema.FILE_SU
 select * from performance_schema.MUTEX_INSTANCES;
 select * from performance_schema.PERFORMANCE_TIMERS;
 select * from performance_schema.RWLOCK_INSTANCES;
+select * from performance_schema.SETUP_ACTORS;
 select * from performance_schema.SETUP_CONSUMERS;
 select * from performance_schema.SETUP_INSTRUMENTS;
 select * from performance_schema.SETUP_TIMERS;
@@ -52,6 +53,7 @@ performance_schema_max_table_handles	100
 performance_schema_max_table_instances	1000
 performance_schema_max_thread_classes	50
 performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
 show engine PERFORMANCE_SCHEMA status;
 show status like "performance_schema%";
 show variables like "performance_schema_max_mutex_classes";

=== modified file 'mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result'
--- a/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result	2010-08-27 21:51:59 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result	2010-09-01 22:59:33 +0000
@@ -30,6 +30,7 @@ select * from performance_schema.FILE_SU
 select * from performance_schema.MUTEX_INSTANCES;
 select * from performance_schema.PERFORMANCE_TIMERS;
 select * from performance_schema.RWLOCK_INSTANCES;
+select * from performance_schema.SETUP_ACTORS;
 select * from performance_schema.SETUP_CONSUMERS;
 select * from performance_schema.SETUP_INSTRUMENTS;
 select * from performance_schema.SETUP_TIMERS;
@@ -52,6 +53,7 @@ performance_schema_max_table_handles	100
 performance_schema_max_table_instances	1000
 performance_schema_max_thread_classes	50
 performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
 show engine PERFORMANCE_SCHEMA status;
 show status like "performance_schema%";
 show variables like "performance_schema_max_mutex_classes";

=== modified file 'mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result'
--- a/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result	2010-08-27 21:51:59 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result	2010-09-01 22:59:33 +0000
@@ -30,6 +30,7 @@ select * from performance_schema.FILE_SU
 select * from performance_schema.MUTEX_INSTANCES;
 select * from performance_schema.PERFORMANCE_TIMERS;
 select * from performance_schema.RWLOCK_INSTANCES;
+select * from performance_schema.SETUP_ACTORS;
 select * from performance_schema.SETUP_CONSUMERS;
 select * from performance_schema.SETUP_INSTRUMENTS;
 select * from performance_schema.SETUP_TIMERS;
@@ -52,6 +53,7 @@ performance_schema_max_table_handles	100
 performance_schema_max_table_instances	1000
 performance_schema_max_thread_classes	50
 performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
 show engine PERFORMANCE_SCHEMA status;
 show status like "performance_schema%";
 show variables like "performance_schema_max_rwlock_classes";

=== modified file 'mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result'
--- a/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result	2010-08-27 21:51:59 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result	2010-09-01 22:59:33 +0000
@@ -30,6 +30,7 @@ select * from performance_schema.FILE_SU
 select * from performance_schema.MUTEX_INSTANCES;
 select * from performance_schema.PERFORMANCE_TIMERS;
 select * from performance_schema.RWLOCK_INSTANCES;
+select * from performance_schema.SETUP_ACTORS;
 select * from performance_schema.SETUP_CONSUMERS;
 select * from performance_schema.SETUP_INSTRUMENTS;
 select * from performance_schema.SETUP_TIMERS;
@@ -52,6 +53,7 @@ performance_schema_max_table_handles	100
 performance_schema_max_table_instances	1000
 performance_schema_max_thread_classes	50
 performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
 show engine PERFORMANCE_SCHEMA status;
 show status like "performance_schema%";
 show variables like "performance_schema_max_rwlock_classes";

=== added file 'mysql-test/suite/perfschema/r/start_server_no_setup_actors.result'
--- a/mysql-test/suite/perfschema/r/start_server_no_setup_actors.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_setup_actors.result	2010-09-01 22:59:33 +0000
@@ -0,0 +1,64 @@
+show databases;
+Database
+information_schema
+mtr
+mysql
+performance_schema
+test
+select count(*) from performance_schema.PERFORMANCE_TIMERS;
+count(*)
+5
+select count(*) from performance_schema.SETUP_CONSUMERS;
+count(*)
+8
+select count(*) > 1 from performance_schema.SETUP_INSTRUMENTS;
+count(*) > 1
+1
+select count(*) from performance_schema.SETUP_TIMERS;
+count(*)
+1
+select * from performance_schema.COND_INSTANCES;
+select * from performance_schema.EVENTS_WAITS_CURRENT;
+select * from performance_schema.EVENTS_WAITS_HISTORY;
+select * from performance_schema.EVENTS_WAITS_HISTORY_LONG;
+select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_INSTANCE;
+select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
+select * from performance_schema.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
+select * from performance_schema.FILE_INSTANCES;
+select * from performance_schema.FILE_SUMMARY_BY_EVENT_NAME;
+select * from performance_schema.FILE_SUMMARY_BY_INSTANCE;
+select * from performance_schema.MUTEX_INSTANCES;
+select * from performance_schema.PERFORMANCE_TIMERS;
+select * from performance_schema.RWLOCK_INSTANCES;
+select * from performance_schema.SETUP_ACTORS;
+select * from performance_schema.SETUP_CONSUMERS;
+select * from performance_schema.SETUP_INSTRUMENTS;
+select * from performance_schema.SETUP_TIMERS;
+select * from performance_schema.THREADS;
+show variables like "performance_schema%";
+Variable_name	Value
+performance_schema	ON
+performance_schema_events_waits_history_long_size	10000
+performance_schema_events_waits_history_size	10
+performance_schema_max_cond_classes	80
+performance_schema_max_cond_instances	1000
+performance_schema_max_file_classes	50
+performance_schema_max_file_handles	32768
+performance_schema_max_file_instances	10000
+performance_schema_max_mutex_classes	200
+performance_schema_max_mutex_instances	1000000
+performance_schema_max_rwlock_classes	30
+performance_schema_max_rwlock_instances	1000000
+performance_schema_max_table_handles	10000
+performance_schema_max_table_instances	1000
+performance_schema_max_thread_classes	50
+performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	0
+show engine PERFORMANCE_SCHEMA status;
+show status like "performance_schema%";
+show variables like "performance_schema_setup_actors_size";
+Variable_name	Value
+performance_schema_setup_actors_size	0
+select count(*) from performance_schema.SETUP_ACTORS;
+count(*)
+0

=== modified file 'mysql-test/suite/perfschema/r/start_server_no_table_hdl.result'
--- a/mysql-test/suite/perfschema/r/start_server_no_table_hdl.result	2010-08-27 21:51:59 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_table_hdl.result	2010-09-01 22:59:33 +0000
@@ -30,6 +30,7 @@ select * from performance_schema.FILE_SU
 select * from performance_schema.MUTEX_INSTANCES;
 select * from performance_schema.PERFORMANCE_TIMERS;
 select * from performance_schema.RWLOCK_INSTANCES;
+select * from performance_schema.SETUP_ACTORS;
 select * from performance_schema.SETUP_CONSUMERS;
 select * from performance_schema.SETUP_INSTRUMENTS;
 select * from performance_schema.SETUP_TIMERS;
@@ -52,6 +53,7 @@ performance_schema_max_table_handles	0
 performance_schema_max_table_instances	1000
 performance_schema_max_thread_classes	50
 performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
 show engine PERFORMANCE_SCHEMA status;
 show status like "performance_schema%";
 show variables like "performance_schema_max_table_instances";

=== modified file 'mysql-test/suite/perfschema/r/start_server_no_table_inst.result'
--- a/mysql-test/suite/perfschema/r/start_server_no_table_inst.result	2010-08-27 21:51:59 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_table_inst.result	2010-09-01 22:59:33 +0000
@@ -30,6 +30,7 @@ select * from performance_schema.FILE_SU
 select * from performance_schema.MUTEX_INSTANCES;
 select * from performance_schema.PERFORMANCE_TIMERS;
 select * from performance_schema.RWLOCK_INSTANCES;
+select * from performance_schema.SETUP_ACTORS;
 select * from performance_schema.SETUP_CONSUMERS;
 select * from performance_schema.SETUP_INSTRUMENTS;
 select * from performance_schema.SETUP_TIMERS;
@@ -52,6 +53,7 @@ performance_schema_max_table_handles	100
 performance_schema_max_table_instances	0
 performance_schema_max_thread_classes	50
 performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
 show engine PERFORMANCE_SCHEMA status;
 show status like "performance_schema%";
 show variables like "performance_schema_max_table_instances";

=== modified file 'mysql-test/suite/perfschema/r/start_server_no_thread_class.result'
--- a/mysql-test/suite/perfschema/r/start_server_no_thread_class.result	2010-08-27 21:51:59 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_thread_class.result	2010-09-01 22:59:33 +0000
@@ -30,6 +30,7 @@ select * from performance_schema.FILE_SU
 select * from performance_schema.MUTEX_INSTANCES;
 select * from performance_schema.PERFORMANCE_TIMERS;
 select * from performance_schema.RWLOCK_INSTANCES;
+select * from performance_schema.SETUP_ACTORS;
 select * from performance_schema.SETUP_CONSUMERS;
 select * from performance_schema.SETUP_INSTRUMENTS;
 select * from performance_schema.SETUP_TIMERS;
@@ -52,6 +53,7 @@ performance_schema_max_table_handles	100
 performance_schema_max_table_instances	1000
 performance_schema_max_thread_classes	0
 performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
 show engine PERFORMANCE_SCHEMA status;
 show status like "performance_schema%";
 show variables like "performance_schema_max_thread_classes";

=== modified file 'mysql-test/suite/perfschema/r/start_server_no_thread_inst.result'
--- a/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result	2010-08-27 21:51:59 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result	2010-09-01 22:59:33 +0000
@@ -30,6 +30,7 @@ select * from performance_schema.FILE_SU
 select * from performance_schema.MUTEX_INSTANCES;
 select * from performance_schema.PERFORMANCE_TIMERS;
 select * from performance_schema.RWLOCK_INSTANCES;
+select * from performance_schema.SETUP_ACTORS;
 select * from performance_schema.SETUP_CONSUMERS;
 select * from performance_schema.SETUP_INSTRUMENTS;
 select * from performance_schema.SETUP_TIMERS;
@@ -52,6 +53,7 @@ performance_schema_max_table_handles	100
 performance_schema_max_table_instances	1000
 performance_schema_max_thread_classes	50
 performance_schema_max_thread_instances	0
+performance_schema_setup_actors_size	100
 show engine PERFORMANCE_SCHEMA status;
 show status like "performance_schema%";
 show variables like "performance_schema_max_thread_classes";

=== modified file 'mysql-test/suite/perfschema/r/start_server_nothing.result'
--- a/mysql-test/suite/perfschema/r/start_server_nothing.result	2010-08-12 15:25:01 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_nothing.result	2010-09-01 22:59:33 +0000
@@ -30,6 +30,7 @@ select * from performance_schema.FILE_SU
 select * from performance_schema.MUTEX_INSTANCES;
 select * from performance_schema.PERFORMANCE_TIMERS;
 select * from performance_schema.RWLOCK_INSTANCES;
+select * from performance_schema.SETUP_ACTORS;
 select * from performance_schema.SETUP_CONSUMERS;
 select * from performance_schema.SETUP_INSTRUMENTS;
 select * from performance_schema.SETUP_TIMERS;
@@ -52,6 +53,7 @@ performance_schema_max_table_handles	0
 performance_schema_max_table_instances	0
 performance_schema_max_thread_classes	0
 performance_schema_max_thread_instances	0
+performance_schema_setup_actors_size	0
 show engine PERFORMANCE_SCHEMA status;
 show status like "performance_schema%";
 show variables like "performance_schema%";
@@ -72,6 +74,7 @@ performance_schema_max_table_handles	0
 performance_schema_max_table_instances	0
 performance_schema_max_thread_classes	0
 performance_schema_max_thread_instances	0
+performance_schema_setup_actors_size	0
 select * from performance_schema.SETUP_INSTRUMENTS;
 NAME	ENABLED	TIMED
 wait/io/table/sql/handler	YES	YES
@@ -118,6 +121,8 @@ FILE_NAME	EVENT_NAME	COUNT_READ	COUNT_WR
 select * from performance_schema.MUTEX_INSTANCES;
 NAME	OBJECT_INSTANCE_BEGIN	LOCKED_BY_THREAD_ID
 select * from performance_schema.THREADS;
-THREAD_ID	ID	NAME
+THREAD_ID	NAME	TYPE	PROCESSLIST_ID	PROCESSLIST_USER	PROCESSLIST_HOST	PROCESSLIST_DB	PROCESSLIST_COMMAND	PROCESSLIST_TIME	PROCESSLIST_STATE	PROCESSLIST_INFO	PARENT_THREAD_ID	ROLE	INSTRUMENTED
 select * from performance_schema.RWLOCK_INSTANCES;
 NAME	OBJECT_INSTANCE_BEGIN	WRITE_LOCKED_BY_THREAD_ID	READ_LOCKED_BY_COUNT
+select * from performance_schema.THREADS;
+THREAD_ID	NAME	TYPE	PROCESSLIST_ID	PROCESSLIST_USER	PROCESSLIST_HOST	PROCESSLIST_DB	PROCESSLIST_COMMAND	PROCESSLIST_TIME	PROCESSLIST_STATE	PROCESSLIST_INFO	PARENT_THREAD_ID	ROLE	INSTRUMENTED

=== modified file 'mysql-test/suite/perfschema/r/start_server_off.result'
--- a/mysql-test/suite/perfschema/r/start_server_off.result	2010-08-27 21:51:59 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_off.result	2010-09-01 22:59:33 +0000
@@ -30,6 +30,7 @@ select * from performance_schema.FILE_SU
 select * from performance_schema.MUTEX_INSTANCES;
 select * from performance_schema.PERFORMANCE_TIMERS;
 select * from performance_schema.RWLOCK_INSTANCES;
+select * from performance_schema.SETUP_ACTORS;
 select * from performance_schema.SETUP_CONSUMERS;
 select * from performance_schema.SETUP_INSTRUMENTS;
 select * from performance_schema.SETUP_TIMERS;
@@ -52,6 +53,7 @@ performance_schema_max_table_handles	100
 performance_schema_max_table_instances	1000
 performance_schema_max_thread_classes	50
 performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
 show engine PERFORMANCE_SCHEMA status;
 show status like "performance_schema%";
 show status like "performance_schema%";

=== modified file 'mysql-test/suite/perfschema/r/start_server_on.result'
--- a/mysql-test/suite/perfschema/r/start_server_on.result	2010-08-27 21:51:59 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_on.result	2010-09-01 22:59:33 +0000
@@ -30,6 +30,7 @@ select * from performance_schema.FILE_SU
 select * from performance_schema.MUTEX_INSTANCES;
 select * from performance_schema.PERFORMANCE_TIMERS;
 select * from performance_schema.RWLOCK_INSTANCES;
+select * from performance_schema.SETUP_ACTORS;
 select * from performance_schema.SETUP_CONSUMERS;
 select * from performance_schema.SETUP_INSTRUMENTS;
 select * from performance_schema.SETUP_TIMERS;
@@ -52,6 +53,7 @@ performance_schema_max_table_handles	100
 performance_schema_max_table_instances	1000
 performance_schema_max_thread_classes	50
 performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
 show engine PERFORMANCE_SCHEMA status;
 show status like "performance_schema%";
 show status like "performance_schema%";

=== added file 'mysql-test/suite/perfschema/r/threads_events.result'
--- a/mysql-test/suite/perfschema/r/threads_events.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/r/threads_events.result	2010-07-29 18:00:27 +0000
@@ -0,0 +1,17 @@
+DROP TABLE IF EXISTS t_event;
+DROP EVENT IF EXISTS t_ps_event;
+CREATE TABLE t_event AS
+SELECT EVENT_ID FROM performance_schema.EVENTS_WAITS_CURRENT
+WHERE 1 = 2;
+CREATE EVENT t_ps_event
+ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 SECOND
+DO INSERT INTO t_event
+SELECT DISTINCT EVENT_ID
+FROM performance_schema.EVENTS_WAITS_CURRENT
+JOIN performance_schema.EVENTS_WAITS_HISTORY USING (EVENT_ID)
+ORDER BY EVENT_ID
+LIMIT 1;
+SELECT * FROM t_event;
+EVENT_ID
+[EVENT_ID]
+DROP TABLE t_event;

=== added file 'mysql-test/suite/perfschema/r/threads_innodb.result'
--- a/mysql-test/suite/perfschema/r/threads_innodb.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/r/threads_innodb.result	2010-07-29 18:00:27 +0000
@@ -0,0 +1,12 @@
+SELECT name, type, processlist_user, processlist_host, processlist_db,
+processlist_command, processlist_time, processlist_state, processlist_info,
+parent_thread_id, role, instrumented
+FROM performance_schema.THREADS
+WHERE name LIKE 'thread/innodb/%'
+GROUP BY name;
+name	type	processlist_user	processlist_host	processlist_db	processlist_command	processlist_time	processlist_state	processlist_info	parent_thread_id	role	instrumented
+thread/innodb/io_handler_thread	BACKGROUND	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	YES
+thread/innodb/srv_error_monitor_thread	BACKGROUND	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	YES
+thread/innodb/srv_lock_timeout_thread	BACKGROUND	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	YES
+thread/innodb/srv_master_thread	BACKGROUND	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	YES
+thread/innodb/srv_monitor_thread	BACKGROUND	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	YES

=== added file 'mysql-test/suite/perfschema/r/threads_insert_delayed.result'
--- a/mysql-test/suite/perfschema/r/threads_insert_delayed.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/r/threads_insert_delayed.result	2010-07-29 18:00:27 +0000
@@ -0,0 +1,19 @@
+DROP TABLE IF EXISTS t1;
+DROP TEMPORARY TABLE IF EXISTS t2;
+CREATE TABLE t1 (f1 BIGINT) ENGINE = MyISAM;
+CREATE TEMPORARY TABLE t2 AS
+SELECT thread_id FROM performance_schema.THREADS WHERE 1 = 2;
+SELECT COUNT(*) = 0 AS expect_1 FROM performance_schema.THREADS
+WHERE name = 'thread/sql/delayed_insert';
+expect_1
+1
+INSERT INTO t2 SELECT thread_id
+FROM performance_schema.THREADS;
+INSERT DELAYED INTO t1 SET f1 = SLEEP(3);
+SELECT name, type, instrumented, processlist_user, processlist_host
+FROM performance_schema.THREADS
+WHERE thread_id NOT IN (SELECT thread_id FROM t2);
+name	type	instrumented	processlist_user	processlist_host
+thread/sql/delayed_insert	FOREGROUND	YES	root	localhost
+DROP TABLE t1;
+DROP TEMPORARY TABLE t2;

=== added file 'mysql-test/suite/perfschema/r/threads_mysql.result'
--- a/mysql-test/suite/perfschema/r/threads_mysql.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/r/threads_mysql.result	2010-09-01 19:14:10 +0000
@@ -0,0 +1,108 @@
+SET GLOBAL event_scheduler = OFF;
+SELECT name, type, processlist_user, processlist_host, processlist_db,
+processlist_command, processlist_info,
+IF(parent_thread_id IS NULL, parent_thread_id, 'unified parent_thread_id')
+AS unified_parent_thread_id,
+role, instrumented
+FROM performance_schema.THREADS
+WHERE name LIKE 'thread/sql%'
+ORDER BY name;
+name	thread/sql/main
+type	BACKGROUND
+processlist_user	NULL
+processlist_host	NULL
+processlist_db	NULL
+processlist_command	NULL
+processlist_info	INTERNAL DDL LOG RECOVER IN PROGRESS
+unified_parent_thread_id	NULL
+role	NULL
+instrumented	YES
+name	thread/sql/one_connection
+type	FOREGROUND
+processlist_user	root
+processlist_host	localhost
+processlist_db	test
+processlist_command	Query
+processlist_info	SELECT name, type, processlist_user, processlist_host, processlist_db,
+processlist_command, processlist_info,
+IF(parent_thread_id IS NULL, parent_thread_id, 'unified parent_thread_id')
+AS unified_parent_thread_id,
+role, instrumented
+FROM performance_schema.THREADS
+WHERE name LIKE 'thread/sql%'
+ORDER BY name
+unified_parent_thread_id	unified parent_thread_id
+role	NULL
+instrumented	YES
+name	thread/sql/signal_handler
+type	BACKGROUND
+processlist_user	NULL
+processlist_host	NULL
+processlist_db	NULL
+processlist_command	NULL
+processlist_info	NULL
+unified_parent_thread_id	unified parent_thread_id
+role	NULL
+instrumented	YES
+CREATE TEMPORARY TABLE t1 AS
+SELECT thread_id FROM performance_schema.THREADS
+WHERE name LIKE 'thread/sql%';
+SET GLOBAL event_scheduler = ON;
+SELECT name, type, processlist_user, processlist_host, processlist_db,
+processlist_command, processlist_info,
+IF(parent_thread_id IS NULL, parent_thread_id, 'unified parent_thread_id')
+AS unified_parent_thread_id,
+role, instrumented
+FROM performance_schema.THREADS
+WHERE name LIKE 'thread/sql%'
+  AND thread_id NOT IN (SELECT thread_id FROM t1)
+ORDER BY name;
+name	thread/sql/event_scheduler
+type	FOREGROUND
+processlist_user	root
+processlist_host	localhost
+processlist_db	NULL
+processlist_command	Sleep
+processlist_info	NULL
+unified_parent_thread_id	unified parent_thread_id
+role	NULL
+instrumented	YES
+TRUNCATE t1;
+INSERT INTO t1
+SELECT thread_id FROM performance_schema.THREADS
+WHERE name LIKE 'thread/sql%';
+SELECT COUNT(*) INTO @aux FROM t1;
+DROP EVENT IF EXISTS t_ps_event;
+CREATE EVENT t_ps_event
+ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 SECOND
+DO SELECT SLEEP(3);
+SELECT name, type, processlist_user, processlist_host, processlist_db,
+processlist_command, processlist_info,
+IF(parent_thread_id IS NULL, parent_thread_id, 'unified parent_thread_id')
+AS unified_parent_thread_id,
+role, instrumented
+FROM performance_schema.THREADS
+WHERE name LIKE 'thread/sql%'
+  AND thread_id NOT IN (SELECT thread_id FROM t1)
+ORDER BY name;
+name	thread/sql/event_worker
+type	FOREGROUND
+processlist_user	root
+processlist_host	localhost
+processlist_db	NULL
+processlist_command	Sleep
+processlist_info	SELECT SLEEP(3)
+unified_parent_thread_id	unified parent_thread_id
+role	NULL
+instrumented	YES
+SELECT t2.name AS parent_thread_name, t1.name AS child_thread_name
+FROM performance_schema.THREADS t1 INNER JOIN performance_schema.THREADS t2
+ON t1.parent_thread_id = t2.thread_id
+WHERE t1.name LIKE 'thread/sql%'
+  AND t1.parent_thread_id IS NOT NULL
+ORDER BY parent_thread_name, child_thread_name;
+parent_thread_name	child_thread_name
+thread/sql/event_scheduler	thread/sql/event_worker
+thread/sql/main	thread/sql/one_connection
+thread/sql/main	thread/sql/signal_handler
+thread/sql/one_connection	thread/sql/event_scheduler

=== added file 'mysql-test/suite/perfschema/t/ddl_setup_actors.test'
--- a/mysql-test/suite/perfschema/t/ddl_setup_actors.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/t/ddl_setup_actors.test	2010-07-02 16:36:20 +0000
@@ -0,0 +1,45 @@
+# 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
+
+--replace_result '\'setup_actors' '\'SETUP_ACTORS'
+-- error ER_DBACCESS_DENIED_ERROR
+alter table performance_schema.SETUP_ACTORS add column foo integer;
+
+--disable_warnings
+drop table if exists test.SETUP_ACTORS;
+--enable_warnings
+
+create table test.SETUP_ACTORS as
+  select * from performance_schema.SETUP_ACTORS;
+
+truncate table performance_schema.SETUP_ACTORS;
+
+select count(*) from performance_schema.SETUP_ACTORS;
+
+insert into performance_schema.SETUP_ACTORS
+  select * from test.SETUP_ACTORS;
+drop table test.SETUP_ACTORS;
+
+-- error ER_DBACCESS_DENIED_ERROR
+ALTER TABLE performance_schema.SETUP_ACTORS ADD INDEX test_index(HOST);
+
+-- error ER_DBACCESS_DENIED_ERROR
+CREATE UNIQUE INDEX test_index ON performance_schema.SETUP_ACTORS(HOST);
+

=== removed file 'mysql-test/suite/perfschema/t/ddl_threads.test'
--- a/mysql-test/suite/perfschema/t/ddl_threads.test	2010-08-12 14:08:52 +0000
+++ b/mysql-test/suite/perfschema/t/ddl_threads.test	1970-01-01 00:00:00 +0000
@@ -1,32 +0,0 @@
-# Copyright (C) 2008-2009 Sun Microsystems, Inc
-#
-# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-# Tests for PERFORMANCE_SCHEMA
-
---source include/not_embedded.inc
---source include/have_perfschema.inc
-
--- error ER_DBACCESS_DENIED_ERROR
-alter table performance_schema.THREADS add column foo integer;
-
--- error ER_WRONG_PERFSCHEMA_USAGE
-truncate table performance_schema.THREADS;
-
--- error ER_DBACCESS_DENIED_ERROR
-ALTER TABLE performance_schema.THREADS ADD INDEX test_index(ID);
-
--- error ER_DBACCESS_DENIED_ERROR
-CREATE UNIQUE INDEX test_index ON performance_schema.THREADS(ID);
-

=== added file 'mysql-test/suite/perfschema/t/ddl_threads.test'
--- a/mysql-test/suite/perfschema/t/ddl_threads.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/t/ddl_threads.test	2010-07-02 16:36:20 +0000
@@ -0,0 +1,32 @@
+# Copyright (c) 2008, 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
+
+-- error ER_DBACCESS_DENIED_ERROR
+alter table performance_schema.THREADS add column foo integer;
+
+-- error ER_WRONG_PERFSCHEMA_USAGE
+truncate table performance_schema.THREADS;
+
+-- error ER_DBACCESS_DENIED_ERROR
+ALTER TABLE performance_schema.THREADS ADD INDEX test_index(PROCESSLIST_ID);
+
+-- error ER_DBACCESS_DENIED_ERROR
+CREATE UNIQUE INDEX test_index ON performance_schema.THREADS(PROCESSLIST_ID);
+

=== modified file 'mysql-test/suite/perfschema/t/disabled.def'
--- a/mysql-test/suite/perfschema/t/disabled.def	2010-06-03 13:30:54 +0000
+++ b/mysql-test/suite/perfschema/t/disabled.def	2010-06-15 14:23:08 +0000
@@ -25,3 +25,5 @@
 #
 ##############################################################################
 
+pfs_upgrade : Waiting to merge WL#5291
+

=== added file 'mysql-test/suite/perfschema/t/dml_setup_actors.test'
--- a/mysql-test/suite/perfschema/t/dml_setup_actors.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/t/dml_setup_actors.test	2010-07-02 16:36:20 +0000
@@ -0,0 +1,87 @@
+# 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
+
+--disable_warnings
+drop table if exists test.SETUP_ACTORS;
+--enable_warnings
+
+# Save the setup
+create table test.SETUP_ACTORS as
+  select * from performance_schema.SETUP_ACTORS;
+truncate table performance_schema.SETUP_ACTORS;
+
+select * from performance_schema.SETUP_ACTORS;
+
+select * from performance_schema.SETUP_ACTORS
+  where user = '%';
+
+insert into performance_schema.SETUP_ACTORS
+  set user='Joe', host='localhost';
+
+insert into performance_schema.SETUP_ACTORS
+  set user='Joe', host='%';
+
+insert into performance_schema.SETUP_ACTORS
+  set user='%', host='server1';
+
+insert into performance_schema.SETUP_ACTORS
+  set user='%', host='%';
+
+select * from performance_schema.SETUP_ACTORS
+  order by USER, HOST;
+
+--error ER_WRONG_PERFSCHEMA_USAGE
+update performance_schema.SETUP_ACTORS
+  set user='ILLEGAL';
+
+--error ER_WRONG_PERFSCHEMA_USAGE
+update performance_schema.SETUP_ACTORS
+  set host='ILLEGAL';
+
+--error ER_WRONG_PERFSCHEMA_USAGE
+update performance_schema.SETUP_ACTORS
+  set role='ILLEGAL';
+
+select * from performance_schema.SETUP_ACTORS
+  order by USER, HOST;
+
+delete from performance_schema.SETUP_ACTORS
+  where user = 'Joe' and host = 'localhost';
+
+select * from performance_schema.SETUP_ACTORS
+  order by USER, HOST;
+
+delete from performance_schema.SETUP_ACTORS;
+
+select * from performance_schema.SETUP_ACTORS
+  order by USER, HOST;
+
+LOCK TABLES performance_schema.SETUP_ACTORS READ;
+UNLOCK TABLES;
+
+LOCK TABLES performance_schema.SETUP_ACTORS WRITE;
+UNLOCK TABLES;
+
+# Restore the setup
+truncate table performance_schema.SETUP_ACTORS;
+insert into performance_schema.SETUP_ACTORS
+  select * from test.SETUP_ACTORS;
+drop table test.SETUP_ACTORS;
+

=== removed file 'mysql-test/suite/perfschema/t/dml_threads.test'
--- a/mysql-test/suite/perfschema/t/dml_threads.test	2010-08-12 14:08:52 +0000
+++ b/mysql-test/suite/perfschema/t/dml_threads.test	1970-01-01 00:00:00 +0000
@@ -1,61 +0,0 @@
-# Copyright (C) 2009 Sun Microsystems, Inc
-#
-# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-# Tests for PERFORMANCE_SCHEMA
-
---source include/not_embedded.inc
---source include/have_perfschema.inc
-
---replace_column 1 # 2 # 3 #
-select * from performance_schema.THREADS
-  where name like 'Thread/%' limit 1;
-
-select * from performance_schema.THREADS
-  where name='FOO';
-
---replace_result '\'threads' '\'THREADS'
---error ER_TABLEACCESS_DENIED_ERROR
-insert into performance_schema.THREADS
-  set name='FOO', thread_id=1, id=2;
-
---replace_result '\'threads' '\'THREADS'
---error ER_TABLEACCESS_DENIED_ERROR
-update performance_schema.THREADS
-  set thread_id=12;
-
---replace_result '\'threads' '\'THREADS'
---error ER_TABLEACCESS_DENIED_ERROR
-update performance_schema.THREADS
-  set thread_id=12 where name like "FOO";
-
---replace_result '\'threads' '\'THREADS'
---error ER_TABLEACCESS_DENIED_ERROR
-delete from performance_schema.THREADS
-  where id=1;
-
---replace_result '\'threads' '\'THREADS'
---error ER_TABLEACCESS_DENIED_ERROR
-delete from performance_schema.THREADS;
-
---replace_result '\'threads' '\'THREADS'
--- error ER_TABLEACCESS_DENIED_ERROR
-LOCK TABLES performance_schema.THREADS READ;
-UNLOCK TABLES;
-
---replace_result '\'threads' '\'THREADS'
--- error ER_TABLEACCESS_DENIED_ERROR
-LOCK TABLES performance_schema.THREADS WRITE;
-UNLOCK TABLES;
-

=== added file 'mysql-test/suite/perfschema/t/dml_threads.test'
--- a/mysql-test/suite/perfschema/t/dml_threads.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/t/dml_threads.test	2010-07-02 16:36:20 +0000
@@ -0,0 +1,67 @@
+# 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
+# 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
+
+--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10 # 11 # 12 # 13 # 14 #
+select * from performance_schema.THREADS
+  where name like 'Thread/%' limit 1;
+
+select * from performance_schema.THREADS
+  where name='FOO';
+
+--replace_result '\'threads' '\'THREADS'
+--error ER_TABLEACCESS_DENIED_ERROR
+insert into performance_schema.THREADS
+  set name='FOO', thread_id=1, processlist_id=2;
+
+--error ER_WRONG_PERFSCHEMA_USAGE
+update performance_schema.THREADS
+  set thread_id=12;
+
+--error ER_WRONG_PERFSCHEMA_USAGE
+update performance_schema.THREADS
+  set thread_id=12 where PROCESSLIST_ID=connection_id();
+
+update performance_schema.THREADS
+  set instrumented= 'NO' where PROCESSLIST_ID=connection_id();
+
+select instrumented from performance_schema.THREADS
+  where PROCESSLIST_ID=connection_id();
+
+update performance_schema.THREADS
+  set instrumented= 'YES' where PROCESSLIST_ID=connection_id();
+
+select instrumented from performance_schema.THREADS
+  where PROCESSLIST_ID=connection_id();
+
+--replace_result '\'threads' '\'THREADS'
+--error ER_TABLEACCESS_DENIED_ERROR
+delete from performance_schema.THREADS
+  where id=1;
+
+--replace_result '\'threads' '\'THREADS'
+--error ER_TABLEACCESS_DENIED_ERROR
+delete from performance_schema.THREADS;
+
+LOCK TABLES performance_schema.THREADS READ;
+UNLOCK TABLES;
+
+LOCK TABLES performance_schema.THREADS WRITE;
+UNLOCK TABLES;
+

=== modified file 'mysql-test/suite/perfschema/t/func_file_io.test'
--- a/mysql-test/suite/perfschema/t/func_file_io.test	2010-08-12 15:25:01 +0000
+++ b/mysql-test/suite/perfschema/t/func_file_io.test	2010-09-01 22:59:33 +0000
@@ -27,6 +27,9 @@ UPDATE performance_schema.SETUP_INSTRUME
 UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES'
 WHERE name LIKE 'wait/io/file/%';
 
+update performance_schema.THREADS SET instrumented = 'YES'
+  WHERE PROCESSLIST_ID=connection_id();
+
 --disable_warnings
 DROP TABLE IF EXISTS t1;
 --enable_warnings
@@ -155,12 +158,11 @@ LIMIT 10;
 #
 
 --disable_result_log
-SELECT i.user, SUM(TIMER_WAIT) SUM_WAIT
+SELECT p.processlist_user, SUM(TIMER_WAIT) SUM_WAIT
 # ((TIME_TO_SEC(TIMEDIFF(NOW(), i.startup_time)) * 1000) / SUM(TIMER_WAIT)) * 100 WAIT_PERCENTAGE
 FROM performance_schema.EVENTS_WAITS_HISTORY_LONG h
 INNER JOIN performance_schema.THREADS p USING (THREAD_ID)
-LEFT JOIN information_schema.PROCESSLIST i USING (ID)
-GROUP BY i.user
+GROUP BY p.processlist_user
 ORDER BY SUM_WAIT DESC
 LIMIT 20;
 --enable_result_log
@@ -172,7 +174,7 @@ LIMIT 20;
 SELECT h.EVENT_NAME, SUM(h.TIMER_WAIT) TOTAL_WAIT
 FROM performance_schema.EVENTS_WAITS_HISTORY_LONG h
 INNER JOIN performance_schema.THREADS p USING (THREAD_ID)
-WHERE p.ID = 1
+WHERE p.PROCESSLIST_ID = 1
 GROUP BY h.EVENT_NAME
 HAVING TOTAL_WAIT > 0;
 --enable_result_log
@@ -182,13 +184,12 @@ HAVING TOTAL_WAIT > 0;
 #
 
 --disable_result_log
-SELECT i.user, h.operation, SUM(NUMBER_OF_BYTES) bytes
+SELECT p.processlist_user, h.operation, SUM(NUMBER_OF_BYTES) bytes
 FROM performance_schema.EVENTS_WAITS_HISTORY_LONG h
 INNER JOIN performance_schema.THREADS p USING (THREAD_ID)
-LEFT JOIN information_schema.PROCESSLIST i USING (ID)
-GROUP BY i.user, h.operation
+GROUP BY p.processlist_user, h.operation
 HAVING BYTES > 0
-ORDER BY i.user, h.operation;
+ORDER BY p.processlist_user, h.operation;
 --enable_result_log
 
 UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES', timed = 'YES';

=== removed file 'mysql-test/suite/perfschema/t/schema.test'
--- a/mysql-test/suite/perfschema/t/schema.test	2010-08-12 15:25:01 +0000
+++ b/mysql-test/suite/perfschema/t/schema.test	1970-01-01 00:00:00 +0000
@@ -1,45 +0,0 @@
-# Copyright (c) 2008, 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
---source include/have_lowercase0.inc
-
-show databases;
-
-use performance_schema;
-
-show tables;
-
-show create table COND_INSTANCES;
-show create table EVENTS_WAITS_CURRENT;
-show create table EVENTS_WAITS_HISTORY;
-show create table EVENTS_WAITS_HISTORY_LONG;
-show create table EVENTS_WAITS_SUMMARY_BY_INSTANCE;
-show create table EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME;
-show create table EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME;
-show create table FILE_INSTANCES;
-show create table FILE_SUMMARY_BY_EVENT_NAME;
-show create table FILE_SUMMARY_BY_INSTANCE;
-show create table MUTEX_INSTANCES;
-show create table PERFORMANCE_TIMERS;
-show create table RWLOCK_INSTANCES;
-show create table SETUP_CONSUMERS;
-show create table SETUP_INSTRUMENTS;
-show create table SETUP_TIMERS;
-show create table THREADS;
-

=== added file 'mysql-test/suite/perfschema/t/schema_lc0.test'
--- a/mysql-test/suite/perfschema/t/schema_lc0.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/t/schema_lc0.test	2010-07-29 18:00:27 +0000
@@ -0,0 +1,23 @@
+# Copyright (c) 2008, 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
+#    Show existing objects and information about their structure
+
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+--source include/have_lowercase0.inc
+--source ../include/schema.inc
+

=== added file 'mysql-test/suite/perfschema/t/schema_lc1.test'
--- a/mysql-test/suite/perfschema/t/schema_lc1.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/t/schema_lc1.test	2010-07-29 18:00:27 +0000
@@ -0,0 +1,23 @@
+# Copyright (c) 2008, 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
+#    Show existing objects and information about their structure
+
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+--source include/have_lowercase1.inc
+--source ../include/schema.inc
+

=== added file 'mysql-test/suite/perfschema/t/schema_lc2.test'
--- a/mysql-test/suite/perfschema/t/schema_lc2.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/t/schema_lc2.test	2010-07-29 18:00:27 +0000
@@ -0,0 +1,23 @@
+# Copyright (c) 2008, 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
+#    Show existing objects and information about their structure
+
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+--source include/have_lowercase2.inc
+--source ../include/schema.inc
+

=== modified file 'mysql-test/suite/perfschema/t/selects.test'
--- a/mysql-test/suite/perfschema/t/selects.test	2010-08-12 15:25:01 +0000
+++ b/mysql-test/suite/perfschema/t/selects.test	2010-09-01 22:59:33 +0000
@@ -142,17 +142,17 @@ DROP PROCEDURE IF EXISTS t_ps_proc;
 --enable_warnings
 delimiter |;
 
-CREATE PROCEDURE t_ps_proc(IN tid INT, OUT pid INT)
+CREATE PROCEDURE t_ps_proc(IN conid INT, OUT pid INT)
 BEGIN
-   SELECT id FROM performance_schema.THREADS
-   WHERE THREAD_ID = tid INTO pid;
+   SELECT thread_id FROM performance_schema.THREADS
+   WHERE PROCESSLIST_ID = conid INTO pid;
 END;
 
 |
 
 delimiter ;|
 
-CALL t_ps_proc(0, @p_id);
+CALL t_ps_proc(connection_id(), @p_id);
 
 # FUNCTION
 
@@ -161,17 +161,17 @@ DROP FUNCTION IF EXISTS t_ps_proc;
 --enable_warnings
 delimiter |;
 
-CREATE FUNCTION t_ps_func(tid INT) RETURNS int
+CREATE FUNCTION t_ps_func(conid INT) RETURNS int
 BEGIN
-   return (SELECT id FROM performance_schema.THREADS
-           WHERE THREAD_ID = tid);
+   return (SELECT thread_id FROM performance_schema.THREADS
+           WHERE PROCESSLIST_ID = conid);
 END;
 
 |
 
 delimiter ;|
 
-SELECT t_ps_func(0) = @p_id;
+SELECT t_ps_func(connection_id()) = @p_id;
 
 # We might reach this point too early which means the event scheduler has not
 # execute our "t_ps_event". Therefore we poll till the record was inserted

=== added file 'mysql-test/suite/perfschema/t/setup_actors.test'
--- a/mysql-test/suite/perfschema/t/setup_actors.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/t/setup_actors.test	2010-09-07 18:33:49 +0000
@@ -0,0 +1,262 @@
+# 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
+
+# Check the impact of different entries in performance_schema.SETUP_ACTORS
+# on when and how activity of users is recordeed in performance_schema.THREADS.
+# The checks for indirect activity caused by users, system threads etc.
+# are within setup_actors1.test.
+
+--source include/not_windows.inc
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+# The initial number of rows is 1. The initial row always looks like this:
+# mysql> select * from performance_schema.SETUP_ACTORS;
+# +------+------+------+
+# | Host | User | ROLE |
+# +------+------+------+
+# | %    | %    | %    |
+# +------+------+------+
+select * from performance_schema.SETUP_ACTORS;
+
+truncate table performance_schema.SETUP_ACTORS;
+
+insert into performance_schema.SETUP_ACTORS
+values ('hosta', 'user1', '%');
+
+insert into performance_schema.SETUP_ACTORS
+values ('%', 'user2', '%');
+
+insert into performance_schema.SETUP_ACTORS
+values ('localhost', 'user3', '%');
+
+insert into performance_schema.SETUP_ACTORS
+values ('hostb', '%', '%');
+
+select * from performance_schema.SETUP_ACTORS
+order by USER, HOST, ROLE;
+
+grant ALL on *.* to user1@localhost;
+grant ALL on *.* to user2@localhost;
+grant ALL on *.* to user3@localhost;
+grant ALL on *.* to user4@localhost;
+grant select on test.* to user5@localhost;
+
+flush privileges;
+
+--echo # Switch to (con1, localhost, user1, , )
+connect (con1, localhost, user1, , );
+
+# INSTRUMENTED must be NO because there is no match in performance_schema.SETUP_ACTORS
+select NAME, TYPE, INSTRUMENTED, PROCESSLIST_USER, PROCESSLIST_HOST
+from performance_schema.THREADS
+where PROCESSLIST_ID = connection_id();
+let $con1_thread_id= `select THREAD_ID from performance_schema.THREADS
+  where PROCESSLIST_ID = connection_id()`;
+
+--echo # Switch to connection default
+--connection default
+insert into performance_schema.SETUP_ACTORS
+values ('%', 'user1', '%');
+
+--echo # Switch to connection con1
+--connection con1
+# INSTRUMENTED must be NO because there was no match in performance_schema.SETUP_ACTORS
+# when our current session made its connect. Later changes in SETUP_ACTORS have no
+# impact.
+select NAME, TYPE, INSTRUMENTED, PROCESSLIST_USER, PROCESSLIST_HOST
+from performance_schema.THREADS
+where PROCESSLIST_ID = connection_id();
+
+--echo # Disconnect con1
+--disconnect con1
+
+--echo # Switch to (con2, localhost, user2, , )
+connect (con2, localhost, user2, , );
+
+# INSTRUMENTED must be YES because there is a match via
+# (HOST,USER,ROLE) = ('%', 'user2', '%') in performance_schema.SETUP_ACTORS.
+select NAME, TYPE, INSTRUMENTED, PROCESSLIST_USER, PROCESSLIST_HOST
+from performance_schema.THREADS
+where PROCESSLIST_ID=connection_id();
+let $con2_thread_id= `select THREAD_ID from performance_schema.THREADS
+  where PROCESSLIST_ID = connection_id()`;
+
+--echo # Disconnect con2
+--disconnect con2
+
+--echo # Switch to connection default
+--connection default
+# If a thread dies, we don't expect its THREAD_ID value will be re-used.
+if (`SELECT $con2_thread_id <= $con1_thread_id`)
+{
+   --echo ERROR: THREAD_ID of con2 is not bigger than THREAD_ID of con1
+   eval SELECT $con2_thread_id as THREAD_ID_con2, $con1_thread_id THREAD_ID_con1;
+}
+
+--disable_warnings
+drop table if exists test.t1;
+--enable_warnings
+create table test.t1 (col1 bigint);
+lock table test.t1 write;
+
+--echo # Switch to (con3, localhost, user3, , )
+connect (con3, localhost, user3, , );
+
+# INSTRUMENTED must be YES because there is a match via
+# (HOST,USER,ROLE) = ('localhost', 'user3', '%') in performance_schema.SETUP_ACTORS.
+select NAME, TYPE, INSTRUMENTED, PROCESSLIST_USER, PROCESSLIST_HOST
+from performance_schema.THREADS
+where PROCESSLIST_ID = connection_id();
+
+# PROCESSLIST_ columns are:
+#   (if name like '%OneConnection') all the same as what you'd get if you
+#   run a select on INFORMATION_SCHEMA.PROCESSLIST for the corresponding thread.
+# Check at least once that this is fulfilled.
+# Note(mleich):
+#   A join between INFORMATION_SCHEMA.PROCESSLIST and performance_schema.THREADS
+#   Example:
+#      select count(*) = 1
+#      from performance_schema.THREADS T inner join information_schema.PROCESSLIST P
+#      on T.PROCESSLIST_ID = P.ID and T.PROCESSLIST_USER = P.USER and
+#         T.PROCESSLIST_HOST = P.HOST and T.PROCESSLIST_DB = P.DB and
+#         T.PROCESSLIST_COMMAND = P.COMMAND and T.PROCESSLIST_INFO = P.INFO
+#      where T.PROCESSLIST_ID = connection_id() and T.NAME = 'thread/sql/one_connection'
+#   executed by the current connection looks like some of the most elegant solutions
+#   for revealing this. But such a join suffers from sporadic differences like
+#      column |  observation
+#      -------|-------------
+#      state  |  "Sending data" vs. "executing"
+#      time   |  0 vs. 1 (high load on the testing box)
+#      info   |  <full statement> vs. NULL (use of "--ps-protocol")
+#   IMHO the differences are harmless.
+#   Therefore we use here a different solution.
+#
+--echo # Send a statement to the server, but do not wait till the result
+--echo # comes back. We will pull this later.
+send
+insert into test.t1 set col1 = 1;
+--echo # Switch to (con4, localhost, user4, , )
+connect (con4, localhost, user4, , );
+--echo # Poll till INFO is no more NULL and State = 'Waiting for table metadata lock'.
+let $wait_condition= select count(*) from information_schema.processlist
+        where user = 'user3' and info is not null
+        and state = 'Waiting for table metadata lock';
+--source include/wait_condition.inc
+# Expect to get 1 now
+select count(*) = 1
+from performance_schema.THREADS T inner join information_schema.PROCESSLIST P
+  on T.PROCESSLIST_ID = P.ID and T.PROCESSLIST_USER = P.USER and
+     T.PROCESSLIST_HOST = P.HOST and T.PROCESSLIST_DB = P.DB and
+     T.PROCESSLIST_COMMAND = P.COMMAND and T.PROCESSLIST_INFO = P.INFO
+where T.PROCESSLIST_USER = 'user3' and T.NAME = 'thread/sql/one_connection';
+
+# Resolve the situation + some cleanup
+--echo # Switch to connection default
+--connection default
+unlock tables;
+--echo # Switch to connection con3 and reap the result of the no more blocked insert
+--connection con3
+--reap
+--echo # Switch to connection default
+--connection default
+drop table test.t1;
+--echo # Disconnect con3
+--disconnect con3
+
+--echo # Switch to connection con4
+--connection con4
+# INSTRUMENTED must be NO because there is no match in performance_schema.SETUP_ACTORS
+select NAME, TYPE, INSTRUMENTED, PROCESSLIST_USER, PROCESSLIST_HOST
+from performance_schema.THREADS
+where PROCESSLIST_ID = connection_id();
+
+--echo # Disconnect con4
+--disconnect con4
+
+--echo # Switch to connection default
+--connection default
+
+insert into performance_schema.SETUP_ACTORS
+values ('localhost', '%', '%');
+
+select * from performance_schema.SETUP_ACTORS
+order by USER, HOST, ROLE;
+
+--echo # Switch to (con4b, localhost, user4, , )
+connect (con4b, localhost, user4, , );
+
+# INSTRUMENTED must be YES because there is a match via
+# (HOST,USER,ROLE) = ('localhost', '%', '%') in performance_schema.SETUP_ACTORS.
+select NAME, TYPE, INSTRUMENTED, PROCESSLIST_USER, PROCESSLIST_HOST
+from performance_schema.THREADS
+where PROCESSLIST_ID = connection_id();
+
+--echo # Disconnect con4b
+--disconnect con4b
+
+--echo # Switch to connection default
+--connection default
+insert into performance_schema.SETUP_ACTORS
+values ('%', 'user5', '%');
+
+create sql security definer view test.v1 as select NAME, TYPE, INSTRUMENTED, PROCESSLIST_USER, PROCESSLIST_HOST
+from performance_schema.THREADS
+where PROCESSLIST_ID = connection_id();
+
+--echo # Switch to (con5, localhost, user5, , )
+connect (con5, localhost, user5, , );
+
+--replace_result '\'threads' '\'THREADS'
+--error ER_TABLEACCESS_DENIED_ERROR
+select * from performance_schema.THREADS;
+# 1. INSTRUMENTED must be YES because there are two matches
+#    (HOST,USER,ROLE) = ('localhost', '%', '%')
+#    (HOST,USER,ROLE) = ('%', 'user5', '%')
+#    in performance_schema.SETUP_ACTORS.
+#    But the instrument will only count once which means we must get only one row.
+# 2. PROCESSLIST_USER refers to USER(), the user who connected,
+#    not the user we might be temporarily acting as (with definer's rights).
+#    Therefore PROCESSLIST_USER must be 'user5' though we run with right's of definer 'root'
+select * from test.v1;
+
+--echo # Disconnect con5
+--disconnect con5
+--source include/wait_until_disconnected.inc
+
+
+--echo # Switch to connection default and cleanup
+--connection default
+
+drop view test.v1;
+revoke all privileges, grant option from user1@localhost;
+revoke all privileges, grant option from user2@localhost;
+revoke all privileges, grant option from user3@localhost;
+revoke all privileges, grant option from user4@localhost;
+revoke all privileges, grant option from user5@localhost;
+drop user user1@localhost;
+drop user user2@localhost;
+drop user user3@localhost;
+drop user user4@localhost;
+drop user user5@localhost;
+flush privileges;
+
+truncate table performance_schema.SETUP_ACTORS;
+
+insert into performance_schema.SETUP_ACTORS
+values ('%', '%', '%');
+
+select * from performance_schema.SETUP_ACTORS;
+

=== added file 'mysql-test/suite/perfschema/t/start_server_no_setup_actors-master.opt'
--- a/mysql-test/suite/perfschema/t/start_server_no_setup_actors-master.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/t/start_server_no_setup_actors-master.opt	2010-05-20 15:43:53 +0000
@@ -0,0 +1,2 @@
+--loose-enable-performance-schema
+--loose-performance_schema_setup_actors_size=0

=== added file 'mysql-test/suite/perfschema/t/start_server_no_setup_actors.test'
--- a/mysql-test/suite/perfschema/t/start_server_no_setup_actors.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/t/start_server_no_setup_actors.test	2010-07-02 16:36:20 +0000
@@ -0,0 +1,28 @@
+# 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
+
+--source ../include/start_server_common.inc
+
+# Expect no setup_actors
+show variables like "performance_schema_setup_actors_size";
+
+# Expect no setup_actors
+select count(*) from performance_schema.SETUP_ACTORS;
+

=== modified file 'mysql-test/suite/perfschema/t/start_server_nothing.test'
--- a/mysql-test/suite/perfschema/t/start_server_nothing.test	2010-08-12 15:25:01 +0000
+++ b/mysql-test/suite/perfschema/t/start_server_nothing.test	2010-09-01 22:59:33 +0000
@@ -42,4 +42,5 @@ select * from performance_schema.FILE_SU
 select * from performance_schema.MUTEX_INSTANCES;
 select * from performance_schema.THREADS;
 select * from performance_schema.RWLOCK_INSTANCES;
+select * from performance_schema.THREADS;
 

=== modified file 'mysql-test/suite/perfschema/t/thread_cache.test'
--- a/mysql-test/suite/perfschema/t/thread_cache.test	2010-08-12 15:25:01 +0000
+++ b/mysql-test/suite/perfschema/t/thread_cache.test	2010-09-01 22:59:33 +0000
@@ -31,14 +31,14 @@ connect (con1, localhost, root, , );
 let $con1_ID=`select connection_id()`;
 
 let $con1_THREAD_ID=`select thread_id from performance_schema.THREADS
-  where ID = connection_id()`;
+  where PROCESSLIST_ID = connection_id()`;
 
 connect (con2, localhost, root, , );
 
 let $con2_ID=`select connection_id()`;
 
 let $con2_THREAD_ID=`select thread_id from performance_schema.THREADS
-  where ID = connection_id()`;
+  where PROCESSLIST_ID = connection_id()`;
 
 connection default;
 
@@ -59,7 +59,7 @@ connect (con3, localhost, root, , );
 let $con3_ID=`select connection_id()`;
 
 let $con3_THREAD_ID=`select thread_id from performance_schema.THREADS
-  where ID = connection_id()`;
+  where PROCESSLIST_ID = connection_id()`;
 
 disconnect con3;
 disconnect con1;
@@ -83,14 +83,14 @@ connect (con1, localhost, root, , );
 let $con1_ID=`select connection_id()`;
 
 let $con1_THREAD_ID=`select thread_id from performance_schema.THREADS
-  where ID = connection_id()`;
+  where PROCESSLIST_ID = connection_id()`;
 
 connect (con2, localhost, root, , );
 
 let $con2_ID=`select connection_id()`;
 
 let $con2_THREAD_ID=`select thread_id from performance_schema.THREADS
-  where ID = connection_id()`;
+  where PROCESSLIST_ID = connection_id()`;
 
 connection default;
 
@@ -109,7 +109,7 @@ connect (con3, localhost, root, , );
 let $con3_ID=`select connection_id()`;
 
 let $con3_THREAD_ID=`select thread_id from performance_schema.THREADS
-  where ID = connection_id()`;
+  where PROCESSLIST_ID = connection_id()`;
 
 disconnect con3;
 disconnect con1;

=== added file 'mysql-test/suite/perfschema/t/threads_innodb.test'
--- a/mysql-test/suite/perfschema/t/threads_innodb.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/t/threads_innodb.test	2010-07-29 18:00:27 +0000
@@ -0,0 +1,35 @@
+# 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 special content of performance_schema.THREADS
+#
+# Show InnoDB related content in performance_schema.THREADS
+
+--source include/not_embedded.inc
+--source include/have_innodb.inc
+--source include/have_perfschema.inc
+
+# There are several InnoDB io_handler_threads servicing for read IO, write IO etc.
+# The number of these threads is at least for some types configurable.
+# We suppress here duplicates rows with the goal to avoid that the test fails
+# in case some defaults are changed.
+SELECT name, type, processlist_user, processlist_host, processlist_db,
+       processlist_command, processlist_time, processlist_state, processlist_info,
+       parent_thread_id, role, instrumented
+FROM performance_schema.THREADS
+WHERE name LIKE 'thread/innodb/%'
+GROUP BY name;
+

=== added file 'mysql-test/suite/perfschema/t/threads_insert_delayed.test'
--- a/mysql-test/suite/perfschema/t/threads_insert_delayed.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/t/threads_insert_delayed.test	2010-07-29 18:00:27 +0000
@@ -0,0 +1,55 @@
+# 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 special content of performance_schema.THREADS
+#
+# The feature INSERT DELAYED (supported by MyISAM,MEMORY,ARCHIVE,BLACKHOLE)
+#    causes that a "delayed_insert" thread shows up as soon as the first
+#    INSERT DELAYED was issued.
+
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+DROP TEMPORARY TABLE IF EXISTS t2;
+--enable_warnings
+CREATE TABLE t1 (f1 BIGINT) ENGINE = MyISAM;
+CREATE TEMPORARY TABLE t2 AS
+SELECT thread_id FROM performance_schema.THREADS WHERE 1 = 2;
+
+# Reveal that the delayed_insert thread does not exist.
+# Note(mleich): This expectation is probably not all time true.
+SELECT COUNT(*) = 0 AS expect_1 FROM performance_schema.THREADS
+WHERE name = 'thread/sql/delayed_insert';
+
+INSERT INTO t2 SELECT thread_id
+FROM performance_schema.THREADS;
+
+let $wait_condition= SELECT COUNT(*) = 1 AS expect_0 FROM performance_schema.THREADS
+WHERE name = 'thread/sql/delayed_insert';
+INSERT DELAYED INTO t1 SET f1 = SLEEP(3);
+--source include/wait_condition.inc
+
+# Expect to get
+# thread/sql/delayed_insert	FOREGROUND	YES	root	localhost
+SELECT name, type, instrumented, processlist_user, processlist_host
+FROM performance_schema.THREADS
+WHERE thread_id NOT IN (SELECT thread_id FROM t2);
+
+DROP TABLE t1;
+DROP TEMPORARY TABLE t2;
+

=== added file 'mysql-test/suite/perfschema/t/threads_mysql-master.opt'
--- a/mysql-test/suite/perfschema/t/threads_mysql-master.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/t/threads_mysql-master.opt	2010-07-29 18:00:27 +0000
@@ -0,0 +1 @@
+--event-scheduler

=== added file 'mysql-test/suite/perfschema/t/threads_mysql.test'
--- a/mysql-test/suite/perfschema/t/threads_mysql.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/t/threads_mysql.test	2010-09-07 18:33:49 +0000
@@ -0,0 +1,131 @@
+# 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 special content of performance_schema.THREADS
+#
+# Show MySQL server related content in performance_schema.THREADS
+
+--source include/not_windows.inc
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+# Ensure that the event scheduler (started via threads_events-master.opt)
+# is really running.
+--source include/running_event_scheduler.inc
+
+SET GLOBAL event_scheduler = OFF;
+--source include/no_running_event_scheduler.inc
+
+--vertical_results
+
+# Show all "system" threads except the event scheduler
+# ---------------------------------------------------
+# 0. The values within the columns "thread_id" and "processlist_id" depend
+#    on server history. Therefore they are unstable and need to be omitted.
+# 1. The columns "time" and "state" are omitted because it is thinkable that
+#    they contain slightly unstable though correct values.
+# 2. The unification of the column "parent_thread_id" is in the moment most
+#    probably not required because I observed all time that the parent is
+#    "thread/sql/main" with the thread_id = 1.
+#    But there might be more kinds of parents with most probably unstable
+#    "thread_id" values in future.
+# 3. In case the test is started with the option "--ps-protocol" we will
+#    find a correcet row for our current thread but the content will differ.
+#    Therefore we have to disable this protocol for the next statement.
+--disable_ps_protocol
+SELECT name, type, processlist_user, processlist_host, processlist_db,
+       processlist_command, processlist_info,
+       IF(parent_thread_id IS NULL, parent_thread_id, 'unified parent_thread_id')
+         AS unified_parent_thread_id,
+       role, instrumented
+FROM performance_schema.THREADS
+WHERE name LIKE 'thread/sql%'
+ORDER BY name;
+--enable_ps_protocol
+
+CREATE TEMPORARY TABLE t1 AS
+SELECT thread_id FROM performance_schema.THREADS
+WHERE name LIKE 'thread/sql%';
+
+
+SET GLOBAL event_scheduler = ON;
+--source include/running_event_scheduler.inc
+
+# Show entries belonging to the just started event scheduler
+SELECT name, type, processlist_user, processlist_host, processlist_db,
+       processlist_command, processlist_info,
+       IF(parent_thread_id IS NULL, parent_thread_id, 'unified parent_thread_id')
+         AS unified_parent_thread_id,
+       role, instrumented
+FROM performance_schema.THREADS
+WHERE name LIKE 'thread/sql%'
+  AND thread_id NOT IN (SELECT thread_id FROM t1)
+ORDER BY name;
+
+TRUNCATE t1;
+INSERT INTO t1
+SELECT thread_id FROM performance_schema.THREADS
+WHERE name LIKE 'thread/sql%';
+SELECT COUNT(*) INTO @aux FROM t1;
+
+# Attention:
+#    Just waiting for some new thread showing up is not sufficient because
+#    because the successing SELECT showing the thread might catch this thread
+#    in a very early and short phase.
+#    process_info si quite often
+#        CREATE PROCEDURE `t_ps_event`() SQL SECURITY INVOKER SELECT SLEEP(3)
+#             
+let $wait_condition=
+SELECT COUNT(*) = 1  FROM information_schema.processlist
+WHERE info = 'SELECT SLEEP(3)';
+
+--disable_warnings
+DROP EVENT IF EXISTS t_ps_event;
+--enable_warnings
+CREATE EVENT t_ps_event
+ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 SECOND
+DO SELECT SLEEP(3);
+
+# Wait till one more thread comes up.
+# This must be the event worker thread.
+let $wait_timeout= 20;
+--source include/wait_condition.inc
+
+# Show entries belonging to the just started event worker
+SELECT name, type, processlist_user, processlist_host, processlist_db,
+       processlist_command, processlist_info,
+       IF(parent_thread_id IS NULL, parent_thread_id, 'unified parent_thread_id')
+         AS unified_parent_thread_id,
+       role, instrumented
+FROM performance_schema.THREADS
+WHERE name LIKE 'thread/sql%'
+  AND thread_id NOT IN (SELECT thread_id FROM t1)
+ORDER BY name;
+
+# Show parent - child relations between "system" threads
+# ------------------------------------------------------
+--horizontal_results
+SELECT t2.name AS parent_thread_name, t1.name AS child_thread_name
+FROM performance_schema.THREADS t1 INNER JOIN performance_schema.THREADS t2
+ON t1.parent_thread_id = t2.thread_id
+WHERE t1.name LIKE 'thread/sql%'
+  AND t1.parent_thread_id IS NOT NULL
+ORDER BY parent_thread_name, child_thread_name;
+
+# Cleanup
+#    Wait till the event worker disappeared
+--source include/no_running_events.inc
+

=== added file 'mysql-test/suite/sys_vars/r/pfs_setup_actors_size_basic.result'
--- a/mysql-test/suite/sys_vars/r/pfs_setup_actors_size_basic.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/sys_vars/r/pfs_setup_actors_size_basic.result	2010-05-14 14:21:56 +0000
@@ -0,0 +1,23 @@
+select @@global.performance_schema_setup_actors_size;
+@@global.performance_schema_setup_actors_size
+123
+select @@session.performance_schema_setup_actors_size;
+ERROR HY000: Variable 'performance_schema_setup_actors_size' is a GLOBAL variable
+show global variables like 'performance_schema_setup_actors_size';
+Variable_name	Value
+performance_schema_setup_actors_size	123
+show session variables like 'performance_schema_setup_actors_size';
+Variable_name	Value
+performance_schema_setup_actors_size	123
+select * from information_schema.global_variables
+where variable_name='performance_schema_setup_actors_size';
+VARIABLE_NAME	VARIABLE_VALUE
+PERFORMANCE_SCHEMA_SETUP_ACTORS_SIZE	123
+select * from information_schema.session_variables
+where variable_name='performance_schema_setup_actors_size';
+VARIABLE_NAME	VARIABLE_VALUE
+PERFORMANCE_SCHEMA_SETUP_ACTORS_SIZE	123
+set global performance_schema_setup_actors_size=1;
+ERROR HY000: Variable 'performance_schema_setup_actors_size' is a read only variable
+set session performance_schema_setup_actors_size=1;
+ERROR HY000: Variable 'performance_schema_setup_actors_size' is a read only variable

=== added file 'mysql-test/suite/sys_vars/t/pfs_setup_actors_size_basic-master.opt'
--- a/mysql-test/suite/sys_vars/t/pfs_setup_actors_size_basic-master.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/sys_vars/t/pfs_setup_actors_size_basic-master.opt	2010-05-14 14:21:56 +0000
@@ -0,0 +1,2 @@
+--loose-enable-performance-schema
+--loose-performance-schema-setup-actors-size=123

=== added file 'mysql-test/suite/sys_vars/t/pfs_setup_actors_size_basic.test'
--- a/mysql-test/suite/sys_vars/t/pfs_setup_actors_size_basic.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/sys_vars/t/pfs_setup_actors_size_basic.test	2010-07-02 16:50:51 +0000
@@ -0,0 +1,47 @@
+# 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
+
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+#
+# Only global
+#
+
+select @@global.performance_schema_setup_actors_size;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.performance_schema_setup_actors_size;
+
+show global variables like 'performance_schema_setup_actors_size';
+
+show session variables like 'performance_schema_setup_actors_size';
+
+select * from information_schema.global_variables
+  where variable_name='performance_schema_setup_actors_size';
+
+select * from information_schema.session_variables
+  where variable_name='performance_schema_setup_actors_size';
+
+#
+# Read-only
+#
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global performance_schema_setup_actors_size=1;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session performance_schema_setup_actors_size=1;
+

=== modified file 'mysql-test/t/information_schema.test'
--- a/mysql-test/t/information_schema.test	2010-08-20 09:15:16 +0000
+++ b/mysql-test/t/information_schema.test	2010-09-01 22:59:33 +0000
@@ -485,11 +485,14 @@ drop table t_crashme;
 # Bug#7215 information_schema: columns are longtext instead of varchar
 # Bug#7217 information_schema: columns are varbinary() instead of timestamp
 #
-select table_schema,table_name, column_name from
-information_schema.columns
-where data_type = 'longtext';
+select table_schema, table_name, column_name from information_schema.columns
+where table_schema not like 'performance_schema'
+  and data_type = 'longtext';
+
 select table_name, column_name, data_type from information_schema.columns
-where data_type = 'datetime' and table_name not like 'innodb_%';
+where table_schema not like 'performance_schema'
+  and data_type = 'datetime'
+  and table_name not like 'innodb_%';
 
 #
 # Bug#8164 subquery with INFORMATION_SCHEMA.COLUMNS, 100 % CPU

=== modified file 'mysql-test/t/sp-destruct.test'
--- a/mysql-test/t/sp-destruct.test	2010-04-16 14:24:06 +0000
+++ b/mysql-test/t/sp-destruct.test	2010-09-13 09:58:11 +0000
@@ -222,3 +222,33 @@ SHOW WARNINGS;
 --echo # Restore the procs_priv table
 RENAME TABLE procs_priv_backup TO mysql.procs_priv;
 FLUSH TABLE mysql.procs_priv;
+
+
+--echo #
+--echo # Bug #56137 "Assertion `thd->lock == 0' failed on upgrading from
+--echo #             5.1.50 to 5.5.6".
+--echo #
+--disable_warnings
+drop database if exists mysqltest;
+--enable_warnings
+--echo # Backup mysql.proc.
+flush table mysql.proc;
+let $MYSQLD_DATADIR= `select @@datadir`;
+--copy_file $MYSQLD_DATADIR/mysql/proc.frm $MYSQLTEST_VARDIR/tmp/proc.frm
+--copy_file $MYSQLD_DATADIR/mysql/proc.MYD $MYSQLTEST_VARDIR/tmp/proc.MYD
+--copy_file $MYSQLD_DATADIR/mysql/proc.MYI $MYSQLTEST_VARDIR/tmp/proc.MYI
+
+create database mysqltest;
+--echo # Corrupt mysql.proc to make it unusable by current version of server.
+alter table mysql.proc drop column type;
+--echo # The below statement should not cause assertion failure.
+drop database mysqltest;
+
+--echo # Restore mysql.proc.
+drop table mysql.proc;
+--copy_file $MYSQLTEST_VARDIR/tmp/proc.frm $MYSQLD_DATADIR/mysql/proc.frm
+--copy_file $MYSQLTEST_VARDIR/tmp/proc.MYD $MYSQLD_DATADIR/mysql/proc.MYD
+--copy_file $MYSQLTEST_VARDIR/tmp/proc.MYI $MYSQLD_DATADIR/mysql/proc.MYI 
+--remove_file $MYSQLTEST_VARDIR/tmp/proc.frm
+--remove_file $MYSQLTEST_VARDIR/tmp/proc.MYD
+--remove_file $MYSQLTEST_VARDIR/tmp/proc.MYI

=== modified file 'scripts/CMakeLists.txt'
--- a/scripts/CMakeLists.txt	2010-08-23 17:01:12 +0000
+++ b/scripts/CMakeLists.txt	2010-09-13 10:26:57 +0000
@@ -139,6 +139,7 @@ ELSE()
 ENDIF()
 
 SET(HOSTNAME "hostname")
+SET(MYSQLD_USER "mysql")
 
 # Required for mysqlbug until autotools are deprecated, once done remove these
 # and expand default cmake variables

=== modified file 'scripts/make_win_bin_dist'
--- a/scripts/make_win_bin_dist	2010-07-23 20:14:04 +0000
+++ b/scripts/make_win_bin_dist	2010-08-31 14:33:19 +0000
@@ -260,6 +260,7 @@ cp include/mysql.h \
    include/keycache.h \
    include/m_ctype.h \
    include/my_attribute.h \
+   include/my_compiler.h \
    include/mysqld_error.h \
    include/sql_state.h \
    include/mysqld_ername.h \

=== modified file 'scripts/mysql_system_tables.sql'
--- a/scripts/mysql_system_tables.sql	2010-08-12 15:25:01 +0000
+++ b/scripts/mysql_system_tables.sql	2010-09-01 22:59:33 +0000
@@ -417,6 +417,23 @@ EXECUTE stmt;
 DROP PREPARE stmt;
 
 --
+-- TABLE SETUP_ACTORS
+--
+
+SET @l1="CREATE TABLE performance_schema.SETUP_ACTORS(";
+SET @l2="HOST CHAR(60) collate utf8_bin default '%' not null,";
+SET @l3="USER CHAR(16) collate utf8_bin default '%' not null,";
+SET @l4="ROLE CHAR(16) collate utf8_bin default '%' not null";
+SET @l5=")ENGINE=PERFORMANCE_SCHEMA;";
+
+SET @cmd=concat(@l1,@l2,@l3,@l4,@l5);
+
+SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+--
 -- TABLE SETUP_CONSUMERS
 --
 
@@ -465,8 +482,19 @@ DROP PREPARE stmt;
 
 SET @cmd="CREATE TABLE performance_schema.THREADS("
   "THREAD_ID INTEGER not null,"
-  "ID INTEGER not null,"
-  "NAME VARCHAR(64) not null"
+  "NAME VARCHAR(128) not null,"
+  "TYPE VARCHAR(10) not null,"
+  "PROCESSLIST_ID INTEGER,"
+  "PROCESSLIST_USER VARCHAR(16),"
+  "PROCESSLIST_HOST VARCHAR(60),"
+  "PROCESSLIST_DB VARCHAR(64),"
+  "PROCESSLIST_COMMAND VARCHAR(16),"
+  "PROCESSLIST_TIME BIGINT,"
+  "PROCESSLIST_STATE VARCHAR(64),"
+  "PROCESSLIST_INFO LONGTEXT,"
+  "PARENT_THREAD_ID INTEGER,"
+  "ROLE VARCHAR(64),"
+  "INSTRUMENTED ENUM ('YES', 'NO') not null"
   ")ENGINE=PERFORMANCE_SCHEMA;";
 
 SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');

=== modified file 'sql/CMakeLists.txt'
--- a/sql/CMakeLists.txt	2010-08-20 09:15:16 +0000
+++ b/sql/CMakeLists.txt	2010-09-13 12:15:56 +0000
@@ -289,8 +289,7 @@ IF(WIN32 AND MYSQLD_EXECUTABLE)
      COMMAND ${CMAKE_COMMAND}
      ${CONFIG_PARAM} -P ${CMAKE_CURRENT_BINARY_DIR}/create_initial_db.cmake
      WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/data
-     COMMAND  ${CMAKE_COMMAND} -E touch initdb.dep
-     WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+     COMMAND  ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/initdb.dep
      DEPENDS mysqld
   )
   ADD_CUSTOM_TARGET(initial_database  

=== modified file 'sql/event_scheduler.cc'
--- a/sql/event_scheduler.cc	2010-07-15 13:47:50 +0000
+++ b/sql/event_scheduler.cc	2010-07-23 19:03:52 +0000
@@ -397,7 +397,7 @@ Event_scheduler::start()
   }
   pre_init_event_thread(new_thd);
   new_thd->system_thread= SYSTEM_THREAD_EVENT_SCHEDULER;
-  new_thd->command= COM_DAEMON;
+  new_thd->set_command(COM_DAEMON);
 
   /*
     We should run the event scheduler thread under the super-user privileges.

=== modified file 'sql/ha_ndbcluster_binlog.cc'
--- a/sql/ha_ndbcluster_binlog.cc	2010-08-20 08:48:59 +0000
+++ b/sql/ha_ndbcluster_binlog.cc	2010-09-01 22:59:33 +0000
@@ -3649,7 +3649,7 @@ pthread_handler_t ndb_binlog_thread_func
   }
 
   thd->init_for_queries();
-  thd->command= COM_DAEMON;
+  thd->set_command(COM_DAEMON);
   thd->system_thread= SYSTEM_THREAD_NDBCLUSTER_BINLOG;
   thd->main_security_ctx.host_or_ip= "";
   thd->client_capabilities= 0;

=== modified file 'sql/log.cc'
--- a/sql/log.cc	2010-08-30 08:40:42 +0000
+++ b/sql/log.cc	2010-09-01 22:59:33 +0000
@@ -925,8 +925,8 @@ bool LOGGER::slow_log_print(THD *thd, co
     if (!query)
     {
       is_command= TRUE;
-      query= command_name[thd->command].str;
-      query_length= command_name[thd->command].length;
+      query= command_name[thd->get_command()].str;
+      query_length= command_name[thd->get_command()].length;
     }
 
     for (current_handler= slow_log_handler_list; *current_handler ;)

=== modified file 'sql/mdl.cc'
--- a/sql/mdl.cc	2010-08-20 08:48:59 +0000
+++ b/sql/mdl.cc	2010-09-13 10:26:57 +0000
@@ -124,7 +124,6 @@ public:
   Deadlock_detection_visitor(MDL_context *start_node_arg)
     : m_start_node(start_node_arg),
       m_victim(NULL),
-      m_current_search_depth(0),
       m_found_deadlock(FALSE)
   {}
   virtual bool enter_node(MDL_context *node);
@@ -133,6 +132,8 @@ public:
   virtual bool inspect_edge(MDL_context *dest);
 
   MDL_context *get_victim() const { return m_victim; }
+
+  void abort_traversal(MDL_context *node);
 private:
   /**
     Change the deadlock victim to a new one if it has lower deadlock
@@ -147,13 +148,6 @@ private:
   MDL_context *m_start_node;
   /** If a deadlock is found, the context that identifies the victim. */
   MDL_context *m_victim;
-  /** Set to the 0 at start. Increased whenever
-    we descend into another MDL context (aka traverse to the next
-    wait-for graph node). When MAX_SEARCH_DEPTH is reached, we
-    assume that a deadlock is found, even if we have not found a
-    loop.
-  */
-  uint m_current_search_depth;
   /** TRUE if we found a deadlock. */
   bool m_found_deadlock;
   /**
@@ -187,7 +181,7 @@ private:
 
 bool Deadlock_detection_visitor::enter_node(MDL_context *node)
 {
-  m_found_deadlock= ++m_current_search_depth >= MAX_SEARCH_DEPTH;
+  m_found_deadlock= m_current_search_depth >= MAX_SEARCH_DEPTH;
   if (m_found_deadlock)
   {
     DBUG_ASSERT(! m_victim);
@@ -207,7 +201,6 @@ bool Deadlock_detection_visitor::enter_n
 
 void Deadlock_detection_visitor::leave_node(MDL_context *node)
 {
-  --m_current_search_depth;
   if (m_found_deadlock)
     opt_change_victim_to(node);
 }
@@ -252,6 +245,21 @@ Deadlock_detection_visitor::opt_change_v
 
 
 /**
+  Abort traversal of a wait-for graph and report a deadlock.
+
+  @param node Node which we were about to visit when abort
+              was initiated.
+*/
+
+void Deadlock_detection_visitor::abort_traversal(MDL_context *node)
+{
+  DBUG_ASSERT(! m_victim);
+  m_found_deadlock= TRUE;
+  opt_change_victim_to(node);
+}
+
+
+/**
   Get a bit corresponding to enum_mdl_type value in a granted/waiting bitmaps
   and compatibility matrices.
 */
@@ -2056,8 +2064,13 @@ bool MDL_lock::visit_subgraph(MDL_ticket
     are visiting it but this is OK: in the worst case we might do some
     extra work and one more context might be chosen as a victim.
   */
+  ++gvisitor->m_current_search_depth;
+
   if (gvisitor->enter_node(src_ctx))
+  {
+    --gvisitor->m_current_search_depth;
     goto end;
+  }
 
   /*
     We do a breadth-first search first -- that is, inspect all
@@ -2114,6 +2127,7 @@ bool MDL_lock::visit_subgraph(MDL_ticket
 
 end_leave_node:
   gvisitor->leave_node(src_ctx);
+  --gvisitor->m_current_search_depth;
 
 end:
   mysql_prlock_unlock(&m_rwlock);

=== modified file 'sql/mdl.h'
--- a/sql/mdl.h	2010-08-20 08:48:59 +0000
+++ b/sql/mdl.h	2010-09-13 10:26:57 +0000
@@ -385,7 +385,10 @@ public:
 
   virtual bool inspect_edge(MDL_context *dest) = 0;
   virtual ~MDL_wait_for_graph_visitor();
-  MDL_wait_for_graph_visitor() :m_lock_open_count(0) {}
+  MDL_wait_for_graph_visitor() :m_lock_open_count(0),
+                                m_current_search_depth(0)
+  { }
+  virtual void abort_traversal(MDL_context *node) = 0;
 public:
   /**
    XXX, hack: During deadlock search, we may need to
@@ -396,6 +399,17 @@ public:
    LOCK_open since it has significant performance impacts.
   */
   uint m_lock_open_count;
+  /**
+    Set to the 0 at start. Increased whenever
+    we descend into another MDL context (aka traverse to the next
+    wait-for graph node). When MAX_SEARCH_DEPTH is reached, we
+    assume that a deadlock is found, even if we have not found a
+    loop.
+
+    XXX: This member belongs to this class only temporarily until
+         bug #56405 is fixed.
+  */
+  uint m_current_search_depth;
 };
 
 /**

=== modified file 'sql/rpl_master.cc'
--- a/sql/rpl_master.cc	2010-07-29 11:30:51 +0000
+++ b/sql/rpl_master.cc	2010-08-10 14:41:50 +0000
@@ -1122,7 +1122,7 @@ void kill_zombie_dump_threads(String *sl
 
   while ((tmp=it++))
   {
-    if (tmp != current_thd && tmp->command == COM_BINLOG_DUMP)
+    if (tmp != current_thd && tmp->get_command() == COM_BINLOG_DUMP)
     {
       String tmp_uuid;
       if (get_slave_uuid(tmp, &tmp_uuid) != NULL &&

=== modified file 'sql/sp.cc'
--- a/sql/sp.cc	2010-08-06 08:54:01 +0000
+++ b/sql/sp.cc	2010-09-13 12:15:56 +0000
@@ -440,6 +440,7 @@ static TABLE *open_proc_table_for_update
 {
   TABLE_LIST table_list;
   TABLE *table;
+  MDL_ticket *mdl_savepoint= thd->mdl_context.mdl_savepoint();
   DBUG_ENTER("open_proc_table_for_update");
 
   table_list.init_one_table("mysql", 5, "proc", 4, "proc", TL_WRITE);
@@ -450,6 +451,9 @@ static TABLE *open_proc_table_for_update
   if (!proc_table_intact.check(table, &proc_table_def))
     DBUG_RETURN(table);
 
+  close_thread_tables(thd);
+  thd->mdl_context.rollback_to_savepoint(mdl_savepoint);
+
   DBUG_RETURN(NULL);
 }
 

=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc	2010-08-20 09:15:16 +0000
+++ b/sql/sql_base.cc	2010-09-13 12:15:56 +0000
@@ -100,6 +100,8 @@ bool No_such_table_error_handler::safely
   TABLE_SHAREs, refresh_version and the table id counter.
 */
 mysql_mutex_t LOCK_open;
+mysql_mutex_t LOCK_dd_owns_lock_open;
+uint dd_owns_lock_open= 0;
 
 #ifdef HAVE_PSI_INTERFACE
 static PSI_mutex_key key_LOCK_open;
@@ -298,6 +300,7 @@ bool table_def_init(void)
   init_tdc_psi_keys();
 #endif
   mysql_mutex_init(key_LOCK_open, &LOCK_open, MY_MUTEX_INIT_FAST);
+  mysql_mutex_init(NULL, &LOCK_dd_owns_lock_open, MY_MUTEX_INIT_FAST);
   oldest_unused_share= &end_of_unused_share;
   end_of_unused_share.prev= &oldest_unused_share;
 
@@ -341,6 +344,7 @@ void table_def_free(void)
     table_def_inited= 0;
     /* Free table definitions. */
     my_hash_free(&table_def_cache);
+    mysql_mutex_destroy(&LOCK_dd_owns_lock_open);
     mysql_mutex_destroy(&LOCK_open);
   }
   DBUG_VOID_RETURN;

=== modified file 'sql/sql_base.h'
--- a/sql/sql_base.h	2010-08-20 09:15:16 +0000
+++ b/sql/sql_base.h	2010-09-13 12:15:56 +0000
@@ -71,6 +71,8 @@ enum enum_tdc_remove_table_type {TDC_RT_
 
 bool check_dup(const char *db, const char *name, TABLE_LIST *tables);
 extern mysql_mutex_t LOCK_open;
+extern mysql_mutex_t LOCK_dd_owns_lock_open;
+extern uint dd_owns_lock_open;
 bool table_cache_init(void);
 void table_cache_free(void);
 bool table_def_init(void);

=== modified file 'sql/sql_class.cc'
--- a/sql/sql_class.cc	2010-09-01 13:06:14 +0000
+++ b/sql/sql_class.cc	2010-09-01 22:59:33 +0000
@@ -278,6 +278,10 @@ const char *set_thd_proc_info(void *thd_
   thd->profiling.status_change(info, calling_function, calling_file, calling_line);
 #endif
   thd->proc_info= info;
+#ifdef HAVE_PSI_INTERFACE
+  if (PSI_server)
+    PSI_server->set_thread_state(info);
+#endif
   return old_info;
 }
 
@@ -593,7 +597,7 @@ THD::THD()
   where= THD::DEFAULT_WHERE;
   server_id = ::server_id;
   slave_net = 0;
-  command=COM_CONNECT;
+  set_command(COM_CONNECT);
   *scramble= '\0';
 
   /* Call to init() below requires fully initialized Open_tables_state. */
@@ -3406,6 +3410,16 @@ void THD::set_statement(Statement *stmt)
 }
 
 
+void THD::set_command(enum enum_server_command command)
+{
+  m_command= command;
+#ifdef HAVE_PSI_INTERFACE
+  if (PSI_server)
+    PSI_server->set_thread_command(m_command);
+#endif
+}
+
+
 /** Assign a new value to thd->query.  */
 
 void THD::set_query(char *query_arg, uint32 query_length_arg)
@@ -3413,6 +3427,11 @@ void THD::set_query(char *query_arg, uin
   mysql_mutex_lock(&LOCK_thd_data);
   set_query_inner(query_arg, query_length_arg);
   mysql_mutex_unlock(&LOCK_thd_data);
+
+#ifdef HAVE_PSI_INTERFACE
+  if (PSI_server)
+    PSI_server->set_thread_info(query_arg, query_length_arg);
+#endif
 }
 
 /** Assign a new value to thd->query and thd->query_id.  */

=== modified file 'sql/sql_class.h'
--- a/sql/sql_class.h	2010-09-01 13:06:14 +0000
+++ b/sql/sql_class.h	2010-09-01 22:59:33 +0000
@@ -1499,11 +1499,15 @@ public:
   uint dbug_sentry; // watch out for memory corruption
 #endif
   struct st_my_thread_var *mysys_var;
-  /*
-    Type of current query: COM_STMT_PREPARE, COM_QUERY, etc. Set from
-    first byte of the packet in do_command()
+
+private:
+  /**
+    Type of current query: COM_STMT_PREPARE, COM_QUERY, etc.
+    Set from first byte of the packet in do_command()
   */
-  enum enum_server_command command;
+  enum enum_server_command m_command;
+
+public:
   uint32     server_id;
   uint32     file_id;			// for LOAD DATA INFILE
   /* remote (peer) port */
@@ -2217,12 +2221,28 @@ public:
     }
     else
       start_utime= utime_after_lock= my_micro_time_and_time(&start_time);
+
+#ifdef HAVE_PSI_INTERFACE
+    if (PSI_server)
+      PSI_server->set_thread_start_time(start_time);
+#endif
   }
-  inline void	set_current_time()    { start_time= my_time(MY_WME); }
-  inline void	set_time(time_t t)
+  inline void set_current_time()
+  {
+    start_time= my_time(MY_WME);
+#ifdef HAVE_PSI_INTERFACE
+    if (PSI_server)
+      PSI_server->set_thread_start_time(start_time);
+#endif
+  }
+  inline void set_time(time_t t)
   {
     start_time= user_time= t;
     start_utime= utime_after_lock= my_micro_time();
+#ifdef HAVE_PSI_INTERFACE
+    if (PSI_server)
+      PSI_server->set_thread_start_time(start_time);
+#endif
   }
   /*TODO: this will be obsolete when we have support for 64 bit my_time_t */
   inline bool	is_valid_time() 
@@ -2545,6 +2565,7 @@ public:
   */
   bool set_db(const char *new_db, size_t new_db_len)
   {
+    bool result;
     /* Do not reallocate memory if current chunk is big enough. */
     if (db && new_db && db_length >= new_db_len)
       memcpy(db, new_db, new_db_len+1);
@@ -2557,7 +2578,12 @@ public:
         db= NULL;
     }
     db_length= db ? new_db_len : 0;
-    return new_db && !db;
+    result= new_db && !db;
+#ifdef HAVE_PSI_INTERFACE
+    if (result && PSI_server)
+      PSI_server->set_thread_db(new_db, new_db_len);
+#endif
+    return result;
   }
 
   /**
@@ -2575,6 +2601,10 @@ public:
   {
     db= new_db;
     db_length= new_db_len;
+#ifdef HAVE_PSI_INTERFACE
+    if (PSI_server)
+      PSI_server->set_thread_db(new_db, new_db_len);
+#endif
   }
   /*
     Copy the current database to the argument. Use the current arena to
@@ -2692,6 +2722,11 @@ public:
   /** Overloaded to guard query/query_length fields */
   virtual void set_statement(Statement *stmt);
 
+  void set_command(enum enum_server_command command);
+
+  inline enum enum_server_command get_command() const
+  { return m_command; }
+
   /**
     Assign a new value to thd->query and thd->query_id and mysys_var.
     Protected with LOCK_thd_data mutex.

=== modified file 'sql/sql_connect.cc'
--- a/sql/sql_connect.cc	2010-09-01 13:05:01 +0000
+++ b/sql/sql_connect.cc	2010-09-01 22:59:33 +0000
@@ -15,7 +15,7 @@
 
 
 /*
-  Functions to autenticate and handle reqests for a connection
+  Functions to authenticate and handle requests for a connection
 */
 
 #include "my_global.h"
@@ -506,6 +506,15 @@ check_user(THD *thd, enum enum_server_co
       */
       thd->net.skip_big_packet= TRUE;
 #endif
+#ifdef HAVE_PSI_INTERFACE
+      if (PSI_server)
+      {
+        PSI_server->set_thread_user_host(thd->main_security_ctx.user,
+                                         strlen(thd->main_security_ctx.user),
+                                         thd->main_security_ctx.host_or_ip,
+                                         strlen(thd->main_security_ctx.host_or_ip));
+      }
+#endif
       /* Ready to handle queries */
       DBUG_RETURN(0);
     }
@@ -1082,7 +1091,7 @@ void prepare_new_connection_state(THD* t
     TODO: refactor this to avoid code duplication there
   */
   thd->proc_info= 0;
-  thd->command= COM_SLEEP;
+  thd->set_command(COM_SLEEP);
   thd->set_time();
   thd->init_for_queries();
 

=== modified file 'sql/sql_insert.cc'
--- a/sql/sql_insert.cc	2010-08-30 08:40:42 +0000
+++ b/sql/sql_insert.cc	2010-09-01 22:59:33 +0000
@@ -1860,7 +1860,7 @@ public:
     thd.security_ctx->user=thd.security_ctx->priv_user=(char*) delayed_user;
     thd.security_ctx->host=(char*) my_localhost;
     thd.current_tablenr=0;
-    thd.command=COM_DELAYED_INSERT;
+    thd.set_command(COM_DELAYED_INSERT);
     thd.lex->current_select= 0; 		// for my_message_sql
     thd.lex->sql_command= SQLCOM_INSERT;        // For innodb::store_lock()
     /*

=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc	2010-08-30 08:40:42 +0000
+++ b/sql/sql_parse.cc	2010-09-01 22:59:33 +0000
@@ -910,7 +910,7 @@ bool dispatch_command(enum enum_server_c
                       thd->security_ctx->priv_user,
                       (char *) thd->security_ctx->host_or_ip);
   
-  thd->command=command;
+  thd->set_command(command);
   /*
     Commands which always take a long time are logged into
     the slow log only if opt_log_slow_admin_statements is set.
@@ -1492,7 +1492,7 @@ bool dispatch_command(enum enum_server_c
 
   thd_proc_info(thd, "cleaning up");
   thd->set_query(NULL, 0);
-  thd->command=COM_SLEEP;
+  thd->set_command(COM_SLEEP);
   dec_thread_running();
   thd_proc_info(thd, 0);
   thd->packet.shrink(thd->variables.net_buffer_length);	// Reclaim some memory
@@ -6400,7 +6400,7 @@ uint kill_one_thread(THD *thd, ulong id,
   I_List_iterator<THD> it(threads);
   while ((tmp=it++))
   {
-    if (tmp->command == COM_DAEMON)
+    if (tmp->get_command() == COM_DAEMON)
       continue;
     if (tmp->thread_id == id)
     {

=== modified file 'sql/sql_prepare.cc'
--- a/sql/sql_prepare.cc	2010-08-18 10:18:27 +0000
+++ b/sql/sql_prepare.cc	2010-09-01 22:59:33 +0000
@@ -2724,7 +2724,7 @@ void mysqld_stmt_reset(THD *thd, char *p
 
   stmt->state= Query_arena::PREPARED;
 
-  general_log_print(thd, thd->command, NullS);
+  general_log_print(thd, thd->get_command(), NullS);
 
   my_ok(thd);
 
@@ -2757,7 +2757,7 @@ void mysqld_stmt_close(THD *thd, char *p
   */
   DBUG_ASSERT(! stmt->is_in_use());
   stmt->deallocate();
-  general_log_print(thd, thd->command, NullS);
+  general_log_print(thd, thd->get_command(), NullS);
 
   DBUG_VOID_RETURN;
 }
@@ -2861,7 +2861,7 @@ void mysql_stmt_get_longdata(THD *thd, c
     sprintf(stmt->last_error, ER(ER_OUTOFMEMORY), 0);
   }
 
-  general_log_print(thd, thd->command, NullS);
+  general_log_print(thd, thd->get_command(), NullS);
 
   DBUG_VOID_RETURN;
 }

=== modified file 'sql/sql_show.cc'
--- a/sql/sql_show.cc	2010-09-01 13:06:14 +0000
+++ b/sql/sql_show.cc	2010-09-01 22:59:33 +0000
@@ -1744,7 +1744,7 @@ static const char *thread_state_info(THD
   {
     if (tmp->net.reading_or_writing == 2)
       return "Writing to net";
-    else if (tmp->command == COM_SLEEP)
+    else if (tmp->get_command() == COM_SLEEP)
       return "";
     else
       return "Reading from net";
@@ -1818,7 +1818,7 @@ void mysqld_list_processes(THD *thd,cons
                                       tmp_sctx->host ? tmp_sctx->host : "");
         if ((thd_info->db=tmp->db))             // Safe test
           thd_info->db=thd->strdup(thd_info->db);
-        thd_info->command=(int) tmp->command;
+        thd_info->command=(int) tmp->get_command();
         mysql_mutex_lock(&tmp->LOCK_thd_data);
         if ((mysys_var= tmp->mysys_var))
           mysql_mutex_lock(&mysys_var->mutex);
@@ -1929,8 +1929,8 @@ int fill_schema_processlist(THD* thd, TA
       if ((val= (char *) (tmp->killed == THD::KILL_CONNECTION? "Killed" : 0)))
         table->field[4]->store(val, strlen(val), cs);
       else
-        table->field[4]->store(command_name[tmp->command].str,
-                               command_name[tmp->command].length, cs);
+        table->field[4]->store(command_name[tmp->get_command()].str,
+                               command_name[tmp->get_command()].length, cs);
       /* MYSQL_TIME */
       table->field[5]->store((longlong)(tmp->start_time ?
                                       now - tmp->start_time : 0), FALSE);

=== modified file 'sql/sql_table.cc'
--- a/sql/sql_table.cc	2010-08-30 08:40:42 +0000
+++ b/sql/sql_table.cc	2010-09-01 22:59:33 +0000
@@ -1636,7 +1636,7 @@ void execute_ddl_log_recovery()
   THD *thd;
   DDL_LOG_ENTRY ddl_log_entry;
   char file_name[FN_REFLEN];
-  char recover_query_string[]= "INTERNAL DDL LOG RECOVER IN PROGRESS";
+  static char recover_query_string[]= "INTERNAL DDL LOG RECOVER IN PROGRESS";
   DBUG_ENTER("execute_ddl_log_recovery");
 
   /*

=== modified file 'sql/sys_vars.cc'
--- a/sql/sys_vars.cc	2010-09-01 13:06:14 +0000
+++ b/sql/sys_vars.cc	2010-09-01 22:59:33 +0000
@@ -197,6 +197,14 @@ static Sys_var_ulong Sys_pfs_max_thread_
        DEFAULT(PFS_MAX_THREAD),
        BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
 
+static Sys_var_ulong Sys_pfs_setup_actors_size(
+       "performance_schema_setup_actors_size",
+       "Maximum number of rows in SETUP_ACTORS.",
+       READ_ONLY GLOBAL_VAR(pfs_param.m_setup_actor_sizing),
+       CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 1024),
+       DEFAULT(PFS_MAX_SETUP_ACTOR),
+       BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
+
 #endif /* WITH_PERFSCHEMA_STORAGE_ENGINE */
 
 static Sys_var_ulong Sys_auto_increment_increment(

=== modified file 'sql/table.cc'
--- a/sql/table.cc	2010-08-26 15:32:53 +0000
+++ b/sql/table.cc	2010-09-13 12:15:56 +0000
@@ -3086,7 +3086,30 @@ bool TABLE_SHARE::visit_subgraph(Wait_fo
     holding a write-lock on MDL_lock::m_rwlock.
   */
   if (gvisitor->m_lock_open_count++ == 0)
+  {
+    /*
+      To circumvent bug #56405 "Deadlock in the MDL deadlock detector"
+      we don't try to lock LOCK_open mutex if some thread doing
+      deadlock detection already owns it and current search depth is
+      greater than 0. Instead we report a deadlock.
+
+      TODO/FIXME: The proper fix for this bug is to use rwlocks for
+                  protection of table shares/instead of LOCK_open.
+                  Unfortunately it requires more effort/has significant
+                  performance effect.
+    */
+    mysql_mutex_lock(&LOCK_dd_owns_lock_open);
+    if (gvisitor->m_current_search_depth > 0 && dd_owns_lock_open > 0)
+    {
+      mysql_mutex_unlock(&LOCK_dd_owns_lock_open);
+      --gvisitor->m_lock_open_count;
+      gvisitor->abort_traversal(src_ctx);
+      return TRUE;
+    }
+    ++dd_owns_lock_open;
+    mysql_mutex_unlock(&LOCK_dd_owns_lock_open);
     mysql_mutex_lock(&LOCK_open);
+  }
 
   I_P_List_iterator <TABLE, TABLE_share> tables_it(used_tables);
 
@@ -3101,8 +3124,12 @@ bool TABLE_SHARE::visit_subgraph(Wait_fo
     goto end;
   }
 
+  ++gvisitor->m_current_search_depth;
   if (gvisitor->enter_node(src_ctx))
+  {
+    --gvisitor->m_current_search_depth;
     goto end;
+  }
 
   while ((table= tables_it++))
   {
@@ -3125,10 +3152,16 @@ bool TABLE_SHARE::visit_subgraph(Wait_fo
 
 end_leave_node:
   gvisitor->leave_node(src_ctx);
+  --gvisitor->m_current_search_depth;
 
 end:
   if (gvisitor->m_lock_open_count-- == 1)
+  {
     mysql_mutex_unlock(&LOCK_open);
+    mysql_mutex_lock(&LOCK_dd_owns_lock_open);
+    --dd_owns_lock_open;
+    mysql_mutex_unlock(&LOCK_dd_owns_lock_open);
+  }
 
   return result;
 }

=== modified file 'storage/perfschema/CMakeLists.txt'
--- a/storage/perfschema/CMakeLists.txt	2010-08-12 15:25:01 +0000
+++ b/storage/perfschema/CMakeLists.txt	2010-09-01 22:59:33 +0000
@@ -24,6 +24,7 @@ ADD_DEFINITIONS(-DMYSQL_SERVER)
 SET(PERFSCHEMA_SOURCES ha_perfschema.h
   pfs_column_types.h
   pfs_column_values.h
+  pfs_defaults.h
   pfs_events_waits.h
   pfs_global.h
   pfs.h
@@ -32,6 +33,7 @@ SET(PERFSCHEMA_SOURCES ha_perfschema.h
   pfs_lock.h
   pfs_atomic.h
   pfs_server.h
+  pfs_setup_actor.h
   pfs_stat.h
   pfs_engine_table.h
   pfs_timer.h
@@ -43,6 +45,7 @@ SET(PERFSCHEMA_SOURCES ha_perfschema.h
   table_file_summary.h
   table_helper.h
   table_performance_timers.h
+  table_setup_actors.h
   table_setup_consumers.h
   table_setup_instruments.h
   table_setup_timers.h
@@ -51,11 +54,13 @@ SET(PERFSCHEMA_SOURCES ha_perfschema.h
   ha_perfschema.cc
   pfs.cc
   pfs_column_values.cc
+  pfs_defaults.cc
   pfs_events_waits.cc
   pfs_global.cc
   pfs_instr.cc
   pfs_instr_class.cc
   pfs_server.cc
+  pfs_setup_actor.cc
   pfs_engine_table.cc
   pfs_timer.cc
   table_all_instr.cc
@@ -65,6 +70,7 @@ SET(PERFSCHEMA_SOURCES ha_perfschema.h
   table_file_instances.cc
   table_file_summary.cc
   table_performance_timers.cc
+  table_setup_actors.cc
   table_setup_consumers.cc
   table_setup_instruments.cc
   table_setup_timers.cc

=== modified file 'storage/perfschema/Makefile.am'
--- a/storage/perfschema/Makefile.am	2010-08-12 15:25:01 +0000
+++ b/storage/perfschema/Makefile.am	2010-09-01 22:59:33 +0000
@@ -37,27 +37,29 @@ noinst_HEADERS = ha_perfschema.h pfs_eng
 		pfs_global.h pfs_instr_class.h pfs_instr.h \
                 pfs_column_types.h pfs_column_values.h \
                 table_setup_instruments.h table_performance_timers.h \
-                table_setup_timers.h table_helper.h \
+                table_setup_actors.h table_setup_timers.h table_helper.h \
                 table_setup_consumers.h table_events_waits.h \
 		pfs_events_waits.h pfs_timer.h table_threads.h \
 		table_sync_instances.h \
 		table_events_waits_summary.h pfs_stat.h \
 		table_ews_global_by_event_name.h table_all_instr.h \
 		table_file_instances.h table_file_summary.h \
-		pfs_lock.h pfs_atomic.h
+		pfs_lock.h pfs_atomic.h \
+		pfs_setup_actor.h pfs_defaults.h
 
 PSE_SOURCES = ha_perfschema.cc pfs_engine_table.cc pfs.cc pfs_server.cc \
 		pfs_global.cc pfs_instr_class.cc pfs_instr.cc \
                 pfs_column_values.cc \
                 table_setup_instruments.cc table_performance_timers.cc \
-                table_setup_timers.cc \
+                table_setup_actors.cc table_setup_timers.cc \
                 table_setup_consumers.cc table_events_waits.cc \
 		pfs_events_waits.cc pfs_timer.cc table_threads.cc \
 		table_sync_instances.cc \
 		table_events_waits_summary.cc \
 		table_ews_global_by_event_name.cc table_all_instr.cc \
 		table_file_instances.cc table_file_summary.cc \
-		pfs_atomic.cc pfs_check.cc
+		pfs_atomic.cc pfs_check.cc \
+		pfs_setup_actor.cc pfs_defaults.cc
 
 EXTRA_LIBRARIES = libperfschema.a
 noinst_LIBRARIES = @plugin_perfschema_static_target@

=== modified file 'storage/perfschema/ha_perfschema.cc'
--- a/storage/perfschema/ha_perfschema.cc	2010-07-23 17:08:41 +0000
+++ b/storage/perfschema/ha_perfschema.cc	2010-07-30 09:02:32 +0000
@@ -208,13 +208,7 @@ int ha_perfschema::write_row(uchar *buf)
   ha_statistic_increment(&SSV::ha_write_count);
   DBUG_ASSERT(m_table_share);
 
-  if (m_table_share->m_write_row)
-    result= m_table_share->m_write_row(table, buf, table->field);
-  else
-  {
-    my_error(ER_WRONG_PERFSCHEMA_USAGE, MYF(0));
-    result= HA_ERR_WRONG_COMMAND;
-  }
+  result= m_table_share->write_row(table, buf, table->field);
 
   DBUG_RETURN(result);
 }
@@ -239,6 +233,15 @@ int ha_perfschema::update_row(const ucha
   DBUG_RETURN(result);
 }
 
+int ha_perfschema::delete_row(const uchar *buf)
+{
+  DBUG_ENTER("ha_perfschema::delete_row");
+
+  DBUG_ASSERT(m_table);
+  int result= m_table->delete_row(table, buf, table->field);
+  DBUG_RETURN(result);
+}
+
 int ha_perfschema::rnd_init(bool scan)
 {
   int result;
@@ -306,7 +309,7 @@ int ha_perfschema::info(uint flag)
   DBUG_ENTER("ha_perfschema::info");
   DBUG_ASSERT(m_table_share);
   if (flag & HA_STATUS_VARIABLE)
-    stats.records= m_table_share->m_records;
+    stats.records= m_table_share->get_row_count();
   if (flag & HA_STATUS_CONST)
     ref_length= m_table_share->m_ref_length;
   DBUG_RETURN(0);

=== modified file 'storage/perfschema/ha_perfschema.h'
--- a/storage/perfschema/ha_perfschema.h	2010-07-16 01:28:30 +0000
+++ b/storage/perfschema/ha_perfschema.h	2010-07-23 19:03:52 +0000
@@ -72,7 +72,8 @@ public:
       records.
     */
     return HA_NO_TRANSACTIONS | HA_REC_NOT_IN_SEQ | HA_NO_AUTO_INCREMENT |
-      HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE | HA_NO_BLOBS;
+      HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE |
+      HA_PRIMARY_KEY_REQUIRED_FOR_DELETE;
   }
 
   /**
@@ -113,6 +114,8 @@ public:
 
   int update_row(const uchar *old_data, uchar *new_data);
 
+  int delete_row(const uchar *buf);
+
   int rnd_init(bool scan);
 
   int rnd_end(void);

=== modified file 'storage/perfschema/pfs.cc'
--- a/storage/perfschema/pfs.cc	2010-08-26 16:44:02 +0000
+++ b/storage/perfschema/pfs.cc	2010-09-01 22:59:33 +0000
@@ -28,6 +28,7 @@
 #include "pfs_column_values.h"
 #include "pfs_timer.h"
 #include "pfs_events_waits.h"
+#include "pfs_setup_actor.h"
 
 /**
   @page PAGE_PERFORMANCE_SCHEMA The Performance Schema main page
@@ -1042,9 +1043,25 @@ void* pfs_spawn_thread(void *arg)
   /* First, attach instrumentation to this newly created pthread. */
   PFS_thread_class *klass= find_thread_class(typed_arg->m_child_key);
   if (likely(klass != NULL))
+  {
     pfs= create_thread(klass, typed_arg->m_child_identity, 0);
+    if (likely(pfs != NULL))
+    {
+      PFS_thread *parent= typed_arg->m_parent_thread;
+
+      pfs->m_parent_thread_internal_id= parent->m_thread_internal_id;
+
+      memcpy(pfs->m_username, parent->m_username, sizeof(pfs->m_username));
+      pfs->m_username_length= parent->m_username_length;
+
+      memcpy(pfs->m_hostname, parent->m_hostname, sizeof(pfs->m_hostname));
+      pfs->m_hostname_length= parent->m_hostname_length;
+    }
+  }
   else
+  {
     pfs= NULL;
+  }
   my_pthread_setspecific_ptr(THR_PFS, pfs);
 
   /*
@@ -1115,6 +1132,188 @@ get_thread_v1(void)
   return reinterpret_cast<PSI_thread*> (pfs);
 }
 
+/**
+  Implementation of the thread instrumentation interface.
+  @sa PSI_v1::set_thread_user.
+*/
+static void set_thread_user_v1(const char *user, int user_len)
+{
+  PFS_thread *pfs= my_pthread_getspecific_ptr(PFS_thread*, THR_PFS);
+
+  DBUG_ASSERT((user != NULL) || (user_len == 0));
+  DBUG_ASSERT(user_len >= 0);
+  DBUG_ASSERT((uint) user_len <= sizeof(pfs->m_username));
+
+  if (unlikely(pfs == NULL))
+    return;
+
+  pfs->m_lock.allocated_to_dirty();
+  if (user_len > 0)
+    memcpy(pfs->m_username, user, user_len);
+  pfs->m_username_length= user_len;
+
+  bool enabled= false;
+
+  if ((pfs->m_username_length > 0) && (pfs->m_hostname_length > 0))
+  {
+    /*
+      TODO: performance improvement.
+      Once performance_schema.USERS is exposed,
+      we can use PFS_user::m_enabled instead of looking up
+      SETUP_ACTORS every time.
+    */
+    lookup_setup_actor(pfs,
+                       pfs->m_username, pfs->m_username_length,
+                       pfs->m_hostname, pfs->m_hostname_length,
+                       &enabled);
+  }
+
+  pfs->m_enabled= enabled;
+
+  pfs->m_lock.dirty_to_allocated();
+}
+
+/**
+  Implementation of the thread instrumentation interface.
+  @sa PSI_v1::set_thread_user_host.
+*/
+static void set_thread_user_host_v1(const char *user, int user_len,
+                                    const char *host, int host_len)
+{
+  PFS_thread *pfs= my_pthread_getspecific_ptr(PFS_thread*, THR_PFS);
+
+  DBUG_ASSERT((user != NULL) || (user_len == 0));
+  DBUG_ASSERT(user_len >= 0);
+  DBUG_ASSERT((uint) user_len <= sizeof(pfs->m_username));
+  DBUG_ASSERT((host != NULL) || (host_len == 0));
+  DBUG_ASSERT(host_len >= 0);
+  DBUG_ASSERT((uint) host_len <= sizeof(pfs->m_hostname));
+
+  if (unlikely(pfs == NULL))
+    return;
+
+  pfs->m_lock.allocated_to_dirty();
+
+  if (host_len > 0)
+    memcpy(pfs->m_hostname, host, host_len);
+  pfs->m_hostname_length= host_len;
+
+  if (user_len > 0)
+    memcpy(pfs->m_username, user, user_len);
+  pfs->m_username_length= user_len;
+
+  bool enabled= false;
+  if ((pfs->m_username_length > 0) && (pfs->m_hostname_length > 0))
+  {
+    /*
+      TODO: performance improvement.
+      Once performance_schema.USERS is exposed,
+      we can use PFS_user::m_enabled instead of looking up
+      SETUP_ACTORS every time.
+    */
+    lookup_setup_actor(pfs,
+                       pfs->m_username, pfs->m_username_length,
+                       pfs->m_hostname, pfs->m_hostname_length,
+                       &enabled);
+  }
+  pfs->m_enabled= enabled;
+
+  pfs->m_lock.dirty_to_allocated();
+}
+
+/**
+  Implementation of the thread instrumentation interface.
+  @sa PSI_v1::set_thread_db.
+*/
+static void set_thread_db_v1(const char* db, int db_len)
+{
+  PFS_thread *pfs= my_pthread_getspecific_ptr(PFS_thread*, THR_PFS);
+
+  DBUG_ASSERT((db != NULL) || (db_len == 0));
+  DBUG_ASSERT(db_len >= 0);
+  DBUG_ASSERT((uint) db_len <= sizeof(pfs->m_dbname));
+
+  if (likely(pfs != NULL))
+  {
+    pfs->m_lock.allocated_to_dirty();
+    if (db_len > 0)
+      memcpy(pfs->m_dbname, db, db_len);
+    pfs->m_dbname_length= db_len;
+    pfs->m_lock.dirty_to_allocated();
+  }
+}
+
+/**
+  Implementation of the thread instrumentation interface.
+  @sa PSI_v1::set_thread_command.
+*/
+static void set_thread_command_v1(int command)
+{
+  PFS_thread *pfs= my_pthread_getspecific_ptr(PFS_thread*, THR_PFS);
+
+  DBUG_ASSERT(command >= 0);
+  DBUG_ASSERT(command <= (int) COM_END);
+
+  if (likely(pfs != NULL))
+  {
+    pfs->m_lock.allocated_to_dirty();
+    pfs->m_command= command;
+    pfs->m_lock.dirty_to_allocated();
+  }
+}
+
+/**
+  Implementation of the thread instrumentation interface.
+  @sa PSI_v1::set_thread_start_time.
+*/
+static void set_thread_start_time_v1(time_t start_time)
+{
+  PFS_thread *pfs= my_pthread_getspecific_ptr(PFS_thread*, THR_PFS);
+
+  if (likely(pfs != NULL))
+  {
+    pfs->m_lock.allocated_to_dirty();
+    pfs->m_start_time= start_time;
+    pfs->m_lock.dirty_to_allocated();
+  }
+}
+
+/**
+  Implementation of the thread instrumentation interface.
+  @sa PSI_v1::set_thread_state.
+*/
+static void set_thread_state_v1(const char* state)
+{
+  PFS_thread *pfs= my_pthread_getspecific_ptr(PFS_thread*, THR_PFS);
+
+  if (likely(pfs != NULL))
+  {
+    int state_len= state ? strlen(state) : 0;
+
+    pfs->m_lock.allocated_to_dirty();
+    pfs->m_processlist_state_ptr= state;
+    pfs->m_processlist_state_length= state_len;
+    pfs->m_lock.dirty_to_allocated();
+  }
+}
+
+/**
+  Implementation of the thread instrumentation interface.
+  @sa PSI_v1::set_thread_info.
+*/
+static void set_thread_info_v1(const char* info, int info_len)
+{
+  PFS_thread *pfs= my_pthread_getspecific_ptr(PFS_thread*, THR_PFS);
+
+  if (likely(pfs != NULL))
+  {
+    pfs->m_lock.allocated_to_dirty();
+    pfs->m_processlist_info_ptr= info;
+    pfs->m_processlist_info_length= info_len;
+    pfs->m_lock.dirty_to_allocated();
+  }
+}
+
 static void set_thread_v1(PSI_thread* thread)
 {
   PFS_thread *pfs= reinterpret_cast<PFS_thread*> (thread);
@@ -2186,6 +2385,13 @@ PSI_v1 PFS_v1=
   new_thread_v1,
   set_thread_id_v1,
   get_thread_v1,
+  set_thread_user_v1,
+  set_thread_user_host_v1,
+  set_thread_db_v1,
+  set_thread_command_v1,
+  set_thread_start_time_v1,
+  set_thread_state_v1,
+  set_thread_info_v1,
   set_thread_v1,
   delete_current_thread_v1,
   delete_thread_v1,

=== added file 'storage/perfschema/pfs_defaults.cc'
--- a/storage/perfschema/pfs_defaults.cc	1970-01-01 00:00:00 +0000
+++ b/storage/perfschema/pfs_defaults.cc	2010-07-02 16:15:37 +0000
@@ -0,0 +1,49 @@
+/* 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 */
+
+/**
+  @file storage/perfschema/pfs_defaults.cc
+  Default setup (implementation).
+*/
+
+#include "pfs.h"
+#include "pfs_defaults.h"
+#include "pfs_instr.h"
+#include "pfs_setup_actor.h"
+
+static PSI_thread_key key;
+static PSI_thread_info info= { &key, "setup", PSI_FLAG_GLOBAL };
+
+void install_default_setup(PSI_bootstrap *boot)
+{
+  PSI *psi= (PSI*) boot->get_interface(PSI_CURRENT_VERSION);
+  if (psi == NULL)
+    return;
+
+  psi->register_thread("performance_schema", &info, 1);
+  PSI_thread *psi_thread= psi->new_thread(key, NULL, 0);
+  if (psi_thread == NULL)
+    return;
+
+  /* LF_HASH needs a thread, for PINS */
+  psi->set_thread(psi_thread);
+
+  String percent("%", 1, &my_charset_utf8_bin);
+  /* Enable all users on all hosts by default */
+  insert_setup_actor(&percent, &percent, &percent);
+
+  psi->delete_current_thread();
+}
+

=== added file 'storage/perfschema/pfs_defaults.h'
--- a/storage/perfschema/pfs_defaults.h	1970-01-01 00:00:00 +0000
+++ b/storage/perfschema/pfs_defaults.h	2010-07-02 16:15:37 +0000
@@ -0,0 +1,26 @@
+/* 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 */
+
+#ifndef PFS_DEFAULTS_H
+#define PFS_DEFAULTS_H
+
+/**
+  @file storage/perfschema/pfs_defaults.h
+  Default setup (declarations).
+*/
+
+void install_default_setup(PSI_bootstrap *boot);
+
+#endif

=== modified file 'storage/perfschema/pfs_engine_table.cc'
--- a/storage/perfschema/pfs_engine_table.cc	2010-08-12 15:25:01 +0000
+++ b/storage/perfschema/pfs_engine_table.cc	2010-09-01 22:59:33 +0000
@@ -21,6 +21,7 @@
 #include "pfs_engine_table.h"
 
 #include "table_events_waits.h"
+#include "table_setup_actors.h"
 #include "table_setup_consumers.h"
 #include "table_setup_instruments.h"
 #include "table_setup_timers.h"
@@ -31,10 +32,12 @@
 #include "table_sync_instances.h"
 #include "table_file_instances.h"
 #include "table_file_summary.h"
+#include "table_threads.h"
 
 /* For show status */
 #include "pfs_column_values.h"
 #include "pfs_instr.h"
+#include "pfs_setup_actor.h"
 #include "pfs_global.h"
 
 #include "sql_base.h"                           // close_thread_tables
@@ -47,23 +50,24 @@
 
 static PFS_engine_table_share *all_shares[]=
 {
+  &table_cond_instances::m_share,
   &table_events_waits_current::m_share,
-  &table_events_waits_history::m_share,
   &table_events_waits_history_long::m_share,
-  &table_setup_consumers::m_share,
-  &table_setup_instruments::m_share,
-  &table_setup_timers::m_share,
-  &table_performance_timers::m_share,
-  &table_threads::m_share,
-  &table_events_waits_summary_by_thread_by_event_name::m_share,
+  &table_events_waits_history::m_share,
   &table_events_waits_summary_by_instance::m_share,
+  &table_events_waits_summary_by_thread_by_event_name::m_share,
   &table_ews_global_by_event_name::m_share,
+  &table_file_instances::m_share,
   &table_file_summary_by_event_name::m_share,
   &table_file_summary_by_instance::m_share,
   &table_mutex_instances::m_share,
+  &table_performance_timers::m_share,
   &table_rwlock_instances::m_share,
-  &table_cond_instances::m_share,
-  &table_file_instances::m_share,
+  &table_setup_actors::m_share,
+  &table_setup_consumers::m_share,
+  &table_setup_instruments::m_share,
+  &table_setup_timers::m_share,
+  &table_threads::m_share,
   NULL
 };
 
@@ -78,7 +82,7 @@ void PFS_engine_table_share::check_all_t
   DBUG_EXECUTE_IF("tampered_perfschema_table1",
                   {
                     /* Hack SETUP_INSTRUMENT, incompatible change. */
-                    all_shares[4]->m_field_def->count++;
+                    all_shares[15]->m_field_def->count++;
                   });
 
   for (current= &all_shares[0]; (*current) != NULL; current++)
@@ -169,6 +173,45 @@ void PFS_engine_table_share::delete_all_
     thr_lock_delete((*current)->m_thr_lock_ptr);
 }
 
+ha_rows PFS_engine_table_share::get_row_count(void) const
+{
+  /* If available, count the exact number or records */
+  if (m_get_row_count)
+    return m_get_row_count();
+  /* Otherwise, return an estimate */
+  return m_records;
+}
+
+int PFS_engine_table_share::write_row(TABLE *table, unsigned char *buf,
+                                      Field **fields) const
+{
+  my_bitmap_map *org_bitmap;
+
+  /*
+    Make sure the table structure is as expected before mapping
+    hard wired columns in m_write_row.
+  */
+  if (! m_checked)
+  {
+    my_error(ER_WRONG_NATIVE_TABLE_STRUCTURE, MYF(0),
+             PERFORMANCE_SCHEMA_str.str, m_name);
+    return HA_ERR_TABLE_NEEDS_UPGRADE;
+  }
+
+  if (m_write_row == NULL)
+  {
+    my_error(ER_WRONG_PERFSCHEMA_USAGE, MYF(0));
+    return HA_ERR_WRONG_COMMAND;
+  }
+
+  /* We internally read from Fields to support the write interface */
+  org_bitmap= dbug_tmp_use_all_columns(table, table->read_set);
+  int result= m_write_row(table, buf, fields);
+  dbug_tmp_restore_column_map(table->read_set, org_bitmap);
+
+  return result;
+}
+
 static int compare_table_names(const char *name1, const char *name2)
 {
   /*
@@ -280,6 +323,39 @@ int PFS_engine_table::update_row(TABLE *
   return result;
 }
 
+int PFS_engine_table::delete_row(TABLE *table,
+                                 const unsigned char *buf,
+                                 Field **fields)
+{
+  my_bitmap_map *org_bitmap;
+
+  /*
+    Make sure the table structure is as expected before mapping
+    hard wired columns in delete_row_values.
+  */
+  if (! m_share_ptr->m_checked)
+  {
+    my_error(ER_WRONG_NATIVE_TABLE_STRUCTURE, MYF(0),
+             PERFORMANCE_SCHEMA_str.str, m_share_ptr->m_name.str);
+    return HA_ERR_TABLE_NEEDS_UPGRADE;
+  }
+
+  /* We internally read from Fields to support the delete interface */
+  org_bitmap= dbug_tmp_use_all_columns(table, table->read_set);
+  int result= delete_row_values(table, buf, fields);
+  dbug_tmp_restore_column_map(table->read_set, org_bitmap);
+
+  return result;
+}
+
+int PFS_engine_table::delete_row_values(TABLE *,
+                                        const unsigned char *,
+                                        Field **)
+{
+  my_error(ER_WRONG_PERFSCHEMA_USAGE, MYF(0));
+  return HA_ERR_WRONG_COMMAND;
+}
+
 /**
   Get the position of the current row.
   @param [out] ref        position
@@ -312,6 +388,14 @@ void PFS_engine_table::set_field_ulonglo
   f2->store(value, true);
 }
 
+void PFS_engine_table::set_field_char_utf8(Field *f, const char* str,
+                                           uint len)
+{
+  DBUG_ASSERT(f->real_type() == MYSQL_TYPE_STRING);
+  Field_string *f2= (Field_string*) f;
+  f2->store(str, len, &my_charset_utf8_bin);
+}
+
 void PFS_engine_table::set_field_varchar_utf8(Field *f, const char* str,
                                               uint len)
 {
@@ -320,6 +404,14 @@ void PFS_engine_table::set_field_varchar
   f2->store(str, len, &my_charset_utf8_bin);
 }
 
+void PFS_engine_table::set_field_longtext_utf8(Field *f, const char* str,
+                                               uint len)
+{
+  DBUG_ASSERT(f->real_type() == MYSQL_TYPE_BLOB);
+  Field_blob *f2= (Field_blob*) f;
+  f2->store(str, len, &my_charset_utf8_bin);
+}
+
 void PFS_engine_table::set_field_enum(Field *f, ulonglong value)
 {
   DBUG_ASSERT(f->real_type() == MYSQL_TYPE_ENUM);
@@ -334,6 +426,24 @@ ulonglong PFS_engine_table::get_field_en
   return f2->val_int();
 }
 
+String*
+PFS_engine_table::get_field_char_utf8(Field *f, String *val)
+{
+  DBUG_ASSERT(f->real_type() == MYSQL_TYPE_STRING);
+  Field_string *f2= (Field_string*) f;
+  val= f2->val_str(NULL, val);
+  return val;
+}
+
+String*
+PFS_engine_table::get_field_varchar_utf8(Field *f, String *val)
+{
+  DBUG_ASSERT(f->real_type() == MYSQL_TYPE_VARCHAR);
+  Field_varstring *f2= (Field_varstring*) f;
+  val= f2->val_str(NULL, val);
+  return val;
+}
+
 int PFS_engine_table::update_row_values(TABLE *,
                                         const unsigned char *,
                                         unsigned char *,
@@ -741,11 +851,24 @@ bool pfs_show_status(handlerton *hton, T
       size= table_max * sizeof(PFS_table);
       total_memory+= size;
       break;
+    case 50:
+      name= "SETUP_ACTORS.ROW_SIZE";
+      size= sizeof(PFS_setup_actor);
+      break;
+    case 51:
+      name= "SETUP_ACTORS.ROW_COUNT";
+      size= setup_actor_max;
+      break;
+    case 52:
+      name= "SETUP_ACTORS.MEMORY";
+      size= setup_actor_max * sizeof(PFS_setup_actor);
+      total_memory+= size;
+      break;
     /*
       This case must be last,
       for aggregation in total_memory.
     */
-    case 50:
+    case 53:
       name= "PERFORMANCE_SCHEMA.MEMORY";
       size= total_memory;
       /* This will fail if something is not advertised here */
@@ -770,4 +893,3 @@ end:
 
 /** @} */
 
-

=== modified file 'storage/perfschema/pfs_engine_table.h'
--- a/storage/perfschema/pfs_engine_table.h	2010-07-23 17:08:41 +0000
+++ b/storage/perfschema/pfs_engine_table.h	2010-07-30 09:02:32 +0000
@@ -46,6 +46,8 @@ public:
   int update_row(TABLE *table, const unsigned char *old_buf,
                  unsigned char *new_buf, Field **fields);
 
+  int delete_row(TABLE *table, const unsigned char *buf, Field **fields);
+
   /** Fetch the next row in this cursor. */
   virtual int rnd_next(void)= 0;
   /**
@@ -62,6 +64,17 @@ public:
   virtual ~PFS_engine_table()
   {}
 
+  static void set_field_ulong(Field *f, ulong value);
+  static void set_field_ulonglong(Field *f, ulonglong value);
+  static void set_field_char_utf8(Field *f, const char *str, uint len);
+  static void set_field_varchar_utf8(Field *f, const char *str, uint len);
+  static void set_field_longtext_utf8(Field *f, const char *str, uint len);
+  static void set_field_enum(Field *f, ulonglong value);
+
+  static ulonglong get_field_enum(Field *f);
+  static String *get_field_char_utf8(Field *f, String *val);
+  static String *get_field_varchar_utf8(Field *f, String *val);
+
 protected:
   /**
     Read the current row values.
@@ -84,6 +97,15 @@ protected:
                                 unsigned char *new_buf, Field **fields);
 
   /**
+    Delete a row.
+    @param table            Table handle
+    @param buf              Row buffer
+    @param fields           Table fields
+  */
+  virtual int delete_row_values(TABLE *table, const unsigned char *buf,
+                                Field **fields);
+
+  /**
     Constructor.
     @param share            table share
     @param pos              address of the m_pos position member
@@ -92,13 +114,6 @@ protected:
     : m_share_ptr(share), m_pos_ptr(pos)
   {}
 
-  void set_field_ulong(Field *f, ulong value);
-  void set_field_ulonglong(Field *f, ulonglong value);
-  void set_field_varchar_utf8(Field *f, const char* str, uint len);
-  void set_field_enum(Field *f, ulonglong value);
-
-  ulonglong get_field_enum(Field *f);
-
   /** Table share. */
   const PFS_engine_table_share *m_share_ptr;
   /** Opaque pointer to the m_pos position of this cursor. */
@@ -112,6 +127,8 @@ typedef int (*pfs_write_row_t)(TABLE *ta
                                unsigned char *buf, Field **fields);
 /** Callback to delete all rows. */
 typedef int (*pfs_delete_all_rows_t)(void);
+/** Callback to get a row count. */
+typedef ha_rows (*pfs_get_row_count_t)(void);
 
 /**
   A PERFORMANCE_SCHEMA table share.
@@ -123,6 +140,8 @@ struct PFS_engine_table_share
   void check_one_table(THD *thd);
   static void init_all_locks(void);
   static void delete_all_locks(void);
+  ha_rows get_row_count(void) const;
+  int write_row(TABLE *table, unsigned char *buf, Field **fields) const;
 
   /** Table name. */
   LEX_STRING m_name;
@@ -134,6 +153,8 @@ struct PFS_engine_table_share
   pfs_write_row_t m_write_row;
   /** Delete all rows function. */
   pfs_delete_all_rows_t m_delete_all_rows;
+  /** Get rows count function. */
+  pfs_get_row_count_t m_get_row_count;
   /**
     Number or records.
     This number does not need to be precise,

=== modified file 'storage/perfschema/pfs_instr.cc'
--- a/storage/perfschema/pfs_instr.cc	2010-07-23 17:08:41 +0000
+++ b/storage/perfschema/pfs_instr.cc	2010-07-30 09:02:32 +0000
@@ -693,6 +693,12 @@ void destroy_cond(PFS_cond *pfs)
   pfs->m_lock.allocated_to_free();
 }
 
+PFS_thread* PFS_thread::get_current_thread()
+{
+  PFS_thread *pfs= my_pthread_getspecific_ptr(PFS_thread*, THR_PFS);
+  return pfs;
+}
+
 /**
   Create instrumentation for a thread instance.
   @param klass                        the thread class
@@ -722,6 +728,7 @@ PFS_thread* create_thread(PFS_thread_cla
         {
           pfs->m_thread_internal_id=
             PFS_atomic::add_u32(&thread_internal_id_counter, 1);
+          pfs->m_parent_thread_internal_id= 0;
           pfs->m_thread_id= thread_id;
           pfs->m_event_id= 1;
           pfs->m_enabled= true;
@@ -736,6 +743,16 @@ PFS_thread* create_thread(PFS_thread_cla
             reset_single_stat_link(stat);
           pfs->m_filename_hash_pins= NULL;
           pfs->m_table_share_hash_pins= NULL;
+          pfs->m_setup_actor_hash_pins= NULL;
+
+          pfs->m_username_length= 0;
+          pfs->m_hostname_length= 0;
+          pfs->m_dbname_length= 0;
+          pfs->m_command= 0;
+          pfs->m_start_time= 0;
+          pfs->m_processlist_state_length= 0;
+          pfs->m_processlist_info_length= 0;
+
           pfs->m_lock.dirty_to_allocated();
           return pfs;
         }

=== modified file 'storage/perfschema/pfs_instr.h'
--- a/storage/perfschema/pfs_instr.h	2010-07-23 17:08:41 +0000
+++ b/storage/perfschema/pfs_instr.h	2010-07-30 09:02:32 +0000
@@ -182,18 +182,24 @@ private:
 /** Instrumented thread implementation. @see PSI_thread. */
 struct PFS_thread
 {
+  static PFS_thread* get_current_thread(void);
+
   /** Internal lock. */
   pfs_lock m_lock;
   /** Pins for filename_hash. */
   LF_PINS *m_filename_hash_pins;
   /** Pins for table_share_hash. */
   LF_PINS *m_table_share_hash_pins;
+  /** Pins for setup_actor_hash. */
+  LF_PINS *m_setup_actor_hash_pins;
   /** Event ID counter */
   ulonglong m_event_id;
   /** Thread instrumentation flag. */
   bool m_enabled;
   /** Internal thread identifier, unique. */
   ulong m_thread_internal_id;
+  /** Parent internal thread identifier. */
+  ulong m_parent_thread_internal_id;
   /** External (SHOW PROCESSLIST) thread identifier, not unique. */
   ulong m_thread_id;
   /** Thread class. */
@@ -226,6 +232,31 @@ struct PFS_thread
     PERFORMANCE_SCHEMA.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME.
   */
   PFS_single_stat_chain *m_instr_class_wait_stats;
+
+  /** User name. */
+  char m_username[USERNAME_LENGTH];
+  /** Length of @c m_username. */
+  uint m_username_length;
+  /** Host name. */
+  char m_hostname[HOSTNAME_LENGTH];
+  /** Length of @c m_hostname. */
+  uint m_hostname_length;
+  /** Database name. */
+  char m_dbname[NAME_LEN];
+  /** Length of @c m_dbname. */
+  uint m_dbname_length;
+  /** Current command. */
+  int m_command;
+  /** Start time. */
+  time_t m_start_time;
+  /** Processlist state. */
+  const char *m_processlist_state_ptr;
+  /** Length of @c m_processlist_state_ptr. */
+  uint m_processlist_state_length;
+  /** Processlist info. */
+  const char *m_processlist_info_ptr;
+  /** Length of @c m_processlist_info_length. */
+  uint m_processlist_info_length;
 };
 
 PFS_thread *sanitize_thread(PFS_thread *unsafe);

=== modified file 'storage/perfschema/pfs_lock.h'
--- a/storage/perfschema/pfs_lock.h	2010-07-16 01:28:30 +0000
+++ b/storage/perfschema/pfs_lock.h	2010-07-23 19:03:52 +0000
@@ -108,6 +108,17 @@ struct pfs_lock
   }
 
   /**
+    Execute an allocated to dirty transition.
+    This transition should be executed by the writer that owns the record,
+    before the record is modified.
+  */
+  void allocated_to_dirty(void)
+  {
+    DBUG_ASSERT(m_state == PFS_LOCK_ALLOCATED);
+    PFS_atomic::store_32(&m_state, PFS_LOCK_DIRTY);
+  }
+
+  /**
     Execute a dirty to allocated transition.
     This transition should be executed by the writer that owns the record,
     after the record is in a state ready to be read.

=== modified file 'storage/perfschema/pfs_server.cc'
--- a/storage/perfschema/pfs_server.cc	2010-07-16 01:28:30 +0000
+++ b/storage/perfschema/pfs_server.cc	2010-07-23 19:03:52 +0000
@@ -28,6 +28,8 @@
 #include "pfs_instr.h"
 #include "pfs_events_waits.h"
 #include "pfs_timer.h"
+#include "pfs_setup_actor.h"
+#include "pfs_defaults.h"
 
 PFS_global_param pfs_param;
 
@@ -69,7 +71,9 @@ initialize_performance_schema(const PFS_
       init_events_waits_history_long(
         param->m_events_waits_history_long_sizing) ||
       init_file_hash() ||
-      init_table_share_hash())
+      init_table_share_hash() ||
+      init_setup_actor(param) ||
+      init_setup_actor_hash())
   {
     /*
       The performance schema initialization failed.
@@ -80,6 +84,7 @@ initialize_performance_schema(const PFS_
   }
 
   pfs_initialized= true;
+  install_default_setup(&PFS_bootstrap);
   return &PFS_bootstrap;
 }
 
@@ -112,6 +117,8 @@ static void cleanup_performance_schema(v
   cleanup_events_waits_history_long();
   cleanup_table_share_hash();
   cleanup_file_hash();
+  cleanup_setup_actor();
+  cleanup_setup_actor_hash();
   PFS_atomic::cleanup();
 }
 

=== modified file 'storage/perfschema/pfs_server.h'
--- a/storage/perfschema/pfs_server.h	2010-08-27 21:51:59 +0000
+++ b/storage/perfschema/pfs_server.h	2010-09-01 22:59:33 +0000
@@ -66,6 +66,9 @@
 #ifndef PFS_WAITS_HISTORY_LONG_SIZE
   #define PFS_WAITS_HISTORY_LONG_SIZE 10000
 #endif
+#ifndef PFS_MAX_SETUP_ACTOR
+  #define PFS_MAX_SETUP_ACTOR 100
+#endif
 
 /** Performance schema global sizing parameters. */
 struct PFS_global_param
@@ -94,6 +97,7 @@ struct PFS_global_param
   ulong m_file_handle_sizing;
   ulong m_events_waits_history_sizing;
   ulong m_events_waits_history_long_sizing;
+  ulong m_setup_actor_sizing;
 };
 
 extern PFS_global_param pfs_param;

=== added file 'storage/perfschema/pfs_setup_actor.cc'
--- a/storage/perfschema/pfs_setup_actor.cc	1970-01-01 00:00:00 +0000
+++ b/storage/perfschema/pfs_setup_actor.cc	2010-07-02 16:15:37 +0000
@@ -0,0 +1,323 @@
+/* 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 */
+
+/**
+  @file storage/perfschema/pfs_setup_actor.cc
+  Performance schema setup actor (implementation).
+*/
+
+#include "my_global.h"
+#include "my_sys.h"
+#include "my_base.h"
+#include "pfs.h"
+#include "pfs_stat.h"
+#include "pfs_instr.h"
+#include "pfs_setup_actor.h"
+#include "pfs_global.h"
+
+/**
+  @addtogroup Performance_schema_buffers
+  @{
+*/
+
+ulong setup_actor_max;
+
+PFS_setup_actor *setup_actor_array= NULL;
+
+static LF_HASH setup_actor_hash;
+static bool setup_actor_hash_inited= false;
+
+/**
+  Initialize the setup actor buffers.
+  @param param                        sizing parameters
+  @return 0 on success
+*/
+int init_setup_actor(const PFS_global_param *param)
+{
+  setup_actor_max= param->m_setup_actor_sizing;
+
+  setup_actor_array= NULL;
+
+  if (setup_actor_max > 0)
+  {
+    setup_actor_array= PFS_MALLOC_ARRAY(setup_actor_max, PFS_setup_actor,
+                                         MYF(MY_ZEROFILL));
+    if (unlikely(setup_actor_array == NULL))
+      return 1;
+  }
+
+  return 0;
+}
+
+/** Cleanup all the setup actor buffers. */
+void cleanup_setup_actor(void)
+{
+  pfs_free(setup_actor_array);
+  setup_actor_array= NULL;
+  setup_actor_max= 0;
+}
+
+static uchar *setup_actor_hash_get_key(const uchar *entry, size_t *length,
+                                       my_bool)
+{
+  const PFS_setup_actor * const *typed_entry;
+  const PFS_setup_actor *setup_actor;
+  const void *result;
+  typed_entry= reinterpret_cast<const PFS_setup_actor* const *> (entry);
+  DBUG_ASSERT(typed_entry != NULL);
+  setup_actor= *typed_entry;
+  DBUG_ASSERT(setup_actor != NULL);
+  *length= setup_actor->m_key.m_key_length;
+  result= setup_actor->m_key.m_hash_key;
+  return const_cast<uchar*> (reinterpret_cast<const uchar*> (result));
+}
+
+/**
+  Initialize the setup actor hash.
+  @return 0 on success
+*/
+int init_setup_actor_hash(void)
+{
+  if (! setup_actor_hash_inited)
+  {
+    lf_hash_init(&setup_actor_hash, sizeof(PFS_setup_actor*), LF_HASH_UNIQUE,
+                 0, 0, setup_actor_hash_get_key, &my_charset_bin);
+    setup_actor_hash_inited= true;
+  }
+  return 0;
+}
+
+/** Cleanup the setup actor hash. */
+void cleanup_setup_actor_hash(void)
+{
+  if (setup_actor_hash_inited)
+  {
+    lf_hash_destroy(&setup_actor_hash);
+    setup_actor_hash_inited= false;
+  }
+}
+
+static LF_PINS* get_setup_actor_hash_pins(PFS_thread *thread)
+{
+  if (! setup_actor_hash_inited)
+    return NULL;
+  if (unlikely(thread->m_setup_actor_hash_pins == NULL))
+    thread->m_setup_actor_hash_pins= lf_hash_get_pins(&setup_actor_hash);
+  return thread->m_setup_actor_hash_pins;
+}
+
+static void set_setup_actor_key(PFS_setup_actor_key *key,
+                                const char *user, uint user_length,
+                                const char *host, uint host_length,
+                                const char *role, uint role_length)
+{
+  DBUG_ASSERT(user_length <= USERNAME_LENGTH);
+  DBUG_ASSERT(host_length <= HOSTNAME_LENGTH);
+
+  char *ptr= &key->m_hash_key[0];
+  memcpy(ptr, user, user_length);
+  ptr+= user_length;
+  ptr[0]= 0;
+  ptr++;
+  memcpy(ptr, host, host_length);
+  ptr+= host_length;
+  ptr[0]= 0;
+  ptr++;
+  memcpy(ptr, role, role_length);
+  ptr+= role_length;
+  ptr[0]= 0;
+  ptr++;
+  key->m_key_length= ptr - &key->m_hash_key[0];
+}
+
+int insert_setup_actor(const String *user, const String *host, const String *role)
+{
+  if (setup_actor_max == 0)
+    return HA_ERR_RECORD_FILE_FULL;
+
+  PFS_thread *thread= PFS_thread::get_current_thread();
+  if (unlikely(thread == NULL))
+    return HA_ERR_OUT_OF_MEM;
+
+  LF_PINS *pins= get_setup_actor_hash_pins(thread);
+  if (unlikely(pins == NULL))
+    return HA_ERR_OUT_OF_MEM;
+
+  /* user is not constant, just using it for noise on insert */
+  uint i= randomized_index(user, setup_actor_max);
+
+  /*
+    Pass 1: [random, setup_actor_max - 1]
+    Pass 2: [0, setup_actor_max - 1]
+  */
+  int pass;
+  for (pass= 1; pass <= 2; i=0, pass++)
+  {
+    PFS_setup_actor *pfs= setup_actor_array + i;
+    PFS_setup_actor *pfs_last= setup_actor_array + setup_actor_max;
+    for ( ; pfs < pfs_last; pfs++)
+    {
+      if (pfs->m_lock.is_free())
+      {
+        if (pfs->m_lock.free_to_dirty())
+        {
+          set_setup_actor_key(&pfs->m_key,
+                              user->ptr(), user->length(),
+                              host->ptr(), host->length(),
+                              role->ptr(), role->length());
+          pfs->m_username= &pfs->m_key.m_hash_key[0];
+          pfs->m_username_length= user->length();
+          pfs->m_hostname= pfs->m_username + pfs->m_username_length + 1;
+          pfs->m_hostname_length= host->length();
+          pfs->m_rolename= pfs->m_hostname + pfs->m_hostname_length + 1;
+          pfs->m_rolename_length= role->length();
+
+          int res;
+          res= lf_hash_insert(&setup_actor_hash, pins, &pfs);
+          if (likely(res == 0))
+          {
+            pfs->m_lock.dirty_to_allocated();
+            return 0;
+          }
+
+          pfs->m_lock.dirty_to_free();
+          if (res > 0)
+            return HA_ERR_FOUND_DUPP_KEY;
+          return HA_ERR_OUT_OF_MEM;
+        }
+      }
+    }
+  }
+
+  return HA_ERR_RECORD_FILE_FULL;
+}
+
+int delete_setup_actor(const String *user, const String *host, const String *role)
+{
+  PFS_thread *thread= PFS_thread::get_current_thread();
+  if (unlikely(thread == NULL))
+    return HA_ERR_OUT_OF_MEM;
+
+  LF_PINS* pins= get_setup_actor_hash_pins(thread);
+  if (unlikely(pins == NULL))
+    return HA_ERR_OUT_OF_MEM;
+
+  PFS_setup_actor_key key;
+  set_setup_actor_key(&key,
+                      user->ptr(), user->length(),
+                      host->ptr(), host->length(),
+                      role->ptr(), role->length());
+
+  PFS_setup_actor **entry;
+  entry= reinterpret_cast<PFS_setup_actor**>
+    (lf_hash_search(&setup_actor_hash, pins, key.m_hash_key, key.m_key_length));
+
+  if (entry && (entry != MY_ERRPTR))
+  {
+    PFS_setup_actor *pfs= *entry;
+    lf_hash_delete(&setup_actor_hash, pins, key.m_hash_key, key.m_key_length);
+    pfs->m_lock.allocated_to_free();
+  }
+
+  return 0;
+}
+
+int reset_setup_actor()
+{
+  PFS_thread *thread= PFS_thread::get_current_thread();
+  if (unlikely(thread == NULL))
+    return HA_ERR_OUT_OF_MEM;
+
+  LF_PINS* pins= get_setup_actor_hash_pins(thread);
+  if (unlikely(pins == NULL))
+    return HA_ERR_OUT_OF_MEM;
+
+  PFS_setup_actor *pfs= setup_actor_array;
+  PFS_setup_actor *pfs_last= setup_actor_array + setup_actor_max;
+
+  for ( ; pfs < pfs_last; pfs++)
+  {
+    if (pfs->m_lock.is_populated())
+    {
+      lf_hash_delete(&setup_actor_hash, pins,
+                     pfs->m_key.m_hash_key, pfs->m_key.m_key_length);
+      pfs->m_lock.allocated_to_free();
+    }
+  }
+
+  return 0;
+}
+
+long setup_actor_count()
+{
+  return setup_actor_hash.count;
+}
+
+/*
+  - '%' should be replaced by NULL in table SETUP_ACTOR
+  - add an ENABLED column to include/exclude patterns, more flexible
+  - the principle is similar to SETUP_OBJECTS
+*/
+void lookup_setup_actor(PFS_thread *thread,
+                        const char *user, uint user_length,
+                        const char *host, uint host_length,
+                        bool *enabled)
+{
+  PFS_setup_actor_key key;
+  PFS_setup_actor **entry;
+  int i;
+
+  LF_PINS* pins= get_setup_actor_hash_pins(thread);
+  if (unlikely(pins == NULL))
+  {
+    *enabled= false;
+    return;
+  }
+
+  for (i= 1; i<=4; i++)
+  {
+    /*
+      WL#988 Roles is not implemented, so we do not have a role name.
+      Looking up "%" in SETUP_ACTORS.ROLE.
+    */
+    switch(i)
+    {
+    case 1:
+      set_setup_actor_key(&key, user, user_length, host, host_length, "%", 1);
+      break;
+    case 2:
+      set_setup_actor_key(&key, user, user_length, "%", 1, "%", 1);
+      break;
+    case 3:
+      set_setup_actor_key(&key, "%", 1, host, host_length, "%", 1);
+      break;
+    case 4:
+      set_setup_actor_key(&key, "%", 1, "%", 1, "%", 1);
+      break;
+    }
+    entry= reinterpret_cast<PFS_setup_actor**>
+      (lf_hash_search(&setup_actor_hash, pins, key.m_hash_key, key.m_key_length));
+
+    if (entry && (entry != MY_ERRPTR))
+    {
+      *enabled= true;
+      return;
+    }
+  }
+  *enabled= false;
+  return;
+}
+
+/** @} */

=== added file 'storage/perfschema/pfs_setup_actor.h'
--- a/storage/perfschema/pfs_setup_actor.h	1970-01-01 00:00:00 +0000
+++ b/storage/perfschema/pfs_setup_actor.h	2010-07-10 03:31:35 +0000
@@ -0,0 +1,95 @@
+/* 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 */
+
+#ifndef PFS_SETUP_ACTOR_H
+#define PFS_SETUP_ACTOR_H
+
+/**
+  @file storage/perfschema/pfs_setup_actor.h
+  Performance schema setup actors (declarations).
+*/
+
+#include "sql_string.h"
+#include "pfs_lock.h"
+#include "lf.h"
+
+struct PFS_global_param;
+
+/* WL#988 Roles Not implemented yet */
+#define ROLENAME_LENGTH 64
+
+/**
+  @addtogroup Performance_schema_buffers
+  @{
+*/
+
+struct PFS_setup_actor_key
+{
+  /**
+    Hash search key.
+    This has to be a string for LF_HASH,
+    the format is "<username><0x00><hostname><0x00><rolename><0x00>"
+  */
+  char m_hash_key[USERNAME_LENGTH + 1 + HOSTNAME_LENGTH + 1 + ROLENAME_LENGTH + 1];
+  /** Length of @c m_hash_key. */
+  uint m_key_length;
+};
+
+struct PFS_setup_actor
+{
+  /** Internal lock. */
+  pfs_lock m_lock;
+  /** Hash key. */
+  PFS_setup_actor_key m_key;
+  /** User name. This points inside the hash key. */
+  const char *m_username;
+  /** Length of @c m_username. */
+  uint m_username_length;
+  /** Host name. This points inside the hash key. */
+  const char *m_hostname;
+  /** Length of @c m_hostname. */
+  uint m_hostname_length;
+  /** Role name. This points inside the hash key. */
+  const char *m_rolename;
+  /** Length of @c m_rolename. */
+  uint m_rolename_length;
+};
+
+int init_setup_actor(const PFS_global_param *param);
+void cleanup_setup_actor(void);
+int init_setup_actor_hash(void);
+void cleanup_setup_actor_hash(void);
+
+int insert_setup_actor(const String *user, const String *host, const String *role);
+int delete_setup_actor(const String *user, const String *host, const String *role);
+int reset_setup_actor(void);
+long setup_actor_count(void);
+
+void lookup_setup_actor(PFS_thread *thread,
+                        const char *user, uint user_length,
+                        const char *host, uint host_length,
+                        bool *enabled);
+
+/* For iterators and show status. */
+
+extern ulong setup_actor_max;
+
+/* Exposing the data directly, for iterators. */
+
+extern PFS_setup_actor *setup_actor_array;
+
+/** @} */
+#endif
+

=== modified file 'storage/perfschema/table_events_waits.cc'
--- a/storage/perfschema/table_events_waits.cc	2010-08-12 10:21:22 +0000
+++ b/storage/perfschema/table_events_waits.cc	2010-08-26 22:46:51 +0000
@@ -123,6 +123,7 @@ table_events_waits_current::m_share=
   &table_events_waits_current::create,
   NULL, /* write_row */
   &table_events_waits_current::delete_all_rows,
+  NULL, /* get_row_count */
   1000, /* records */
   sizeof(pos_events_waits_current), /* ref length */
   &m_table_lock,
@@ -140,6 +141,7 @@ table_events_waits_history::m_share=
   &table_events_waits_history::create,
   NULL, /* write_row */
   &table_events_waits_history::delete_all_rows,
+  NULL, /* get_row_count */
   1000, /* records */
   sizeof(pos_events_waits_history), /* ref length */
   &m_table_lock,
@@ -157,6 +159,7 @@ table_events_waits_history_long::m_share
   &table_events_waits_history_long::create,
   NULL, /* write_row */
   &table_events_waits_history_long::delete_all_rows,
+  NULL, /* get_row_count */
   10000, /* records */
   sizeof(PFS_simple_index), /* ref length */
   &m_table_lock,

=== modified file 'storage/perfschema/table_events_waits.h'
--- a/storage/perfschema/table_events_waits.h	2010-07-23 17:08:41 +0000
+++ b/storage/perfschema/table_events_waits.h	2010-07-30 09:02:32 +0000
@@ -143,7 +143,7 @@ protected:
 
   /** Current row. */
   row_events_waits m_row;
-  /** True is the current row exists. */
+  /** True if the current row exists. */
   bool m_row_exists;
 };
 

=== modified file 'storage/perfschema/table_events_waits_summary.cc'
--- a/storage/perfschema/table_events_waits_summary.cc	2010-08-12 15:25:01 +0000
+++ b/storage/perfschema/table_events_waits_summary.cc	2010-09-01 22:59:33 +0000
@@ -79,6 +79,7 @@ table_events_waits_summary_by_thread_by_
   &table_events_waits_summary_by_thread_by_event_name::create,
   NULL, /* write_row */
   &table_events_waits_summary_by_thread_by_event_name::delete_all_rows,
+  NULL, /* get_row_count */
   1000, /* records */
   sizeof(pos_events_waits_summary_by_thread_by_event_name),
   &m_table_lock,
@@ -391,6 +392,7 @@ table_events_waits_summary_by_instance::
   &table_events_waits_summary_by_instance::create,
   NULL, /* write_row */
   &table_events_waits_summary_by_instance::delete_all_rows,
+  NULL, /* get_row_count */
   1000, /* records */
   sizeof(pos_all_instr),
   &m_table_lock,

=== modified file 'storage/perfschema/table_events_waits_summary.h'
--- a/storage/perfschema/table_events_waits_summary.h	2010-08-12 15:25:01 +0000
+++ b/storage/perfschema/table_events_waits_summary.h	2010-09-01 22:59:33 +0000
@@ -137,7 +137,7 @@ private:
 
   /** Current row. */
   row_events_waits_summary_by_thread_by_event_name m_row;
-  /** True is the current row exists. */
+  /** True if the current row exists. */
   bool m_row_exists;
   /** Current position. */
   pos_events_waits_summary_by_thread_by_event_name m_pos;
@@ -202,7 +202,7 @@ private:
 
   /** Current row. */
   row_events_waits_summary_by_instance m_row;
-  /** True is the current row exists. */
+  /** True if the current row exists. */
   bool m_row_exists;
 };
 

=== modified file 'storage/perfschema/table_ews_global_by_event_name.cc'
--- a/storage/perfschema/table_ews_global_by_event_name.cc	2010-08-12 14:08:52 +0000
+++ b/storage/perfschema/table_ews_global_by_event_name.cc	2010-09-01 22:59:33 +0000
@@ -74,6 +74,7 @@ table_ews_global_by_event_name::m_share=
   &table_ews_global_by_event_name::create,
   NULL, /* write_row */
   &table_ews_global_by_event_name::delete_all_rows,
+  NULL, /* get_row_count */
   1000, /* records */
   sizeof(pos_all_instr_class),
   &m_table_lock,

=== modified file 'storage/perfschema/table_file_instances.cc'
--- a/storage/perfschema/table_file_instances.cc	2010-07-16 01:28:30 +0000
+++ b/storage/perfschema/table_file_instances.cc	2010-07-23 19:03:52 +0000
@@ -59,6 +59,7 @@ table_file_instances::m_share=
   &table_file_instances::create,
   NULL, /* write_row */
   NULL, /* delete_all_rows */
+  NULL, /* get_row_count */
   1000, /* records */
   sizeof(PFS_simple_index),
   &m_table_lock,

=== modified file 'storage/perfschema/table_file_instances.h'
--- a/storage/perfschema/table_file_instances.h	2010-07-16 01:28:30 +0000
+++ b/storage/perfschema/table_file_instances.h	2010-07-23 19:03:52 +0000
@@ -78,7 +78,7 @@ private:
 
   /** Current row. */
   row_file_instances m_row;
-  /** True is the current row exists. */
+  /** True if the current row exists. */
   bool m_row_exists;
   /** Current position. */
   PFS_simple_index m_pos;

=== modified file 'storage/perfschema/table_file_summary.cc'
--- a/storage/perfschema/table_file_summary.cc	2010-07-16 01:28:30 +0000
+++ b/storage/perfschema/table_file_summary.cc	2010-07-23 19:03:52 +0000
@@ -69,6 +69,7 @@ table_file_summary_by_event_name::m_shar
   &table_file_summary_by_event_name::create,
   NULL, /* write_row */
   table_file_summary_by_event_name::delete_all_rows,
+  NULL, /* get_row_count */
   1000, /* records */
   sizeof(PFS_simple_index),
   &m_table_lock,
@@ -232,6 +233,7 @@ table_file_summary_by_instance::m_share=
   &table_file_summary_by_instance::create,
   NULL, /* write_row */
   table_file_summary_by_instance::delete_all_rows,
+  NULL, /* get_row_count */
   1000, /* records */
   sizeof(PFS_simple_index),
   &m_table_lock,

=== modified file 'storage/perfschema/table_file_summary.h'
--- a/storage/perfschema/table_file_summary.h	2010-07-16 01:28:30 +0000
+++ b/storage/perfschema/table_file_summary.h	2010-07-23 19:03:52 +0000
@@ -139,7 +139,7 @@ private:
 
   /** Current row. */
   row_file_summary_by_instance m_row;
-  /** True is the current row exists. */
+  /** True if the current row exists. */
   bool m_row_exists;
   /** Current position. */
   PFS_simple_index m_pos;

=== modified file 'storage/perfschema/table_performance_timers.cc'
--- a/storage/perfschema/table_performance_timers.cc	2010-07-16 01:28:30 +0000
+++ b/storage/perfschema/table_performance_timers.cc	2010-07-23 19:03:52 +0000
@@ -63,6 +63,7 @@ table_performance_timers::m_share=
   &table_performance_timers::create,
   NULL, /* write_row */
   NULL, /* delete_all_rows */
+  NULL, /* get_row_count */
   COUNT_TIMER_NAME, /* records */
   sizeof(PFS_simple_index), /* ref length */
   &m_table_lock,

=== added file 'storage/perfschema/table_setup_actors.cc'
--- a/storage/perfschema/table_setup_actors.cc	1970-01-01 00:00:00 +0000
+++ b/storage/perfschema/table_setup_actors.cc	2010-07-02 16:15:37 +0000
@@ -0,0 +1,292 @@
+/* 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 */
+
+/**
+  @file storage/perfschema/table_setup_actors.cc
+  Table SETUP_ACTORS (implementation).
+*/
+
+#include "my_global.h"
+#include "my_pthread.h"
+#include "pfs_instr_class.h"
+#include "pfs_column_types.h"
+#include "pfs_column_values.h"
+#include "pfs_setup_actor.h"
+#include "table_setup_actors.h"
+#include "pfs_global.h"
+
+THR_LOCK table_setup_actors::m_table_lock;
+
+static const TABLE_FIELD_TYPE field_types[]=
+{
+  {
+    { C_STRING_WITH_LEN("HOST") },
+    { C_STRING_WITH_LEN("char(60)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("USER") },
+    { C_STRING_WITH_LEN("char(16)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("ROLE") },
+    { C_STRING_WITH_LEN("char(16)") },
+    { NULL, 0}
+  }
+};
+
+TABLE_FIELD_DEF
+table_setup_actors::m_field_def=
+{ 3, field_types };
+
+PFS_engine_table_share
+table_setup_actors::m_share=
+{
+  { C_STRING_WITH_LEN("SETUP_ACTORS") },
+  &pfs_editable_acl,
+  table_setup_actors::create,
+  table_setup_actors::write_row,
+  table_setup_actors::delete_all_rows,
+  table_setup_actors::get_row_count,
+  1000, /* records */
+  sizeof(PFS_simple_index),
+  &m_table_lock,
+  &m_field_def,
+  false /* checked */
+};
+
+PFS_engine_table* table_setup_actors::create()
+{
+  return new table_setup_actors();
+}
+
+int table_setup_actors::write_row(TABLE *table, unsigned char *buf,
+                                  Field **fields)
+{
+  Field *f;
+  String user_data("%", 1, &my_charset_utf8_bin);
+  String host_data("%", 1, &my_charset_utf8_bin);
+  String role_data("%", 1, &my_charset_utf8_bin);
+  String *user= &user_data;
+  String *host= &host_data;
+  String *role= &role_data;
+
+  for (; (f= *fields) ; fields++)
+  {
+    if (bitmap_is_set(table->write_set, f->field_index))
+    {
+      switch(f->field_index)
+      {
+      case 0: /* HOST */
+        host= get_field_char_utf8(f, &host_data);
+        break;
+      case 1: /* USER */
+        user= get_field_char_utf8(f, &user_data);
+        break;
+      case 2: /* ROLE */
+        role= get_field_char_utf8(f, &role_data);
+        break;
+      default:
+        DBUG_ASSERT(false);
+      }
+    }
+  }
+
+  return insert_setup_actor(user, host, role);
+}
+
+int table_setup_actors::delete_all_rows(void)
+{
+  return reset_setup_actor();
+}
+
+ha_rows table_setup_actors::get_row_count(void)
+{
+  return setup_actor_count();
+}
+
+table_setup_actors::table_setup_actors()
+  : PFS_engine_table(&m_share, &m_pos),
+  m_row_exists(false), m_pos(0), m_next_pos(0)
+{}
+
+void table_setup_actors::reset_position(void)
+{
+  m_pos.m_index= 0;
+  m_next_pos.m_index= 0;
+}
+
+int table_setup_actors::rnd_next()
+{
+  PFS_setup_actor *pfs;
+
+  for (m_pos.set_at(&m_next_pos);
+       m_pos.m_index < setup_actor_max;
+       m_pos.next())
+  {
+    pfs= &setup_actor_array[m_pos.m_index];
+    if (pfs->m_lock.is_populated())
+    {
+      make_row(pfs);
+      m_next_pos.set_after(&m_pos);
+      return 0;
+    }
+  }
+
+  return HA_ERR_END_OF_FILE;
+}
+
+int table_setup_actors::rnd_pos(const void *pos)
+{
+  PFS_setup_actor *pfs;
+
+  set_position(pos);
+
+  DBUG_ASSERT(m_pos.m_index < setup_actor_max);
+  pfs= &setup_actor_array[m_pos.m_index];
+  if (pfs->m_lock.is_populated())
+  {
+    make_row(pfs);
+    return 0;
+  }
+
+  return HA_ERR_RECORD_DELETED;
+}
+
+void table_setup_actors::make_row(PFS_setup_actor *pfs)
+{
+  pfs_lock lock;
+
+  m_row_exists= false;
+
+  pfs->m_lock.begin_optimistic_lock(&lock);
+
+  memcpy(m_row.m_hostname, pfs->m_hostname, pfs->m_hostname_length);
+  m_row.m_hostname_length= pfs->m_hostname_length;
+  memcpy(m_row.m_username, pfs->m_username, pfs->m_username_length);
+  m_row.m_username_length= pfs->m_username_length;
+  memcpy(m_row.m_rolename, pfs->m_rolename, pfs->m_rolename_length);
+  m_row.m_rolename_length= pfs->m_rolename_length;
+
+  if (pfs->m_lock.end_optimistic_lock(&lock))
+    m_row_exists= true;
+}
+
+int table_setup_actors::read_row_values(TABLE *table,
+                                        unsigned char *buf,
+                                        Field **fields,
+                                        bool read_all)
+{
+  Field *f;
+
+  if (unlikely(! m_row_exists))
+    return HA_ERR_RECORD_DELETED;
+
+  /* Set the null bits */
+  DBUG_ASSERT(table->s->null_bytes == 1);
+
+  for (; (f= *fields) ; fields++)
+  {
+    if (read_all || bitmap_is_set(table->read_set, f->field_index))
+    {
+      switch(f->field_index)
+      {
+      case 0: /* HOST */
+        set_field_char_utf8(f, m_row.m_hostname, m_row.m_hostname_length);
+        break;
+      case 1: /* USER */
+        set_field_char_utf8(f, m_row.m_username, m_row.m_username_length);
+        break;
+      case 2: /* ROLE */
+        set_field_char_utf8(f, m_row.m_rolename, m_row.m_rolename_length);
+        break;
+      default:
+        DBUG_ASSERT(false);
+      }
+    }
+  }
+
+  return 0;
+}
+
+int table_setup_actors::update_row_values(TABLE *table,
+                                          const unsigned char *old_buf,
+                                          unsigned char *new_buf,
+                                          Field **fields)
+{
+  Field *f;
+
+  for (; (f= *fields) ; fields++)
+  {
+    if (bitmap_is_set(table->write_set, f->field_index))
+    {
+      switch(f->field_index)
+      {
+      case 0: /* HOST */
+      case 1: /* USER */
+      case 2: /* ROLE */
+        my_error(ER_WRONG_PERFSCHEMA_USAGE, MYF(0));
+        return HA_ERR_WRONG_COMMAND;
+        break;
+      default:
+        DBUG_ASSERT(false);
+      }
+    }
+  }
+
+  return 0;
+}
+
+int table_setup_actors::delete_row_values(TABLE *table,
+                                          const unsigned char *buf,
+                                          Field **fields)
+{
+  Field *f;
+  String user_data("", 0, &my_charset_utf8_bin);
+  String host_data("", 0, &my_charset_utf8_bin);
+  String role_data("", 0, &my_charset_utf8_bin);
+  String *user= NULL;
+  String *host= NULL;
+  String *role= NULL;
+
+  for (; (f= *fields) ; fields++)
+  {
+    if (bitmap_is_set(table->read_set, f->field_index))
+    {
+      switch(f->field_index)
+      {
+      case 0: /* HOST */
+        host= get_field_char_utf8(f, &host_data);
+        break;
+      case 1: /* USER */
+        user= get_field_char_utf8(f, &user_data);
+        break;
+      case 2: /* ROLE */
+        role= get_field_char_utf8(f, &role_data);
+        break;
+      default:
+        DBUG_ASSERT(false);
+      }
+    }
+  }
+
+  DBUG_ASSERT(user != NULL);
+  DBUG_ASSERT(host != NULL);
+  DBUG_ASSERT(role != NULL);
+
+  return delete_setup_actor(user, host, role);
+}
+

=== added file 'storage/perfschema/table_setup_actors.h'
--- a/storage/perfschema/table_setup_actors.h	1970-01-01 00:00:00 +0000
+++ b/storage/perfschema/table_setup_actors.h	2010-07-02 16:15:37 +0000
@@ -0,0 +1,106 @@
+/* Copyright (c) 2008, 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 */
+
+#ifndef TABLE_SETUP_ACTORS_H
+#define TABLE_SETUP_ACTORS_H
+
+/**
+  @file storage/perfschema/table_setup_actors.h
+  Table SETUP_ACTORS (declarations).
+*/
+
+#include "pfs_engine_table.h"
+
+struct PFS_setup_actor;
+
+/**
+  @addtogroup Performance_schema_tables
+  @{
+*/
+
+/** A row of PERFORMANCE_SCHEMA.SETUP_ACTORS. */
+struct row_setup_actors
+{
+  /** Column HOST. */
+  char m_hostname[HOSTNAME_LENGTH];
+  /** Length in bytes of @c m_hostname. */
+  uint m_hostname_length;
+  /** Column USER. */
+  char m_username[USERNAME_LENGTH];
+  /** Length in bytes of @c m_username. */
+  uint m_username_length;
+  /** Column ROLE. */
+  char m_rolename[16];
+  /** Length in bytes of @c m_rolename. */
+  uint m_rolename_length;
+};
+
+/** Table PERFORMANCE_SCHEMA.SETUP_ACTORS. */
+class table_setup_actors : public PFS_engine_table
+{
+public:
+  /** Table share. */
+  static PFS_engine_table_share m_share;
+  /** Table builder. */
+  static PFS_engine_table* create();
+  static int write_row(TABLE *table, unsigned char *buf, Field **fields);
+  static int delete_all_rows();
+  static ha_rows get_row_count();
+
+  virtual int rnd_next();
+  virtual int rnd_pos(const void *pos);
+  virtual void reset_position(void);
+
+protected:
+  virtual int read_row_values(TABLE *table,
+                              unsigned char *buf,
+                              Field **fields,
+                              bool read_all);
+
+  virtual int update_row_values(TABLE *table,
+                                const unsigned char *old_buf,
+                                unsigned char *new_buf,
+                                Field **fields);
+
+  virtual int delete_row_values(TABLE *table,
+                                const unsigned char *buf,
+                                Field **fields);
+
+  table_setup_actors();
+
+public:
+  ~table_setup_actors()
+  {}
+
+private:
+  void make_row(PFS_setup_actor *actor);
+
+  /** Table share lock. */
+  static THR_LOCK m_table_lock;
+  /** Fields definition. */
+  static TABLE_FIELD_DEF m_field_def;
+
+  /** Current row. */
+  row_setup_actors m_row;
+  /** True if the current row exists. */
+  bool m_row_exists;
+  /** Current position. */
+  PFS_simple_index m_pos;
+  /** Next position. */
+  PFS_simple_index m_next_pos;
+};
+
+/** @} */
+#endif

=== modified file 'storage/perfschema/table_setup_consumers.cc'
--- a/storage/perfschema/table_setup_consumers.cc	2010-07-16 01:28:30 +0000
+++ b/storage/perfschema/table_setup_consumers.cc	2010-07-23 19:03:52 +0000
@@ -89,6 +89,7 @@ table_setup_consumers::m_share=
   &table_setup_consumers::create,
   NULL, /* write_row */
   NULL, /* delete_all_rows */
+  NULL, /* get_row_count */
   COUNT_SETUP_CONSUMERS, /* records */
   sizeof(PFS_simple_index), /* ref length */
   &m_table_lock,

=== modified file 'storage/perfschema/table_setup_instruments.cc'
--- a/storage/perfschema/table_setup_instruments.cc	2010-07-23 17:08:41 +0000
+++ b/storage/perfschema/table_setup_instruments.cc	2010-07-30 09:02:32 +0000
@@ -59,6 +59,7 @@ table_setup_instruments::m_share=
   &table_setup_instruments::create,
   NULL, /* write_row */
   NULL, /* delete_all_rows */
+  NULL, /* get_row_count */
   1000, /* records */
   sizeof(pos_setup_instruments),
   &m_table_lock,

=== modified file 'storage/perfschema/table_setup_timers.cc'
--- a/storage/perfschema/table_setup_timers.cc	2010-07-16 01:28:30 +0000
+++ b/storage/perfschema/table_setup_timers.cc	2010-07-23 19:03:52 +0000
@@ -62,6 +62,7 @@ table_setup_timers::m_share=
   &table_setup_timers::create,
   NULL, /* write_row */
   NULL, /* delete_all_rows */
+  NULL, /* get_row_count */
   COUNT_SETUP_TIMERS,
   sizeof(PFS_simple_index),
   &m_table_lock,

=== modified file 'storage/perfschema/table_sync_instances.cc'
--- a/storage/perfschema/table_sync_instances.cc	2010-07-16 01:28:30 +0000
+++ b/storage/perfschema/table_sync_instances.cc	2010-07-23 19:03:52 +0000
@@ -60,6 +60,7 @@ table_mutex_instances::m_share=
   &table_mutex_instances::create,
   NULL, /* write_row */
   NULL, /* delete_all_rows */
+  NULL, /* get_row_count */
   1000, /* records */
   sizeof(PFS_simple_index),
   &m_table_lock,
@@ -228,6 +229,7 @@ table_rwlock_instances::m_share=
   &table_rwlock_instances::create,
   NULL, /* write_row */
   NULL, /* delete_all_rows */
+  NULL, /* get_row_count */
   1000, /* records */
   sizeof(PFS_simple_index),
   &m_table_lock,
@@ -393,6 +395,7 @@ table_cond_instances::m_share=
   &table_cond_instances::create,
   NULL, /* write_row */
   NULL, /* delete_all_rows */
+  NULL, /* get_row_count */
   1000, /* records */
   sizeof(PFS_simple_index),
   &m_table_lock,

=== modified file 'storage/perfschema/table_sync_instances.h'
--- a/storage/perfschema/table_sync_instances.h	2010-07-16 01:28:30 +0000
+++ b/storage/perfschema/table_sync_instances.h	2010-07-23 19:03:52 +0000
@@ -82,7 +82,7 @@ private:
 
   /** Current row. */
   row_mutex_instances m_row;
-  /** True is the current row exists. */
+  /** True if the current row exists. */
   bool m_row_exists;
   /** Current position. */
   PFS_simple_index m_pos;
@@ -141,7 +141,7 @@ private:
 
   /** Current row. */
   row_rwlock_instances m_row;
-  /** True is the current row exists. */
+  /** True if the current row exists. */
   bool m_row_exists;
   /** Current position. */
   PFS_simple_index m_pos;
@@ -194,7 +194,7 @@ private:
 
   /** Current row. */
   row_cond_instances m_row;
-  /** True is the current row exists. */
+  /** True if the current row exists. */
   bool m_row_exists;
   /** Current position. */
   PFS_simple_index m_pos;

=== added file 'storage/perfschema/table_threads.cc'
--- a/storage/perfschema/table_threads.cc	1970-01-01 00:00:00 +0000
+++ b/storage/perfschema/table_threads.cc	2010-07-21 19:06:21 +0000
@@ -0,0 +1,357 @@
+/* Copyright (c) 2008, 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 */
+
+#include "my_global.h"
+#include "my_pthread.h"
+#include "table_threads.h"
+#include "sql_parse.h"
+#include "pfs_instr_class.h"
+#include "pfs_instr.h"
+
+THR_LOCK table_threads::m_table_lock;
+
+static const TABLE_FIELD_TYPE field_types[]=
+{
+  {
+    { C_STRING_WITH_LEN("THREAD_ID") },
+    { C_STRING_WITH_LEN("int(11)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("NAME") },
+    { C_STRING_WITH_LEN("varchar(128)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("TYPE") },
+    { C_STRING_WITH_LEN("varchar(10)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("PROCESSLIST_ID") },
+    { C_STRING_WITH_LEN("int(11)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("PROCESSLIST_USER") },
+    { C_STRING_WITH_LEN("varchar(16)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("PROCESSLIST_HOST") },
+    { C_STRING_WITH_LEN("varchar(60)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("PROCESSLIST_DB") },
+    { C_STRING_WITH_LEN("varchar(64)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("PROCESSLIST_COMMAND") },
+    { C_STRING_WITH_LEN("varchar(16)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("PROCESSLIST_TIME") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("PROCESSLIST_STATE") },
+    { C_STRING_WITH_LEN("varchar(64)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("PROCESSLIST_INFO") },
+    { C_STRING_WITH_LEN("longtext") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("PARENT_THREAD_ID") },
+    { C_STRING_WITH_LEN("int(11)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("ROLE") },
+    { C_STRING_WITH_LEN("varchar(64)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("INSTRUMENTED") },
+    { C_STRING_WITH_LEN("enum(\'YES\',\'NO\')") },
+    { NULL, 0}
+  }
+};
+
+TABLE_FIELD_DEF
+table_threads::m_field_def=
+{ 14, field_types };
+
+PFS_engine_table_share
+table_threads::m_share=
+{
+  { C_STRING_WITH_LEN("THREADS") },
+  &pfs_updatable_acl,
+  &table_threads::create,
+  NULL, /* write_row */
+  NULL, /* delete_all_rows */
+  NULL, /* get_row_count */
+  1000, /* records */
+  sizeof(PFS_simple_index), /* ref length */
+  &m_table_lock,
+  &m_field_def,
+  false /* checked */
+};
+
+PFS_engine_table* table_threads::create()
+{
+  return new table_threads();
+}
+
+table_threads::table_threads()
+  : PFS_engine_table(& m_share, & m_pos),
+  m_row_exists(false), m_pos(0), m_next_pos(0)
+{}
+
+void table_threads::reset_position(void)
+{
+  m_pos.m_index= 0;
+  m_next_pos.m_index= 0;
+}
+
+int table_threads::rnd_next()
+{
+  PFS_thread *pfs;
+
+  for (m_pos.set_at(&m_next_pos);
+       m_pos.m_index < thread_max;
+       m_pos.next())
+  {
+    pfs= &thread_array[m_pos.m_index];
+    if (pfs->m_lock.is_populated())
+    {
+      make_row(pfs);
+      m_next_pos.set_after(&m_pos);
+      return 0;
+    }
+  }
+
+  return HA_ERR_END_OF_FILE;
+}
+
+int table_threads::rnd_pos(const void *pos)
+{
+  PFS_thread *pfs;
+
+  set_position(pos);
+  DBUG_ASSERT(m_pos.m_index < thread_max);
+  pfs= &thread_array[m_pos.m_index];
+  if (pfs->m_lock.is_populated())
+  {
+    make_row(pfs);
+    return 0;
+  }
+
+  return HA_ERR_RECORD_DELETED;
+}
+
+void table_threads::make_row(PFS_thread *pfs)
+{
+  pfs_lock lock;
+  PFS_thread_class *safe_class;
+
+  m_row_exists= false;
+
+  /* Protect this reader against thread termination */
+  pfs->m_lock.begin_optimistic_lock(&lock);
+
+  safe_class= sanitize_thread_class(pfs->m_class);
+  if (unlikely(safe_class == NULL))
+    return;
+
+  m_row.m_thread_internal_id= pfs->m_thread_internal_id;
+  m_row.m_parent_thread_internal_id= pfs->m_parent_thread_internal_id;
+  m_row.m_thread_id= pfs->m_thread_id;
+  m_row.m_name= safe_class->m_name;
+  m_row.m_name_length= safe_class->m_name_length;
+  memcpy(m_row.m_username, pfs->m_username, pfs->m_username_length);
+  m_row.m_username_length= pfs->m_username_length;
+  memcpy(m_row.m_hostname, pfs->m_hostname, pfs->m_hostname_length);
+  m_row.m_hostname_length= pfs->m_hostname_length;
+  memcpy(m_row.m_dbname, pfs->m_dbname, pfs->m_dbname_length);
+  m_row.m_dbname_length= pfs->m_dbname_length;
+  m_row.m_command= pfs->m_command;
+  m_row.m_start_time= pfs->m_start_time;
+  /* FIXME: need to copy it ? */
+  m_row.m_processlist_state_ptr= pfs->m_processlist_state_ptr;
+  m_row.m_processlist_state_length= pfs->m_processlist_state_length;
+  /* FIXME: need to copy it ? */
+  m_row.m_processlist_info_ptr= pfs->m_processlist_info_ptr;
+  m_row.m_processlist_info_length= pfs->m_processlist_info_length;
+  m_row.m_enabled_ptr= &pfs->m_enabled;
+
+  if (pfs->m_lock.end_optimistic_lock(& lock))
+    m_row_exists= true;
+}
+
+int table_threads::read_row_values(TABLE *table,
+                                   unsigned char *buf,
+                                   Field **fields,
+                                   bool read_all)
+{
+  Field *f;
+
+  if (unlikely(! m_row_exists))
+    return HA_ERR_RECORD_DELETED;
+
+  /* Set the null bits */
+  DBUG_ASSERT(table->s->null_bytes == 2);
+  buf[0]= 0;
+  buf[1]= 0;
+
+  for (; (f= *fields) ; fields++)
+  {
+    if (read_all || bitmap_is_set(table->read_set, f->field_index))
+    {
+      switch(f->field_index)
+      {
+      case 0: /* THREAD_ID */
+        set_field_ulong(f, m_row.m_thread_internal_id);
+        break;
+      case 1: /* NAME */
+        set_field_varchar_utf8(f, m_row.m_name, m_row.m_name_length);
+        break;
+      case 2: /* TYPE */
+        if (m_row.m_thread_id != 0)
+          set_field_varchar_utf8(f, "FOREGROUND", 10);
+        else
+          set_field_varchar_utf8(f, "BACKGROUND", 10);
+        break;
+      case 3: /* PROCESSLIST_ID */
+        if (m_row.m_thread_id != 0)
+          set_field_ulong(f, m_row.m_thread_id);
+        else
+          f->set_null();
+        break;
+      case 4: /* PROCESSLIST_USER */
+        if (m_row.m_username_length > 0)
+          set_field_varchar_utf8(f, m_row.m_username,
+                                 m_row.m_username_length);
+        else
+          f->set_null();
+        break;
+      case 5: /* PROCESSLIST_HOST */
+        if (m_row.m_hostname_length > 0)
+          set_field_varchar_utf8(f, m_row.m_hostname,
+                                 m_row.m_hostname_length);
+        else
+          f->set_null();
+        break;
+      case 6: /* PROCESSLIST_DB */
+        if (m_row.m_dbname_length > 0)
+          set_field_varchar_utf8(f, m_row.m_dbname,
+                                 m_row.m_dbname_length);
+        else
+          f->set_null();
+        break;
+      case 7: /* PROCESSLIST_COMMAND */
+        if (m_row.m_thread_id != 0)
+          set_field_varchar_utf8(f, command_name[m_row.m_command].str,
+                                 command_name[m_row.m_command].length);
+        else
+          f->set_null();
+        break;
+      case 8: /* PROCESSLIST_TIME */
+        if (m_row.m_start_time)
+          set_field_ulonglong(f, my_time(0) - m_row.m_start_time);
+        else
+          f->set_null();
+        break;
+      case 9: /* PROCESSLIST_STATE */
+        if (m_row.m_processlist_state_length > 0)
+          set_field_varchar_utf8(f, m_row.m_processlist_state_ptr,
+                                 m_row.m_processlist_state_length);
+        else
+          f->set_null();
+        break;
+      case 10: /* PROCESSLIST_INFO */
+        if (m_row.m_processlist_info_length > 0)
+          set_field_longtext_utf8(f, m_row.m_processlist_info_ptr,
+                                  m_row.m_processlist_info_length);
+        else
+          f->set_null();
+        break;
+      case 11: /* PARENT_THREAD_ID */
+        if (m_row.m_parent_thread_internal_id != 0)
+          set_field_ulong(f, m_row.m_parent_thread_internal_id);
+        else
+          f->set_null();
+        break;
+      case 12: /* ROLE */
+        f->set_null();
+        break;
+      case 13: /* INSTRUMENTED */
+        set_field_enum(f, (*m_row.m_enabled_ptr) ? ENUM_YES : ENUM_NO);
+        break;
+      default:
+        DBUG_ASSERT(false);
+      }
+    }
+  }
+  return 0;
+}
+
+int table_threads::update_row_values(TABLE *table,
+                                     const unsigned char *old_buf,
+                                     unsigned char *new_buf,
+                                     Field **fields)
+{
+  Field *f;
+  enum_yes_no value;
+
+  for (; (f= *fields) ; fields++)
+  {
+    if (bitmap_is_set(table->write_set, f->field_index))
+    {
+      switch(f->field_index)
+      {
+      case 0: /* THREAD_ID */
+      case 1: /* NAME */
+      case 2: /* TYPE */
+      case 3: /* PROCESSLIST_ID */
+      case 4: /* PROCESSLIST_USER */
+      case 5: /* PROCESSLIST_HOST */
+      case 6: /* PROCESSLIST_DB */
+      case 7: /* PROCESSLIST_COMMAND */
+      case 8: /* PROCESSLIST_TIME */
+      case 9: /* PROCESSLIST_STATE */
+      case 10: /* PROCESSLIST_INFO */
+      case 11: /* PARENT_THREAD_ID */
+      case 12: /* ROLE */
+        my_error(ER_WRONG_PERFSCHEMA_USAGE, MYF(0));
+        return HA_ERR_WRONG_COMMAND;
+      case 13: /* INSTRUMENTED */
+        value= (enum_yes_no) get_field_enum(f);
+        *m_row.m_enabled_ptr= (value == ENUM_YES) ? true : false;
+        break;
+      default:
+        DBUG_ASSERT(false);
+      }
+    }
+  }
+  return 0;
+}
+

=== removed file 'storage/perfschema/table_threads.cc'
--- a/storage/perfschema/table_threads.cc	2010-08-12 14:08:52 +0000
+++ b/storage/perfschema/table_threads.cc	1970-01-01 00:00:00 +0000
@@ -1,177 +0,0 @@
-/* Copyright (c) 2008, 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 */
-
-/**
-  @file storage/perfschema/table_threads.cc
-  Table THREADS (implementation).
-*/
-
-#include "my_global.h"
-#include "my_pthread.h"
-#include "table_threads.h"
-#include "pfs_instr_class.h"
-#include "pfs_instr.h"
-
-THR_LOCK table_threads::m_table_lock;
-
-static const TABLE_FIELD_TYPE field_types[]=
-{
-  {
-    { C_STRING_WITH_LEN("THREAD_ID") },
-    { C_STRING_WITH_LEN("int(11)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("ID") },
-    { C_STRING_WITH_LEN("int(11)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("NAME") },
-    { C_STRING_WITH_LEN("varchar(64)") },
-    { NULL, 0}
-  }
-};
-
-TABLE_FIELD_DEF
-table_threads::m_field_def=
-{ 3, field_types };
-
-PFS_engine_table_share
-table_threads::m_share=
-{
-  { C_STRING_WITH_LEN("THREADS") },
-  &pfs_readonly_acl,
-  &table_threads::create,
-  NULL, /* write_row */
-  NULL, /* delete_all_rows */
-  1000, /* records */
-  sizeof(PFS_simple_index), /* ref length */
-  &m_table_lock,
-  &m_field_def,
-  false /* checked */
-};
-
-PFS_engine_table* table_threads::create(void)
-{
-  return new table_threads();
-}
-
-table_threads::table_threads()
-  : PFS_engine_table(&m_share, &m_pos),
-  m_row_exists(false), m_pos(0), m_next_pos(0)
-{}
-
-void table_threads::reset_position(void)
-{
-  m_pos.m_index= 0;
-  m_next_pos.m_index= 0;
-}
-
-int table_threads::rnd_next(void)
-{
-  PFS_thread *pfs;
-
-  for (m_pos.set_at(&m_next_pos);
-       m_pos.m_index < thread_max;
-       m_pos.next())
-  {
-    pfs= &thread_array[m_pos.m_index];
-    if (pfs->m_lock.is_populated())
-    {
-      make_row(pfs);
-      m_next_pos.set_after(&m_pos);
-      return 0;
-    }
-  }
-
-  return HA_ERR_END_OF_FILE;
-}
-
-int table_threads::rnd_pos(const void *pos)
-{
-  PFS_thread *pfs;
-
-  set_position(pos);
-  DBUG_ASSERT(m_pos.m_index < thread_max);
-  pfs= &thread_array[m_pos.m_index];
-  if (pfs->m_lock.is_populated())
-  {
-    make_row(pfs);
-    return 0;
-  }
-
-  return HA_ERR_RECORD_DELETED;
-}
-
-void table_threads::make_row(PFS_thread *pfs)
-{
-  pfs_lock lock;
-  PFS_thread_class *safe_class;
-
-  m_row_exists= false;
-
-  /* Protect this reader against thread termination */
-  pfs->m_lock.begin_optimistic_lock(&lock);
-
-  safe_class= sanitize_thread_class(pfs->m_class);
-  if (unlikely(safe_class == NULL))
-    return;
-
-  m_row.m_thread_internal_id= pfs->m_thread_internal_id;
-  m_row.m_thread_id= pfs->m_thread_id;
-  m_row.m_name= safe_class->m_name;
-  m_row.m_name_length= safe_class->m_name_length;
-
-  if (pfs->m_lock.end_optimistic_lock(&lock))
-    m_row_exists= true;
-}
-
-int table_threads::read_row_values(TABLE *table,
-                                   unsigned char *,
-                                   Field **fields,
-                                   bool read_all)
-{
-  Field *f;
-
-  if (unlikely(! m_row_exists))
-    return HA_ERR_RECORD_DELETED;
-
-  /* Set the null bits */
-  DBUG_ASSERT(table->s->null_bytes == 0);
-
-  for (; (f= *fields) ; fields++)
-  {
-    if (read_all || bitmap_is_set(table->read_set, f->field_index))
-    {
-      switch(f->field_index)
-      {
-      case 0: /* THREAD_ID */
-        set_field_ulong(f, m_row.m_thread_internal_id);
-        break;
-      case 1: /* ID */
-        set_field_ulong(f, m_row.m_thread_id);
-        break;
-      case 2: /* NAME */
-        set_field_varchar_utf8(f, m_row.m_name, m_row.m_name_length);
-        break;
-      default:
-        DBUG_ASSERT(false);
-      }
-    }
-  }
-  return 0;
-}
-

=== added file 'storage/perfschema/table_threads.h'
--- a/storage/perfschema/table_threads.h	1970-01-01 00:00:00 +0000
+++ b/storage/perfschema/table_threads.h	2010-07-21 19:06:21 +0000
@@ -0,0 +1,123 @@
+/* Copyright (c) 2008, 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 */
+
+#ifndef TABLE_THREADS_H
+#define TABLE_THREADS_H
+
+#include "pfs_column_types.h"
+#include "pfs_engine_table.h"
+
+struct PFS_thread;
+
+/**
+  \addtogroup Performance_schema_tables
+  @{
+*/
+
+/**
+  A row of PERFORMANCE_SCHEMA.THREADS.
+*/
+struct row_threads
+{
+  /** Column THREAD_ID. */
+  ulong m_thread_internal_id;
+  /** Column PROCESSLIST_ID. */
+  ulong m_thread_id;
+  /** Column NAME. */
+  const char* m_name;
+  /** Length in bytes of @c m_name. */
+  uint m_name_length;
+  /** Column PROCESSLIST_USER. */
+  char m_username[USERNAME_LENGTH];
+  /** Length in bytes of @c m_username. */
+  uint m_username_length;
+  /** Column PROCESSLIST_HOST. */
+  char m_hostname[HOSTNAME_LENGTH];
+  /** Length in bytes of @c m_hostname. */
+  uint m_hostname_length;
+  /** Column PROCESSLIST_DB. */
+  char m_dbname[NAME_LEN];
+  /** Length in bytes of @c m_dbname. */
+  uint m_dbname_length;
+  /** Column PROCESSLIST_COMMAND. */
+  int m_command;
+  /** Column PROCESSLIST_TIME. */
+  time_t m_start_time;
+  /** Column PROCESSLIST_STATE. */
+  const char* m_processlist_state_ptr;
+  /** Length in bytes of @c m_processlist_state_ptr. */
+  uint m_processlist_state_length;
+  /** Column PROCESSLIST_INFO. */
+  const char* m_processlist_info_ptr;
+  /** Length in bytes of @c m_processlist_info_ptr. */
+  uint m_processlist_info_length;
+  /** Column INSTRUMENTED. */
+  bool *m_enabled_ptr;
+  /** Column PARENT_THREAD_ID. */
+  ulong m_parent_thread_internal_id;
+};
+
+/** Table PERFORMANCE_SCHEMA.THREADS. */
+class table_threads : public PFS_engine_table
+{
+public:
+  /** Table share */
+  static PFS_engine_table_share m_share;
+  /** Table builder */
+  static PFS_engine_table* create();
+
+  virtual int rnd_next();
+  virtual int rnd_pos(const void *pos);
+  virtual void reset_position(void);
+
+protected:
+  virtual int read_row_values(TABLE *table,
+                              unsigned char *buf,
+                              Field **fields,
+                              bool read_all);
+
+
+  virtual int update_row_values(TABLE *table,
+                                const unsigned char *old_buf,
+                                unsigned char *new_buf,
+                                Field **fields);
+
+protected:
+  table_threads();
+
+public:
+  ~table_threads()
+  {}
+
+private:
+  void make_row(PFS_thread *pfs);
+
+  /** Table share lock. */
+  static THR_LOCK m_table_lock;
+  /** Fields definition. */
+  static TABLE_FIELD_DEF m_field_def;
+
+  /** Current row. */
+  row_threads m_row;
+  /** True if the current row exists. */
+  bool m_row_exists;
+  /** Current position. */
+  PFS_simple_index m_pos;
+  /** Next position. */
+  PFS_simple_index m_next_pos;
+};
+
+/** @} */
+#endif

=== removed file 'storage/perfschema/table_threads.h'
--- a/storage/perfschema/table_threads.h	2010-08-12 14:08:52 +0000
+++ b/storage/perfschema/table_threads.h	1970-01-01 00:00:00 +0000
@@ -1,91 +0,0 @@
-/* Copyright (c) 2008, 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 */
-
-#ifndef TABLE_THREADS_H
-#define TABLE_THREADS_H
-
-/**
-  @file storage/perfschema/table_threads.h
-  Table THREADS (declarations).
-*/
-
-#include "pfs_column_types.h"
-#include "pfs_engine_table.h"
-
-struct PFS_thread;
-
-/**
-  @addtogroup Performance_schema_tables
-  @{
-*/
-
-/** A row of PERFORMANCE_SCHEMA.THREADS. */
-struct row_threads
-{
-  /** Column THREAD_ID. */
-  ulong m_thread_internal_id;
-  /** Column ID. */
-  ulong m_thread_id;
-  /** Column NAME. */
-  const char *m_name;
-  /** Length in bytes of @c m_name. */
-  uint m_name_length;
-};
-
-/** Table PERFORMANCE_SCHEMA.THREADS. */
-class table_threads : public PFS_engine_table
-{
-public:
-  /** Table share. */
-  static PFS_engine_table_share m_share;
-  static PFS_engine_table* create();
-
-  virtual int rnd_next();
-  virtual int rnd_pos(const void *pos);
-  virtual void reset_position(void);
-
-protected:
-  virtual int read_row_values(TABLE *table,
-                              unsigned char *buf,
-                              Field **fields,
-                              bool read_all);
-
-protected:
-  table_threads();
-
-public:
-  ~table_threads()
-  {}
-
-private:
-  void make_row(PFS_thread *pfs);
-
-  /** Table share lock. */
-  static THR_LOCK m_table_lock;
-  /** Fields definition. */
-  static TABLE_FIELD_DEF m_field_def;
-
-  /** Current row. */
-  row_threads m_row;
-  /** True is the current row exists. */
-  bool m_row_exists;
-  /** Current position. */
-  PFS_simple_index m_pos;
-  /** Next position. */
-  PFS_simple_index m_next_pos;
-};
-
-/** @} */
-#endif

=== modified file 'storage/perfschema/unittest/pfs-t.cc'
--- a/storage/perfschema/unittest/pfs-t.cc	2010-07-16 01:28:30 +0000
+++ b/storage/perfschema/unittest/pfs-t.cc	2010-07-23 19:03:52 +0000
@@ -94,6 +94,7 @@ void test_bootstrap()
   param.m_file_handle_sizing= 0;
   param.m_events_waits_history_sizing= 0;
   param.m_events_waits_history_long_sizing= 0;
+  param.m_setup_actor_sizing= 0;
 
   boot= initialize_performance_schema(& param);
   ok(boot != NULL, "boot");
@@ -136,6 +137,7 @@ PSI * load_perfschema()
   param.m_file_handle_sizing= 50;
   param.m_events_waits_history_sizing= 10;
   param.m_events_waits_history_long_sizing= 10;
+  param.m_setup_actor_sizing= 0;
 
   /* test_bootstrap() covered this, assuming it just works */
   boot= initialize_performance_schema(& param);
@@ -374,7 +376,7 @@ void test_bad_registration()
   ok(dummy_thread_key == 0, "zero key");
   dummy_thread_key= 9999;
   psi->register_thread("12345678901234567890123", bad_thread_1, 1);
-  ok(dummy_thread_key == 1, "assigned key");
+  ok(dummy_thread_key == 2, "assigned key");
 
   /*
     Test that length('thread/' (7) + category + '/' (1) + name) <= 128
@@ -410,7 +412,7 @@ void test_bad_registration()
   ok(dummy_thread_key == 0, "zero key");
 
   psi->register_thread("X", bad_thread_3, 1);
-  ok(dummy_thread_key == 2, "assigned key");
+  ok(dummy_thread_key == 3, "assigned key");
 
   /*
     Test that length('wait/io/file/' (13) + category + '/' (1)) < 32

=== modified file 'storage/perfschema/unittest/pfs_instr-oom-t.cc'
--- a/storage/perfschema/unittest/pfs_instr-oom-t.cc	2010-07-16 01:28:30 +0000
+++ b/storage/perfschema/unittest/pfs_instr-oom-t.cc	2010-07-23 19:03:52 +0000
@@ -45,6 +45,7 @@ void test_oom()
   param.m_file_handle_sizing= 0;
   param.m_events_waits_history_sizing= 0;
   param.m_events_waits_history_long_sizing= 0;
+  param.m_setup_actor_sizing= 0;
 
   rc= init_instruments(& param);
   ok(rc == 1, "oom (mutex)");
@@ -65,6 +66,7 @@ void test_oom()
   param.m_file_handle_sizing= 0;
   param.m_events_waits_history_sizing= 0;
   param.m_events_waits_history_long_sizing= 0;
+  param.m_setup_actor_sizing= 0;
 
   rc= init_instruments(& param);
   ok(rc == 1, "oom (rwlock)");
@@ -85,6 +87,7 @@ void test_oom()
   param.m_file_handle_sizing= 0;
   param.m_events_waits_history_sizing= 0;
   param.m_events_waits_history_long_sizing= 0;
+  param.m_setup_actor_sizing= 0;
 
   rc= init_instruments(& param);
   ok(rc == 1, "oom (cond)");
@@ -105,6 +108,7 @@ void test_oom()
   param.m_file_handle_sizing= 1000;
   param.m_events_waits_history_sizing= 0;
   param.m_events_waits_history_long_sizing= 0;
+  param.m_setup_actor_sizing= 0;
 
   rc= init_instruments(& param);
   ok(rc == 1, "oom (file)");
@@ -125,6 +129,7 @@ void test_oom()
   param.m_file_handle_sizing= 0;
   param.m_events_waits_history_sizing= 0;
   param.m_events_waits_history_long_sizing= 0;
+  param.m_setup_actor_sizing= 0;
 
   rc= init_instruments(& param);
   ok(rc == 1, "oom (table)");
@@ -145,6 +150,7 @@ void test_oom()
   param.m_file_handle_sizing= 0;
   param.m_events_waits_history_sizing= 0;
   param.m_events_waits_history_long_sizing= 0;
+  param.m_setup_actor_sizing= 0;
 
   rc= init_instruments(& param);
   ok(rc == 1, "oom (thread)");
@@ -167,6 +173,7 @@ void test_oom()
   param.m_file_handle_sizing= 0;
   param.m_events_waits_history_sizing= 10;
   param.m_events_waits_history_long_sizing= 0;
+  param.m_setup_actor_sizing= 0;
 
   stub_alloc_fails_after_count= 2;
   rc= init_instruments(& param);
@@ -188,6 +195,7 @@ void test_oom()
   param.m_file_handle_sizing= 0;
   param.m_events_waits_history_sizing= 0;
   param.m_events_waits_history_long_sizing= 0;
+  param.m_setup_actor_sizing= 0;
 
   stub_alloc_fails_after_count= 2;
   rc= init_instruments(& param);

=== modified file 'storage/perfschema/unittest/pfs_instr-t.cc'
--- a/storage/perfschema/unittest/pfs_instr-t.cc	2010-07-23 17:08:41 +0000
+++ b/storage/perfschema/unittest/pfs_instr-t.cc	2010-07-30 09:02:32 +0000
@@ -43,6 +43,7 @@ void test_no_instruments()
   param.m_file_handle_sizing= 0;
   param.m_events_waits_history_sizing= 0;
   param.m_events_waits_history_long_sizing= 0;
+  param.m_setup_actor_sizing= 0;
 
   rc= init_instruments(& param);
   ok(rc == 0, "zero init");
@@ -83,6 +84,7 @@ void test_no_instances()
   param.m_file_handle_sizing= 0;
   param.m_events_waits_history_sizing= 0;
   param.m_events_waits_history_long_sizing= 0;
+  param.m_setup_actor_sizing= 0;
 
   rc= init_instruments(& param);
   ok(rc == 0, "no instances init");
@@ -196,6 +198,7 @@ void test_with_instances()
   param.m_file_handle_sizing= 100;
   param.m_events_waits_history_sizing= 10;
   param.m_events_waits_history_long_sizing= 10000;
+  param.m_setup_actor_sizing= 0;
 
   rc= init_instruments(& param);
   ok(rc == 0, "instances init");
@@ -355,6 +358,7 @@ void test_per_thread_wait()
   param.m_file_handle_sizing= 0;
   param.m_events_waits_history_sizing= 10;
   param.m_events_waits_history_long_sizing= 10000;
+  param.m_setup_actor_sizing= 0;
 
   rc= init_instruments(& param);
   ok(rc == 0, "instances init");

=== modified file 'storage/perfschema/unittest/stub_pfs_global.h'
--- a/storage/perfschema/unittest/stub_pfs_global.h	2010-07-16 01:28:30 +0000
+++ b/storage/perfschema/unittest/stub_pfs_global.h	2010-07-23 19:03:52 +0000
@@ -39,3 +39,7 @@ void pfs_free(void *)
 {
 }
 
+void pfs_print_error(const char *format, ...)
+{
+}
+


Attachment: [text/bzr-bundle] bzr/marc.alff@oracle.com-20100920174858-pzxssc3ov8rp8q2g.bundle
Thread
bzr push into mysql-next-mr branch (marc.alff:3192 to 3193) Marc Alff20 Sep