List:Commits« Previous MessageNext Message »
From:Marc Alff Date:May 30 2012 11:45am
Subject:bzr push into mysql-trunk-wl6135 branch (marc.alff:3791 to 3792) WL#6135
View as plain text  
 3792 Marc Alff	2012-05-30
      WL#6135 PERFORMANCE SCHEMA ENABLED BY DEFAULT
      
      Implementation continued, improved tests.

    added:
      mysql-test/include/default_mysqld_autosize.cnf
      mysql-test/suite/perfschema/r/sizing_high.result
      mysql-test/suite/perfschema/r/sizing_med.result
      mysql-test/suite/perfschema/t/sizing_high.cnf
      mysql-test/suite/perfschema/t/sizing_high.test
      mysql-test/suite/perfschema/t/sizing_med.cnf
      mysql-test/suite/perfschema/t/sizing_med.test
    modified:
      mysql-test/suite/perfschema/r/sizing_default.result
      mysql-test/suite/perfschema/r/sizing_low.result
      mysql-test/suite/perfschema/t/sizing_default.cnf
      mysql-test/suite/perfschema/t/sizing_low.cnf
      sql/mysqld.cc
      sql/mysqld.h
      sql/sys_vars.cc
      storage/perfschema/pfs_autosize.cc
 3791 Marc Alff	2012-05-30
      Code cleanup for the embedded build, fixed test cases.

    modified:
      libmysqld/lib_sql.cc
      mysql-test/r/mysqld--help-win.result
      mysql-test/suite/perfschema/include/sizing_auto.inc
      mysql-test/suite/perfschema/r/sizing_default.result
      mysql-test/suite/perfschema/r/sizing_low.result
      mysql-test/suite/perfschema/t/sizing_default.test
      mysql-test/suite/perfschema/t/sizing_low.test
      sql/mysqld.cc
      sql/mysqld.h
      sql/sys_vars.cc
      storage/perfschema/pfs_server.h
=== added file 'mysql-test/include/default_mysqld_autosize.cnf'
--- a/mysql-test/include/default_mysqld_autosize.cnf	1970-01-01 00:00:00 +0000
+++ b/mysql-test/include/default_mysqld_autosize.cnf	2012-05-30 11:44:42 +0000
@@ -0,0 +1,63 @@
+# Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
+
+# Default values that applies to all MySQL Servers
+[mysqld]
+local-infile
+character-set-server=      latin1
+
+# Increase default connect_timeout to avoid intermittent
+# disconnects when test servers are put under load see BUG#28359
+connect-timeout=            60
+
+log-bin-trust-function-creators=1
+key_buffer_size=            1M
+sort_buffer=                256K
+max_heap_table_size=        1M
+
+loose-innodb_data_file_path=      ibdata1:10M:autoextend
+loose-innodb_buffer_pool_size=    8M
+loose-innodb_lru_scan_depth=      100
+loose-innodb_write_io_threads=    2
+loose-innodb_read_io_threads=     2
+loose-innodb_log_buffer_size=     1M
+loose-innodb_log_file_size=       5M
+loose-innodb_additional_mem_pool_size= 1M
+loose-innodb_log_files_in_group=  2
+
+slave-net-timeout=120
+
+log-bin=mysqld-bin
+
+# No performance schema sizing provided
+
+# Disable everything, we only need the sizing data,
+# and also need a stable output for show engine performance_schema status
+loose-performance-schema-consumer-global-instrumentation=OFF
+
+loose-performance-schema-instrument='%=ON'
+
+loose-performance-schema-consumer-events-stages-current=ON
+loose-performance-schema-consumer-events-stages-history=ON
+loose-performance-schema-consumer-events-stages-history-long=ON
+loose-performance-schema-consumer-events-statements-current=ON
+loose-performance-schema-consumer-events-statements-history=ON
+loose-performance-schema-consumer-events-statements-history-long=ON
+loose-performance-schema-consumer-events-waits-current=ON
+loose-performance-schema-consumer-events-waits-history=ON
+loose-performance-schema-consumer-events-waits-history-long=ON
+loose-performance-schema-consumer-thread-instrumentation=ON
+
+binlog-direct-non-transactional-updates

=== modified file 'mysql-test/suite/perfschema/r/sizing_default.result'
--- a/mysql-test/suite/perfschema/r/sizing_default.result	2012-05-29 23:35:24 +0000
+++ b/mysql-test/suite/perfschema/r/sizing_default.result	2012-05-30 11:44:42 +0000
@@ -23,7 +23,7 @@ performance_schema_max_cond_classes	80
 performance_schema_max_cond_instances	836
 performance_schema_max_file_classes	50
 performance_schema_max_file_handles	32768
-performance_schema_max_file_instances	1112
+performance_schema_max_file_instances	1138
 performance_schema_max_mutex_classes	200
 performance_schema_max_mutex_instances	2393
 performance_schema_max_rwlock_classes	30
@@ -101,8 +101,8 @@ performance_schema	threads.row_size	1004
 performance_schema	threads.row_count	224
 performance_schema	threads.memory	2250752
 performance_schema	file_instances.row_size	768
-performance_schema	file_instances.row_count	1112
-performance_schema	file_instances.memory	854016
+performance_schema	file_instances.row_count	1138
+performance_schema	file_instances.memory	873984
 performance_schema	(pfs_file_handle).row_size	8
 performance_schema	(pfs_file_handle).row_count	32768
 performance_schema	(pfs_file_handle).memory	262144
@@ -204,10 +204,10 @@ performance_schema	events_statements_sum
 performance_schema	events_statements_summary_by_digest.memory	1280000
 performance_schema	(account_hash).count	2
 performance_schema	(account_hash).size	10
-performance_schema	(digest_hash).count	11
+performance_schema	(digest_hash).count	0
 performance_schema	(digest_hash).size	1000
-performance_schema	(filename_hash).count	135
-performance_schema	(filename_hash).size	1112
+performance_schema	(filename_hash).count	0
+performance_schema	(filename_hash).size	1138
 performance_schema	(host_hash).count	2
 performance_schema	(host_hash).size	20
 performance_schema	(setup_actor_hash).count	1
@@ -218,4 +218,4 @@ performance_schema	(table_share_hash).co
 performance_schema	(table_share_hash).size	445
 performance_schema	(user_hash).count	2
 performance_schema	(user_hash).size	5
-performance_schema	performance_schema.memory	37001824
+performance_schema	performance_schema.memory	37021792

