List:Commits« Previous MessageNext Message »
From:Marc Alff Date:May 25 2012 7:53am
Subject:bzr push into mysql-trunk-wl6135 branch (marc.alff:3783 to 3784) WL#6135
View as plain text  
 3784 Marc Alff	2012-05-25
      WL#6135 PERFORMANCE SCHEMA ENABLED BY DEFAULT
      
      Work in progress

    added:
      storage/perfschema/pfs_autosize.cc
    modified:
      .bzr-mysql/default.conf
      mysql-test/include/default_mysqld.cnf
      mysql-test/r/mysqld--help-notwin.result
      sql/mysqld.cc
      sql/sys_vars.cc
      storage/perfschema/CMakeLists.txt
      storage/perfschema/pfs_server.cc
      storage/perfschema/pfs_server.h
 3783 Nuno Carvalho	2012-05-24
      BUG#14021292 - 65152: MYSQL CAN'T START IF RELAY LOGS ARE REMOVED AND SKIP_SLAVE_START = 0
      
      Updated rpl.rpl_binlog_index to new slave start behaviour, when relay 
      log file name is changed directly on mysql.slave_relay_log_info table
      after a missing relay log file error a server restart is required.

    modified:
      mysql-test/suite/rpl/t/rpl_binlog_index.test
=== modified file '.bzr-mysql/default.conf'
--- a/.bzr-mysql/default.conf	2012-05-23 10:06:12 +0000
+++ b/.bzr-mysql/default.conf	2012-05-25 07:53:01 +0000
@@ -1,4 +1,4 @@
 [MYSQL]
 post_commit_to = "commits@stripped"
 post_push_to = "commits@stripped"
-tree_name = "mysql-trunk"
+tree_name = "mysql-trunk-wl6135"

=== modified file 'mysql-test/include/default_mysqld.cnf'
--- a/mysql-test/include/default_mysqld.cnf	2011-12-09 21:08:37 +0000
+++ b/mysql-test/include/default_mysqld.cnf	2012-05-25 07:53:01 +0000
@@ -1,4 +1,4 @@
-# Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+# 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
@@ -42,19 +42,36 @@ slave-net-timeout=120
 
 log-bin=mysqld-bin
 
+# MAINTAINER:
+# the loose- syntax is to make sure the cnf file is also
+# valid when building without the performance schema.
+
 # Run tests with the performance schema instrumentation
 loose-enable-performance-schema
 # Run tests with a small number of instrumented objects
 # to limit memory consumption with MTR
+loose-performance-schema-accounts-size=100
+loose-performance-schema-digests-size=200
+loose-performance-schema-hosts-size=100
+loose-performance-schema-users-size=100
 loose-performance-schema-max-mutex-instances=5000
 loose-performance-schema-max-rwlock-instances=5000
+loose-performance-schema-max-cond-instances=1000
+loose-performance-schema-max-file-instances=10000
+loose-performance-schema-max-socket-instances=1000
 loose-performance-schema-max-table-instances=500
 loose-performance-schema-max-table-handles=1000
 
+loose-performance-schema-events-waits-history-size=10
+loose-performance-schema-events-waits-history-long-size=10000
+loose-performance-schema-events-stages-history-size=10
 loose-performance-schema-events-stages-history-long-size=1000
+loose-performance-schema-events-statements-history-size=10
 loose-performance-schema-events-statements-history-long-size=1000
 loose-performance-schema-max-thread-instances=200
 
+# Enable everything, for maximun code exposure during testing
+
 loose-performance-schema-instrument='%=ON'
 
 loose-performance-schema-consumer-events-stages-current=ON

=== modified file 'mysql-test/r/mysqld--help-notwin.result'
--- a/mysql-test/r/mysqld--help-notwin.result	2012-05-23 11:20:06 +0000
+++ b/mysql-test/r/mysqld--help-notwin.result	2012-05-25 07:53:01 +0000
@@ -484,8 +484,10 @@ The following options may be given as th
  Offset of first optimizer trace to show; see manual
  --performance-schema 
  Enable the performance schema.
+ (Defaults to on; use --skip-performance-schema to disable.)
  --performance-schema-accounts-size=# 
- Maximum number of instrumented user@host accounts.
+ Maximum number of instrumented user@host accounts. Use 0
+ to disable, -1 for automated sizing.
  --performance-schema-consumer-events-stages-current 
  Default startup value for the events_stages_current
  consumer.
@@ -526,64 +528,81 @@ The following options may be given as th
  consumer.
  (Defaults to on; use --skip-performance-schema-consumer-thread-instrumentation to disable.)
  --performance-schema-digests-size=# 
- Size of the statement digest.
+ Size of the statement digest. Use 0 to disable, -1 for
+ automated sizing.
  --performance-schema-events-stages-history-long-size=# 
- Number of rows in EVENTS_STAGES_HISTORY_LONG.
+ Number of rows in EVENTS_STAGES_HISTORY_LONG. Use 0 to
+ disable, -1 for automated sizing.
  --performance-schema-events-stages-history-size=# 
- Number of rows per thread in EVENTS_STAGES_HISTORY.
+ Number of rows per thread in EVENTS_STAGES_HISTORY. Use 0
+ to disable, -1 for automated sizing.
  --performance-schema-events-statements-history-long-size=# 
- Number of rows in EVENTS_STATEMENTS_HISTORY_LONG.
+ Number of rows in EVENTS_STATEMENTS_HISTORY_LONG. Use 0
+ to disable, -1 for automated sizing.
  --performance-schema-events-statements-history-size=# 
  Number of rows per thread in EVENTS_STATEMENTS_HISTORY.
+ Use 0 to disable, -1 for automated sizing.
  --performance-schema-events-waits-history-long-size=# 
- Number of rows in EVENTS_WAITS_HISTORY_LONG.
+ Number of rows in EVENTS_WAITS_HISTORY_LONG. Use 0 to
+ disable, -1 for automated sizing.
  --performance-schema-events-waits-history-size=# 
