List:Commits« Previous MessageNext Message »
From:Marc Alff Date:September 24 2010 6:21pm
Subject:bzr push into mysql-next-mr-wl4816 branch (marc.alff:3196 to 3197) WL#4816
View as plain text  
 3197 Marc Alff	2010-09-24
      WL#4816 PERFORMANCE_SCHEMA SUMMARIES
      
      Porting to 5.6, continued

    added:
      mysql-test/suite/perfschema/r/ddl_os_global_by_type.result
      mysql-test/suite/perfschema/r/ddl_setup_objects.result
      mysql-test/suite/perfschema/r/dml_os_global_by_type.result
      mysql-test/suite/perfschema/r/dml_setup_objects.result
      mysql-test/suite/perfschema/r/setup_objects.result
      mysql-test/suite/perfschema/r/start_server_no_setup_objects.result
      mysql-test/suite/perfschema/t/ddl_os_global_by_type.test
      mysql-test/suite/perfschema/t/ddl_setup_objects.test
      mysql-test/suite/perfschema/t/dml_os_global_by_type.test
      mysql-test/suite/perfschema/t/dml_setup_objects.test
      mysql-test/suite/perfschema/t/setup_objects.test
      mysql-test/suite/perfschema/t/start_server_no_setup_objects-master.opt
      mysql-test/suite/perfschema/t/start_server_no_setup_objects.test
      mysql-test/suite/sys_vars/r/pfs_setup_objects_size_basic.result
      mysql-test/suite/sys_vars/t/pfs_setup_objects_size_basic-master.opt
      mysql-test/suite/sys_vars/t/pfs_setup_objects_size_basic.test
    modified:
      mysql-test/suite/perfschema/include/start_server_common.inc
      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_setup_actors.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
      storage/perfschema/pfs_instr.cc
      storage/perfschema/pfs_instr.h
      storage/perfschema/pfs_instr_class.cc
      storage/perfschema/pfs_instr_class.h
      storage/perfschema/pfs_setup_object.cc
      storage/perfschema/table_ews_global_by_event_name.cc
      storage/perfschema/table_helper.h
 3196 Marc Alff	2010-09-23
      Doxygen documentation

    removed:
      Doxyfile-wl4895
    added:
      Doxyfile-perfschema
    modified:
      .bzrignore
      storage/perfschema/pfs.cc
=== modified file 'mysql-test/suite/perfschema/include/start_server_common.inc'
--- a/mysql-test/suite/perfschema/include/start_server_common.inc	2010-09-01 22:59:33 +0000
+++ b/mysql-test/suite/perfschema/include/start_server_common.inc	2010-09-24 18:21:22 +0000
@@ -37,11 +37,13 @@ select * from performance_schema.FILE_IN
 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.OBJECTS_SUMMARY_GLOBAL_BY_TYPE;
 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_OBJECTS;
 select * from performance_schema.SETUP_TIMERS;
 select * from performance_schema.THREADS;
 --enable_result_log

=== added file 'mysql-test/suite/perfschema/r/ddl_os_global_by_type.result'
--- a/mysql-test/suite/perfschema/r/ddl_os_global_by_type.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/r/ddl_os_global_by_type.result	2010-09-24 18:21:22 +0000
@@ -0,0 +1,10 @@
+alter table performance_schema.OBJECTS_SUMMARY_GLOBAL_BY_TYPE
+add column foo integer;
+ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
+truncate table performance_schema.OBJECTS_SUMMARY_GLOBAL_BY_TYPE;
+ALTER TABLE performance_schema.OBJECTS_SUMMARY_GLOBAL_BY_TYPE
+ADD INDEX test_index(OBJECT_NAME);
+ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
+CREATE UNIQUE INDEX test_index
+ON performance_schema.OBJECTS_SUMMARY_GLOBAL_BY_TYPE(OBJECT_NAME);
+ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'

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

=== added file 'mysql-test/suite/perfschema/r/dml_os_global_by_type.result'
--- a/mysql-test/suite/perfschema/r/dml_os_global_by_type.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/r/dml_os_global_by_type.result	2010-09-24 18:21:22 +0000
@@ -0,0 +1,45 @@
+select * from performance_schema.OBJECTS_SUMMARY_GLOBAL_BY_TYPE
+where object_schema = 'performance_schema' limit 1;
+OBJECT_TYPE	OBJECT_SCHEMA	OBJECT_NAME	COUNT_STAR	SUM_TIMER_WAIT	MIN_TIMER_WAIT	AVG_TIMER_WAIT	MAX_TIMER_WAIT
+#	#	#	#	#	#	#	#
+select * from performance_schema.OBJECTS_SUMMARY_GLOBAL_BY_TYPE
+where object_schema='FOO';
+OBJECT_TYPE	OBJECT_SCHEMA	OBJECT_NAME	COUNT_STAR	SUM_TIMER_WAIT	MIN_TIMER_WAIT	AVG_TIMER_WAIT	MAX_TIMER_WAIT
+select * from performance_schema.OBJECTS_SUMMARY_GLOBAL_BY_TYPE
+order by count_star limit 1;
+OBJECT_TYPE	OBJECT_SCHEMA	OBJECT_NAME	COUNT_STAR	SUM_TIMER_WAIT	MIN_TIMER_WAIT	AVG_TIMER_WAIT	MAX_TIMER_WAIT
+#	#	#	#	#	#	#	#
+select * from performance_schema.OBJECTS_SUMMARY_GLOBAL_BY_TYPE
+order by count_star desc limit 1;
+OBJECT_TYPE	OBJECT_SCHEMA	OBJECT_NAME	COUNT_STAR	SUM_TIMER_WAIT	MIN_TIMER_WAIT	AVG_TIMER_WAIT	MAX_TIMER_WAIT
+#	#	#	#	#	#	#	#
+select * from performance_schema.OBJECTS_SUMMARY_GLOBAL_BY_TYPE
+where object_type = 'TABLE' order by object_schema, object_name limit 1;
+OBJECT_TYPE	OBJECT_SCHEMA	OBJECT_NAME	COUNT_STAR	SUM_TIMER_WAIT	MIN_TIMER_WAIT	AVG_TIMER_WAIT	MAX_TIMER_WAIT
+#	#	#	#	#	#	#	#
+select * from performance_schema.OBJECTS_SUMMARY_GLOBAL_BY_TYPE
+where object_type = 'TABLE' order by object_schema desc, object_name desc limit 1;
+OBJECT_TYPE	OBJECT_SCHEMA	OBJECT_NAME	COUNT_STAR	SUM_TIMER_WAIT	MIN_TIMER_WAIT	AVG_TIMER_WAIT	MAX_TIMER_WAIT
+#	#	#	#	#	#	#	#
+insert into performance_schema.OBJECTS_SUMMARY_GLOBAL_BY_TYPE
+set object_type='TABLE', schema_name='FOO', object_name='BAR',
+count_star=1, sum_timer_wait=2, min_timer_wait=3,
+avg_timer_wait=4, max_timer_wait=5;
+ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'OBJECTS_SUMMARY_GLOBAL_BY_TYPE'
+update performance_schema.OBJECTS_SUMMARY_GLOBAL_BY_TYPE
+set count_star=12;
+ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'OBJECTS_SUMMARY_GLOBAL_BY_TYPE'
+update performance_schema.OBJECTS_SUMMARY_GLOBAL_BY_TYPE
+set count_star=12 where object_name like "FOO";
+ERROR 42000: UPDATE command denied to user 'root'@'localhost' for table 'OBJECTS_SUMMARY_GLOBAL_BY_TYPE'
+delete from performance_schema.OBJECTS_SUMMARY_GLOBAL_BY_TYPE
+where count_star=1;
+ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'OBJECTS_SUMMARY_GLOBAL_BY_TYPE'
+delete from performance_schema.OBJECTS_SUMMARY_GLOBAL_BY_TYPE;
+ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'OBJECTS_SUMMARY_GLOBAL_BY_TYPE'
+LOCK TABLES performance_schema.OBJECTS_SUMMARY_GLOBAL_BY_TYPE READ;
+ERROR 42000: SELECT, LOCK TABLES command denied to user 'root'@'localhost' for table 'OBJECTS_SUMMARY_GLOBAL_BY_TYPE'
+UNLOCK TABLES;
+LOCK TABLES performance_schema.OBJECTS_SUMMARY_GLOBAL_BY_TYPE WRITE;
+ERROR 42000: SELECT, LOCK TABLES command denied to user 'root'@'localhost' for table 'OBJECTS_SUMMARY_GLOBAL_BY_TYPE'
+UNLOCK TABLES;