=== added file 'mysql-test/suite/perfschema/r/sizing_high.result'
--- a/mysql-test/suite/perfschema/r/sizing_high.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/r/sizing_high.result	2012-05-30 11:44:42 +0000
@@ -0,0 +1,221 @@
+show variables like "table_definition_cache";
+Variable_name	Value
+table_definition_cache	801
+show variables like "table_open_cache";
+Variable_name	Value
+table_open_cache	2000
+show variables like "max_connections";
+Variable_name	Value
+max_connections	350
+show variables like "%performance_schema%";
+Variable_name	Value
+performance_schema	ON
+performance_schema_accounts_size	100
+performance_schema_digests_size	10000
+performance_schema_events_stages_history_long_size	10000
+performance_schema_events_stages_history_size	10
+performance_schema_events_statements_history_long_size	10000
+performance_schema_events_statements_history_size	10
+performance_schema_events_waits_history_long_size	10000
+performance_schema_events_waits_history_size	10
+performance_schema_hosts_size	100
+performance_schema_max_cond_classes	80
+performance_schema_max_cond_instances	3102
+performance_schema_max_file_classes	50
+performance_schema_max_file_handles	32768
+performance_schema_max_file_instances	2773
+performance_schema_max_mutex_classes	200
+performance_schema_max_mutex_instances	7906
+performance_schema_max_rwlock_classes	30
+performance_schema_max_rwlock_instances	5906
+performance_schema_max_socket_classes	10
+performance_schema_max_socket_instances	720
+performance_schema_max_stage_classes	150
+performance_schema_max_statement_classes	169
+performance_schema_max_table_handles	4000
+performance_schema_max_table_instances	12500
+performance_schema_max_thread_classes	50
+performance_schema_max_thread_instances	800
+performance_schema_setup_actors_size	100
+performance_schema_setup_objects_size	100
+performance_schema_users_size	100
+show status like "%performance_schema%";
+Variable_name	Value
+Performance_schema_accounts_lost	0
+Performance_schema_cond_classes_lost	0
+Performance_schema_cond_instances_lost	0
+Performance_schema_digest_lost	0
+Performance_schema_file_classes_lost	0
+Performance_schema_file_handles_lost	0
+Performance_schema_file_instances_lost	0
+Performance_schema_hosts_lost	0
+Performance_schema_locker_lost	0
+Performance_schema_mutex_classes_lost	0
+Performance_schema_mutex_instances_lost	0
+Performance_schema_rwlock_classes_lost	0
+Performance_schema_rwlock_instances_lost	0
+Performance_schema_socket_classes_lost	0
+Performance_schema_socket_instances_lost	0
+Performance_schema_stage_classes_lost	0
+Performance_schema_statement_classes_lost	0
+Performance_schema_table_handles_lost	0
+Performance_schema_table_instances_lost	0
+Performance_schema_thread_classes_lost	0
+Performance_schema_thread_instances_lost	0
+Performance_schema_users_lost	0
+show engine performance_schema status;
+Type	Name	Status
+performance_schema	events_waits_current.row_size	184
+performance_schema	events_waits_current.row_count	4800
+performance_schema	events_waits_history.row_size	184
+performance_schema	events_waits_history.row_count	8000
+performance_schema	events_waits_history.memory	1472000
+performance_schema	events_waits_history_long.row_size	184
+performance_schema	events_waits_history_long.row_count	10000
+performance_schema	events_waits_history_long.memory	1840000
+performance_schema	(pfs_mutex_class).row_size	256
+performance_schema	(pfs_mutex_class).row_count	200
+performance_schema	(pfs_mutex_class).memory	51200
+performance_schema	(pfs_rwlock_class).row_size	256
+performance_schema	(pfs_rwlock_class).row_count	30
+performance_schema	(pfs_rwlock_class).memory	7680
+performance_schema	(pfs_cond_class).row_size	192
+performance_schema	(pfs_cond_class).row_count	80
+performance_schema	(pfs_cond_class).memory	15360
+performance_schema	(pfs_thread_class).row_size	192
+performance_schema	(pfs_thread_class).row_count	50
+performance_schema	(pfs_thread_class).memory	9600
+performance_schema	(pfs_file_class).row_size	320
+performance_schema	(pfs_file_class).row_count	50
+performance_schema	(pfs_file_class).memory	16000
+performance_schema	mutex_instances.row_size	192
+performance_schema	mutex_instances.row_count	7906
+performance_schema	mutex_instances.memory	1517952
+performance_schema	rwlock_instances.row_size	192
+performance_schema	rwlock_instances.row_count	5906
+performance_schema	rwlock_instances.memory	1133952
+performance_schema	cond_instances.row_size	128
+performance_schema	cond_instances.row_count	3102
+performance_schema	cond_instances.memory	397056
+performance_schema	threads.row_size	10048
+performance_schema	threads.row_count	800
+performance_schema	threads.memory	8038400
+performance_schema	file_instances.row_size	768
+performance_schema	file_instances.row_count	2773
+performance_schema	file_instances.memory	2129664
+performance_schema	(pfs_file_handle).row_size	8
+performance_schema	(pfs_file_handle).row_count	32768
+performance_schema	(pfs_file_handle).memory	262144
+performance_schema	events_waits_summary_by_thread_by_event_name.row_size	32
+performance_schema	events_waits_summary_by_thread_by_event_name.row_count	298400
+performance_schema	events_waits_summary_by_thread_by_event_name.memory	9548800
+performance_schema	(pfs_table_share).row_size	22208
+performance_schema	(pfs_table_share).row_count	12500
+performance_schema	(pfs_table_share).memory	277600000
+performance_schema	(pfs_table).row_size	9280
+performance_schema	(pfs_table).row_count	4000
+performance_schema	(pfs_table).memory	37120000
+performance_schema	setup_actors.row_size	256
+performance_schema	setup_actors.row_count	100
+performance_schema	setup_actors.memory	25600
+performance_schema	setup_objects.row_size	448
+performance_schema	setup_objects.row_count	100
+performance_schema	setup_objects.memory	44800
+performance_schema	events_waits_summary_global_by_event_name.row_size	32
+performance_schema	events_waits_summary_global_by_event_name.row_count	373
+performance_schema	events_waits_summary_global_by_event_name.memory	11936
+performance_schema	(pfs_account).row_size	256
+performance_schema	(pfs_account).row_count	100
+performance_schema	(pfs_account).memory	25600
+performance_schema	events_waits_summary_by_account_by_event_name.row_size	32
+performance_schema	events_waits_summary_by_account_by_event_name.row_count	37300
+performance_schema	events_waits_summary_by_account_by_event_name.memory	1193600
+performance_schema	events_waits_summary_by_user_by_event_name.row_size	32
+performance_schema	events_waits_summary_by_user_by_event_name.row_count	37300
+performance_schema	events_waits_summary_by_user_by_event_name.memory	1193600
+performance_schema	events_waits_summary_by_host_by_event_name.row_size	32
+performance_schema	events_waits_summary_by_host_by_event_name.row_count	37300
+performance_schema	events_waits_summary_by_host_by_event_name.memory	1193600
+performance_schema	(pfs_user).row_size	128
+performance_schema	(pfs_user).row_count	100
+performance_schema	(pfs_user).memory	12800
+performance_schema	(pfs_host).row_size	192
+performance_schema	(pfs_host).row_count	100
+performance_schema	(pfs_host).memory	19200
+performance_schema	(pfs_stage_class).row_size	192
+performance_schema	(pfs_stage_class).row_count	150
+performance_schema	(pfs_stage_class).memory	28800
+performance_schema	events_stages_history.row_size	88
+performance_schema	events_stages_history.row_count	8000
+performance_schema	events_stages_history.memory	704000
+performance_schema	events_stages_history_long.row_size	88
+performance_schema	events_stages_history_long.row_count	10000
+performance_schema	events_stages_history_long.memory	880000
+performance_schema	events_stages_summary_by_thread_by_event_name.row_size	32
+performance_schema	events_stages_summary_by_thread_by_event_name.row_count	120000
+performance_schema	events_stages_summary_by_thread_by_event_name.memory	3840000
+performance_schema	events_stages_summary_global_by_event_name.row_size	32
+performance_schema	events_stages_summary_global_by_event_name.row_count	150
+performance_schema	events_stages_summary_global_by_event_name.memory	4800
+performance_schema	events_stages_summary_by_account_by_event_name.row_size	32
+performance_schema	events_stages_summary_by_account_by_event_name.row_count	15000
+performance_schema	events_stages_summary_by_account_by_event_name.memory	480000
+performance_schema	events_stages_summary_by_user_by_event_name.row_size	32
+performance_schema	events_stages_summary_by_user_by_event_name.row_count	15000
+performance_schema	events_stages_summary_by_user_by_event_name.memory	480000
+performance_schema	events_stages_summary_by_host_by_event_name.row_size	32
+performance_schema	events_stages_summary_by_host_by_event_name.row_count	15000
+performance_schema	events_stages_summary_by_host_by_event_name.memory	480000
+performance_schema	(pfs_statement_class).row_size	192
+performance_schema	(pfs_statement_class).row_count	169
+performance_schema	(pfs_statement_class).memory	32448
+performance_schema	events_statements_history.row_size	3024
+performance_schema	events_statements_history.row_count	8000
+performance_schema	events_statements_history.memory	24192000
+performance_schema	events_statements_history_long.row_size	3024
+performance_schema	events_statements_history_long.row_count	10000
+performance_schema	events_statements_history_long.memory	30240000
+performance_schema	events_statements_summary_by_thread_by_event_name.row_size	184
+performance_schema	events_statements_summary_by_thread_by_event_name.row_count	135200
+performance_schema	events_statements_summary_by_thread_by_event_name.memory	24876800
+performance_schema	events_statements_summary_global_by_event_name.row_size	184
+performance_schema	events_statements_summary_global_by_event_name.row_count	169
+performance_schema	events_statements_summary_global_by_event_name.memory	31096
+performance_schema	events_statements_summary_by_account_by_event_name.row_size	184
+performance_schema	events_statements_summary_by_account_by_event_name.row_count	16900
+performance_schema	events_statements_summary_by_account_by_event_name.memory	3109600
+performance_schema	events_statements_summary_by_user_by_event_name.row_size	184
+performance_schema	events_statements_summary_by_user_by_event_name.row_count	16900
+performance_schema	events_statements_summary_by_user_by_event_name.memory	3109600
+performance_schema	events_statements_summary_by_host_by_event_name.row_size	184
+performance_schema	events_statements_summary_by_host_by_event_name.row_count	16900
+performance_schema	events_statements_summary_by_host_by_event_name.memory	3109600
+performance_schema	events_statements_current.row_size	3024
+performance_schema	events_statements_current.row_count	800
+performance_schema	events_statements_current.memory	2419200
+performance_schema	(pfs_socket_class).row_size	320
+performance_schema	(pfs_socket_class).row_count	10
+performance_schema	(pfs_socket_class).memory	3200
+performance_schema	socket_instances.row_size	384
+performance_schema	socket_instances.row_count	720
+performance_schema	socket_instances.memory	276480
+performance_schema	events_statements_summary_by_digest.row_size	1280
+performance_schema	events_statements_summary_by_digest.row_count	10000
+performance_schema	events_statements_summary_by_digest.memory	12800000
+performance_schema	(account_hash).count	2
+performance_schema	(account_hash).size	100
+performance_schema	(digest_hash).count	0
+performance_schema	(digest_hash).size	10000
+performance_schema	(filename_hash).count	0
+performance_schema	(filename_hash).size	2773
+performance_schema	(host_hash).count	2
+performance_schema	(host_hash).size	100
+performance_schema	(setup_actor_hash).count	1
+performance_schema	(setup_actor_hash).size	100
+performance_schema	(setup_object_hash).count	4
+performance_schema	(setup_object_hash).size	100
+performance_schema	(table_share_hash).count	81
+performance_schema	(table_share_hash).size	12500
+performance_schema	(user_hash).count	2
+performance_schema	(user_hash).size	100
+performance_schema	performance_schema.memory	455978168