- Number of rows per thread in EVENTS_WAITS_HISTORY.
+ Number of rows per thread in EVENTS_WAITS_HISTORY. Use 0
+ to disable, -1 for automated sizing.
  --performance-schema-hosts-size=# 
- Maximum number of instrumented hosts.
+ Maximum number of instrumented hosts. Use 0 to disable,
+ -1 for automated sizing.
  --performance-schema-instrument[=name] 
  Default startup value for a performance schema
  instrument.
  --performance-schema-max-cond-classes=# 
  Maximum number of condition instruments.
  --performance-schema-max-cond-instances=# 
- Maximum number of instrumented condition objects.
+ Maximum number of instrumented condition objects. Use 0
+ to disable, -1 for automated sizing.
  --performance-schema-max-file-classes=# 
  Maximum number of file instruments.
  --performance-schema-max-file-handles=# 
  Maximum number of opened instrumented files.
  --performance-schema-max-file-instances=# 
- Maximum number of instrumented files.
+ Maximum number of instrumented files. Use 0 to disable,
+ -1 for automated sizing.
  --performance-schema-max-mutex-classes=# 
  Maximum number of mutex instruments.
  --performance-schema-max-mutex-instances=# 
- Maximum number of instrumented MUTEX objects.
+ Maximum number of instrumented MUTEX objects. Use 0 to
+ disable, -1 for automated sizing.
  --performance-schema-max-rwlock-classes=# 
  Maximum number of rwlock instruments.
  --performance-schema-max-rwlock-instances=# 
- Maximum number of instrumented RWLOCK objects.
+ Maximum number of instrumented RWLOCK objects. Use 0 to
+ disable, -1 for automated sizing.
  --performance-schema-max-socket-classes=# 
  Maximum number of socket instruments.
  --performance-schema-max-socket-instances=# 
- Maximum number of opened instrumented sockets.
+ Maximum number of opened instrumented sockets. Use 0 to
+ disable, -1 for automated sizing.
  --performance-schema-max-stage-classes=# 
  Maximum number of stage instruments.
  --performance-schema-max-statement-classes=# 
  Maximum number of statement instruments.
  --performance-schema-max-table-handles=# 
- Maximum number of opened instrumented tables.
+ Maximum number of opened instrumented tables. Use 0 to
+ disable, -1 for automated sizing.
  --performance-schema-max-table-instances=# 
- Maximum number of instrumented tables.
+ Maximum number of instrumented tables. Use 0 to disable,
+ -1 for automated sizing.
  --performance-schema-max-thread-classes=# 
  Maximum number of thread instruments.
  --performance-schema-max-thread-instances=# 
- Maximum number of instrumented threads.
+ Maximum number of instrumented threads. Use 0 to disable,
+ -1 for automated sizing.
  --performance-schema-setup-actors-size=# 
  Maximum number of rows in SETUP_ACTORS.
  --performance-schema-setup-objects-size=# 
  Maximum number of rows in SETUP_OBJECTS.
  --performance-schema-users-size=# 
- Maximum number of instrumented users.
+ Maximum number of instrumented users. Use 0 to disable,
+ -1 for automated sizing.
  --pid-file=name     Pid file used by safe_mysqld
  --plugin-dir=name   Directory for plugins
  --plugin-load=name  Optional semicolon-separated list of plugins to load,
@@ -1060,7 +1079,7 @@ optimizer-trace-limit 1
 optimizer-trace-max-mem-size 16384
 optimizer-trace-offset -1
 performance-schema FALSE
-performance-schema-accounts-size 100
+performance-schema-accounts-size -1
 performance-schema-consumer-events-stages-current FALSE
 performance-schema-consumer-events-stages-history FALSE
 performance-schema-consumer-events-stages-history-long FALSE
@@ -1073,35 +1092,35 @@ performance-schema-consumer-events-waits
 performance-schema-consumer-global-instrumentation TRUE
 performance-schema-consumer-statements-digest TRUE
 performance-schema-consumer-thread-instrumentation TRUE
-performance-schema-digests-size 200
-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-digests-size -1
+performance-schema-events-stages-history-long-size -1
+performance-schema-events-stages-history-size -1
+performance-schema-events-statements-history-long-size -1
+performance-schema-events-statements-history-size -1
+performance-schema-events-waits-history-long-size -1
+performance-schema-events-waits-history-size -1
+performance-schema-hosts-size -1
 performance-schema-instrument 
 performance-schema-max-cond-classes 80
-performance-schema-max-cond-instances 1000
+performance-schema-max-cond-instances -1
 performance-schema-max-file-classes 50
 performance-schema-max-file-handles 32768
-performance-schema-max-file-instances 10000
+performance-schema-max-file-instances -1
 performance-schema-max-mutex-classes 200
-performance-schema-max-mutex-instances 1000000
+performance-schema-max-mutex-instances -1
 performance-schema-max-rwlock-classes 30
-performance-schema-max-rwlock-instances 1000000
+performance-schema-max-rwlock-instances -1
 performance-schema-max-socket-classes 10
-performance-schema-max-socket-instances 1000
+performance-schema-max-socket-instances -1
 performance-schema-max-stage-classes 150
 performance-schema-max-statement-classes 168
-performance-schema-max-table-handles 10000
-performance-schema-max-table-instances 1000
+performance-schema-max-table-handles -1
+performance-schema-max-table-instances -1
 performance-schema-max-thread-classes 50
-performance-schema-max-thread-instances 1000
+performance-schema-max-thread-instances -1
 performance-schema-setup-actors-size 100
 performance-schema-setup-objects-size 100
-performance-schema-users-size 100
+performance-schema-users-size -1
 port 3306
 port-open-timeout 0
 preload-buffer-size 32768

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2012-05-23 11:20:06 +0000
+++ b/sql/mysqld.cc	2012-05-25 07:53:01 +0000
@@ -924,7 +924,7 @@ void init_net_server_extension(THD *thd)
   for parsing performance schema options, this code is not needed
   when the performance schema is not compiled in.
 */
-#ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
+// #ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
 /**
   A log message for the error log, buffered in memory.
   Log messages are temporarily buffered when generated before the error log
@@ -1080,7 +1080,7 @@ static void buffered_option_error_report
 }
 C_MODE_END
 #endif /* !EMBEDDED_LIBRARY */