=== added file 'mysql-test/suite/perfschema/r/dml_setup_objects.result'
--- a/mysql-test/suite/perfschema/r/dml_setup_objects.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/r/dml_setup_objects.result	2010-09-24 18:21:22 +0000
@@ -0,0 +1,67 @@
+drop table if exists test.SETUP_OBJECTS;
+create table test.SETUP_OBJECTS as
+select * from performance_schema.SETUP_OBJECTS;
+truncate table performance_schema.SETUP_OBJECTS;
+select * from performance_schema.SETUP_OBJECTS;
+OBJECT_TYPE	OBJECT_SCHEMA	OBJECT_NAME	TIMED
+select * from performance_schema.SETUP_OBJECTS
+order by object_type, object_schema, object_name;
+OBJECT_TYPE	OBJECT_SCHEMA	OBJECT_NAME	TIMED
+select * from performance_schema.SETUP_OBJECTS
+where object_type = 'TABLE'
+  order by object_type, object_schema, object_name;
+OBJECT_TYPE	OBJECT_SCHEMA	OBJECT_NAME	TIMED
+select * from performance_schema.SETUP_OBJECTS
+order by object_type, object_schema, object_name;
+OBJECT_TYPE	OBJECT_SCHEMA	OBJECT_NAME	TIMED
+insert into performance_schema.SETUP_OBJECTS
+set object_type='ILLEGAL', object_schema='FOO', object_name='BAR',
+timed='YES';
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails ()
+insert into performance_schema.SETUP_OBJECTS
+set object_type='TABLE', object_schema='FOO', object_name='BAR',
+timed='YES';
+insert into performance_schema.SETUP_OBJECTS
+set object_type='TABLE', object_schema='FOO', object_name='BAR',
+timed='NO';
+ERROR 23000: Can't write; duplicate key in table 'SETUP_OBJECTS'
+delete from performance_schema.SETUP_OBJECTS
+where object_type='TABLE' and object_schema='FOO';
+select * from performance_schema.SETUP_OBJECTS
+order by object_type, object_schema, object_name;
+OBJECT_TYPE	OBJECT_SCHEMA	OBJECT_NAME	TIMED
+insert into performance_schema.SETUP_OBJECTS
+set object_type='TABLE', object_schema='FOO', object_name='BAR',
+timed='YES';
+select * from performance_schema.SETUP_OBJECTS
+order by object_type, object_schema, object_name;
+OBJECT_TYPE	OBJECT_SCHEMA	OBJECT_NAME	TIMED
+TABLE	FOO	BAR	YES
+update performance_schema.SETUP_OBJECTS
+set object_type='ILLEGAL';
+ERROR HY000: Invalid performance_schema usage.
+update performance_schema.SETUP_OBJECTS
+set object_schema='ILLEGAL';
+ERROR HY000: Invalid performance_schema usage.
+update performance_schema.SETUP_OBJECTS
+set object_name='ILLEGAL';
+ERROR HY000: Invalid performance_schema usage.
+update performance_schema.SETUP_OBJECTS
+set timed='NO';
+select * from performance_schema.SETUP_OBJECTS
+order by object_type, object_schema, object_name;
+OBJECT_TYPE	OBJECT_SCHEMA	OBJECT_NAME	TIMED
+TABLE	FOO	BAR	NO
+update performance_schema.SETUP_OBJECTS
+set timed='YES';
+delete from performance_schema.SETUP_OBJECTS
+where object_type = 'TABLE';
+delete from performance_schema.SETUP_OBJECTS;
+LOCK TABLES performance_schema.SETUP_OBJECTS READ;
+UNLOCK TABLES;
+LOCK TABLES performance_schema.SETUP_OBJECTS WRITE;
+UNLOCK TABLES;
+truncate table performance_schema.SETUP_OBJECTS;
+insert into performance_schema.SETUP_OBJECTS
+select * from test.SETUP_OBJECTS;
+drop table test.SETUP_OBJECTS;

=== added file 'mysql-test/suite/perfschema/r/setup_objects.result'
--- a/mysql-test/suite/perfschema/r/setup_objects.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/r/setup_objects.result	2010-09-24 18:21:22 +0000
@@ -0,0 +1,102 @@
+drop table if exists test.SETUP_OBJECTS;
+create table test.SETUP_OBJECTS as select * from performance_schema.SETUP_OBJECTS;
+truncate table performance_schema.SETUP_OBJECTS;
+insert into performance_schema.SETUP_OBJECTS
+values ('TABLE', 'db1', 't1', 'YES');
+insert into performance_schema.SETUP_OBJECTS
+values ('TABLE', 'db1', 't2', 'NO');
+insert into performance_schema.SETUP_OBJECTS
+values ('TABLE', 'db1', '%', 'YES');
+insert into performance_schema.SETUP_OBJECTS
+values ('TABLE', 'db2', 't1', 'YES');
+insert into performance_schema.SETUP_OBJECTS
+values ('TABLE', 'db2', 't2', 'NO');
+select * from performance_schema.SETUP_OBJECTS
+order by OBJECT_TYPE, OBJECT_SCHEMA, OBJECT_NAME;
+OBJECT_TYPE	OBJECT_SCHEMA	OBJECT_NAME	TIMED
+TABLE	db1	%	YES
+TABLE	db1	t1	YES
+TABLE	db1	t2	NO
+TABLE	db2	t1	YES
+TABLE	db2	t2	NO
+drop database if exists db1;
+drop database if exists db2;
+drop database if exists db3;
+create database db1;
+create database db2;
+create database db3;
+create table db1.t1(a int);
+create table db1.t2(a int);
+create table db1.t3(a int);
+create table db1.t4(a int);
+create table db1.t5(a int);
+create table db2.t1(a int);
+create table db2.t2(a int);
+create table db2.t3(a int);
+create table db2.t4(a int);
+create table db2.t5(a int);
+create table db3.t1(a int);
+select * from db1.t1;
+a
+select * from db1.t2;
+a
+select * from db1.t3;
+a
+select * from db1.t4;
+a
+select * from db1.t5;
+a
+select * from db2.t1;
+a
+select * from db2.t2;
+a
+select * from db2.t3;
+a
+select * from db2.t4;
+a
+select * from db2.t5;
+a
+select * from db3.t1;
+a
+create table db3.t2(a int);
+select * from db3.t2;
+a
+select distinct OBJECT_TYPE, OBJECT_NAME, OBJECT_SCHEMA 
+from performance_schema.EVENTS_WAITS_HISTORY_LONG
+where OBJECT_SCHEMA like "db%"
+  group by OBJECT_TYPE, OBJECT_NAME, OBJECT_SCHEMA
+order by OBJECT_TYPE, OBJECT_NAME, OBJECT_SCHEMA;
+OBJECT_TYPE	OBJECT_NAME	OBJECT_SCHEMA
+TABLE	t1	db1
+TABLE	t1	db2
+TABLE	t2	db1
+TABLE	t2	db2
+TABLE	t3	db1
+TABLE	t4	db1
+TABLE	t5	db1
+select distinct OBJECT_TYPE, OBJECT_NAME, OBJECT_SCHEMA 
+from performance_schema.EVENTS_WAITS_HISTORY_LONG
+where OBJECT_SCHEMA like "db%" and TIMER_END is not NULL
+group by OBJECT_TYPE, OBJECT_NAME, OBJECT_SCHEMA
+order by OBJECT_TYPE, OBJECT_NAME, OBJECT_SCHEMA;
+OBJECT_TYPE	OBJECT_NAME	OBJECT_SCHEMA
+TABLE	t1	db1
+TABLE	t1	db2
+TABLE	t3	db1
+TABLE	t4	db1
+TABLE	t5	db1
+update performance_schema.SETUP_OBJECTS
+set timed='YES' where OBJECT_SCHEMA = '%';
+create table db3.t3(a int);
+select * from db3.t3;
+a
+truncate table performance_schema.SETUP_OBJECTS;
+select count(*) from performance_schema.SETUP_OBJECTS;
+count(*)
+0
+drop database db1;
+drop database db2;
+drop database db3;
+truncate table performance_schema.SETUP_OBJECTS;
+insert into performance_schema.SETUP_OBJECTS select * from test.SETUP_OBJECTS;
+drop table test.SETUP_OBJECTS;