=== modified file 'mysql-test/suite/perfschema/r/sizing_low.result'
--- a/mysql-test/suite/perfschema/r/sizing_low.result	2012-05-29 23:35:24 +0000
+++ b/mysql-test/suite/perfschema/r/sizing_low.result	2012-05-30 11:44:42 +0000
@@ -3,10 +3,10 @@ Variable_name	Value
 table_definition_cache	400
 show variables like "table_open_cache";
 Variable_name	Value
-table_open_cache	400
+table_open_cache	100
 show variables like "max_connections";
 Variable_name	Value
-max_connections	151
+max_connections	50
 show variables like "%performance_schema%";
 Variable_name	Value
 performance_schema	ON
@@ -20,22 +20,22 @@ performance_schema_events_waits_history_
 performance_schema_events_waits_history_size	5
 performance_schema_hosts_size	20
 performance_schema_max_cond_classes	80
-performance_schema_max_cond_instances	836
+performance_schema_max_cond_instances	612
 performance_schema_max_file_classes	50
 performance_schema_max_file_handles	32768
-performance_schema_max_file_instances	1112
+performance_schema_max_file_instances	1138
 performance_schema_max_mutex_classes	200
-performance_schema_max_mutex_instances	2393
+performance_schema_max_mutex_instances	2056
 performance_schema_max_rwlock_classes	30
-performance_schema_max_rwlock_instances	1724
+performance_schema_max_rwlock_instances	1612
 performance_schema_max_socket_classes	10
-performance_schema_max_socket_instances	179
+performance_schema_max_socket_instances	67
 performance_schema_max_stage_classes	150
 performance_schema_max_statement_classes	169
 performance_schema_max_table_handles	112
 performance_schema_max_table_instances	445
 performance_schema_max_thread_classes	50
-performance_schema_max_thread_instances	224
+performance_schema_max_thread_instances	112
 performance_schema_setup_actors_size	100
 performance_schema_setup_objects_size	100
 performance_schema_users_size	5
@@ -66,10 +66,10 @@ Performance_schema_users_lost	0
 show engine performance_schema status;
 Type	Name	Status
 performance_schema	events_waits_current.row_size	184
-performance_schema	events_waits_current.row_count	1344
+performance_schema	events_waits_current.row_count	672
 performance_schema	events_waits_history.row_size	184
-performance_schema	events_waits_history.row_count	1120
-performance_schema	events_waits_history.memory	206080
+performance_schema	events_waits_history.row_count	560
+performance_schema	events_waits_history.memory	103040
 performance_schema	events_waits_history_long.row_size	184
 performance_schema	events_waits_history_long.row_count	100
 performance_schema	events_waits_history_long.memory	18400
@@ -89,26 +89,26 @@ performance_schema	(pfs_file_class).row_
 performance_schema	(pfs_file_class).row_count	50
 performance_schema	(pfs_file_class).memory	16000
 performance_schema	mutex_instances.row_size	192
-performance_schema	mutex_instances.row_count	2393
-performance_schema	mutex_instances.memory	459456
+performance_schema	mutex_instances.row_count	2056
+performance_schema	mutex_instances.memory	394752
 performance_schema	rwlock_instances.row_size	192
