diff options
author | Sergei Golubchik <sergii@pisem.net> | 2013-02-02 12:52:44 +0100 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2013-02-02 12:52:44 +0100 |
commit | f0b6f7fb20e4eacf0f70a6c71cc199762278663b (patch) | |
tree | 9c4c35c1ccf6ba69fdc2574bf0c14c4226ae8d25 | |
parent | 48061c32f10c09e0edca59897f2bd42899ce89c7 (diff) | |
download | mariadb-git-f0b6f7fb20e4eacf0f70a6c71cc199762278663b.tar.gz |
remove "invisible sysvars" oxymoron
-rw-r--r-- | TODO | 1 | ||||
-rw-r--r-- | sql/mysqld.cc | 97 | ||||
-rw-r--r-- | sql/set_var.cc | 8 | ||||
-rw-r--r-- | sql/set_var.h | 4 | ||||
-rw-r--r-- | sql/sys_vars.cc | 79 | ||||
-rw-r--r-- | sql/sys_vars.h | 1 |
6 files changed, 89 insertions, 101 deletions
@@ -52,7 +52,6 @@ Sergei's notes: anders.song@greatopensource.com-20110105052107-zoab0bsf5a6xxk2y (don't binlog rolled back changes) mysql-test/suite/perfschema/disabled.def why --source include/have_innodb.inc in lots of tests? (with no other changes) - WTF "invisible sysvars" ? Sys_var_tx_read_only not needed (must be the same as Sys_var_tx_isolation) SIGNAL/RESIGNAL ? fix mysql-test to know the difference between compiled-in innodb and compiled-in xtradb diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 75c4094324b..b20e0423281 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -738,6 +738,76 @@ static char **remaining_argv; int orig_argc; char **orig_argv; +static struct my_option pfs_early_options[]= +{ + {"performance_schema_instrument", OPT_PFS_INSTRUMENT, + "Default startup value for a performance schema instrument.", + &pfs_param.m_pfs_instrument, &pfs_param.m_pfs_instrument, 0, GET_STR, + OPT_ARG, 0, 0, 0, 0, 0, 0}, + {"performance_schema_consumer_events_stages_current", 0, + "Default startup value for the events_stages_current consumer.", + &pfs_param.m_consumer_events_stages_current_enabled, + &pfs_param.m_consumer_events_stages_current_enabled, 0, GET_BOOL, + OPT_ARG, FALSE, 0, 0, 0, 0, 0}, + {"performance_schema_consumer_events_stages_history", 0, + "Default startup value for the events_stages_history consumer.", + &pfs_param.m_consumer_events_stages_history_enabled, + &pfs_param.m_consumer_events_stages_history_enabled, 0, + GET_BOOL, OPT_ARG, FALSE, 0, 0, 0, 0, 0}, + {"performance_schema_consumer_events_stages_history_long", 0, + "Default startup value for the events_stages_history_long consumer.", + &pfs_param.m_consumer_events_stages_history_long_enabled, + &pfs_param.m_consumer_events_stages_history_long_enabled, 0, + GET_BOOL, OPT_ARG, FALSE, 0, 0, 0, 0, 0}, + {"performance_schema_consumer_events_statements_current", 0, + "Default startup value for the events_statements_current consumer.", + &pfs_param.m_consumer_events_statements_current_enabled, + &pfs_param.m_consumer_events_statements_current_enabled, 0, + GET_BOOL, OPT_ARG, TRUE, 0, 0, 0, 0, 0}, + {"performance_schema_consumer_events_statements_history", 0, + "Default startup value for the events_statements_history consumer.", + &pfs_param.m_consumer_events_statements_history_enabled, + &pfs_param.m_consumer_events_statements_history_enabled, 0, + GET_BOOL, OPT_ARG, FALSE, 0, 0, 0, 0, 0}, + {"performance_schema_consumer_events_statements_history_long", 0, + "Default startup value for the events_statements_history_long consumer.", + &pfs_param.m_consumer_events_statements_history_long_enabled, + &pfs_param.m_consumer_events_statements_history_long_enabled, 0, + GET_BOOL, OPT_ARG, FALSE, 0, 0, 0, 0, 0}, + {"performance_schema_consumer_events_waits_current", 0, + "Default startup value for the events_waits_current consumer.", + &pfs_param.m_consumer_events_waits_current_enabled, + &pfs_param.m_consumer_events_waits_current_enabled, 0, + GET_BOOL, OPT_ARG, FALSE, 0, 0, 0, 0, 0}, + {"performance_schema_consumer_events_waits_history", 0, + "Default startup value for the events_waits_history consumer.", + &pfs_param.m_consumer_events_waits_history_enabled, + &pfs_param.m_consumer_events_waits_history_enabled, 0, + GET_BOOL, OPT_ARG, FALSE, 0, 0, 0, 0, 0}, + {"performance_schema_consumer_events_waits_history_long", 0, + "Default startup value for the events_waits_history_long consumer.", + &pfs_param.m_consumer_events_waits_history_long_enabled, + &pfs_param.m_consumer_events_waits_history_long_enabled, 0, + GET_BOOL, OPT_ARG, FALSE, 0, 0, 0, 0, 0}, + {"performance_schema_consumer_global_instrumentation", 0, + "Default startup value for the global_instrumentation consumer.", + &pfs_param.m_consumer_global_instrumentation_enabled, + &pfs_param.m_consumer_global_instrumentation_enabled, 0, + GET_BOOL, OPT_ARG, TRUE, 0, 0, 0, 0, 0}, + {"performance_schema_consumer_thread_instrumentation", 0, + "Default startup value for the thread_instrumentation consumer.", + &pfs_param.m_consumer_thread_instrumentation_enabled, + &pfs_param.m_consumer_thread_instrumentation_enabled, 0, + GET_BOOL, OPT_ARG, TRUE, 0, 0, 0, 0, 0}, + {"performance_schema_consumer_statements_digest", 0, + "Default startup value for the statements_digest consumer.", + &pfs_param.m_consumer_statement_digest_enabled, + &pfs_param.m_consumer_statement_digest_enabled, 0, + GET_BOOL, OPT_ARG, TRUE, 0, 0, 0, 0, 0} +}; + + + #ifdef HAVE_PSI_INTERFACE #ifdef HAVE_MMAP PSI_mutex_key key_PAGE_lock, key_LOCK_sync, key_LOCK_active, key_LOCK_pool, @@ -1316,6 +1386,7 @@ pthread_handler_t signal_hand(void *arg); static int mysql_init_variables(void); static int get_options(int *argc_ptr, char ***argv_ptr); static bool add_terminator(DYNAMIC_ARRAY *options); +static bool add_many_options(DYNAMIC_ARRAY *, my_option *, size_t); extern "C" my_bool mysqld_get_one_option(int, const struct my_option *, char *); static int init_thread_environment(); static char *get_relative_path(const char *path); @@ -4857,6 +4928,8 @@ int mysqld_main(int argc, char **argv) /* prepare all_early_options array */ my_init_dynamic_array(&all_early_options, sizeof(my_option), 100, 25, MYF(0)); + add_many_options(&all_early_options, pfs_early_options, + array_elements(pfs_early_options)); sys_var_add_options(&all_early_options, sys_var::PARSE_EARLY); add_terminator(&all_early_options); @@ -4867,6 +4940,7 @@ int mysqld_main(int argc, char **argv) buffered_logs.init(); my_getopt_error_reporter= buffered_option_error_reporter; my_charset_error_reporter= buffered_option_error_reporter; + pfs_param.m_pfs_instrument= const_cast<char*>(""); /* Initialize the array of performance schema instrument configurations. @@ -6299,7 +6373,6 @@ error: */ struct my_option my_long_options[]= - { {"help", '?', "Display this help and exit.", &opt_help, &opt_help, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, @@ -6726,11 +6799,9 @@ struct my_option my_long_options[]= 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} + REQUIRED_ARG, TABLE_OPEN_CACHE_DEFAULT, 1, 512*1024L, 0, 1, 0} }; - static int show_queries(THD *thd, SHOW_VAR *var, char *buff) { var->type= SHOW_LONGLONG; @@ -7439,12 +7510,21 @@ SHOW_VAR status_vars[]= { {NullS, NullS, SHOW_LONG} }; -bool add_terminator(DYNAMIC_ARRAY *options) +static bool add_terminator(DYNAMIC_ARRAY *options) { my_option empty_element= {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}; return insert_dynamic(options, (uchar *)&empty_element); } +static bool add_many_options(DYNAMIC_ARRAY *options, my_option *list, + size_t elements) +{ + for (my_option *opt= list; opt < list + elements; opt++) + if (insert_dynamic(options, opt)) + return 1; + return 0; +} + #ifndef EMBEDDED_LIBRARY static void print_version(void) { @@ -7486,6 +7566,8 @@ static void print_help() init_alloc_root(&mem_root, 4096, 4096, MYF(0)); pop_dynamic(&all_options); + add_many_options(&all_options, pfs_early_options, + array_elements(pfs_early_options)); sys_var_add_options(&all_options, sys_var::PARSE_EARLY); add_plugin_options(&all_options, &mem_root); sort_dynamic(&all_options, (qsort_cmp) option_cmp); @@ -8248,10 +8330,7 @@ static int get_options(int *argc_ptr, char ***argv_ptr) my_init_dynamic_array(&all_options, sizeof(my_option), array_elements(my_long_options), array_elements(my_long_options)/4, MYF(0)); - for (my_option *opt= my_long_options; - opt < my_long_options + array_elements(my_long_options) - 1; - opt++) - insert_dynamic(&all_options, (uchar*) opt); + add_many_options(&all_options, my_long_options, array_elements(my_long_options)); sys_var_add_options(&all_options, 0); add_terminator(&all_options); diff --git a/sql/set_var.cc b/sql/set_var.cc index be624351731..9f5404d75ce 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -487,10 +487,6 @@ SHOW_VAR* enumerate_sys_vars(THD *thd, bool sorted, enum enum_var_type type) if (type == OPT_GLOBAL && var->check_type(type)) continue; - /* don't show non-visible variables */ - if (var->not_visible()) - continue; - show->name= var->name.str; show->value= (char*) var; show->type= SHOW_SYS; @@ -532,10 +528,6 @@ sys_var *intern_find_sys_var(const char *str, uint length) var= (sys_var*) my_hash_search(&system_variable_hash, (uchar*) str, length ? length : strlen(str)); - /* Don't show non-visible variables. */ - if (var && var->not_visible()) - return NULL; - return var; } diff --git a/sql/set_var.h b/sql/set_var.h index 683f74e35b7..f912c9fffad 100644 --- a/sql/set_var.h +++ b/sql/set_var.h @@ -60,8 +60,7 @@ public: sys_var *next; LEX_CSTRING name; enum flag_enum { GLOBAL, SESSION, ONLY_SESSION, SCOPE_MASK=1023, - READONLY=1024, ALLOCATED=2048, INVISIBLE= 4096, - PARSE_EARLY=8192 }; + READONLY=1024, ALLOCATED=2048, PARSE_EARLY=4096 }; /** Enumeration type to indicate for a system variable whether it will be written to the binlog or not. @@ -113,7 +112,6 @@ public: int scope() const { return flags & SCOPE_MASK; } CHARSET_INFO *charset(THD *thd); bool is_readonly() const { return flags & READONLY; } - bool not_visible() const { return flags & INVISIBLE; } /** the following is only true for keycache variables, that support the syntax @@keycache_name.variable_name diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 9b55c09a170..ed5e34463e9 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -75,85 +75,6 @@ static Sys_var_mybool Sys_pfs_enabled( PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_enabled), CMD_LINE(OPT_ARG), DEFAULT(FALSE)); -static Sys_var_charptr Sys_pfs_instrument( - "performance_schema_instrument", - "Default startup value for a performance schema instrument.", - PARSED_EARLY READ_ONLY NOT_VISIBLE GLOBAL_VAR(pfs_param.m_pfs_instrument), - CMD_LINE(OPT_ARG, OPT_PFS_INSTRUMENT), - IN_FS_CHARSET, DEFAULT("")); - -static Sys_var_mybool Sys_pfs_consumer_events_stages_current( - "performance_schema_consumer_events_stages_current", - "Default startup value for the events_stages_current consumer.", - PARSED_EARLY READ_ONLY NOT_VISIBLE GLOBAL_VAR(pfs_param.m_consumer_events_stages_current_enabled), - CMD_LINE(OPT_ARG), DEFAULT(FALSE)); - -static Sys_var_mybool Sys_pfs_consumer_events_stages_history( - "performance_schema_consumer_events_stages_history", - "Default startup value for the events_stages_history consumer.", - PARSED_EARLY READ_ONLY NOT_VISIBLE GLOBAL_VAR(pfs_param.m_consumer_events_stages_history_enabled), - CMD_LINE(OPT_ARG), DEFAULT(FALSE)); - -static Sys_var_mybool Sys_pfs_consumer_events_stages_history_long( - "performance_schema_consumer_events_stages_history_long", - "Default startup value for the events_stages_history_long consumer.", - PARSED_EARLY READ_ONLY NOT_VISIBLE GLOBAL_VAR(pfs_param.m_consumer_events_stages_history_long_enabled), - CMD_LINE(OPT_ARG), DEFAULT(FALSE)); - -static Sys_var_mybool Sys_pfs_consumer_events_statements_current( - "performance_schema_consumer_events_statements_current", - "Default startup value for the events_statements_current consumer.", - PARSED_EARLY READ_ONLY NOT_VISIBLE GLOBAL_VAR(pfs_param.m_consumer_events_statements_current_enabled), - CMD_LINE(OPT_ARG), DEFAULT(TRUE)); - -static Sys_var_mybool Sys_pfs_consumer_events_statements_history( - "performance_schema_consumer_events_statements_history", - "Default startup value for the events_statements_history consumer.", - PARSED_EARLY READ_ONLY NOT_VISIBLE GLOBAL_VAR(pfs_param.m_consumer_events_statements_history_enabled), - CMD_LINE(OPT_ARG), DEFAULT(FALSE)); - -static Sys_var_mybool Sys_pfs_consumer_events_statements_history_long( - "performance_schema_consumer_events_statements_history_long", - "Default startup value for the events_statements_history_long consumer.", - PARSED_EARLY READ_ONLY NOT_VISIBLE GLOBAL_VAR(pfs_param.m_consumer_events_statements_history_long_enabled), - CMD_LINE(OPT_ARG), DEFAULT(FALSE)); - -static Sys_var_mybool Sys_pfs_consumer_events_waits_current( - "performance_schema_consumer_events_waits_current", - "Default startup value for the events_waits_current consumer.", - PARSED_EARLY READ_ONLY NOT_VISIBLE GLOBAL_VAR(pfs_param.m_consumer_events_waits_current_enabled), - CMD_LINE(OPT_ARG), DEFAULT(FALSE)); - -static Sys_var_mybool Sys_pfs_consumer_events_waits_history( - "performance_schema_consumer_events_waits_history", - "Default startup value for the events_waits_history consumer.", - PARSED_EARLY READ_ONLY NOT_VISIBLE GLOBAL_VAR(pfs_param.m_consumer_events_waits_history_enabled), - CMD_LINE(OPT_ARG), DEFAULT(FALSE)); - -static Sys_var_mybool Sys_pfs_consumer_events_waits_history_long( - "performance_schema_consumer_events_waits_history_long", - "Default startup value for the events_waits_history_long consumer.", - PARSED_EARLY READ_ONLY NOT_VISIBLE GLOBAL_VAR(pfs_param.m_consumer_events_waits_history_long_enabled), - CMD_LINE(OPT_ARG), DEFAULT(FALSE)); - -static Sys_var_mybool Sys_pfs_consumer_global_instrumentation( - "performance_schema_consumer_global_instrumentation", - "Default startup value for the global_instrumentation consumer.", - PARSED_EARLY READ_ONLY NOT_VISIBLE GLOBAL_VAR(pfs_param.m_consumer_global_instrumentation_enabled), - CMD_LINE(OPT_ARG), DEFAULT(TRUE)); - -static Sys_var_mybool Sys_pfs_consumer_thread_instrumentation( - "performance_schema_consumer_thread_instrumentation", - "Default startup value for the thread_instrumentation consumer.", - PARSED_EARLY READ_ONLY NOT_VISIBLE GLOBAL_VAR(pfs_param.m_consumer_thread_instrumentation_enabled), - CMD_LINE(OPT_ARG), DEFAULT(TRUE)); - -static Sys_var_mybool Sys_pfs_consumer_statement_digest( - "performance_schema_consumer_statements_digest", - "Default startup value for the statements_digest consumer.", - PARSED_EARLY READ_ONLY NOT_VISIBLE GLOBAL_VAR(pfs_param.m_consumer_statement_digest_enabled), - CMD_LINE(OPT_ARG), DEFAULT(TRUE)); - static Sys_var_ulong Sys_pfs_events_waits_history_long_size( "performance_schema_events_waits_history_long_size", "Number of rows in EVENTS_WAITS_HISTORY_LONG.", diff --git a/sql/sys_vars.h b/sql/sys_vars.h index 98c71e1df13..ffa7de118c8 100644 --- a/sql/sys_vars.h +++ b/sql/sys_vars.h @@ -51,7 +51,6 @@ #define ON_CHECK(X) X #define ON_UPDATE(X) X #define READ_ONLY sys_var::READONLY+ -#define NOT_VISIBLE sys_var::INVISIBLE+ // this means that Sys_var_charptr initial value was malloc()ed #define PREALLOCATED sys_var::ALLOCATED+ #define PARSED_EARLY sys_var::PARSE_EARLY+ |