=== 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-09-23 16:08:54 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_cond_class.result	2010-09-24 18:21:22 +0000
@@ -28,11 +28,13 @@ select * from performance_schema.FILE_IN
 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.OBJECTS_SUMMARY_GLOBAL_BY_TYPE;
 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_OBJECTS;
 select * from performance_schema.SETUP_TIMERS;
 select * from performance_schema.THREADS;
 show variables like "performance_schema%";

=== 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-09-23 16:08:54 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result	2010-09-24 18:21:22 +0000
@@ -28,11 +28,13 @@ select * from performance_schema.FILE_IN
 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.OBJECTS_SUMMARY_GLOBAL_BY_TYPE;
 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_OBJECTS;
 select * from performance_schema.SETUP_TIMERS;
 select * from performance_schema.THREADS;
 show variables like "performance_schema%";

=== 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-09-23 16:08:54 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_file_class.result	2010-09-24 18:21:22 +0000
@@ -28,11 +28,13 @@ select * from performance_schema.FILE_IN
 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.OBJECTS_SUMMARY_GLOBAL_BY_TYPE;
 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_OBJECTS;
 select * from performance_schema.SETUP_TIMERS;
 select * from performance_schema.THREADS;
 show variables like "performance_schema%";

=== 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-09-23 16:08:54 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_file_inst.result	2010-09-24 18:21:22 +0000
@@ -28,11 +28,13 @@ select * from performance_schema.FILE_IN
 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.OBJECTS_SUMMARY_GLOBAL_BY_TYPE;
 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_OBJECTS;
 select * from performance_schema.SETUP_TIMERS;
 select * from performance_schema.THREADS;
 show variables like "performance_schema%";

=== 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-09-23 16:08:54 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result	2010-09-24 18:21:22 +0000
@@ -28,11 +28,13 @@ select * from performance_schema.FILE_IN
 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.OBJECTS_SUMMARY_GLOBAL_BY_TYPE;
 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_OBJECTS;
 select * from performance_schema.SETUP_TIMERS;
 select * from performance_schema.THREADS;
 show variables like "performance_schema%";

=== 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-09-23 16:08:54 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result	2010-09-24 18:21:22 +0000
@@ -28,11 +28,13 @@ select * from performance_schema.FILE_IN
 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.OBJECTS_SUMMARY_GLOBAL_BY_TYPE;
 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_OBJECTS;
 select * from performance_schema.SETUP_TIMERS;
 select * from performance_schema.THREADS;
 show variables like "performance_schema%";

=== 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-09-23 16:08:54 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result	2010-09-24 18:21:22 +0000
@@ -28,11 +28,13 @@ select * from performance_schema.FILE_IN
 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.OBJECTS_SUMMARY_GLOBAL_BY_TYPE;
 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_OBJECTS;
 select * from performance_schema.SETUP_TIMERS;
 select * from performance_schema.THREADS;
 show variables like "performance_schema%";

=== 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-09-23 16:08:54 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result	2010-09-24 18:21:22 +0000
@@ -28,11 +28,13 @@ select * from performance_schema.FILE_IN
 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.OBJECTS_SUMMARY_GLOBAL_BY_TYPE;
 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_OBJECTS;
 select * from performance_schema.SETUP_TIMERS;
 select * from performance_schema.THREADS;
 show variables like "performance_schema%";

=== modified file 'mysql-test/suite/perfschema/r/start_server_no_setup_actors.result'
--- a/mysql-test/suite/perfschema/r/start_server_no_setup_actors.result	2010-09-23 16:08:54 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_setup_actors.result	2010-09-24 18:21:22 +0000
@@ -28,11 +28,13 @@ select * from performance_schema.FILE_IN
 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.OBJECTS_SUMMARY_GLOBAL_BY_TYPE;
 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_OBJECTS;
 select * from performance_schema.SETUP_TIMERS;
 select * from performance_schema.THREADS;
 show variables like "performance_schema%";

=== added file 'mysql-test/suite/perfschema/r/start_server_no_setup_objects.result'
--- a/mysql-test/suite/perfschema/r/start_server_no_setup_objects.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_setup_objects.result	2010-09-24 18:21:22 +0000
@@ -0,0 +1,67 @@
+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(*)
+5
+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.OBJECTS_SUMMARY_GLOBAL_BY_TYPE;
+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_OBJECTS;
+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	100
+performance_schema_setup_objects_size	0
+show engine PERFORMANCE_SCHEMA status;
+show status like "performance_schema%";
+show variables like "performance_schema_setup_objects_size";
+Variable_name	Value
+performance_schema_setup_objects_size	0
+select count(*) from performance_schema.SETUP_OBJECTS;
+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-09-23 16:08:54 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_table_hdl.result	2010-09-24 18:21:22 +0000
@@ -28,11 +28,13 @@ select * from performance_schema.FILE_IN
 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.OBJECTS_SUMMARY_GLOBAL_BY_TYPE;
 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_OBJECTS;
 select * from performance_schema.SETUP_TIMERS;
 select * from performance_schema.THREADS;
 show variables like "performance_schema%";

=== 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-09-23 16:08:54 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_table_inst.result	2010-09-24 18:21:22 +0000
@@ -28,11 +28,13 @@ select * from performance_schema.FILE_IN
 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.OBJECTS_SUMMARY_GLOBAL_BY_TYPE;
 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_OBJECTS;
 select * from performance_schema.SETUP_TIMERS;
 select * from performance_schema.THREADS;
 show variables like "performance_schema%";

=== 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-09-23 16:08:54 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_thread_class.result	2010-09-24 18:21:22 +0000
@@ -28,11 +28,13 @@ select * from performance_schema.FILE_IN
 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.OBJECTS_SUMMARY_GLOBAL_BY_TYPE;
 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_OBJECTS;
 select * from performance_schema.SETUP_TIMERS;
 select * from performance_schema.THREADS;
 show variables like "performance_schema%";