-performance_schema	rwlock_instances.row_count	1724
-performance_schema	rwlock_instances.memory	331008
+performance_schema	rwlock_instances.row_count	1612
+performance_schema	rwlock_instances.memory	309504
 performance_schema	cond_instances.row_size	128
-performance_schema	cond_instances.row_count	836
-performance_schema	cond_instances.memory	107008
+performance_schema	cond_instances.row_count	612
+performance_schema	cond_instances.memory	78336
 performance_schema	threads.row_size	10048
-performance_schema	threads.row_count	224
-performance_schema	threads.memory	2250752
+performance_schema	threads.row_count	112
+performance_schema	threads.memory	1125376
 performance_schema	file_instances.row_size	768
-performance_schema	file_instances.row_count	1112
-performance_schema	file_instances.memory	854016
+performance_schema	file_instances.row_count	1138
+performance_schema	file_instances.memory	873984
 performance_schema	(pfs_file_handle).row_size	8
 performance_schema	(pfs_file_handle).row_count	32768
 performance_schema	(pfs_file_handle).memory	262144
 performance_schema	events_waits_summary_by_thread_by_event_name.row_size	32
-performance_schema	events_waits_summary_by_thread_by_event_name.row_count	83552
-performance_schema	events_waits_summary_by_thread_by_event_name.memory	2673664
+performance_schema	events_waits_summary_by_thread_by_event_name.row_count	41776
+performance_schema	events_waits_summary_by_thread_by_event_name.memory	1336832
 performance_schema	(pfs_table_share).row_size	22208
 performance_schema	(pfs_table_share).row_count	445
 performance_schema	(pfs_table_share).memory	9882560
@@ -146,14 +146,14 @@ performance_schema	(pfs_stage_class).row
 performance_schema	(pfs_stage_class).row_count	150
 performance_schema	(pfs_stage_class).memory	28800
 performance_schema	events_stages_history.row_size	88
-performance_schema	events_stages_history.row_count	1120
-performance_schema	events_stages_history.memory	98560
+performance_schema	events_stages_history.row_count	560
+performance_schema	events_stages_history.memory	49280
 performance_schema	events_stages_history_long.row_size	88
 performance_schema	events_stages_history_long.row_count	100
 performance_schema	events_stages_history_long.memory	8800
 performance_schema	events_stages_summary_by_thread_by_event_name.row_size	32
-performance_schema	events_stages_summary_by_thread_by_event_name.row_count	33600
-performance_schema	events_stages_summary_by_thread_by_event_name.memory	1075200
+performance_schema	events_stages_summary_by_thread_by_event_name.row_count	16800
+performance_schema	events_stages_summary_by_thread_by_event_name.memory	537600
 performance_schema	events_stages_summary_global_by_event_name.row_size	32
 performance_schema	events_stages_summary_global_by_event_name.row_count	150
 performance_schema	events_stages_summary_global_by_event_name.memory	4800
@@ -170,14 +170,14 @@ performance_schema	(pfs_statement_class)
 performance_schema	(pfs_statement_class).row_count	169
 performance_schema	(pfs_statement_class).memory	32448
 performance_schema	events_statements_history.row_size	3024
-performance_schema	events_statements_history.row_count	1120
-performance_schema	events_statements_history.memory	3386880
+performance_schema	events_statements_history.row_count	560
+performance_schema	events_statements_history.memory	1693440
 performance_schema	events_statements_history_long.row_size	3024
 performance_schema	events_statements_history_long.row_count	100
 performance_schema	events_statements_history_long.memory	302400
 performance_schema	events_statements_summary_by_thread_by_event_name.row_size	184
-performance_schema	events_statements_summary_by_thread_by_event_name.row_count	37856
-performance_schema	events_statements_summary_by_thread_by_event_name.memory	6965504
+performance_schema	events_statements_summary_by_thread_by_event_name.row_count	18928
+performance_schema	events_statements_summary_by_thread_by_event_name.memory	3482752
 performance_schema	events_statements_summary_global_by_event_name.row_size	184
 performance_schema	events_statements_summary_global_by_event_name.row_count	169
 performance_schema	events_statements_summary_global_by_event_name.memory	31096
@@ -191,23 +191,23 @@ performance_schema	events_statements_sum
 performance_schema	events_statements_summary_by_host_by_event_name.row_count	3380
 performance_schema	events_statements_summary_by_host_by_event_name.memory	621920
 performance_schema	events_statements_current.row_size	3024
-performance_schema	events_statements_current.row_count	224
-performance_schema	events_statements_current.memory	677376
+performance_schema	events_statements_current.row_count	112
+performance_schema	events_statements_current.memory	338688
 performance_schema	(pfs_socket_class).row_size	320
 performance_schema	(pfs_socket_class).row_count	10
 performance_schema	(pfs_socket_class).memory	3200
 performance_schema	socket_instances.row_size	384
-performance_schema	socket_instances.row_count	179
-performance_schema	socket_instances.memory	68736
+performance_schema	socket_instances.row_count	67
+performance_schema	socket_instances.memory	25728
 performance_schema	events_statements_summary_by_digest.row_size	1280
 performance_schema	events_statements_summary_by_digest.row_count	1000
 performance_schema	events_statements_summary_by_digest.memory	1280000
 performance_schema	(account_hash).count	2
 performance_schema	(account_hash).size	10
-performance_schema	(digest_hash).count	11
+performance_schema	(digest_hash).count	0
 performance_schema	(digest_hash).size	1000
-performance_schema	(filename_hash).count	135
-performance_schema	(filename_hash).size	1112
+performance_schema	(filename_hash).count	0
+performance_schema	(filename_hash).size	1138
 performance_schema	(host_hash).count	2
 performance_schema	(host_hash).size	20
 performance_schema	(setup_actor_hash).count	1
@@ -218,4 +218,4 @@ performance_schema	(table_share_hash).co
 performance_schema	(table_share_hash).size	445
 performance_schema	(user_hash).count	2
 performance_schema	(user_hash).size	5
-performance_schema	performance_schema.memory	33911584
+performance_schema	performance_schema.memory	25106656