-#endif /* WITH_PERFSCHEMA_STORAGE_ENGINE */
+// #endif /* WITH_PERFSCHEMA_STORAGE_ENGINE */
 
 static MYSQL_SOCKET unix_sock, ip_sock;
 struct rand_struct sql_rand; ///< used by sql_class.cc:THD::THD()
@@ -4852,7 +4852,6 @@ int mysqld_main(int argc, char **argv)
 
   sys_var_init();
 
-#ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
   /*
     The performance schema needs to be initialized as early as possible,
     before to-be-instrumented objects of the server are initialized.
@@ -4877,16 +4876,19 @@ int mysqld_main(int argc, char **argv)
   my_getopt_error_reporter= buffered_option_error_reporter;
   my_charset_error_reporter= buffered_option_error_reporter;
 
+#ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
   /*
     Initialize the array of performance schema instrument configurations.
   */
   init_pfs_instrument_array();
+#endif /* WITH_PERFSCHEMA_STORAGE_ENGINE */
 
   ho_error= handle_options(&remaining_argc, &remaining_argv,
                            &all_early_options[0], mysqld_get_one_option);
   // Swap with an empty vector, i.e. delete elements and free allocated space.
   vector<my_option>().swap(all_early_options);
 
+#ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
   if (ho_error == 0)
   {
     /* Add back the program name handle_options removes */
@@ -4894,6 +4896,10 @@ int mysqld_main(int argc, char **argv)
     remaining_argv--;
     if (pfs_param.m_enabled)
     {
+      /* Add sizing hints from the server sizing parameters. */
+      pfs_param.m_hints.m_table_definition_cache= table_def_size;
+      pfs_param.m_hints.m_table_open_cache= 0;
+      pfs_param.m_hints.m_max_connections= 0;
       PSI_hook= initialize_performance_schema(&pfs_param);
       if (PSI_hook == NULL)
       {

=== modified file 'sql/sys_vars.cc'
--- a/sql/sys_vars.cc	2012-05-03 09:41:32 +0000
+++ b/sql/sys_vars.cc	2012-05-25 07:53:01 +0000
@@ -1,4 +1,4 @@
-/* Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2009, 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
@@ -158,7 +158,7 @@ static Sys_var_mybool Sys_pfs_enabled(
        "performance_schema",
        "Enable the performance schema.",
        READ_ONLY GLOBAL_VAR(pfs_param.m_enabled),
-       CMD_LINE(OPT_ARG), DEFAULT(FALSE),
+       CMD_LINE(OPT_ARG), DEFAULT(TRUE),
        PFS_TRAILING_PROPERTIES);
 
 static Sys_var_charptr Sys_pfs_instrument(
@@ -254,20 +254,22 @@ static Sys_var_mybool Sys_pfs_consumer_s
        CMD_LINE(OPT_ARG), DEFAULT(TRUE),
        PFS_TRAILING_PROPERTIES);
 
-static Sys_var_ulong Sys_pfs_events_waits_history_long_size(
+static Sys_var_long Sys_pfs_events_waits_history_long_size(
        "performance_schema_events_waits_history_long_size",
-       "Number of rows in EVENTS_WAITS_HISTORY_LONG.",
+       "Number of rows in EVENTS_WAITS_HISTORY_LONG."
+         " Use 0 to disable, -1 for automated sizing.",
        READ_ONLY GLOBAL_VAR(pfs_param.m_events_waits_history_long_sizing),
-       CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 1024*1024),
-       DEFAULT(PFS_WAITS_HISTORY_LONG_SIZE),
+       CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024*1024),
+       DEFAULT(-1),
        BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
 
-static Sys_var_ulong Sys_pfs_events_waits_history_size(
+static Sys_var_long Sys_pfs_events_waits_history_size(
        "performance_schema_events_waits_history_size",
-       "Number of rows per thread in EVENTS_WAITS_HISTORY.",
+       "Number of rows per thread in EVENTS_WAITS_HISTORY."
+         " Use 0 to disable, -1 for automated sizing.",
        READ_ONLY GLOBAL_VAR(pfs_param.m_events_waits_history_sizing),
-       CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 1024),
-       DEFAULT(PFS_WAITS_HISTORY_SIZE),
+       CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024),
+       DEFAULT(-1),
        BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
 
 static Sys_var_ulong Sys_pfs_max_cond_classes(
@@ -278,12 +280,13 @@ static Sys_var_ulong Sys_pfs_max_cond_cl
        DEFAULT(PFS_MAX_COND_CLASS),
        BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
 
-static Sys_var_ulong Sys_pfs_max_cond_instances(
+static Sys_var_long Sys_pfs_max_cond_instances(
        "performance_schema_max_cond_instances",
-       "Maximum number of instrumented condition objects.",
+       "Maximum number of instrumented condition objects."
+         " Use 0 to disable, -1 for automated sizing.",
        READ_ONLY GLOBAL_VAR(pfs_param.m_cond_sizing),
-       CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 1024*1024),
-       DEFAULT(PFS_MAX_COND),
+       CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024*1024),
+       DEFAULT(-1),
        BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
 
 static Sys_var_ulong Sys_pfs_max_file_classes(
@@ -302,20 +305,22 @@ static Sys_var_ulong Sys_pfs_max_file_ha
        DEFAULT(PFS_MAX_FILE_HANDLE),
        BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
 
-static Sys_var_ulong Sys_pfs_max_file_instances(
+static Sys_var_long Sys_pfs_max_file_instances(
        "performance_schema_max_file_instances",
-       "Maximum number of instrumented files.",
+       "Maximum number of instrumented files."
+         " Use 0 to disable, -1 for automated sizing.",
        READ_ONLY GLOBAL_VAR(pfs_param.m_file_sizing),
-       CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 1024*1024),
-       DEFAULT(PFS_MAX_FILE),
+       CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024*1024),
+       DEFAULT(-1),
        BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
 
-static Sys_var_ulong Sys_pfs_max_sockets(
+static Sys_var_long Sys_pfs_max_sockets(
        "performance_schema_max_socket_instances",
-       "Maximum number of opened instrumented sockets.",
+       "Maximum number of opened instrumented sockets."
+         " Use 0 to disable, -1 for automated sizing.",
        READ_ONLY GLOBAL_VAR(pfs_param.m_socket_sizing),
-       CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 1024*1024),
-       DEFAULT(PFS_MAX_SOCKETS),
+       CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024*1024),
+       DEFAULT(-1),
        BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
 
 static Sys_var_ulong Sys_pfs_max_socket_classes(
@@ -334,12 +339,13 @@ static Sys_var_ulong Sys_pfs_max_mutex_c
        DEFAULT(PFS_MAX_MUTEX_CLASS),
        BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
 
-static Sys_var_ulong Sys_pfs_max_mutex_instances(
+static Sys_var_long Sys_pfs_max_mutex_instances(
        "performance_schema_max_mutex_instances",
-       "Maximum number of instrumented MUTEX objects.",
+       "Maximum number of instrumented MUTEX objects."
+         " Use 0 to disable, -1 for automated sizing.",
        READ_ONLY GLOBAL_VAR(pfs_param.m_mutex_sizing),
-       CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 100*1024*1024),
-       DEFAULT(PFS_MAX_MUTEX),
+       CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 100*1024*1024),
+       DEFAULT(-1),
        BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
 
 static Sys_var_ulong Sys_pfs_max_rwlock_classes(
@@ -350,28 +356,31 @@ static Sys_var_ulong Sys_pfs_max_rwlock_
        DEFAULT(PFS_MAX_RWLOCK_CLASS),
        BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
 
-static Sys_var_ulong Sys_pfs_max_rwlock_instances(
+static Sys_var_long Sys_pfs_max_rwlock_instances(
        "performance_schema_max_rwlock_instances",
-       "Maximum number of instrumented RWLOCK objects.",
+       "Maximum number of instrumented RWLOCK objects."
+         " Use 0 to disable, -1 for automated sizing.",
        READ_ONLY GLOBAL_VAR(pfs_param.m_rwlock_sizing),
-       CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 100*1024*1024),
-       DEFAULT(PFS_MAX_RWLOCK),
+       CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 100*1024*1024),
+       DEFAULT(-1),
        BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
 
-static Sys_var_ulong Sys_pfs_max_table_handles(
+static Sys_var_long Sys_pfs_max_table_handles(
        "performance_schema_max_table_handles",
-       "Maximum number of opened instrumented tables.",
+       "Maximum number of opened instrumented tables."
+         " Use 0 to disable, -1 for automated sizing.",
        READ_ONLY GLOBAL_VAR(pfs_param.m_table_sizing),
-       CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 1024*1024),
-       DEFAULT(PFS_MAX_TABLE),
+       CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024*1024),
+       DEFAULT(-1),
        BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
 
-static Sys_var_ulong Sys_pfs_max_table_instances(
+static Sys_var_long Sys_pfs_max_table_instances(
        "performance_schema_max_table_instances",
-       "Maximum number of instrumented tables.",
+       "Maximum number of instrumented tables."
+         " Use 0 to disable, -1 for automated sizing.",
        READ_ONLY GLOBAL_VAR(pfs_param.m_table_share_sizing),
-       CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 1024*1024),
-       DEFAULT(PFS_MAX_TABLE_SHARE),
+       CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024*1024),
+       DEFAULT(-1),
        BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
 
 static Sys_var_ulong Sys_pfs_max_thread_classes(
@@ -382,12 +391,13 @@ static Sys_var_ulong Sys_pfs_max_thread_
        DEFAULT(PFS_MAX_THREAD_CLASS),
        BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
 
-static Sys_var_ulong Sys_pfs_max_thread_instances(
+static Sys_var_long Sys_pfs_max_thread_instances(
        "performance_schema_max_thread_instances",
-       "Maximum number of instrumented threads.",
+       "Maximum number of instrumented threads."
+         " Use 0 to disable, -1 for automated sizing.",
        READ_ONLY GLOBAL_VAR(pfs_param.m_thread_sizing),
-       CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 1024*1024),
-       DEFAULT(PFS_MAX_THREAD),
+       CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024*1024),
+       DEFAULT(-1),
        BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
 
 static Sys_var_ulong Sys_pfs_setup_actors_size(
@@ -406,28 +416,31 @@ static Sys_var_ulong Sys_pfs_setup_objec
        DEFAULT(PFS_MAX_SETUP_OBJECT),
        BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
 
-static Sys_var_ulong Sys_pfs_accounts_size(
+static Sys_var_long Sys_pfs_accounts_size(
        "performance_schema_accounts_size",
-       "Maximum number of instrumented user@host accounts.",
+       "Maximum number of instrumented user@host accounts."
+         " Use 0 to disable, -1 for automated sizing.",
        READ_ONLY GLOBAL_VAR(pfs_param.m_account_sizing),
-       CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 1024*1024),
-       DEFAULT(PFS_MAX_ACCOUNT),
+       CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024*1024),
+       DEFAULT(-1),
        BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
 
-static Sys_var_ulong Sys_pfs_hosts_size(
+static Sys_var_long Sys_pfs_hosts_size(
        "performance_schema_hosts_size",
-       "Maximum number of instrumented hosts.",
+       "Maximum number of instrumented hosts."
+         " Use 0 to disable, -1 for automated sizing.",
        READ_ONLY GLOBAL_VAR(pfs_param.m_host_sizing),
-       CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 1024*1024),
-       DEFAULT(PFS_MAX_HOST),
+       CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024*1024),
+       DEFAULT(-1),
        BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
 
-static Sys_var_ulong Sys_pfs_users_size(
+static Sys_var_long Sys_pfs_users_size(
        "performance_schema_users_size",
-       "Maximum number of instrumented users.",
+       "Maximum number of instrumented users."
+         " Use 0 to disable, -1 for automated sizing.",
        READ_ONLY GLOBAL_VAR(pfs_param.m_user_sizing),
-       CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 1024*1024),
-       DEFAULT(PFS_MAX_USER),
+       CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024*1024),
+       DEFAULT(-1),
        BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
 
 static Sys_var_ulong Sys_pfs_max_stage_classes(
@@ -438,20 +451,22 @@ static Sys_var_ulong Sys_pfs_max_stage_c
        DEFAULT(PFS_MAX_STAGE_CLASS),
        BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
 
-static Sys_var_ulong Sys_pfs_events_stages_history_long_size(
+static Sys_var_long Sys_pfs_events_stages_history_long_size(
        "performance_schema_events_stages_history_long_size",
-       "Number of rows in EVENTS_STAGES_HISTORY_LONG.",
+       "Number of rows in EVENTS_STAGES_HISTORY_LONG."
+         " Use 0 to disable, -1 for automated sizing.",
        READ_ONLY GLOBAL_VAR(pfs_param.m_events_stages_history_long_sizing),
-       CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 1024*1024),
-       DEFAULT(PFS_STAGES_HISTORY_LONG_SIZE),
+       CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024*1024),
+       DEFAULT(-1),
        BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
 
-static Sys_var_ulong Sys_pfs_events_stages_history_size(
+static Sys_var_long Sys_pfs_events_stages_history_size(
        "performance_schema_events_stages_history_size",
-       "Number of rows per thread in EVENTS_STAGES_HISTORY.",
+       "Number of rows per thread in EVENTS_STAGES_HISTORY."
+         " Use 0 to disable, -1 for automated sizing.",
        READ_ONLY GLOBAL_VAR(pfs_param.m_events_stages_history_sizing),
-       CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 1024),
-       DEFAULT(PFS_STAGES_HISTORY_SIZE),
+       CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024),
+       DEFAULT(-1),
        BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
 
 /**
@@ -471,28 +486,31 @@ static Sys_var_ulong Sys_pfs_max_stateme
        DEFAULT((ulong) SQLCOM_END + (ulong) COM_END + 3),
        BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
 
-static Sys_var_ulong Sys_pfs_events_statements_history_long_size(
+static Sys_var_long Sys_pfs_events_statements_history_long_size(
        "performance_schema_events_statements_history_long_size",
-       "Number of rows in EVENTS_STATEMENTS_HISTORY_LONG.",
+       "Number of rows in EVENTS_STATEMENTS_HISTORY_LONG."
+         " Use 0 to disable, -1 for automated sizing.",
        READ_ONLY GLOBAL_VAR(pfs_param.m_events_statements_history_long_sizing),
-       CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 1024*1024),
-       DEFAULT(PFS_STATEMENTS_HISTORY_LONG_SIZE),
+       CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024*1024),
+       DEFAULT(-1),
        BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
 
-static Sys_var_ulong Sys_pfs_events_statements_history_size(
+static Sys_var_long Sys_pfs_events_statements_history_size(
        "performance_schema_events_statements_history_size",
-       "Number of rows per thread in EVENTS_STATEMENTS_HISTORY.",
+       "Number of rows per thread in EVENTS_STATEMENTS_HISTORY."
+         " Use 0 to disable, -1 for automated sizing.",
        READ_ONLY GLOBAL_VAR(pfs_param.m_events_statements_history_sizing),
-       CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 1024),
-       DEFAULT(PFS_STATEMENTS_HISTORY_SIZE),
+       CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024),
+       DEFAULT(-1),
        BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
 
-static Sys_var_ulong Sys_pfs_digest_size(
+static Sys_var_long Sys_pfs_digest_size(
        "performance_schema_digests_size",
-       "Size of the statement digest.",
+       "Size of the statement digest."
+         " Use 0 to disable, -1 for automated sizing.",
        READ_ONLY GLOBAL_VAR(pfs_param.m_digest_sizing),
-       CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 1024 * 1024),
-       DEFAULT(PFS_DIGEST_SIZE),
+       CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024 * 1024),
+       DEFAULT(-1),
        BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
 
 #endif /* WITH_PERFSCHEMA_STORAGE_ENGINE */
@@ -2750,7 +2768,15 @@ static Sys_var_ulong Sys_table_def_size(
        "The number of cached table definitions",
        GLOBAL_VAR(table_def_size), CMD_LINE(REQUIRED_ARG),
        VALID_RANGE(TABLE_DEF_CACHE_MIN, 512*1024),
-       DEFAULT(TABLE_DEF_CACHE_DEFAULT), BLOCK_SIZE(1));
+       DEFAULT(TABLE_DEF_CACHE_DEFAULT),
+       BLOCK_SIZE(1),
+       NO_MUTEX_GUARD,
+       NOT_IN_BINLOG,
+       ON_CHECK(NULL),
+       ON_UPDATE(NULL),
+       NULL,
+       /* table_definition_cache is used as a sizing hint by the performance schema. */
+       sys_var::PARSE_EARLY);
 
 static Sys_var_ulong Sys_table_cache_size(
        "table_open_cache", "The number of cached open tables",

=== modified file 'storage/perfschema/CMakeLists.txt'
--- a/storage/perfschema/CMakeLists.txt	2012-02-28 14:40:36 +0000
+++ b/storage/perfschema/CMakeLists.txt	2012-05-25 07:53:01 +0000
@@ -126,6 +126,7 @@ ha_perfschema.cc
 pfs.cc
 pfs_account.cc
 pfs_atomic.cc
+pfs_autosize.cc
 pfs_check.cc
 pfs_column_values.cc
 pfs_con_slice.cc

=== added file 'storage/perfschema/pfs_autosize.cc'
--- a/storage/perfschema/pfs_autosize.cc	1970-01-01 00:00:00 +0000
+++ b/storage/perfschema/pfs_autosize.cc	2012-05-25 07:53:01 +0000
@@ -0,0 +1,283 @@
+/* Copyright (c) 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,
+  51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
+
+/**
+  @file storage/perfschema/pfs_autosize.cc
+  Private interface for the server (implementation).
+*/
+
+#include "my_global.h"
+#include "pfs_server.h"
+
+static const ulong fixed_mutex_instances= 500;
+static const ulong fixed_rwlock_instances= 200;
+static const ulong fixed_cond_instances= 50;
+static const ulong fixed_file_instances= 200;
+static const ulong fixed_socket_instances= 10;
+static const ulong fixed_thread_instances= 50;
+
+static const ulong mutex_per_connection= 3;
+static const ulong rwlock_per_connection= 1;
+static const ulong cond_per_connection= 2;
+static const ulong file_per_connection= 0;
+static const ulong socket_per_connection= 1;
+static const ulong thread_per_connection= 1;
+
+static const ulong mutex_per_handle= 0;
+static const ulong rwlock_per_handle= 0;
+static const ulong cond_per_handle= 0;
+static const ulong file_per_handle= 0;
+static const ulong socket_per_handle= 0;
+static const ulong thread_per_handle= 0;
+
+static const ulong mutex_per_share= 3;
+static const ulong rwlock_per_share= 3;
+static const ulong cond_per_share= 1;
+static const ulong file_per_share= 2;
+static const ulong socket_per_share= 0;
+static const ulong thread_per_share= 0;
+
+struct PFS_sizing_data
+{
+  const char* m_name;
+  ulong m_account_sizing;
+  ulong m_user_sizing;
+  ulong m_host_sizing;
+
+  ulong m_events_waits_history_sizing;
+  ulong m_events_waits_history_long_sizing;
+  ulong m_events_stages_history_sizing;
+  ulong m_events_stages_history_long_sizing;
+  ulong m_events_statements_history_sizing;
+  ulong m_events_statements_history_long_sizing;
+  ulong m_digest_sizing;
+
+  ulong m_max_number_of_tables;
+
+  float m_load_factor_volatile;
+  float m_load_factor_normal;
+  float m_load_factor_static;
+};
+
+PFS_sizing_data tiny_data=
+{
+  "HEURISTIC 1",
+  /* account / user / host */
+  10, 5, 20,
+  /* history sizes */
+  5, 100, 5, 100, 5, 100,
+  /* digests */
+  200,
+  /* Max tables */
+  200,
+  /* Load factors */
+  0.90, 0.90, 0.90
+};
+
+PFS_sizing_data small_data=
+{
+  "HEURISTIC 2",
+  /* account / user / host */
+  100, 100, 100,
+  /* history sizes */
+  10, 1000, 10, 1000, 10, 1000,
+  /* digests */
+  1000,
+  /* Max tables */
+  500,
+  /* Load factors */
+  0.70, 0.80, 0.90
+};
+
+PFS_sizing_data big_data=
+{
+  "BIG",
+  /* account / user / host */
+  100, 100, 100,
+  /* history sizes */
+  10, 10000, 10, 10000, 10, 10000,
+  /* digests */
+  10000,
+  /* Max tables */
+  10000,
+  /* Load factors */
+  0.50, 0.65, 0.80
+};
+
+void enforce_range_long(long *value, long min, long max)
+{
+  if (*value < min)
+  {
+    *value = min;
+  }
+  else if (*value > max)
+  {
+    *value = max;
+  }
+}
+
+PFS_sizing_data *estimate_hints(PFS_global_param *param)
+{
+  /* Sanitize hints */
+
+  enforce_range_long(& param->m_hints.m_max_connections, 10, 65535);
+  enforce_range_long(& param->m_hints.m_table_definition_cache, 100, 10000);
+  enforce_range_long(& param->m_hints.m_table_open_cache, 100, 10000);
+
+  return & tiny_data;
+}
+
+static void apply_heuristic(PFS_global_param *p, PFS_sizing_data *h)
+{
+  if (p->m_account_sizing < 0)
+  {
+    p->m_account_sizing= h->m_account_sizing;
+  }
+
+  if (p->m_user_sizing < 0)
+  {
+    p->m_user_sizing= h->m_user_sizing;
+  }
+
+  if (p->m_host_sizing < 0)
+  {
+    p->m_host_sizing= h->m_host_sizing;
+  }
+
+  if (p->m_events_waits_history_sizing < 0)
+  {
+    p->m_events_waits_history_sizing= h->m_events_waits_history_sizing;
+  }
+
+  if (p->m_events_waits_history_long_sizing < 0)
+  {
+    p->m_events_waits_history_long_sizing= h->m_events_waits_history_long_sizing;
+  }
+
+  if (p->m_events_stages_history_sizing < 0)
+  {
+    p->m_events_stages_history_sizing= h->m_events_stages_history_sizing;
+  }
+
+  if (p->m_events_stages_history_long_sizing < 0)
+  {
+    p->m_events_stages_history_long_sizing= h->m_events_stages_history_long_sizing;
+  }
+
+  if (p->m_events_statements_history_sizing < 0)
+  {
+    p->m_events_statements_history_sizing= h->m_events_statements_history_sizing;
+  }
+
+  if (p->m_events_statements_history_long_sizing < 0)
+  {
+    p->m_events_statements_history_long_sizing= h->m_events_statements_history_long_sizing;
+  }
+
+  if (p->m_digest_sizing < 0)
+  {
+    p->m_digest_sizing= h->m_digest_sizing;
+  }
+
+  if (p->m_mutex_sizing < 0)
+  {
+    ulong count;
+    count= fixed_mutex_instances
+      + p->m_hints.m_max_connections * mutex_per_connection
+      + p->m_hints.m_table_open_cache * mutex_per_handle
+      + p->m_hints.m_table_definition_cache * mutex_per_share
+      ;
+
+    p->m_mutex_sizing= ceil(((float) count) / h->m_load_factor_volatile);
+  }
+
+  if (p->m_rwlock_sizing < 0)
+  {
+    ulong count;
+    count= fixed_rwlock_instances
+      + p->m_hints.m_max_connections * rwlock_per_connection
+      + p->m_hints.m_table_open_cache * rwlock_per_handle
+      + p->m_hints.m_table_definition_cache * rwlock_per_share
+      ;
+
+    p->m_rwlock_sizing= ceil(((float) count) / h->m_load_factor_volatile);
+  }
+
+  if (p->m_cond_sizing < 0)
+  {
+    ulong count;
+    count= fixed_cond_instances
+      + p->m_hints.m_max_connections * cond_per_connection
+      + p->m_hints.m_table_open_cache * cond_per_handle
+      + p->m_hints.m_table_definition_cache * cond_per_share
+      ;
+
+    p->m_cond_sizing= ceil(((float) count) / h->m_load_factor_volatile);
+  }
+
+  if (p->m_file_sizing < 0)
+  {
+    ulong count;
+    count= fixed_file_instances
+      + p->m_hints.m_max_connections * file_per_connection
+      + p->m_hints.m_table_open_cache * file_per_handle
+      + p->m_hints.m_table_definition_cache * file_per_share
+      ;
+
+    p->m_file_sizing= ceil(((float) count) / h->m_load_factor_normal);
+  }
+
+  if (p->m_socket_sizing < 0)
+  {
+    ulong count;
+    count= fixed_socket_instances
+      + p->m_hints.m_max_connections * socket_per_connection
+      + p->m_hints.m_table_open_cache * socket_per_handle
+      + p->m_hints.m_table_definition_cache * socket_per_share
+      ;
+
+    p->m_socket_sizing= ceil(((float) count) / h->m_load_factor_volatile);
+  }
+
+  if (p->m_thread_sizing < 0)
+  {
+    ulong count;
+    count= fixed_thread_instances
+      + p->m_hints.m_max_connections * thread_per_connection
+      + p->m_hints.m_table_open_cache * thread_per_handle
+      + p->m_hints.m_table_definition_cache * thread_per_share
+      ;
+
+    p->m_thread_sizing= ceil(((float) count) / h->m_load_factor_volatile);
+  }
+
+
+
+}
+
+void pfs_automated_sizing(PFS_global_param *param)
+{
+  PFS_sizing_data *heuristic;
+  heuristic= estimate_hints(param);
+  apply_heuristic(param, heuristic);
+
+  DBUG_ASSERT(param->m_events_waits_history_sizing >= 0);
+  DBUG_ASSERT(param->m_events_waits_history_long_sizing >= 0);
+  DBUG_ASSERT(param->m_events_stages_history_sizing >= 0);
+  DBUG_ASSERT(param->m_events_stages_history_long_sizing >= 0);
+  DBUG_ASSERT(param->m_events_statements_history_sizing >= 0);
+  DBUG_ASSERT(param->m_events_statements_history_long_sizing >= 0);
+}
+

=== modified file 'storage/perfschema/pfs_server.cc'
--- a/storage/perfschema/pfs_server.cc	2012-05-15 09:39:47 +0000
+++ b/storage/perfschema/pfs_server.cc	2012-05-25 07:53:01 +0000
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 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
@@ -50,7 +50,7 @@ static void cleanup_performance_schema(v
 void cleanup_instrument_config(void);
 
 struct PSI_bootstrap*
-initialize_performance_schema(const PFS_global_param *param)
+initialize_performance_schema(PFS_global_param *param)
 {
   pfs_initialized= false;
 
@@ -58,6 +58,8 @@ initialize_performance_schema(const PFS_
   global_table_io_stat.reset();
   global_table_lock_stat.reset();
 
+  pfs_automated_sizing(param);
+
   if (! param->m_enabled)
   {
     /*

=== modified file 'storage/perfschema/pfs_server.h'
--- a/storage/perfschema/pfs_server.h	2011-12-19 19:08:09 +0000
+++ b/storage/perfschema/pfs_server.h	2012-05-25 07:53:01 +0000
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 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
@@ -24,96 +24,49 @@
 #ifndef PFS_MAX_MUTEX_CLASS
   #define PFS_MAX_MUTEX_CLASS 200
 #endif
-#ifndef PFS_MAX_MUTEX
-  #define PFS_MAX_MUTEX 1000000
-#endif
 #ifndef PFS_MAX_RWLOCK_CLASS
   #define PFS_MAX_RWLOCK_CLASS 30
 #endif
-#ifndef PFS_MAX_RWLOCK
-  #define PFS_MAX_RWLOCK 1000000
-#endif
 #ifndef PFS_MAX_COND_CLASS
   #define PFS_MAX_COND_CLASS 80
 #endif
-#ifndef PFS_MAX_COND
-  #define PFS_MAX_COND 1000
-#endif
 #ifndef PFS_MAX_THREAD_CLASS
   #define PFS_MAX_THREAD_CLASS 50
 #endif
-#ifndef PFS_MAX_THREAD
-  #define PFS_MAX_THREAD 1000
-#endif
 #ifndef PFS_MAX_FILE_CLASS
   #define PFS_MAX_FILE_CLASS 50
 #endif
-#ifndef PFS_MAX_FILE
-  #define PFS_MAX_FILE 10000
-#endif
 #ifndef PFS_MAX_FILE_HANDLE
   #define PFS_MAX_FILE_HANDLE 32768
 #endif
-#ifndef PFS_MAX_SOCKETS
-  #define PFS_MAX_SOCKETS 1000
-#endif
 #ifndef PFS_MAX_SOCKET_CLASS
   #define PFS_MAX_SOCKET_CLASS 10
 #endif
-#ifndef PFS_MAX_TABLE_SHARE
-  #define PFS_MAX_TABLE_SHARE 1000
-#endif
-#ifndef PFS_MAX_TABLE
-  #define PFS_MAX_TABLE 10000
-#endif
-#ifndef PFS_WAITS_HISTORY_SIZE
-  #define PFS_WAITS_HISTORY_SIZE 10
-#endif
-#ifndef PFS_WAITS_HISTORY_LONG_SIZE
-  #define PFS_WAITS_HISTORY_LONG_SIZE 10000
-#endif
 #ifndef PFS_MAX_SETUP_ACTOR
   #define PFS_MAX_SETUP_ACTOR 100
 #endif
 #ifndef PFS_MAX_SETUP_OBJECT
   #define PFS_MAX_SETUP_OBJECT 100
 #endif
-#ifndef PFS_MAX_HOST
-  #define PFS_MAX_HOST 100
-#endif
-#ifndef PFS_MAX_USER
-  #define PFS_MAX_USER 100
-#endif
-#ifndef PFS_MAX_ACCOUNT
-  #define PFS_MAX_ACCOUNT 100
-#endif
 #ifndef PFS_MAX_STAGE_CLASS
   #define PFS_MAX_STAGE_CLASS 150
 #endif
-#ifndef PFS_STAGES_HISTORY_SIZE
-  #define PFS_STAGES_HISTORY_SIZE 10
-#endif
-#ifndef PFS_STAGES_HISTORY_LONG_SIZE
-  #define PFS_STAGES_HISTORY_LONG_SIZE 10000
-#endif
-#ifndef PFS_STATEMENTS_HISTORY_SIZE
-  #define PFS_STATEMENTS_HISTORY_SIZE 10
-#endif
-#ifndef PFS_STATEMENTS_HISTORY_LONG_SIZE
-  #define PFS_STATEMENTS_HISTORY_LONG_SIZE 10000
-#endif
 #ifndef PFS_STATEMENTS_STACK_SIZE
   #define PFS_STATEMENTS_STACK_SIZE 10
 #endif
-#ifndef PFS_DIGEST_SIZE
-  #define PFS_DIGEST_SIZE 200
-#endif
+
+struct PFS_sizing_hints
+{
+  long m_table_definition_cache;
+  long m_table_open_cache;
+  long m_max_connections;
+};
 
 /** Performance schema global sizing parameters. */
 struct PFS_global_param
 {
   /** True if the performance schema is enabled. */
-  bool m_enabled; 
+  bool m_enabled;
   /** Default values for SETUP_CONSUMERS. */
   bool m_consumer_events_stages_current_enabled;
   bool m_consumer_events_stages_history_enabled;
@@ -155,7 +108,7 @@ struct PFS_global_param
     Maximum number of instrumented table share.
     @sa table_share_lost.
   */
-  ulong m_table_share_sizing;
+  long m_table_share_sizing;
   /**
     Maximum number of instrumented file classes.
     @sa file_class_lost.
@@ -165,81 +118,83 @@ struct PFS_global_param
     Maximum number of instrumented mutex instances.
     @sa mutex_lost.
   */
-  ulong m_mutex_sizing;
+  long m_mutex_sizing;
   /**
     Maximum number of instrumented rwlock instances.
     @sa rwlock_lost.
   */
-  ulong m_rwlock_sizing;
+  long m_rwlock_sizing;
   /**
     Maximum number of instrumented cond instances.
     @sa cond_lost.
   */
-  ulong m_cond_sizing;
+  long m_cond_sizing;
   /**
     Maximum number of instrumented thread instances.
     @sa thread_lost.
   */
-  ulong m_thread_sizing;
+  long m_thread_sizing;
   /**
     Maximum number of instrumented table handles.
     @sa table_lost.
   */
-  ulong m_table_sizing;
+  long m_table_sizing;
   /**
     Maximum number of instrumented file instances.
     @sa file_lost.
   */
-  ulong m_file_sizing;
+  long m_file_sizing;
   /**
     Maximum number of instrumented file handles.
     @sa file_handle_lost.
   */
-  ulong m_file_handle_sizing;
+  long m_file_handle_sizing;
   /**
     Maxium number of instrumented socket instances
     @sa socket_lost  
   */
-  ulong m_socket_sizing;
+  long m_socket_sizing;
   /**
     Maximum number of instrumented socket classes.
     @sa socket_class_lost.
   */
   ulong m_socket_class_sizing;
   /** Maximum number of rows per thread in table EVENTS_WAITS_HISTORY. */
-  ulong m_events_waits_history_sizing;
+  long m_events_waits_history_sizing;
   /** Maximum number of rows in table EVENTS_WAITS_HISTORY_LONG. */
-  ulong m_events_waits_history_long_sizing;
+  long m_events_waits_history_long_sizing;
   /** Maximum number of rows in table SETUP_ACTORS. */
   ulong m_setup_actor_sizing;
   /** Maximum number of rows in table SETUP_OBJECTS. */
   ulong m_setup_object_sizing;
   /** Maximum number of rows in table HOSTS. */
-  ulong m_host_sizing;
+  long m_host_sizing;
   /** Maximum number of rows in table USERS. */
-  ulong m_user_sizing;
+  long m_user_sizing;
   /** Maximum number of rows in table ACCOUNTS. */
-  ulong m_account_sizing;
+  long m_account_sizing;
   /**
     Maximum number of instrumented stage classes.
     @sa stage_class_lost.
   */
   ulong m_stage_class_sizing;
   /** Maximum number of rows per thread in table EVENTS_STAGES_HISTORY. */
-  ulong m_events_stages_history_sizing;
+  long m_events_stages_history_sizing;
   /** Maximum number of rows in table EVENTS_STAGES_HISTORY_LONG. */
-  ulong m_events_stages_history_long_sizing;
+  long m_events_stages_history_long_sizing;
   /**
     Maximum number of instrumented statement classes.
     @sa statement_class_lost.
   */
   ulong m_statement_class_sizing;
   /** Maximum number of rows per thread in table EVENTS_STATEMENT_HISTORY. */
-  ulong m_events_statements_history_sizing;
+  long m_events_statements_history_sizing;
   /** Maximum number of rows in table EVENTS_STATEMENTS_HISTORY_LONG. */
-  ulong m_events_statements_history_long_sizing;
+  long m_events_statements_history_long_sizing;
   /** Maximum number of digests to be captured */
-  ulong m_digest_sizing;
+  long m_digest_sizing;
+
+  PFS_sizing_hints m_hints;
 };
 
 /**
@@ -254,7 +209,9 @@ extern PFS_global_param pfs_param;
   @return A boostrap handle, or NULL.
 */
 struct PSI_bootstrap*
-initialize_performance_schema(const PFS_global_param *param);
+initialize_performance_schema(PFS_global_param *param);
+
+void pfs_automated_sizing(PFS_global_param *param);
 
 /**
   Initialize the performance schema ACL.

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