=== 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-09-23 16:08:54 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result	2010-09-24 18:21:22 +0000
@@ -28,11 +28,13 @@ select * from performance_schema.FILE_IN
 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.OBJECTS_SUMMARY_GLOBAL_BY_TYPE;
 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_OBJECTS;
 select * from performance_schema.SETUP_TIMERS;
 select * from performance_schema.THREADS;
 show variables like "performance_schema%";

=== modified file 'mysql-test/suite/perfschema/r/start_server_nothing.result'
--- a/mysql-test/suite/perfschema/r/start_server_nothing.result	2010-09-23 16:08:54 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_nothing.result	2010-09-24 18:21:22 +0000
@@ -28,11 +28,13 @@ select * from performance_schema.FILE_IN
 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.OBJECTS_SUMMARY_GLOBAL_BY_TYPE;
 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_OBJECTS;
 select * from performance_schema.SETUP_TIMERS;
 select * from performance_schema.THREADS;
 show variables like "performance_schema%";

=== modified file 'mysql-test/suite/perfschema/r/start_server_off.result'
--- a/mysql-test/suite/perfschema/r/start_server_off.result	2010-09-23 16:08:54 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_off.result	2010-09-24 18:21:22 +0000
@@ -28,11 +28,13 @@ select * from performance_schema.FILE_IN
 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.OBJECTS_SUMMARY_GLOBAL_BY_TYPE;
 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_OBJECTS;
 select * from performance_schema.SETUP_TIMERS;
 select * from performance_schema.THREADS;
 show variables 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-09-23 16:08:54 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_on.result	2010-09-24 18:21:22 +0000
@@ -28,11 +28,13 @@ select * from performance_schema.FILE_IN
 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.OBJECTS_SUMMARY_GLOBAL_BY_TYPE;
 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_OBJECTS;
 select * from performance_schema.SETUP_TIMERS;
 select * from performance_schema.THREADS;
 show variables like "performance_schema%";

=== added file 'mysql-test/suite/perfschema/t/ddl_os_global_by_type.test'
--- a/mysql-test/suite/perfschema/t/ddl_os_global_by_type.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/t/ddl_os_global_by_type.test	2010-09-24 18:21:22 +0000
@@ -0,0 +1,34 @@
+# 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, 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.OBJECTS_SUMMARY_GLOBAL_BY_TYPE
+  add column foo integer;
+
+truncate table performance_schema.OBJECTS_SUMMARY_GLOBAL_BY_TYPE;
+
+-- error ER_DBACCESS_DENIED_ERROR
+ALTER TABLE performance_schema.OBJECTS_SUMMARY_GLOBAL_BY_TYPE
+  ADD INDEX test_index(OBJECT_NAME);
+
+-- error ER_DBACCESS_DENIED_ERROR
+CREATE UNIQUE INDEX test_index
+  ON performance_schema.OBJECTS_SUMMARY_GLOBAL_BY_TYPE(OBJECT_NAME);
+

=== added file 'mysql-test/suite/perfschema/t/ddl_setup_objects.test'
--- a/mysql-test/suite/perfschema/t/ddl_setup_objects.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/t/ddl_setup_objects.test	2010-09-24 18:21:22 +0000
@@ -0,0 +1,45 @@
+# 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_result '\'setup_objects' '\'SETUP_OBJECTS'
+-- error ER_DBACCESS_DENIED_ERROR
+alter table performance_schema.SETUP_OBJECTS add column foo integer;
+
+--disable_warnings
+drop table if exists test.SETUP_OBJECTS;
+--enable_warnings
+
+create table test.SETUP_OBJECTS as
+  select * from performance_schema.SETUP_OBJECTS;
+
+truncate table performance_schema.SETUP_OBJECTS;
+
+select count(*) from performance_schema.SETUP_OBJECTS;
+
+insert into performance_schema.SETUP_OBJECTS
+  select * from test.SETUP_OBJECTS;
+drop table test.SETUP_OBJECTS;
+
+-- error ER_DBACCESS_DENIED_ERROR
+ALTER TABLE performance_schema.SETUP_OBJECTS ADD INDEX test_index(OBJECT_NAME);
+
+-- error ER_DBACCESS_DENIED_ERROR
+CREATE UNIQUE INDEX test_index ON performance_schema.SETUP_OBJECTS(OBJECT_NAME);
+

=== added file 'mysql-test/suite/perfschema/t/dml_os_global_by_type.test'
--- a/mysql-test/suite/perfschema/t/dml_os_global_by_type.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/t/dml_os_global_by_type.test	2010-09-24 18:21:22 +0000
@@ -0,0 +1,79 @@
+# 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, 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 # 4 # 5 # 6 # 7 # 8 #
+select * from performance_schema.OBJECTS_SUMMARY_GLOBAL_BY_TYPE
+  where object_schema = 'performance_schema' limit 1;
+
+select * from performance_schema.OBJECTS_SUMMARY_GLOBAL_BY_TYPE
+  where object_schema='FOO';
+
+--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 #
+select * from performance_schema.OBJECTS_SUMMARY_GLOBAL_BY_TYPE
+  order by count_star limit 1;
+
+--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 #
+select * from performance_schema.OBJECTS_SUMMARY_GLOBAL_BY_TYPE
+  order by count_star desc limit 1;
+
+--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 #
+select * from performance_schema.OBJECTS_SUMMARY_GLOBAL_BY_TYPE
+  where object_type = 'TABLE' order by object_schema, object_name limit 1;
+
+--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 #
+select * from performance_schema.OBJECTS_SUMMARY_GLOBAL_BY_TYPE
+  where object_type = 'TABLE' order by object_schema desc, object_name desc limit 1;
+
+--replace_result '\'objects_summary_global_by_type' '\'OBJECTS_SUMMARY_GLOBAL_BY_TYPE'
+--error ER_TABLEACCESS_DENIED_ERROR
+insert into performance_schema.OBJECTS_SUMMARY_GLOBAL_BY_TYPE
+  set object_type='TABLE', schema_name='FOO', object_name='BAR',
+  count_star=1, sum_timer_wait=2, min_timer_wait=3,
+  avg_timer_wait=4, max_timer_wait=5;
+
+--replace_result '\'objects_summary_global_by_type' '\'OBJECTS_SUMMARY_GLOBAL_BY_TYPE'
+--error ER_TABLEACCESS_DENIED_ERROR
+update performance_schema.OBJECTS_SUMMARY_GLOBAL_BY_TYPE
+  set count_star=12;
+
+--replace_result '\'objects_summary_global_by_type' '\'OBJECTS_SUMMARY_GLOBAL_BY_TYPE'
+--error ER_TABLEACCESS_DENIED_ERROR
+update performance_schema.OBJECTS_SUMMARY_GLOBAL_BY_TYPE
+  set count_star=12 where object_name like "FOO";
+
+--replace_result '\'objects_summary_global_by_type' '\'OBJECTS_SUMMARY_GLOBAL_BY_TYPE'
+--error ER_TABLEACCESS_DENIED_ERROR
+delete from performance_schema.OBJECTS_SUMMARY_GLOBAL_BY_TYPE
+  where count_star=1;
+
+--replace_result '\'objects_summary_global_by_type' '\'OBJECTS_SUMMARY_GLOBAL_BY_TYPE'
+--error ER_TABLEACCESS_DENIED_ERROR
+delete from performance_schema.OBJECTS_SUMMARY_GLOBAL_BY_TYPE;
+
+--replace_result '\'objects_summary_global_by_type' '\'OBJECTS_SUMMARY_GLOBAL_BY_TYPE'
+-- error ER_TABLEACCESS_DENIED_ERROR
+LOCK TABLES performance_schema.OBJECTS_SUMMARY_GLOBAL_BY_TYPE READ;
+UNLOCK TABLES;
+
+--replace_result '\'objects_summary_global_by_type' '\'OBJECTS_SUMMARY_GLOBAL_BY_TYPE'
+-- error ER_TABLEACCESS_DENIED_ERROR
+LOCK TABLES performance_schema.OBJECTS_SUMMARY_GLOBAL_BY_TYPE WRITE;
+UNLOCK TABLES;
+