=== added file 'mysql-test/suite/perfschema/r/sizing_med.result'
--- a/mysql-test/suite/perfschema/r/sizing_med.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/r/sizing_med.result	2012-05-30 11:44:42 +0000
@@ -0,0 +1,221 @@
+show variables like "table_definition_cache";
+Variable_name	Value
+table_definition_cache	401
+show variables like "table_open_cache";
+Variable_name	Value
+table_open_cache	401
+show variables like "max_connections";
+Variable_name	Value
+max_connections	152
+show variables like "%performance_schema%";
+Variable_name	Value
+performance_schema	ON
+performance_schema_accounts_size	100
+performance_schema_digests_size	5000
+performance_schema_events_stages_history_long_size	1000
+performance_schema_events_stages_history_size	10
+performance_schema_events_statements_history_long_size	1000
+performance_schema_events_statements_history_size	10
+performance_schema_events_waits_history_long_size	1000
+performance_schema_events_waits_history_size	10
+performance_schema_hosts_size	100
+performance_schema_max_cond_classes	80
+performance_schema_max_cond_instances	1079
+performance_schema_max_file_classes	50
+performance_schema_max_file_handles	32768
+performance_schema_max_file_instances	1280
+performance_schema_max_mutex_classes	200
+performance_schema_max_mutex_instances	3085
+performance_schema_max_rwlock_classes	30
+performance_schema_max_rwlock_instances	2222
+performance_schema_max_socket_classes	10
+performance_schema_max_socket_instances	232
+performance_schema_max_stage_classes	150
+performance_schema_max_statement_classes	169
+performance_schema_max_table_handles	573
+performance_schema_max_table_instances	556
+performance_schema_max_thread_classes	50
+performance_schema_max_thread_instances	289
+performance_schema_setup_actors_size	100
+performance_schema_setup_objects_size	100
+performance_schema_users_size	100
+show status like "%performance_schema%";
+Variable_name	Value
+Performance_schema_accounts_lost	0
+Performance_schema_cond_classes_lost	0
+Performance_schema_cond_instances_lost	0
+Performance_schema_digest_lost	0
+Performance_schema_file_classes_lost	0
+Performance_schema_file_handles_lost	0
+Performance_schema_file_instances_lost	0
+Performance_schema_hosts_lost	0
+Performance_schema_locker_lost	0
+Performance_schema_mutex_classes_lost	0
+Performance_schema_mutex_instances_lost	0
+Performance_schema_rwlock_classes_lost	0
+Performance_schema_rwlock_instances_lost	0
+Performance_schema_socket_classes_lost	0
+Performance_schema_socket_instances_lost	0
+Performance_schema_stage_classes_lost	0
+Performance_schema_statement_classes_lost	0
+Performance_schema_table_handles_lost	0
+Performance_schema_table_instances_lost	0
+Performance_schema_thread_classes_lost	0
+Performance_schema_thread_instances_lost	0
+Performance_schema_users_lost	0
+show engine performance_schema status;
+Type	Name	Status
+performance_schema	events_waits_current.row_size	184
+performance_schema	events_waits_current.row_count	1734
+performance_schema	events_waits_history.row_size	184
+performance_schema	events_waits_history.row_count	2890
+performance_schema	events_waits_history.memory	531760
+performance_schema	events_waits_history_long.row_size	184
+performance_schema	events_waits_history_long.row_count	1000
+performance_schema	events_waits_history_long.memory	184000
+performance_schema	(pfs_mutex_class).row_size	256
+performance_schema	(pfs_mutex_class).row_count	200
+performance_schema	(pfs_mutex_class).memory	51200
+performance_schema	(pfs_rwlock_class).row_size	256
+performance_schema	(pfs_rwlock_class).row_count	30
+performance_schema	(pfs_rwlock_class).memory	7680
+performance_schema	(pfs_cond_class).row_size	192
+performance_schema	(pfs_cond_class).row_count	80
+performance_schema	(pfs_cond_class).memory	15360
+performance_schema	(pfs_thread_class).row_size	192
+performance_schema	(pfs_thread_class).row_count	50
+performance_schema	(pfs_thread_class).memory	9600
+performance_schema	(pfs_file_class).row_size	320
+performance_schema	(pfs_file_class).row_count	50
+performance_schema	(pfs_file_class).memory	16000
+performance_schema	mutex_instances.row_size	192
+performance_schema	mutex_instances.row_count	3085
+performance_schema	mutex_instances.memory	592320
+performance_schema	rwlock_instances.row_size	192
+performance_schema	rwlock_instances.row_count	2222
+performance_schema	rwlock_instances.memory	426624
+performance_schema	cond_instances.row_size	128
+performance_schema	cond_instances.row_count	1079
+performance_schema	cond_instances.memory	138112
+performance_schema	threads.row_size	10048
+performance_schema	threads.row_count	289
+performance_schema	threads.memory	2903872
+performance_schema	file_instances.row_size	768
+performance_schema	file_instances.row_count	1280
+performance_schema	file_instances.memory	983040
+performance_schema	(pfs_file_handle).row_size	8
+performance_schema	(pfs_file_handle).row_count	32768
+performance_schema	(pfs_file_handle).memory	262144
+performance_schema	events_waits_summary_by_thread_by_event_name.row_size	32
+performance_schema	events_waits_summary_by_thread_by_event_name.row_count	107797
+performance_schema	events_waits_summary_by_thread_by_event_name.memory	3449504
+performance_schema	(pfs_table_share).row_size	22208
+performance_schema	(pfs_table_share).row_count	556
+performance_schema	(pfs_table_share).memory	12347648
+performance_schema	(pfs_table).row_size	9280
+performance_schema	(pfs_table).row_count	573
+performance_schema	(pfs_table).memory	5317440
+performance_schema	setup_actors.row_size	256
+performance_schema	setup_actors.row_count	100
+performance_schema	setup_actors.memory	25600
+performance_schema	setup_objects.row_size	448
+performance_schema	setup_objects.row_count	100
+performance_schema	setup_objects.memory	44800
+performance_schema	events_waits_summary_global_by_event_name.row_size	32
+performance_schema	events_waits_summary_global_by_event_name.row_count	373
+performance_schema	events_waits_summary_global_by_event_name.memory	11936
+performance_schema	(pfs_account).row_size	256
+performance_schema	(pfs_account).row_count	100
+performance_schema	(pfs_account).memory	25600
+performance_schema	events_waits_summary_by_account_by_event_name.row_size	32
+performance_schema	events_waits_summary_by_account_by_event_name.row_count	37300
+performance_schema	events_waits_summary_by_account_by_event_name.memory	1193600
+performance_schema	events_waits_summary_by_user_by_event_name.row_size	32
+performance_schema	events_waits_summary_by_user_by_event_name.row_count	37300
+performance_schema	events_waits_summary_by_user_by_event_name.memory	1193600
+performance_schema	events_waits_summary_by_host_by_event_name.row_size	32
+performance_schema	events_waits_summary_by_host_by_event_name.row_count	37300
+performance_schema	events_waits_summary_by_host_by_event_name.memory	1193600
+performance_schema	(pfs_user).row_size	128
+performance_schema	(pfs_user).row_count	100
+performance_schema	(pfs_user).memory	12800
+performance_schema	(pfs_host).row_size	192
+performance_schema	(pfs_host).row_count	100
+performance_schema	(pfs_host).memory	19200
+performance_schema	(pfs_stage_class).row_size	192
+performance_schema	(pfs_stage_class).row_count	150
+performance_schema	(pfs_stage_class).memory	28800
+performance_schema	events_stages_history.row_size	88
+performance_schema	events_stages_history.row_count	2890
+performance_schema	events_stages_history.memory	254320
+performance_schema	events_stages_history_long.row_size	88
+performance_schema	events_stages_history_long.row_count	1000
+performance_schema	events_stages_history_long.memory	88000
+performance_schema	events_stages_summary_by_thread_by_event_name.row_size	32
+performance_schema	events_stages_summary_by_thread_by_event_name.row_count	43350
+performance_schema	events_stages_summary_by_thread_by_event_name.memory	1387200
+performance_schema	events_stages_summary_global_by_event_name.row_size	32
+performance_schema	events_stages_summary_global_by_event_name.row_count	150
+performance_schema	events_stages_summary_global_by_event_name.memory	4800
+performance_schema	events_stages_summary_by_account_by_event_name.row_size	32
+performance_schema	events_stages_summary_by_account_by_event_name.row_count	15000
+performance_schema	events_stages_summary_by_account_by_event_name.memory	480000
+performance_schema	events_stages_summary_by_user_by_event_name.row_size	32
+performance_schema	events_stages_summary_by_user_by_event_name.row_count	15000
+performance_schema	events_stages_summary_by_user_by_event_name.memory	480000
+performance_schema	events_stages_summary_by_host_by_event_name.row_size	32
+performance_schema	events_stages_summary_by_host_by_event_name.row_count	15000
+performance_schema	events_stages_summary_by_host_by_event_name.memory	480000
+performance_schema	(pfs_statement_class).row_size	192
+performance_schema	(pfs_statement_class).row_count	169
+performance_schema	(pfs_statement_class).memory	32448
+performance_schema	events_statements_history.row_size	3024
+performance_schema	events_statements_history.row_count	2890
+performance_schema	events_statements_history.memory	8739360
+performance_schema	events_statements_history_long.row_size	3024
+performance_schema	events_statements_history_long.row_count	1000
+performance_schema	events_statements_history_long.memory	3024000
+performance_schema	events_statements_summary_by_thread_by_event_name.row_size	184
+performance_schema	events_statements_summary_by_thread_by_event_name.row_count	48841
+performance_schema	events_statements_summary_by_thread_by_event_name.memory	8986744
+performance_schema	events_statements_summary_global_by_event_name.row_size	184
+performance_schema	events_statements_summary_global_by_event_name.row_count	169
+performance_schema	events_statements_summary_global_by_event_name.memory	31096
+performance_schema	events_statements_summary_by_account_by_event_name.row_size	184
+performance_schema	events_statements_summary_by_account_by_event_name.row_count	16900
+performance_schema	events_statements_summary_by_account_by_event_name.memory	3109600
+performance_schema	events_statements_summary_by_user_by_event_name.row_size	184
+performance_schema	events_statements_summary_by_user_by_event_name.row_count	16900
+performance_schema	events_statements_summary_by_user_by_event_name.memory	3109600
+performance_schema	events_statements_summary_by_host_by_event_name.row_size	184
+performance_schema	events_statements_summary_by_host_by_event_name.row_count	16900
+performance_schema	events_statements_summary_by_host_by_event_name.memory	3109600
+performance_schema	events_statements_current.row_size	3024
+performance_schema	events_statements_current.row_count	289
+performance_schema	events_statements_current.memory	873936
+performance_schema	(pfs_socket_class).row_size	320
+performance_schema	(pfs_socket_class).row_count	10
+performance_schema	(pfs_socket_class).memory	3200
+performance_schema	socket_instances.row_size	384
+performance_schema	socket_instances.row_count	232
+performance_schema	socket_instances.memory	89088
+performance_schema	events_statements_summary_by_digest.row_size	1280
+performance_schema	events_statements_summary_by_digest.row_count	5000
+performance_schema	events_statements_summary_by_digest.memory	6400000
+performance_schema	(account_hash).count	2
+performance_schema	(account_hash).size	100
+performance_schema	(digest_hash).count	0
+performance_schema	(digest_hash).size	5000
+performance_schema	(filename_hash).count	0
+performance_schema	(filename_hash).size	1280
+performance_schema	(host_hash).count	2
+performance_schema	(host_hash).size	100
+performance_schema	(setup_actor_hash).count	1
+performance_schema	(setup_actor_hash).size	100
+performance_schema	(setup_object_hash).count	4
+performance_schema	(setup_object_hash).size	100
+performance_schema	(table_share_hash).count	81
+performance_schema	(table_share_hash).size	556
+performance_schema	(user_hash).count	2
+performance_schema	(user_hash).size	100
+performance_schema	performance_schema.memory	71668832

