3437 Christopher Powers 2011-11-17
WL#5461 PERFORMANCE_SCHEMA MY.CNF Default Setup
Changes per code review:
- Make new test cases platform- and compile option-generic
- Issue warnings for invalid configuration options
- Improve configuration option descriptions
- Misc code tweaks
modified:
mysql-test/r/mysqld--help-win.result
mysql-test/suite/perfschema/r/setup_consumers_defaults.result
mysql-test/suite/perfschema/r/setup_instruments_defaults.result
mysql-test/suite/perfschema/t/setup_consumers_defaults.test
mysql-test/suite/perfschema/t/setup_instruments_defaults-master.opt
mysql-test/suite/perfschema/t/setup_instruments_defaults.test
sql/mysqld.cc
sql/sys_vars.cc
storage/perfschema/pfs_instr_class.cc
storage/perfschema/pfs_instr_class.h
storage/perfschema/pfs_server.cc
storage/perfschema/pfs_server.h
3436 Christopher Powers 2011-11-17
WL#5461 PERFORMANCE_SCHEMA MY.CNF Defaults Setup
setup_instruments_defaults.test
- Remove SELECT on setup_instruments - inconsistent across platforms
modified:
mysql-test/suite/perfschema/r/setup_instruments_defaults.result
mysql-test/suite/perfschema/t/setup_instruments_defaults.test
mysql-test/valgrind.supp
=== modified file 'mysql-test/r/mysqld--help-win.result'
--- a/mysql-test/r/mysqld--help-win.result 2011-11-16 07:36:28 +0000
+++ b/mysql-test/r/mysqld--help-win.result 2011-11-17 21:44:20 +0000
@@ -456,29 +456,40 @@ The following options may be given as th
--performance-schema-accounts-size=#
Maximum number of instrumented user@host accounts.
--performance-schema-consumer-events-stages-current
- Enable the events_stages_current consumer.
+ Default startup value for the events_stages_current
+ consumer.
--performance-schema-consumer-events-stages-history
- Enable the events_stages_history consumer.
+ Default startup value for the events_stages_history
+ consumer.
--performance-schema-consumer-events-stages-history-long
- Enable the events_stages_history_long consumer.
+ Default startup value for the events_stages_history_long
+ consumer.
--performance-schema-consumer-events-statements-current
- Enable the events_statements_current consumer.
+ Default startup value for the events_statements_current
+ consumer.
(Defaults to on; use --skip-performance-schema-consumer-events-statements-current to disable.)
--performance-schema-consumer-events-statements-history
- Enable the events_statements_history consumer.
+ Default startup value for the events_statements_history
+ consumer.
--performance-schema-consumer-events-statements-history-long
- Enable the events_statements_history_long consumer.
+ Default startup value for the
+ events_statements_history_long consumer.
--performance-schema-consumer-events-waits-current
- Enable the events_waits_current consumer.
+ Default startup value for the events_waits_current
+ consumer.
--performance-schema-consumer-events-waits-history
- Enable the events_waits_history consumer.
+ Default startup value for the events_waits_history
+ consumer.
--performance-schema-consumer-events-waits-history-long
- Enable the events_waits_history_long consumer.
+ Default startup value for the events_waits_history_long
+ consumer.
--performance-schema-consumer-global-instrumentation
- Enable the global_instrumentation consumer.
+ Default startup value for the global_instrumentation
+ consumer.
(Defaults to on; use --skip-performance-schema-consumer-global-instrumentation to disable.)
--performance-schema-consumer-thread-instrumentation
- Enable the thread_instrumentation consumer.
+ Default startup value for the thread_instrumentation
+ consumer.
(Defaults to on; use --skip-performance-schema-consumer-thread-instrumentation to disable.)
--performance-schema-events-stages-history-long-size=#
Number of rows in EVENTS_STAGES_HISTORY_LONG.
@@ -495,7 +506,8 @@ The following options may be given as th
--performance-schema-hosts-size=#
Maximum number of instrumented hosts.
--performance-schema-instrument[=name]
- Enable a performance schema instrument.
+ Default startup value for a performance schema
+ instrument.
--performance-schema-max-cond-classes=#
Maximum number of condition instruments.
--performance-schema-max-cond-instances=#
=== modified file 'mysql-test/suite/perfschema/r/setup_consumers_defaults.result'
--- a/mysql-test/suite/perfschema/r/setup_consumers_defaults.result 2011-11-16 07:05:50 +0000
+++ b/mysql-test/suite/perfschema/r/setup_consumers_defaults.result 2011-11-17 21:44:20 +0000
@@ -1,13 +1,3 @@
-SELECT COUNT(*) = 6 AS 'Expect 1'
-FROM performance_schema.setup_consumers
-WHERE enabled = 'yes';
-Expect 1
-1
-SELECT COUNT(*) = 5 AS 'Expect 1'
-FROM performance_schema.setup_consumers
-WHERE enabled = 'no';
-Expect 1
-1
SELECT * FROM performance_schema.setup_consumers ORDER BY name;
NAME ENABLED
events_stages_current NO
=== modified file 'mysql-test/suite/perfschema/r/setup_instruments_defaults.result'
--- a/mysql-test/suite/perfschema/r/setup_instruments_defaults.result 2011-11-17 17:01:38 +0000
+++ b/mysql-test/suite/perfschema/r/setup_instruments_defaults.result 2011-11-17 21:44:20 +0000
@@ -1,20 +1,34 @@
-SELECT COUNT(*) = 31 AS 'Expect 1'
-FROM performance_schema.setup_instruments
-WHERE name LIKE 'wait/synch/mutex/sql/%' AND enabled = 'no' and timed = 'no';
-Expect 1
-1
-SELECT COUNT(*) = 1 AS 'Expect 1'
-FROM performance_schema.setup_instruments
-WHERE name = 'wait/synch/mutex/sql/LOCK_thread_count' AND enabled = 'no' and timed = 'no';
-Expect 1
-1
-SELECT COUNT(*) = 4 AS 'Expect 1'
-FROM performance_schema.setup_instruments
-WHERE name LIKE 'wait/synch/mutex/sql/LOCK_%' AND enabled = 'yes' and timed = 'no';
-Expect 1
-1
-SELECT COUNT(*) = 1 AS 'Expect 1'
-FROM performance_schema.setup_instruments
-WHERE name LIKE 'stage/%' AND enabled = 'yes' and timed = 'no';
-Expect 1
-1
+SELECT * FROM performance_schema.setup_instruments
+WHERE name IN (
+'wait/synch/mutex/sql/LOCK_user_conn',
+'wait/synch/mutex/sql/LOCK_uuid_generator',
+'wait/synch/mutex/sql/LOCK_xid_cache'
+ 'stage/sql/creating table')
+AND enabled = 'yes' AND timed = 'no'
+ORDER BY name;
+NAME ENABLED TIMED
+wait/synch/mutex/sql/LOCK_user_conn YES NO
+wait/synch/mutex/sql/LOCK_uuid_generator YES NO
+SELECT * FROM performance_schema.setup_instruments
+WHERE name = 'wait/synch/mutex/sql/LOCK_thread_count'
+AND enabled = 'no' AND timed = 'no';
+NAME ENABLED TIMED
+wait/synch/mutex/sql/LOCK_thread_count NO NO
+SELECT * FROM performance_schema.setup_instruments
+WHERE name IN (
+'wait/synch/mutex/sql/LOG_INFO::lock',
+'wait/synch/mutex/sql/THD::LOCK_thd_data')
+AND enabled = 'yes' AND timed = 'yes'
+ORDER BY name;
+NAME ENABLED TIMED
+wait/synch/mutex/sql/LOG_INFO::lock YES YES
+wait/synch/mutex/sql/THD::LOCK_thd_data YES YES
+SELECT * FROM performance_schema.setup_instruments
+WHERE name IN (
+'wait/synch/mutex/sql/Delayed_insert::mutex',
+'wait/synch/mutex/sql/hash_filo::lock')
+AND enabled = 'no' AND timed = 'no'
+ORDER BY name;
+NAME ENABLED TIMED
+wait/synch/mutex/sql/Delayed_insert::mutex NO NO
+wait/synch/mutex/sql/hash_filo::lock NO NO
=== modified file 'mysql-test/suite/perfschema/t/setup_consumers_defaults.test'
--- a/mysql-test/suite/perfschema/t/setup_consumers_defaults.test 2011-11-16 07:05:50 +0000
+++ b/mysql-test/suite/perfschema/t/setup_consumers_defaults.test 2011-11-17 21:44:20 +0000
@@ -3,14 +3,4 @@
--source include/not_embedded.inc
--source include/have_perfschema.inc
-# performance-schema-instrument = 'wait/synch/mutex/sql/% = NO'
-
-eval SELECT COUNT(*) = 6 AS 'Expect 1'
-FROM performance_schema.setup_consumers
-WHERE enabled = 'yes';
-
-eval SELECT COUNT(*) = 5 AS 'Expect 1'
-FROM performance_schema.setup_consumers
-WHERE enabled = 'no';
-
SELECT * FROM performance_schema.setup_consumers ORDER BY name;
=== modified file 'mysql-test/suite/perfschema/t/setup_instruments_defaults-master.opt'
--- a/mysql-test/suite/perfschema/t/setup_instruments_defaults-master.opt 2011-11-16 07:05:50 +0000
+++ b/mysql-test/suite/perfschema/t/setup_instruments_defaults-master.opt 2011-11-17 21:44:20 +0000
@@ -1,22 +1,21 @@
+--log-error=0
--loose-performance-schema-instrument='%=ON'
--loose-performance-schema-instrument='wait/synch/mutex/sql/% = OFF'
--loose-performance-schema-instrument='wait/synch/mutex/sql/LOCK% = ON'
--loose-performance-schema-instrument='wait/synch/mutex/sql/LOCK_thread_count = OFF'
--loose-performance-schema-instrument=' wait/synch/mutex/sql/LOCK_user_conn = COUNTED'
---loose-performance-schema-instrument='%wait/synch/mutex/sql/%user_locks = COUNTED'
--loose-performance-schema-instrument='wait%/synch/mutex/sql/LOCK_uu%_genera%/ = COUNTED'
--loose-performance-schema-instrument='%%wait/synch/mutex/sql/LOCK_xid_cache = COUNTED'
--loose-performance-schema-instrument='%=FOO'
--loose-performance-schema-instrument='%=%'
--loose-performance-schema-instrument='%'
--loose-performance-schema-instrument=''
---loose-performance-schema-instrument='stage/sql/Waiting until MASTER_DELAY seconds after master executed event = COUNTED'
---loose-performance-schema-instrument=' unknown%instrument/event/name with blanks = YES'
---loose-performance-schema-instrument='unknown/instrument/event/name = TRUE'
---loose-performance-schema-instrument='wait/synch/mutex/sql/LOG_INFO::lock = 1'
---loose-performance-schema-instrument='wait/synch/mutex/sql/Master_info::data_lock = 0'
---loose-performance-schema-instrument='wait/synch/mutex/sql/Master_info::run_lock = TRUE'
---loose-performance-schema-instrument='wait/synch/mutex/sql/Master_info::sleep_lock = FALSE'
---loose-performance-schema-instrument='wait/synch/cond/sql/MYSQL_BIN_LOG::COND_prep_xids = NO'
---loose-performance-schema-instrument='wait/synch/cond/sql/MYSQL_BIN_LOG::update_cond = NO'
+--loose-performance-schema-instrument=' unknown%instrument/event/name with blanks = YES'
+--loose-performance-schema-instrument='unknown/instrument/event/name = TRUE'
+--loose-performance-schema-instrument='stage/sql/creating table = COUNTED'
+--loose-performance-schema-instrument='wait/synch/mutex/sql/LOG_INFO::lock = 1'
+--loose-performance-schema-instrument='wait/synch/mutex/sql/Delayed_insert::mutex = 0'
+--loose-performance-schema-instrument='wait/synch/mutex/sql/THD::LOCK_thd_data = TRUE'
+--loose-performance-schema-instrument='wait/synch/mutex/sql/hash_filo::lock = FALSE'
+--loose-performance-schema-instrument='wait/synch/mutex/sql/TABLE_SHARE::LOCK_ha_data= NO'
=== modified file 'mysql-test/suite/perfschema/t/setup_instruments_defaults.test'
--- a/mysql-test/suite/perfschema/t/setup_instruments_defaults.test 2011-11-17 17:01:38 +0000
+++ b/mysql-test/suite/perfschema/t/setup_instruments_defaults.test 2011-11-17 21:44:20 +0000
@@ -3,21 +3,34 @@
--source include/not_embedded.inc
--source include/have_perfschema.inc
-# performance-schema-instrument = 'wait/synch/mutex/sql/% = NO'
-
-eval SELECT COUNT(*) = 31 AS 'Expect 1'
-FROM performance_schema.setup_instruments
-WHERE name LIKE 'wait/synch/mutex/sql/%' AND enabled = 'no' and timed = 'no';
-
-eval SELECT COUNT(*) = 1 AS 'Expect 1'
-FROM performance_schema.setup_instruments
-WHERE name = 'wait/synch/mutex/sql/LOCK_thread_count' AND enabled = 'no' and timed = 'no';
-
-eval SELECT COUNT(*) = 4 AS 'Expect 1'
-FROM performance_schema.setup_instruments
-WHERE name LIKE 'wait/synch/mutex/sql/LOCK_%' AND enabled = 'yes' and timed = 'no';
-
-eval SELECT COUNT(*) = 1 AS 'Expect 1'
-FROM performance_schema.setup_instruments
-WHERE name LIKE 'stage/%' AND enabled = 'yes' and timed = 'no';
+# Verify that the configuration options were applied correctly to the
+# setup_instruments table. These instruments that are known to persist across
+# platforms and the various compile options.
+
+SELECT * FROM performance_schema.setup_instruments
+WHERE name IN (
+ 'wait/synch/mutex/sql/LOCK_user_conn',
+ 'wait/synch/mutex/sql/LOCK_uuid_generator',
+ 'wait/synch/mutex/sql/LOCK_xid_cache'
+ 'stage/sql/creating table')
+AND enabled = 'yes' AND timed = 'no'
+ORDER BY name;
+
+SELECT * FROM performance_schema.setup_instruments
+WHERE name = 'wait/synch/mutex/sql/LOCK_thread_count'
+AND enabled = 'no' AND timed = 'no';
+
+SELECT * FROM performance_schema.setup_instruments
+WHERE name IN (
+ 'wait/synch/mutex/sql/LOG_INFO::lock',
+ 'wait/synch/mutex/sql/THD::LOCK_thd_data')
+AND enabled = 'yes' AND timed = 'yes'
+ORDER BY name;
+
+SELECT * FROM performance_schema.setup_instruments
+WHERE name IN (
+ 'wait/synch/mutex/sql/Delayed_insert::mutex',
+ 'wait/synch/mutex/sql/hash_filo::lock')
+AND enabled = 'no' AND timed = 'no'
+ORDER BY name;
=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc 2011-11-16 07:36:28 +0000
+++ b/sql/mysqld.cc 2011-11-17 21:44:20 +0000
@@ -7857,12 +7857,22 @@ mysqld_get_one_option(int optid,
/* Assignment required */
if (!(p= strchr(argument, '=')))
+ {
+ my_getopt_error_reporter(WARNING_LEVEL,
+ "Missing value for performance_schema_instrument "
+ "'%s'", argument);
return 0;
+ }
/* Option value */
val= p + 1;
if (!*val)
+ {
+ my_getopt_error_reporter(WARNING_LEVEL,
+ "Missing value for performance_schema_instrument "
+ "'%s'", argument);
return 0;
+ }
/* Trim leading spaces from instrument name */
while (*name && my_isspace(mysqld_charset, *name))
@@ -7874,12 +7884,16 @@ mysqld_get_one_option(int optid,
*p= 0;
if (!*name)
+ {
+ my_getopt_error_reporter(WARNING_LEVEL,
+ "Invalid instrument name for "
+ "performance_schema_instrument '%s'", argument);
return 0;
+ }
/* Trim leading and trailing spaces from option value */
while (*val && my_isspace(mysqld_charset, *val))
val++;
-
p= val + strlen(val);
while(p > val && my_isspace(mysqld_charset, p[-1]))
@@ -7887,10 +7901,22 @@ mysqld_get_one_option(int optid,
*p= 0;
if (!*val)
+ {
+ my_getopt_error_reporter(WARNING_LEVEL,
+ "Invalid value for performance_schema_instrument "
+ "'%s'", argument);
return 0;
+ }
/* Add instrument name and value to array of configuration options */
- add_pfs_instr_to_array(name, val);
+ if (add_pfs_instr_to_array(name, val))
+ {
+ my_getopt_error_reporter(WARNING_LEVEL,
+ "Invalid value for performance_schema_instrument "
+ "'%s'", argument);
+ return 0;
+ }
+
#endif
break;
}
=== modified file 'sql/sys_vars.cc'
--- a/sql/sys_vars.cc 2011-11-16 07:36:28 +0000
+++ b/sql/sys_vars.cc 2011-11-17 21:44:20 +0000
@@ -87,7 +87,7 @@ static Sys_var_mybool Sys_pfs_enabled(
static Sys_var_charptr Sys_pfs_instrument(
"performance_schema_instrument",
- "Enable a performance schema instrument.",
+ "Default startup value for a performance schema instrument.",
READ_ONLY NOT_VISIBLE GLOBAL_VAR(pfs_param.m_pfs_instrument),
CMD_LINE(OPT_ARG, OPT_PFS_INSTRUMENT),
IN_FS_CHARSET,
@@ -96,77 +96,77 @@ static Sys_var_charptr Sys_pfs_instrumen
static Sys_var_mybool Sys_pfs_consumer_events_stages_current(
"performance_schema_consumer_events_stages_current",
- "Enable the events_stages_current consumer.",
+ "Default startup value for the events_stages_current consumer.",
READ_ONLY NOT_VISIBLE GLOBAL_VAR(pfs_param.m_consumer_events_stages_current_enabled),
CMD_LINE(OPT_ARG), DEFAULT(FALSE),
PFS_TRAILING_PROPERTIES);
static Sys_var_mybool Sys_pfs_consumer_events_stages_history(
"performance_schema_consumer_events_stages_history",
- "Enable the events_stages_history consumer.",
+ "Default startup value for the events_stages_history consumer.",
READ_ONLY NOT_VISIBLE GLOBAL_VAR(pfs_param.m_consumer_events_stages_history_enabled),
CMD_LINE(OPT_ARG), DEFAULT(FALSE),
PFS_TRAILING_PROPERTIES);
static Sys_var_mybool Sys_pfs_consumer_events_stages_history_long(
"performance_schema_consumer_events_stages_history_long",
- "Enable the events_stages_history_long consumer.",
+ "Default startup value for the events_stages_history_long consumer.",
READ_ONLY NOT_VISIBLE GLOBAL_VAR(pfs_param.m_consumer_events_stages_history_long_enabled),
CMD_LINE(OPT_ARG), DEFAULT(FALSE),
PFS_TRAILING_PROPERTIES);
static Sys_var_mybool Sys_pfs_consumer_events_statements_current(
"performance_schema_consumer_events_statements_current",
- "Enable the events_statements_current consumer.",
+ "Default startup value for the events_statements_current consumer.",
READ_ONLY NOT_VISIBLE GLOBAL_VAR(pfs_param.m_consumer_events_statements_current_enabled),
CMD_LINE(OPT_ARG), DEFAULT(TRUE),
PFS_TRAILING_PROPERTIES);
static Sys_var_mybool Sys_pfs_consumer_events_statements_history(
"performance_schema_consumer_events_statements_history",
- "Enable the events_statements_history consumer.",
+ "Default startup value for the events_statements_history consumer.",
READ_ONLY NOT_VISIBLE GLOBAL_VAR(pfs_param.m_consumer_events_statements_history_enabled),
CMD_LINE(OPT_ARG), DEFAULT(FALSE),
PFS_TRAILING_PROPERTIES);
static Sys_var_mybool Sys_pfs_consumer_events_statements_history_long(
"performance_schema_consumer_events_statements_history_long",
- "Enable the events_statements_history_long consumer.",
+ "Default startup value for the events_statements_history_long consumer.",
READ_ONLY NOT_VISIBLE GLOBAL_VAR(pfs_param.m_consumer_events_statements_history_long_enabled),
CMD_LINE(OPT_ARG), DEFAULT(FALSE),
PFS_TRAILING_PROPERTIES);
static Sys_var_mybool Sys_pfs_consumer_events_waits_current(
"performance_schema_consumer_events_waits_current",
- "Enable the events_waits_current consumer.",
+ "Default startup value for the events_waits_current consumer.",
READ_ONLY NOT_VISIBLE GLOBAL_VAR(pfs_param.m_consumer_events_waits_current_enabled),
CMD_LINE(OPT_ARG), DEFAULT(FALSE),
PFS_TRAILING_PROPERTIES);
static Sys_var_mybool Sys_pfs_consumer_events_waits_history(
"performance_schema_consumer_events_waits_history",
- "Enable the events_waits_history consumer.",
+ "Default startup value for the events_waits_history consumer.",
READ_ONLY NOT_VISIBLE GLOBAL_VAR(pfs_param.m_consumer_events_waits_history_enabled),
CMD_LINE(OPT_ARG), DEFAULT(FALSE),
PFS_TRAILING_PROPERTIES);
static Sys_var_mybool Sys_pfs_consumer_events_waits_history_long(
"performance_schema_consumer_events_waits_history_long",
- "Enable the events_waits_history_long consumer.",
+ "Default startup value for the events_waits_history_long consumer.",
READ_ONLY NOT_VISIBLE GLOBAL_VAR(pfs_param.m_consumer_events_waits_history_long_enabled),
CMD_LINE(OPT_ARG), DEFAULT(FALSE),
PFS_TRAILING_PROPERTIES);
static Sys_var_mybool Sys_pfs_consumer_global_instrumentation(
"performance_schema_consumer_global_instrumentation",
- "Enable the global_instrumentation consumer.",
+ "Default startup value for the global_instrumentation consumer.",
READ_ONLY NOT_VISIBLE GLOBAL_VAR(pfs_param.m_consumer_global_instrumentation_enabled),
CMD_LINE(OPT_ARG), DEFAULT(TRUE),
PFS_TRAILING_PROPERTIES);
static Sys_var_mybool Sys_pfs_consumer_thread_instrumentation(
"performance_schema_consumer_thread_instrumentation",
- "Enable the thread_instrumentation consumer.",
+ "Default startup value for the thread_instrumentation consumer.",
READ_ONLY NOT_VISIBLE GLOBAL_VAR(pfs_param.m_consumer_thread_instrumentation_enabled),
CMD_LINE(OPT_ARG), DEFAULT(TRUE),
PFS_TRAILING_PROPERTIES);
=== modified file 'storage/perfschema/pfs_instr_class.cc'
--- a/storage/perfschema/pfs_instr_class.cc 2011-11-16 07:05:50 +0000
+++ b/storage/perfschema/pfs_instr_class.cc 2011-11-17 21:44:20 +0000
@@ -615,9 +615,9 @@ static void configure_instr_class(PFS_in
Consecutive wildcards affect the count.
*/
if (!my_wildcmp(&my_charset_latin1,
- entry->m_name, entry->m_name+entry->m_name_length,
- e->m_name, e->m_name+e->m_name_length,
- '\\', '?','%'))
+ entry->m_name, entry->m_name+entry->m_name_length,
+ e->m_name, e->m_name+e->m_name_length,
+ '\\', '?','%'))
{
if (e->m_name_length >= match_length)
{
=== modified file 'storage/perfschema/pfs_instr_class.h'
--- a/storage/perfschema/pfs_instr_class.h 2011-11-09 01:38:37 +0000
+++ b/storage/perfschema/pfs_instr_class.h 2011-11-17 21:44:20 +0000
@@ -86,10 +86,6 @@ struct PFS_instr_init
char *m_name;
/* Name length. */
uint m_name_length;
- /* Instrument option value: ON, OFF, TIMED. */
- char *m_value;
- /* Value length. */
- uint m_value_length;
/** Enabled flag. */
bool m_enabled;
/** Timed flag. */
=== modified file 'storage/perfschema/pfs_server.cc'
--- a/storage/perfschema/pfs_server.cc 2011-11-16 01:01:44 +0000
+++ b/storage/perfschema/pfs_server.cc 2011-11-17 21:44:20 +0000
@@ -197,10 +197,16 @@ void init_pfs_instrument_array()
}
/**
- Process one PFS_INSTRUMENT configuration string. Isolate the instrument name,
- evaluate the option value, and store them in a dynamic array.
+ Process one performance_schema_instrument configuration string. Isolate the
+ instrument name, evaluate the option value, and store them in a dynamic array.
+ Return 'false' for success, 'true' for error.
+
+ @param name Instrument name
+ @param value Configuration option: 'on', 'off', etc.
+ @return 0 for success, non zero for errors
*/
-bool add_pfs_instr_to_array(const char* name, const char* value)
+
+int add_pfs_instr_to_array(const char* name, const char* value)
{
int name_length= strlen(name);
int value_length= strlen(value);
@@ -210,58 +216,50 @@ bool add_pfs_instr_to_array(const char*
+ name_length + 1 + value_length + 1, MYF(MY_WME));
if (!e) return 1;
- /* Copy the name string */
+ /* Copy the instrument name */
e->m_name= (char*)e + sizeof(PFS_instr_init);
memcpy(e->m_name, name, name_length);
e->m_name_length= name_length;
e->m_name[name_length]= '\0';
- /* Copy the option string */
- e->m_value= e->m_name + name_length + 1;
- memcpy(e->m_value, value, value_length);
- e->m_value_length= value_length;
- e->m_value[value_length]= '\0';
-
- /* Unrecognized values default to 'disabled'. */
- e->m_enabled= false;
- e->m_timed= false;
- bool valid= true;
-
/* Set flags accordingly */
- if (!my_strcasecmp(&my_charset_latin1, e->m_value, "counted"))
+ if (!my_strcasecmp(&my_charset_latin1, value, "counted"))
{
e->m_enabled= true;
e->m_timed= false;
}
else
- if (!my_strcasecmp(&my_charset_latin1, e->m_value, "true") ||
- !my_strcasecmp(&my_charset_latin1, e->m_value, "on") ||
- !my_strcasecmp(&my_charset_latin1, e->m_value, "1") ||
- !my_strcasecmp(&my_charset_latin1, e->m_value, "yes") ||
- !my_strcasecmp(&my_charset_latin1, e->m_value, "enabled"))
+ if (!my_strcasecmp(&my_charset_latin1, value, "true") ||
+ !my_strcasecmp(&my_charset_latin1, value, "on") ||
+ !my_strcasecmp(&my_charset_latin1, value, "1") ||
+ !my_strcasecmp(&my_charset_latin1, value, "yes") ||
+ !my_strcasecmp(&my_charset_latin1, value, "enabled"))
{
e->m_enabled= true;
e->m_timed= true;
}
else
- if (!my_strcasecmp(&my_charset_latin1, e->m_value, "false") ||
- !my_strcasecmp(&my_charset_latin1, e->m_value, "off") ||
- !my_strcasecmp(&my_charset_latin1, e->m_value, "0") ||
- !my_strcasecmp(&my_charset_latin1, e->m_value, "no") ||
- !my_strcasecmp(&my_charset_latin1, e->m_value, "disabled"))
+ if (!my_strcasecmp(&my_charset_latin1, value, "false") ||
+ !my_strcasecmp(&my_charset_latin1, value, "off") ||
+ !my_strcasecmp(&my_charset_latin1, value, "0") ||
+ !my_strcasecmp(&my_charset_latin1, value, "no") ||
+ !my_strcasecmp(&my_charset_latin1, value, "disabled"))
{
e->m_enabled= false;
e->m_timed= false;
}
else
{
- valid= false; /* ignore invalid option values */
+ my_free(e);
+ return 1;
}
- if (valid && insert_dynamic(&pfs_instr_init_array, &e))
+ /* Add to the array of default startup options */
+ if (insert_dynamic(&pfs_instr_init_array, &e))
{
my_free(e);
return 1;
}
+
return 0;
}
=== modified file 'storage/perfschema/pfs_server.h'
--- a/storage/perfschema/pfs_server.h 2011-11-09 03:49:18 +0000
+++ b/storage/perfschema/pfs_server.h 2011-11-17 21:44:20 +0000
@@ -272,7 +272,7 @@ void init_pfs_instrument_array();
/**
Process one PFS_INSTRUMENT configuration string.
*/
-bool add_pfs_instr_to_array(const char* name, const char* value);
+int add_pfs_instr_to_array(const char* name, const char* value);
/**
Shutdown the performance schema.
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-trunk-wl5461 branch (chris.powers:3436 to 3437) WL#5461 | Christopher Powers | 18 Nov |