=== added file 'mysql-test/suite/perfschema/t/dml_setup_objects.test'
--- a/mysql-test/suite/perfschema/t/dml_setup_objects.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/t/dml_setup_objects.test	2010-09-24 18:21:22 +0000
@@ -0,0 +1,109 @@
+# 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
+
+--disable_warnings
+drop table if exists test.SETUP_OBJECTS;
+--enable_warnings
+
+# Save the setup
+create table test.SETUP_OBJECTS as
+  select * from performance_schema.SETUP_OBJECTS;
+truncate table performance_schema.SETUP_OBJECTS;
+
+# Test
+
+select * from performance_schema.SETUP_OBJECTS;
+
+select * from performance_schema.SETUP_OBJECTS
+  order by object_type, object_schema, object_name;
+
+select * from performance_schema.SETUP_OBJECTS
+  where object_type = 'TABLE'
+  order by object_type, object_schema, object_name;
+
+select * from performance_schema.SETUP_OBJECTS
+  order by object_type, object_schema, object_name;
+
+--error ER_NO_REFERENCED_ROW_2
+insert into performance_schema.SETUP_OBJECTS
+  set object_type='ILLEGAL', object_schema='FOO', object_name='BAR',
+  timed='YES';
+
+insert into performance_schema.SETUP_OBJECTS
+  set object_type='TABLE', object_schema='FOO', object_name='BAR',
+  timed='YES';
+
+--replace_result '\'setup_objects' '\'SETUP_OBJECTS'
+--error ER_DUP_KEY
+insert into performance_schema.SETUP_OBJECTS
+  set object_type='TABLE', object_schema='FOO', object_name='BAR',
+  timed='NO';
+
+delete from performance_schema.SETUP_OBJECTS
+  where object_type='TABLE' and object_schema='FOO';
+
+select * from performance_schema.SETUP_OBJECTS
+  order by object_type, object_schema, object_name;
+
+insert into performance_schema.SETUP_OBJECTS
+  set object_type='TABLE', object_schema='FOO', object_name='BAR',
+  timed='YES';
+
+select * from performance_schema.SETUP_OBJECTS
+  order by object_type, object_schema, object_name;
+
+--error ER_WRONG_PERFSCHEMA_USAGE
+update performance_schema.SETUP_OBJECTS
+  set object_type='ILLEGAL';
+
+--error ER_WRONG_PERFSCHEMA_USAGE
+update performance_schema.SETUP_OBJECTS
+  set object_schema='ILLEGAL';
+
+--error ER_WRONG_PERFSCHEMA_USAGE
+update performance_schema.SETUP_OBJECTS
+  set object_name='ILLEGAL';
+
+update performance_schema.SETUP_OBJECTS
+  set timed='NO';
+
+select * from performance_schema.SETUP_OBJECTS
+  order by object_type, object_schema, object_name;
+
+update performance_schema.SETUP_OBJECTS
+  set timed='YES';
+
+delete from performance_schema.SETUP_OBJECTS
+  where object_type = 'TABLE';
+
+delete from performance_schema.SETUP_OBJECTS;
+
+LOCK TABLES performance_schema.SETUP_OBJECTS READ;
+UNLOCK TABLES;
+
+LOCK TABLES performance_schema.SETUP_OBJECTS WRITE;
+UNLOCK TABLES;
+
+# Restore the setup
+truncate table performance_schema.SETUP_OBJECTS;
+insert into performance_schema.SETUP_OBJECTS
+  select * from test.SETUP_OBJECTS;
+drop table test.SETUP_OBJECTS;
+

=== added file 'mysql-test/suite/perfschema/t/setup_objects.test'
--- a/mysql-test/suite/perfschema/t/setup_objects.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/t/setup_objects.test	2010-09-24 18:21:22 +0000
@@ -0,0 +1,118 @@
+# 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, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+--disable_warnings
+drop table if exists test.SETUP_OBJECTS;
+--enable_warnings
+
+# Save the setup
+create table test.SETUP_OBJECTS as select * from performance_schema.SETUP_OBJECTS;
+truncate table performance_schema.SETUP_OBJECTS;
+
+insert into performance_schema.SETUP_OBJECTS
+  values ('TABLE', 'db1', 't1', 'YES');
+
+insert into performance_schema.SETUP_OBJECTS
+  values ('TABLE', 'db1', 't2', 'NO');
+
+insert into performance_schema.SETUP_OBJECTS
+  values ('TABLE', 'db1', '%', 'YES');
+
+insert into performance_schema.SETUP_OBJECTS
+  values ('TABLE', 'db2', 't1', 'YES');
+
+insert into performance_schema.SETUP_OBJECTS
+  values ('TABLE', 'db2', 't2', 'NO');
+
+select * from performance_schema.SETUP_OBJECTS
+  order by OBJECT_TYPE, OBJECT_SCHEMA, OBJECT_NAME;
+
+--disable_warnings
+drop database if exists db1;
+drop database if exists db2;
+drop database if exists db3;
+--enable_warnings
+
+create database db1;
+create database db2;
+create database db3;
+
+create table db1.t1(a int);
+create table db1.t2(a int);
+create table db1.t3(a int);
+create table db1.t4(a int);
+create table db1.t5(a int);
+
+create table db2.t1(a int);
+create table db2.t2(a int);
+create table db2.t3(a int);
+create table db2.t4(a int);
+create table db2.t5(a int);
+
+create table db3.t1(a int);
+
+select * from db1.t1;
+select * from db1.t2;
+select * from db1.t3;
+select * from db1.t4;
+select * from db1.t5;
+
+select * from db2.t1;
+select * from db2.t2;
+select * from db2.t3;
+select * from db2.t4;
+select * from db2.t5;
+
+select * from db3.t1;
+
+create table db3.t2(a int);
+select * from db3.t2;
+
+# Verify what is instrumented
+select distinct OBJECT_TYPE, OBJECT_NAME, OBJECT_SCHEMA 
+  from performance_schema.EVENTS_WAITS_HISTORY_LONG
+  where OBJECT_SCHEMA like "db%"
+  group by OBJECT_TYPE, OBJECT_NAME, OBJECT_SCHEMA
+  order by OBJECT_TYPE, OBJECT_NAME, OBJECT_SCHEMA;
+
+# Verify what is instrumented and timed
+select distinct OBJECT_TYPE, OBJECT_NAME, OBJECT_SCHEMA 
+  from performance_schema.EVENTS_WAITS_HISTORY_LONG
+  where OBJECT_SCHEMA like "db%" and TIMER_END is not NULL
+  group by OBJECT_TYPE, OBJECT_NAME, OBJECT_SCHEMA
+  order by OBJECT_TYPE, OBJECT_NAME, OBJECT_SCHEMA;
+
+update performance_schema.SETUP_OBJECTS
+  set timed='YES' where OBJECT_SCHEMA = '%';
+
+create table db3.t3(a int);
+select * from db3.t3;
+
+truncate table performance_schema.SETUP_OBJECTS;
+
+select count(*) from performance_schema.SETUP_OBJECTS;
+
+drop database db1;
+drop database db2;
+drop database db3;
+
+# Restore the setup
+truncate table performance_schema.SETUP_OBJECTS;
+insert into performance_schema.SETUP_OBJECTS select * from test.SETUP_OBJECTS;
+drop table test.SETUP_OBJECTS;
+