=== modified file 'mysql-test/suite/perfschema/t/sizing_default.cnf'
--- a/mysql-test/suite/perfschema/t/sizing_default.cnf	2012-05-25 13:22:34 +0000
+++ b/mysql-test/suite/perfschema/t/sizing_default.cnf	2012-05-30 11:44:42 +0000
@@ -1,5 +1,5 @@
 
-!include include/default_mysqld.cnf
+!include include/default_mysqld_autosize.cnf
 
 [mysqld.1]
 
@@ -7,6 +7,7 @@
 table_definition_cache=400
 table_open_cache=400
 max_connections=151
+open_files_limit=1024
 
 # Automated sizing for everything
 

=== added file 'mysql-test/suite/perfschema/t/sizing_high.cnf'
--- a/mysql-test/suite/perfschema/t/sizing_high.cnf	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/t/sizing_high.cnf	2012-05-30 11:44:42 +0000
@@ -0,0 +1,33 @@
+
+!include include/default_mysqld_autosize.cnf
+
+[mysqld.1]
+
+table_definition_cache=801
+table_open_cache=2000
+max_connections=350
+open_files_limit=1024
+
+# Automated sizing for everything
+
+loose-performance-schema-accounts-size=-1
+loose-performance-schema-digests-size=-1
+loose-performance-schema-hosts-size=-1
+loose-performance-schema-users-size=-1
+
+loose-performance-schema-events-waits-history-size=-1
+loose-performance-schema-events-waits-history-long-size=-1
+loose-performance-schema-events-stages-history-size=-1
+loose-performance-schema-events-stages-history-long-size=-1
+loose-performance-schema-events-statements-history-size=-1
+loose-performance-schema-events-statements-history-long-size=-1
+
+loose-performance-schema-max-mutex-instances=-1
+loose-performance-schema-max-rwlock-instances=-1
+loose-performance-schema-max-cond-instances=-1
+loose-performance-schema-max-file-instances=-1
+loose-performance-schema-max-socket-instances=-1
+loose-performance-schema-max-thread-instances=-1
+loose-performance-schema-max-table-instances=-1
+loose-performance-schema-max-table-handles=-1
+

=== added file 'mysql-test/suite/perfschema/t/sizing_high.test'
--- a/mysql-test/suite/perfschema/t/sizing_high.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/t/sizing_high.test	2012-05-30 11:44:42 +0000
@@ -0,0 +1,7 @@
+
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+--source include/have_64bit.inc
+
+--source ../include/sizing_auto.inc
+

=== modified file 'mysql-test/suite/perfschema/t/sizing_low.cnf'
--- a/mysql-test/suite/perfschema/t/sizing_low.cnf	2012-05-25 13:22:34 +0000
+++ b/mysql-test/suite/perfschema/t/sizing_low.cnf	2012-05-30 11:44:42 +0000
@@ -1,10 +1,12 @@
 
-!include include/default_mysqld.cnf
+!include include/default_mysqld_autosize.cnf
 
 [mysqld.1]
 
 table_definition_cache=400
 table_open_cache=100
+max_connections=50
+open_files_limit=1024
 
 # Automated sizing for everything
 