=== added file 'mysql-test/suite/perfschema/t/start_server_no_setup_objects-master.opt'
--- a/mysql-test/suite/perfschema/t/start_server_no_setup_objects-master.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/t/start_server_no_setup_objects-master.opt	2010-09-24 18:21:22 +0000
@@ -0,0 +1,2 @@
+--loose-enable-performance-schema
+--loose-performance_schema_setup_objects_size=0

=== added file 'mysql-test/suite/perfschema/t/start_server_no_setup_objects.test'
--- a/mysql-test/suite/perfschema/t/start_server_no_setup_objects.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/t/start_server_no_setup_objects.test	2010-09-24 18:21:22 +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_objects
+show variables like "performance_schema_setup_objects_size";
+
+# Expect no setup_objects
+select count(*) from performance_schema.SETUP_OBJECTS;
+

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

=== added file 'mysql-test/suite/sys_vars/t/pfs_setup_objects_size_basic-master.opt'
--- a/mysql-test/suite/sys_vars/t/pfs_setup_objects_size_basic-master.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/sys_vars/t/pfs_setup_objects_size_basic-master.opt	2010-09-24 18:21:22 +0000
@@ -0,0 +1,2 @@
+--loose-enable-performance-schema
+--loose-performance-schema-setup-objects-size=123

=== added file 'mysql-test/suite/sys_vars/t/pfs_setup_objects_size_basic.test'
--- a/mysql-test/suite/sys_vars/t/pfs_setup_objects_size_basic.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/sys_vars/t/pfs_setup_objects_size_basic.test	2010-09-24 18:21:22 +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, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+#
+# Only global
+#
+
+select @@global.performance_schema_setup_objects_size;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.performance_schema_setup_objects_size;
+
+show global variables like 'performance_schema_setup_objects_size';
+
+show session variables like 'performance_schema_setup_objects_size';
+
+select * from information_schema.global_variables
+  where variable_name='performance_schema_setup_objects_size';
+
+select * from information_schema.session_variables
+  where variable_name='performance_schema_setup_objects_size';
+
+#
+# Read-only
+#
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global performance_schema_setup_objects_size=1;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session performance_schema_setup_objects_size=1;
+

=== modified file 'storage/perfschema/pfs_instr.cc'
--- a/storage/perfschema/pfs_instr.cc	2010-09-23 16:08:54 +0000
+++ b/storage/perfschema/pfs_instr.cc	2010-09-24 18:21:22 +0000
@@ -463,6 +463,8 @@ PFS_mutex* create_mutex(PFS_mutex_class
           pfs->m_owner= NULL;
           pfs->m_last_locked= 0;
           pfs->m_lock.dirty_to_allocated();
+          if (klass->is_singleton())
+            klass->m_singleton= pfs;
           return pfs;
         }
       }
@@ -480,10 +482,13 @@ PFS_mutex* create_mutex(PFS_mutex_class
 void destroy_mutex(PFS_mutex *pfs)
 {
   DBUG_ASSERT(pfs != NULL);
+  PFS_mutex_class *klass= pfs->m_class;
   /* Aggregate to EVENTS_WAITS_SUMMARY_BY_EVENT_NAME */
-  uint index= pfs->m_class->m_event_name_index;
+  uint index= klass->m_event_name_index;
   global_instr_class_waits_array[index].aggregate(& pfs->m_wait_stat);
   pfs->m_wait_stat.reset();
+  if (klass->is_singleton())
+    klass->m_singleton= NULL;
   pfs->m_lock.allocated_to_free();
 }
 
@@ -520,6 +525,8 @@ PFS_rwlock* create_rwlock(PFS_rwlock_cla
           pfs->m_readers= 0;
           pfs->m_last_written= 0;
           pfs->m_last_read= 0;
+          if (klass->is_singleton())
+            klass->m_singleton= pfs;
           return pfs;
         }
       }
@@ -537,10 +544,13 @@ PFS_rwlock* create_rwlock(PFS_rwlock_cla
 void destroy_rwlock(PFS_rwlock *pfs)
 {
   DBUG_ASSERT(pfs != NULL);
+  PFS_rwlock_class *klass= pfs->m_class;
   /* Aggregate to EVENTS_WAITS_SUMMARY_BY_EVENT_NAME */
-  uint index= pfs->m_class->m_event_name_index;
+  uint index= klass->m_event_name_index;
   global_instr_class_waits_array[index].aggregate(& pfs->m_wait_stat);
   pfs->m_wait_stat.reset();
+  if (klass->is_singleton())
+    klass->m_singleton= NULL;
   pfs->m_lock.allocated_to_free();
 }
 
@@ -573,6 +583,8 @@ PFS_cond* create_cond(PFS_cond_class *kl
           pfs->m_cond_stat.m_broadcast_count= 0;
           pfs->m_wait_stat.reset();
           pfs->m_lock.dirty_to_allocated();
+          if (klass->is_singleton())
+            klass->m_singleton= pfs;
           return pfs;
         }
       }
@@ -590,10 +602,13 @@ PFS_cond* create_cond(PFS_cond_class *kl
 void destroy_cond(PFS_cond *pfs)
 {
   DBUG_ASSERT(pfs != NULL);
+  PFS_cond_class *klass= pfs->m_class;
   /* Aggregate to EVENTS_WAITS_SUMMARY_BY_EVENT_NAME */
-  uint index= pfs->m_class->m_event_name_index;
+  uint index= klass->m_event_name_index;
   global_instr_class_waits_array[index].aggregate(& pfs->m_wait_stat);
   pfs->m_wait_stat.reset();
+  if (klass->is_singleton())
+    klass->m_singleton= NULL;
   pfs->m_lock.allocated_to_free();
 }
 
@@ -669,6 +684,30 @@ PFS_thread* create_thread(PFS_thread_cla
   return NULL;
 }
 
+PFS_mutex *sanitize_mutex(PFS_mutex *unsafe)
+{
+  if ((&mutex_array[0] <= unsafe) &&
+      (unsafe < &mutex_array[mutex_max]))
+    return unsafe;
+  return NULL;
+}
+
+PFS_rwlock *sanitize_rwlock(PFS_rwlock *unsafe)
+{
+  if ((&rwlock_array[0] <= unsafe) &&
+      (unsafe < &rwlock_array[rwlock_max]))
+    return unsafe;
+  return NULL;
+}
+
+PFS_cond *sanitize_cond(PFS_cond *unsafe)
+{
+  if ((&cond_array[0] <= unsafe) &&
+      (unsafe < &cond_array[cond_max]))
+    return unsafe;
+  return NULL;
+}
+
 /**
   Sanitize a PFS_thread pointer.
   Validate that the PFS_thread is part of thread_array.
@@ -686,6 +725,14 @@ PFS_thread *sanitize_thread(PFS_thread *
   return NULL;
 }
 
+PFS_file *sanitize_file(PFS_file *unsafe)
+{
+  if ((&file_array[0] <= unsafe) &&
+      (unsafe < &file_array[file_max]))
+    return unsafe;
+  return NULL;
+}
+
 /**
   Destroy instrumentation for a thread instance.
   @param pfs                          the thread to destroy
@@ -872,6 +919,8 @@ search:
           if (likely(res == 0))
           {
             pfs->m_lock.dirty_to_allocated();
+            if (klass->is_singleton())
+              klass->m_singleton= pfs;
             return pfs;
           }
 
@@ -921,18 +970,21 @@ void destroy_file(PFS_thread *thread, PF
   DBUG_ASSERT(thread != NULL);
   DBUG_ASSERT(thread->m_filename_hash_pins != NULL);
   DBUG_ASSERT(pfs != NULL);
+  PFS_file_class *klass= pfs->m_class;
 
   /* Aggregate to EVENTS_WAITS_SUMMARY_BY_EVENT_NAME */
-  uint index= pfs->m_class->m_event_name_index;
+  uint index= klass->m_event_name_index;
   global_instr_class_waits_array[index].aggregate(& pfs->m_wait_stat);
   pfs->m_wait_stat.reset();
 
   /* Aggregate to FILE_SUMMARY_BY_EVENT_NAME */
-  pfs->m_class->m_file_stat.m_io_stat.aggregate(& pfs->m_file_stat.m_io_stat);
+  klass->m_file_stat.m_io_stat.aggregate(& pfs->m_file_stat.m_io_stat);
   pfs->m_file_stat.m_io_stat.reset();
-  
+
   lf_hash_delete(&filename_hash, thread->m_filename_hash_pins,
                  pfs->m_filename, pfs->m_filename_length);
+  if (klass->is_singleton())
+    klass->m_singleton= NULL;
   pfs->m_lock.allocated_to_free();
 }
 

=== modified file 'storage/perfschema/pfs_instr.h'
--- a/storage/perfschema/pfs_instr.h	2010-09-23 16:08:54 +0000
+++ b/storage/perfschema/pfs_instr.h	2010-09-24 18:21:22 +0000
@@ -275,7 +275,11 @@ struct PFS_thread
 
 extern PFS_single_stat *global_instr_class_waits_array;
 
+PFS_mutex *sanitize_mutex(PFS_mutex *unsafe);
+PFS_rwlock *sanitize_rwlock(PFS_rwlock *unsafe);
+PFS_cond *sanitize_cond(PFS_cond *unsafe);
 PFS_thread *sanitize_thread(PFS_thread *unsafe);
+PFS_file *sanitize_file(PFS_file *unsafe);
 
 int init_instruments(const PFS_global_param *param);
 void cleanup_instruments();

=== modified file 'storage/perfschema/pfs_instr_class.cc'
--- a/storage/perfschema/pfs_instr_class.cc	2010-09-23 16:08:54 +0000
+++ b/storage/perfschema/pfs_instr_class.cc	2010-09-24 18:21:22 +0000
@@ -495,6 +495,7 @@ PFS_sync_key register_mutex_class(const
     entry->m_lock_stat.reset();
     entry->m_index= index;
     entry->m_event_name_index= mutex_class_start + index;
+    entry->m_singleton= NULL;
     /*
       Now that this entry is populated, advertise it
 
@@ -556,6 +557,7 @@ PFS_sync_key register_rwlock_class(const
     entry->m_write_lock_stat.reset();
     entry->m_index= index;
     entry->m_event_name_index= rwlock_class_start + index;
+    entry->m_singleton= NULL;
     PFS_atomic::add_u32(&rwlock_class_allocated_count, 1);
     return (index + 1);
   }
@@ -589,6 +591,7 @@ PFS_sync_key register_cond_class(const c
     init_instr_class(entry, name, name_length, flags);
     entry->m_index= index;
     entry->m_event_name_index= cond_class_start + index;
+    entry->m_singleton= NULL;
     PFS_atomic::add_u32(&cond_class_allocated_count, 1);
     return (index + 1);
   }
@@ -733,6 +736,7 @@ PFS_file_key register_file_class(const c
     init_instr_class(entry, name, name_length, flags);
     entry->m_index= index;
     entry->m_event_name_index= file_class_start + index;
+    entry->m_singleton= NULL;
     PFS_atomic::add_u32(&file_class_allocated_count, 1);
     return (index + 1);
   }

=== modified file 'storage/perfschema/pfs_instr_class.h'
--- a/storage/perfschema/pfs_instr_class.h	2010-09-23 16:08:54 +0000
+++ b/storage/perfschema/pfs_instr_class.h	2010-09-24 18:21:22 +0000
@@ -88,8 +88,15 @@ struct PFS_instr_class
     - EVENTS_WAITS_SUMMARY_*_BY_EVENT_NAME
   */
   uint m_event_name_index;
+
+  bool is_singleton() const
+  {
+    return m_flags & PSI_FLAG_GLOBAL;
+  }
 };
 
+struct PFS_mutex;
+
 /** Instrumentation metadata for a MUTEX. */
 struct PFS_mutex_class : public PFS_instr_class
 {
@@ -100,8 +107,12 @@ struct PFS_mutex_class : public PFS_inst
   PFS_single_stat m_lock_stat;
   /** Self index in @c mutex_class_array. */
   uint m_index;
+  /** Singleton instance. */
+  PFS_mutex *m_singleton;
 };
 
+struct PFS_rwlock;
+
 /** Instrumentation metadata for a RWLOCK. */
 struct PFS_rwlock_class : public PFS_instr_class
 {
@@ -117,8 +128,12 @@ struct PFS_rwlock_class : public PFS_ins
   PFS_single_stat m_write_lock_stat;
   /** Self index in @c rwlock_class_array. */
   uint m_index;
+  /** Singleton instance. */
+  PFS_rwlock *m_singleton;
 };
 
+struct PFS_cond;
+
 /** Instrumentation metadata for a COND. */
 struct PFS_cond_class : public PFS_instr_class
 {
@@ -129,6 +144,8 @@ struct PFS_cond_class : public PFS_instr
   PFS_cond_stat m_cond_stat;
   /** Self index in @c cond_class_array. */
   uint m_index;
+  /** Singleton instance. */
+  PFS_cond *m_singleton;
 };
 
 /** Instrumentation metadata of a thread. */
@@ -140,6 +157,8 @@ struct PFS_thread_class
   uint m_name_length;
   /** True if this thread instrument is enabled. */
   bool m_enabled;
+  /** Singleton instance. */
+  PFS_thread *m_singleton;
 };
 
 /** Key identifying a table share. */
@@ -208,6 +227,8 @@ struct PFS_table_share
 */
 extern PFS_instr_class global_table_io_class;
 
+struct PFS_file;
+
 /** Instrumentation metadata for a file. */
 struct PFS_file_class : public PFS_instr_class
 {
@@ -215,6 +236,8 @@ struct PFS_file_class : public PFS_instr
   PFS_file_stat m_file_stat;
   /** Self index in @c file_class_array. */
   uint m_index;
+  /** Singleton instance. */
+  PFS_file *m_singleton;
 };
 
 void init_event_name_sizing(const PFS_global_param *param);