=== added file 'mysql-test/suite/perfschema/t/sizing_med.cnf'
--- a/mysql-test/suite/perfschema/t/sizing_med.cnf	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/t/sizing_med.cnf	2012-05-30 11:44:42 +0000
@@ -0,0 +1,33 @@
+
+!include include/default_mysqld_autosize.cnf
+
+[mysqld.1]
+
+table_definition_cache=401
+table_open_cache=401
+max_connections=152
+open_files_limit=1024
+
+# Automated sizing for everything
+
+loose-performance-schema-accounts-size=-1
+loose-performance-schema-digests-size=-1
+loose-performance-schema-hosts-size=-1
+loose-performance-schema-users-size=-1
+
+loose-performance-schema-events-waits-history-size=-1
+loose-performance-schema-events-waits-history-long-size=-1
+loose-performance-schema-events-stages-history-size=-1
+loose-performance-schema-events-stages-history-long-size=-1
+loose-performance-schema-events-statements-history-size=-1
+loose-performance-schema-events-statements-history-long-size=-1
+
+loose-performance-schema-max-mutex-instances=-1
+loose-performance-schema-max-rwlock-instances=-1
+loose-performance-schema-max-cond-instances=-1
+loose-performance-schema-max-file-instances=-1
+loose-performance-schema-max-socket-instances=-1
+loose-performance-schema-max-thread-instances=-1
+loose-performance-schema-max-table-instances=-1
+loose-performance-schema-max-table-handles=-1
+

=== added file 'mysql-test/suite/perfschema/t/sizing_med.test'
--- a/mysql-test/suite/perfschema/t/sizing_med.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/t/sizing_med.test	2012-05-30 11:44:42 +0000
@@ -0,0 +1,7 @@
+
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+--source include/have_64bit.inc
+
+--source ../include/sizing_auto.inc
+

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2012-05-29 23:35:24 +0000
+++ b/sql/mysqld.cc	2012-05-30 11:44:42 +0000
@@ -493,6 +493,7 @@ ulong tc_heuristic_recover= 0;
 int32 thread_running;
 ulong thread_created;
 ulong back_log, connect_timeout, concurrency, server_id;
+ulong deprecated_table_cache_size;
 ulong table_cache_size, table_def_size;
 ulong table_cache_instances;
 ulong table_cache_size_per_instance;
@@ -3645,6 +3646,8 @@ int init_common_variables()
     {
       if (!open_files_limit)
       {
+        DBUG_ASSERT(false);
+
         /*
           If we have requested too much file handles than we bring
           max_connections in supported bounds.
@@ -6466,6 +6469,16 @@ void adjust_related_options()
   /* In bootstrap, disable grant tables (we are about to create them) */
   if (opt_bootstrap)
     opt_noacl= 1;
+
+  /*
+    For handle_options(), --table-cache and --table-open-cache
+    are distinct configuration parameters, and should not point to
+    the same global variable table_cache_size.
+    Use deprecated --table-cache if no value was given in --table-open-cache.
+  */
+  if ((table_cache_size == TABLE_OPEN_CACHE_DEFAULT) &&
+      (deprecated_table_cache_size != TABLE_OPEN_CACHE_DEFAULT))
+     table_cache_size= deprecated_table_cache_size;
 }
 
 vector<my_option> all_options;
@@ -6489,6 +6502,9 @@ struct my_option my_long_early_options[]
    &opt_verbose, &opt_verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"version", 'V', "Output version information and exit.", 0, 0, 0, GET_NO_ARG,
    NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"table_cache", 0, "Deprecated; use --table-open-cache instead.",
+   &deprecated_table_cache_size, &deprecated_table_cache_size, 0, GET_ULONG,
+   REQUIRED_ARG, TABLE_OPEN_CACHE_DEFAULT, 1, 512*1024L, 0, 1, 0},
   {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
 };
 
@@ -6857,9 +6873,6 @@ struct my_option my_long_options[]=
    "Multiple --plugin-load-add are supported.",
    0, 0, 0,
    GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
-  {"table_cache", 0, "Deprecated; use --table-open-cache instead.",
-   &table_cache_size, &table_cache_size, 0, GET_ULONG,
-   REQUIRED_ARG, TABLE_OPEN_CACHE_DEFAULT, 1, 512*1024L, 0, 1, 0},
   {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
 };
 

=== modified file 'sql/mysqld.h'
--- a/sql/mysqld.h	2012-05-29 23:35:24 +0000
+++ b/sql/mysqld.h	2012-05-30 11:44:42 +0000
@@ -183,6 +183,7 @@ extern ulong delayed_rows_in_use,delayed
 extern int32 slave_open_temp_tables;
 extern ulong query_cache_size, query_cache_min_res_unit;
 extern ulong slow_launch_threads, slow_launch_time;
+extern ulong deprecated_table_cache_size;
 extern ulong table_cache_size, table_def_size;
 extern ulong table_cache_size_per_instance, table_cache_instances;
 extern MYSQL_PLUGIN_IMPORT ulong max_connections;

=== modified file 'sql/sys_vars.cc'
--- a/sql/sys_vars.cc	2012-05-29 23:35:24 +0000
+++ b/sql/sys_vars.cc	2012-05-30 11:44:42 +0000
@@ -2834,7 +2834,15 @@ static Sys_var_ulong Sys_table_cache_ins
        "table_open_cache_instances", "The number of table cache instances",
        READ_ONLY GLOBAL_VAR(table_cache_instances), CMD_LINE(REQUIRED_ARG),
        VALID_RANGE(1, Table_cache_manager::MAX_TABLE_CACHES), DEFAULT(1),