=== modified file 'storage/perfschema/pfs_setup_object.cc'
--- a/storage/perfschema/pfs_setup_object.cc	2010-09-23 16:08:54 +0000
+++ b/storage/perfschema/pfs_setup_object.cc	2010-09-24 18:21:22 +0000
@@ -251,7 +251,7 @@ int reset_setup_object()
 
   for ( ; pfs < pfs_last; pfs++)
   {
-    if (pfs->m_lock.is_populated())
+    if (pfs->m_enabled && pfs->m_lock.is_populated())
     {
       lf_hash_delete(&setup_object_hash, pins,
                      pfs->m_key.m_hash_key, pfs->m_key.m_key_length);

=== modified file 'storage/perfschema/table_ews_global_by_event_name.cc'
--- a/storage/perfschema/table_ews_global_by_event_name.cc	2010-09-23 16:08:54 +0000
+++ b/storage/perfschema/table_ews_global_by_event_name.cc	2010-09-24 18:21:22 +0000
@@ -243,19 +243,32 @@ void table_ews_global_by_event_name
   uint index= klass->m_event_name_index;
   PFS_single_stat cumulated_stat= global_instr_class_waits_array[index];
 
-  /* FIXME: improve singletons */
-  /* For all the mutex instances ... */
-  PFS_mutex *pfs= mutex_array;
-  PFS_mutex *pfs_last= mutex_array + mutex_max;
-  for ( ; pfs < pfs_last; pfs++)
-  {
-    if ((pfs->m_class == klass) && pfs->m_lock.is_populated())
-    {
-      /*
-        If the instance belongs to this class,
-        aggregate the instance statistics.
-      */
-      cumulated_stat.aggregate(& pfs->m_wait_stat);
+  if (klass->is_singleton())
+  {
+    PFS_mutex *pfs= sanitize_mutex(klass->m_singleton);
+    if (likely(pfs != NULL))
+    {
+      if (likely(pfs->m_lock.is_populated()))
+      {
+        cumulated_stat.aggregate(& pfs->m_wait_stat);
+      }
+    }
+  }
+  else
+  {
+    /* For all the mutex instances ... */
+    PFS_mutex *pfs= mutex_array;
+    PFS_mutex *pfs_last= mutex_array + mutex_max;
+    for ( ; pfs < pfs_last; pfs++)
+    {
+      if ((pfs->m_class == klass) && pfs->m_lock.is_populated())
+      {
+        /*
+          If the instance belongs to this class,
+          aggregate the instance statistics.
+        */
+        cumulated_stat.aggregate(& pfs->m_wait_stat);
+      }
     }
   }
 
@@ -272,19 +285,32 @@ void table_ews_global_by_event_name
   uint index= klass->m_event_name_index;
   PFS_single_stat cumulated_stat= global_instr_class_waits_array[index];
 
-  /* FIXME: improve singletons */
-  /* For all the rwlock instances ... */
-  PFS_rwlock *pfs= rwlock_array;
-  PFS_rwlock *pfs_last= rwlock_array + rwlock_max;
-  for ( ; pfs < pfs_last; pfs++)
-  {
-    if ((pfs->m_class == klass) && pfs->m_lock.is_populated())
-    {
-      /*
-        If the instance belongs to this class,
-        aggregate the instance statistics.
-      */
-      cumulated_stat.aggregate(& pfs->m_wait_stat);
+  if (klass->is_singleton())
+  {
+    PFS_rwlock *pfs= sanitize_rwlock(klass->m_singleton);
+    if (likely(pfs != NULL))
+    {
+      if (likely(pfs->m_lock.is_populated()))
+      {
+        cumulated_stat.aggregate(& pfs->m_wait_stat);
+      }
+    }
+  }
+  else
+  {
+    /* For all the rwlock instances ... */
+    PFS_rwlock *pfs= rwlock_array;
+    PFS_rwlock *pfs_last= rwlock_array + rwlock_max;
+    for ( ; pfs < pfs_last; pfs++)
+    {
+      if ((pfs->m_class == klass) && pfs->m_lock.is_populated())
+      {
+        /*
+          If the instance belongs to this class,
+          aggregate the instance statistics.
+        */
+        cumulated_stat.aggregate(& pfs->m_wait_stat);
+      }
     }
   }
 
@@ -301,19 +327,32 @@ void table_ews_global_by_event_name
   uint index= klass->m_event_name_index;
   PFS_single_stat cumulated_stat= global_instr_class_waits_array[index];
 
-  /* FIXME: improve singletons */
-  /* For all the cond instances ... */
-  PFS_cond *pfs= cond_array;
-  PFS_cond *pfs_last= cond_array + cond_max;
-  for ( ; pfs < pfs_last; pfs++)
-  {
-    if ((pfs->m_class == klass) && pfs->m_lock.is_populated())
-    {
-      /*
-        If the instance belongs to this class,
-        aggregate the instance statistics.
-      */
-      cumulated_stat.aggregate(& pfs->m_wait_stat);
+  if (klass->is_singleton())
+  {
+    PFS_cond *pfs= sanitize_cond(klass->m_singleton);
+    if (likely(pfs != NULL))
+    {
+      if (likely(pfs->m_lock.is_populated()))
+      {
+        cumulated_stat.aggregate(& pfs->m_wait_stat);
+      }
+    }
+  }
+  else
+  {
+    /* For all the cond instances ... */
+    PFS_cond *pfs= cond_array;
+    PFS_cond *pfs_last= cond_array + cond_max;
+    for ( ; pfs < pfs_last; pfs++)
+    {
+      if ((pfs->m_class == klass) && pfs->m_lock.is_populated())
+      {
+        /*
+          If the instance belongs to this class,
+          aggregate the instance statistics.
+        */
+        cumulated_stat.aggregate(& pfs->m_wait_stat);
+      }
     }
   }
 
@@ -330,19 +369,32 @@ void table_ews_global_by_event_name
   uint index= klass->m_event_name_index;
   PFS_single_stat cumulated_stat= global_instr_class_waits_array[index];
 
-  /* FIXME: improve singletons */
-  /* For all the file instances ... */
-  PFS_file *pfs= file_array;
-  PFS_file *pfs_last= file_array + file_max;
-  for ( ; pfs < pfs_last; pfs++)
-  {
-    if ((pfs->m_class == klass) && pfs->m_lock.is_populated())
-    {
-      /*
-        If the instance belongs to this class,
-        aggregate the instance statistics.
-      */
-      cumulated_stat.aggregate(& pfs->m_wait_stat);
+  if (klass->is_singleton())
+  {
+    PFS_file *pfs= sanitize_file(klass->m_singleton);
+    if (likely(pfs != NULL))
+    {
+      if (likely(pfs->m_lock.is_populated()))
+      {
+        cumulated_stat.aggregate(& pfs->m_wait_stat);
+      }
+    }
+  }
+  else
+  {
+    /* For all the file instances ... */
+    PFS_file *pfs= file_array;
+    PFS_file *pfs_last= file_array + file_max;
+    for ( ; pfs < pfs_last; pfs++)
+    {
+      if ((pfs->m_class == klass) && pfs->m_lock.is_populated())
+      {
+        /*
+          If the instance belongs to this class,
+          aggregate the instance statistics.
+        */
+        cumulated_stat.aggregate(& pfs->m_wait_stat);
+      }
     }
   }
 
@@ -374,7 +426,7 @@ void table_ews_global_by_event_name
       for (index= 0; index <= share->m_key_count; index++)
         cumulated_io_stat.aggregate(& share->m_table_stat.m_index_stat[index]);
 
-      /** Aggregate global stats */
+      /* Aggregate global stats */
       cumulated_io_stat.aggregate(& share->m_table_stat.m_index_stat[MAX_KEY]);
     }
   }
@@ -394,7 +446,7 @@ void table_ews_global_by_event_name
         for (index= 0; index <= safe_share->m_key_count; index++)
           cumulated_io_stat.aggregate(& table->m_table_stat.m_index_stat[index]);
 
-        /** Aggregate global stats */
+        /* Aggregate global stats */
         cumulated_io_stat.aggregate(& table->m_table_stat.m_index_stat[MAX_KEY]);
       }
     }

=== modified file 'storage/perfschema/table_helper.h'
--- a/storage/perfschema/table_helper.h	2010-09-23 16:08:54 +0000
+++ b/storage/perfschema/table_helper.h	2010-09-24 18:21:22 +0000
@@ -124,7 +124,6 @@ struct PFS_table_io_stat_row
   }
 };
 
-int object_type_to_enum(String *in, enum_object_type *out);
 void set_field_object_type(Field *f, enum_object_type object_type);
 
 /** @} */


Attachment: [text/bzr-bundle] bzr/marc.alff@oracle.com-20100924182122-l03vi0n65jw2vza8.bundle
Thread
bzr push into mysql-next-mr-wl4816 branch (marc.alff:3196 to 3197) WL#4816Marc Alff24 Sep