-       BLOCK_SIZE(1));
+       BLOCK_SIZE(1), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(NULL),
+       ON_UPDATE(NULL), NULL,
+       /*
+         table_open_cache is used as a sizing hint by the performance schema,
+         and 'table_open_cache' is a prefix of 'table_open_cache_instances'.
+         Is is better to keep these options together, to avoid confusing
+         handle_options() with partial name matches.
+       */
+       sys_var::PARSE_EARLY);
 
 static Sys_var_ulong Sys_thread_cache_size(
        "thread_cache_size",

=== modified file 'storage/perfschema/pfs_autosize.cc'
--- a/storage/perfschema/pfs_autosize.cc	2012-05-25 16:14:57 +0000
+++ b/storage/perfschema/pfs_autosize.cc	2012-05-30 11:44:42 +0000
@@ -22,6 +22,10 @@
 #include "sql_const.h"
 #include "pfs_server.h"
 
+#include <algorithm>
+using std::min;
+using std::max;
+
 static const ulong fixed_mutex_instances= 500;
 static const ulong fixed_rwlock_instances= 200;
 static const ulong fixed_cond_instances= 50;
@@ -53,35 +57,76 @@ static const ulong thread_per_share= 0;
 struct PFS_sizing_data
 {
   const char* m_name;
+  /** Default value for @c PFS_param.m_account_sizing. */
   ulong m_account_sizing;
+  /** Default value for @c PFS_param.m_user_sizing. */
   ulong m_user_sizing;
+  /** Default value for @c PFS_param.m_host_sizing. */
   ulong m_host_sizing;
 
+  /** Default value for @c PFS_param.m_events_waits_history_sizing. */
   ulong m_events_waits_history_sizing;
+  /** Default value for @c PFS_param.m_events_waits_history_long_sizing. */
   ulong m_events_waits_history_long_sizing;
+  /** Default value for @c PFS_param.m_events_stages_history_sizing. */
   ulong m_events_stages_history_sizing;
+  /** Default value for @c PFS_param.m_events_stages_history_long_sizing. */
   ulong m_events_stages_history_long_sizing;
+  /** Default value for @c PFS_param.m_events_statements_history_sizing. */
   ulong m_events_statements_history_sizing;
+  /** Default value for @c PFS_param.m_events_statements_history_long_sizing. */
   ulong m_events_statements_history_long_sizing;
+  /** Default value for @c PFS_param.m_digest_sizing. */
   ulong m_digest_sizing;
 
-  ulong m_max_number_of_tables;
+  /**
+    Minimum number of tables to keep statistics for.
+    On small deployments, all the tables can fit into the table definition cache,
+    and this value can be 0.
+    On big deployments, the table definition cache is only a subset of all the tables
+    in the database, which are accounted for here.
+  */
+  ulong m_min_number_of_tables;
 
+  /**
+    Load factor for 'volatile' objects (mutexes, table handles, ...).
+    Instrumented objects that:
+    - use little memory
+    - are created/destroyed very frequently
+    should be stored in a low density (mostly empty) memory buffer,
+    to optimize for speed.
+  */
   float m_load_factor_volatile;
+  /**
+    Load factor for 'normal' objects (files).
+    Instrumented objects that:
+    - use a medium amount of memory
+    - are created/destroyed 
+    should be stored in a medium density memory buffer,
+    as a trade off between space and speed.
+  */
   float m_load_factor_normal;
+  /**
+    Load factor for 'static' objects (table shares).
+    Instrumented objects that:
+    - use a lot of memory
+    - are created/destroyed very rarely
+    can be stored in a high density (mostly packed) memory buffer,
+    to optimize for space.
+  */
   float m_load_factor_static;
 };
 
 PFS_sizing_data tiny_data=
 {
   "HEURISTIC 1",
-  /* account / user / host */
+  /* Account / user / host */
   10, 5, 20,
-  /* history sizes */
+  /* History sizes */
   5, 100, 5, 100, 5, 100,
-  /* digests */
+  /* Digests */
   1000,
-  /* Max tables */
+  /* Min tables */
   200,
   /* Load factors */
   0.90, 0.90, 0.90
@@ -90,13 +135,13 @@ PFS_sizing_data tiny_data=
 PFS_sizing_data medium_data=
 {
   "HEURISTIC 2",
-  /* account / user / host */
+  /* Account / user / host */
   100, 100, 100,
-  /* history sizes */
+  /* History sizes */
   10, 1000, 10, 1000, 10, 1000,
-  /* digests */
+  /* Digests */
   5000,
-  /* Max tables */
+  /* Min tables */
   500,
   /* Load factors */
   0.70, 0.80, 0.90
@@ -105,27 +150,27 @@ PFS_sizing_data medium_data=
 PFS_sizing_data big_data=
 {
   "HEURISTIC 3",
-  /* account / user / host */
+  /* Account / user / host */
   100, 100, 100,
-  /* history sizes */
+  /* History sizes */
   10, 10000, 10, 10000, 10, 10000,
-  /* digests */
+  /* Digests */
   10000,
-  /* Max tables */
+  /* Min tables */
   10000,
   /* Load factors */
   0.50, 0.65, 0.80
 };
 
-void enforce_range_long(long *value, long min, long max)
+void enforce_range_long(long *value, long min_value, long max_value)
 {
-  if (*value < min)
+  if (*value < min_value)
   {
-    *value = min;
+    *value = min_value;
   }
-  else if (*value > max)
+  else if (*value > max_value)
   {
-    *value = max;
+    *value = max_value;
   }
 }
 
@@ -151,13 +196,13 @@ PFS_sizing_data *estimate_hints(PFS_glob
       (param->m_hints.m_table_definition_cache <= TABLE_DEF_CACHE_DEFAULT) &&
       (param->m_hints.m_table_open_cache <= TABLE_OPEN_CACHE_DEFAULT))
   {
-    /* The my.cnf used is either unchanged, or lower that factory defaults. */
+    /* The my.cnf used is either unchanged, or lower than factory defaults. */
     return & tiny_data;
   }
 
-  if ((param->m_hints.m_max_connections <= MAX_CONNECTIONS_DEFAULT * 5) &&
-      (param->m_hints.m_table_definition_cache <= TABLE_DEF_CACHE_DEFAULT * 5) &&
-      (param->m_hints.m_table_open_cache <= TABLE_OPEN_CACHE_DEFAULT * 5))
+  if ((param->m_hints.m_max_connections <= MAX_CONNECTIONS_DEFAULT * 2) &&
+      (param->m_hints.m_table_definition_cache <= TABLE_DEF_CACHE_DEFAULT * 2) &&
+      (param->m_hints.m_table_open_cache <= TABLE_OPEN_CACHE_DEFAULT * 2))
   {
     /* Some defaults have been increased, to "moderate" values. */
     return & medium_data;
@@ -169,13 +214,14 @@ PFS_sizing_data *estimate_hints(PFS_glob
 
 static void apply_heuristic(PFS_global_param *p, PFS_sizing_data *h)
 {
+  ulong count;
   ulong con = p->m_hints.m_max_connections;
   ulong handle = p->m_hints.m_table_open_cache;
   ulong share = p->m_hints.m_table_definition_cache;
+  ulong file = p->m_hints.m_open_files_limit;
 
   if (p->m_table_sizing < 0)
   {
-    ulong count;
     count= handle;
 
     p->m_table_sizing= apply_load_factor(count, h->m_load_factor_volatile);
@@ -183,14 +229,12 @@ static void apply_heuristic(PFS_global_p
 
   if (p->m_table_share_sizing < 0)
   {
-    ulong count;
     count= share;
 
+    count= max<ulong>(count, h->m_min_number_of_tables);
     p->m_table_share_sizing= apply_load_factor(count, h->m_load_factor_static);
   }
 
-
-
   if (p->m_account_sizing < 0)
   {
     p->m_account_sizing= h->m_account_sizing;
@@ -243,7 +287,6 @@ static void apply_heuristic(PFS_global_p
 
   if (p->m_mutex_sizing < 0)
   {
-    ulong count;
     count= fixed_mutex_instances
       + con * mutex_per_connection
       + handle * mutex_per_handle
@@ -255,7 +298,6 @@ static void apply_heuristic(PFS_global_p
 
   if (p->m_rwlock_sizing < 0)
   {
-    ulong count;
     count= fixed_rwlock_instances
       + con * rwlock_per_connection
       + handle * rwlock_per_handle
@@ -279,19 +321,18 @@ static void apply_heuristic(PFS_global_p
 
   if (p->m_file_sizing < 0)
   {
-    ulong count;
     count= fixed_file_instances
       + con * file_per_connection
       + handle * file_per_handle
       + share * file_per_share
       ;
 
+    count= max<ulong>(count, file);
     p->m_file_sizing= apply_load_factor(count, h->m_load_factor_normal);
   }
 
   if (p->m_socket_sizing < 0)
   {
-    ulong count;
     count= fixed_socket_instances
       + con * socket_per_connection
       + handle * socket_per_handle
@@ -303,7 +344,6 @@ static void apply_heuristic(PFS_global_p
 
   if (p->m_thread_sizing < 0)
   {
-    ulong count;
     count= fixed_thread_instances
       + con * thread_per_connection
       + handle * thread_per_handle
@@ -312,7 +352,6 @@ static void apply_heuristic(PFS_global_p
 
     p->m_thread_sizing= apply_load_factor(count, h->m_load_factor_volatile);
   }
-
 }
 
 void pfs_automated_sizing(PFS_global_param *param)

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk-wl6135 branch (marc.alff:3791 to 3792) WL#6135Marc Alff30 May