Skip to content

Commit a4c3bc6

Browse files
author
Marc Alff
committed
WL#2360 Performance schema
Part IV: sql instrumentation
1 parent b2b0550 commit a4c3bc6

File tree

133 files changed

+5200
-2297
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

133 files changed

+5200
-2297
lines changed

client/client_priv.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ enum options_client
101101
/**
102102
First mysql version supporting the performance schema.
103103
*/
104-
#define FIRST_PERFORMANCE_SCHEMA_VERSION 50600
104+
#define FIRST_PERFORMANCE_SCHEMA_VERSION 50599
105105

106106
/**
107107
Name of the performance schema database.

libmysqld/lib_sql.cc

+13-1
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,19 @@ int init_embedded_server(int argc, char **argv, char **groups)
501501
*/
502502
logger.init_base();
503503

504-
if (init_common_variables("my", *argcp, *argvp, (const char **)groups))
504+
orig_argc= *argcp;
505+
orig_argv= *argvp;
506+
load_defaults("my", (const char **)groups, argcp, argvp);
507+
defaults_argc= *argcp;
508+
defaults_argv= *argvp;
509+
remaining_argc= argc;
510+
remaining_argv= argv;
511+
512+
/* Must be initialized early for comparison of options name */
513+
system_charset_info= &my_charset_utf8_general_ci;
514+
sys_var_init();
515+
516+
if (init_common_variables())
505517
{
506518
mysql_server_end();
507519
return 1;
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright (C) 2010 Sun Microsystems, Inc.
2+
#
3+
# This program is free software; you can redistribute it and/or modify
4+
# it under the terms of the GNU General Public License as published by
5+
# the Free Software Foundation; version 2 of the License.
6+
#
7+
# This program is distributed in the hope that it will be useful,
8+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
9+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10+
# GNU General Public License for more details.
11+
#
12+
# You should have received a copy of the GNU General Public License
13+
# along with this program; if not, write to the Free Software
14+
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15+
16+
if (!`SELECT count(*) FROM information_schema.engines WHERE
17+
(support = 'YES' OR support = 'DEFAULT') AND
18+
engine = 'PERFORMANCE_SCHEMA'`){
19+
skip Need performance schema compiled in;
20+
}
+10-8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
create table t1 (test_name text);
2+
create table t2 (variable_name text);
23
load data infile "MYSQLTEST_VARDIR/tmp/sys_vars.all_vars.txt" into table t1;
3-
select variable_name as `There should be *no* variables listed below:`
4-
from information_schema.global_variables
5-
left join t1 on variable_name=test_name where
6-
test_name is null
7-
union
8-
select variable_name from information_schema.session_variables
9-
left join t1 on variable_name=test_name where
10-
test_name is null;
4+
insert into t2 select variable_name from information_schema.global_variables;
5+
insert into t2 select variable_name from information_schema.session_variables;
6+
update t2 set variable_name= replace(variable_name, "PERFORMANCE_SCHEMA_", "PFS_");
7+
select variable_name as `There should be *no* long test name listed below:` from t2
8+
where length(variable_name) > 50;
9+
There should be *no* long test name listed below:
10+
select variable_name as `There should be *no* variables listed below:` from t2
11+
left join t1 on variable_name=test_name where test_name is null;
1112
There should be *no* variables listed below:
1213
drop table t1;
14+
drop table t2;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
select @@global.performance_schema;
2+
@@global.performance_schema
3+
1
4+
select @@session.performance_schema;
5+
ERROR HY000: Variable 'performance_schema' is a GLOBAL variable
6+
show global variables like 'performance_schema';
7+
Variable_name Value
8+
performance_schema ON
9+
show session variables like 'performance_schema';
10+
Variable_name Value
11+
performance_schema ON
12+
select * from information_schema.global_variables
13+
where variable_name='performance_schema';
14+
VARIABLE_NAME VARIABLE_VALUE
15+
PERFORMANCE_SCHEMA ON
16+
select * from information_schema.session_variables
17+
where variable_name='performance_schema';
18+
VARIABLE_NAME VARIABLE_VALUE
19+
PERFORMANCE_SCHEMA ON
20+
set global performance_schema=1;
21+
ERROR HY000: Variable 'performance_schema' is a read only variable
22+
set session performance_schema=1;
23+
ERROR HY000: Variable 'performance_schema' is a read only variable
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
select @@global.performance_schema_events_waits_history_long_size;
2+
@@global.performance_schema_events_waits_history_long_size
3+
15000
4+
select @@session.performance_schema_events_waits_history_long_size;
5+
ERROR HY000: Variable 'performance_schema_events_waits_history_long_size' is a GLOBAL variable
6+
show global variables like 'performance_schema_events_waits_history_long_size';
7+
Variable_name Value
8+
performance_schema_events_waits_history_long_size 15000
9+
show session variables like 'performance_schema_events_waits_history_long_size';
10+
Variable_name Value
11+
performance_schema_events_waits_history_long_size 15000
12+
select * from information_schema.global_variables
13+
where variable_name='performance_schema_events_waits_history_long_size';
14+
VARIABLE_NAME VARIABLE_VALUE
15+
PERFORMANCE_SCHEMA_EVENTS_WAITS_HISTORY_LONG_SIZE 15000
16+
select * from information_schema.session_variables
17+
where variable_name='performance_schema_events_waits_history_long_size';
18+
VARIABLE_NAME VARIABLE_VALUE
19+
PERFORMANCE_SCHEMA_EVENTS_WAITS_HISTORY_LONG_SIZE 15000
20+
set global performance_schema_events_waits_history_long_size=1;
21+
ERROR HY000: Variable 'performance_schema_events_waits_history_long_size' is a read only variable
22+
set session performance_schema_events_waits_history_long_size=1;
23+
ERROR HY000: Variable 'performance_schema_events_waits_history_long_size' is a read only variable
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
select @@global.performance_schema_events_waits_history_size;
2+
@@global.performance_schema_events_waits_history_size
3+
15
4+
select @@session.performance_schema_events_waits_history_size;
5+
ERROR HY000: Variable 'performance_schema_events_waits_history_size' is a GLOBAL variable
6+
show global variables like 'performance_schema_events_waits_history_size';
7+
Variable_name Value
8+
performance_schema_events_waits_history_size 15
9+
show session variables like 'performance_schema_events_waits_history_size';
10+
Variable_name Value
11+
performance_schema_events_waits_history_size 15
12+
select * from information_schema.global_variables
13+
where variable_name='performance_schema_events_waits_history_size';
14+
VARIABLE_NAME VARIABLE_VALUE
15+
PERFORMANCE_SCHEMA_EVENTS_WAITS_HISTORY_SIZE 15
16+
select * from information_schema.session_variables
17+
where variable_name='performance_schema_events_waits_history_size';
18+
VARIABLE_NAME VARIABLE_VALUE
19+
PERFORMANCE_SCHEMA_EVENTS_WAITS_HISTORY_SIZE 15
20+
set global performance_schema_events_waits_history_size=1;
21+
ERROR HY000: Variable 'performance_schema_events_waits_history_size' is a read only variable
22+
set session performance_schema_events_waits_history_size=1;
23+
ERROR HY000: Variable 'performance_schema_events_waits_history_size' is a read only variable
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
select @@global.performance_schema_max_cond_classes;
2+
@@global.performance_schema_max_cond_classes
3+
123
4+
select @@session.performance_schema_max_cond_classes;
5+
ERROR HY000: Variable 'performance_schema_max_cond_classes' is a GLOBAL variable
6+
show global variables like 'performance_schema_max_cond_classes';
7+
Variable_name Value
8+
performance_schema_max_cond_classes 123
9+
show session variables like 'performance_schema_max_cond_classes';
10+
Variable_name Value
11+
performance_schema_max_cond_classes 123
12+
select * from information_schema.global_variables
13+
where variable_name='performance_schema_max_cond_classes';
14+
VARIABLE_NAME VARIABLE_VALUE
15+
PERFORMANCE_SCHEMA_MAX_COND_CLASSES 123
16+
select * from information_schema.session_variables
17+
where variable_name='performance_schema_max_cond_classes';
18+
VARIABLE_NAME VARIABLE_VALUE
19+
PERFORMANCE_SCHEMA_MAX_COND_CLASSES 123
20+
set global performance_schema_max_cond_classes=1;
21+
ERROR HY000: Variable 'performance_schema_max_cond_classes' is a read only variable
22+
set session performance_schema_max_cond_classes=1;
23+
ERROR HY000: Variable 'performance_schema_max_cond_classes' is a read only variable
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
select @@global.performance_schema_max_cond_instances;
2+
@@global.performance_schema_max_cond_instances
3+
123
4+
select @@session.performance_schema_max_cond_instances;
5+
ERROR HY000: Variable 'performance_schema_max_cond_instances' is a GLOBAL variable
6+
show global variables like 'performance_schema_max_cond_instances';
7+
Variable_name Value
8+
performance_schema_max_cond_instances 123
9+
show session variables like 'performance_schema_max_cond_instances';
10+
Variable_name Value
11+
performance_schema_max_cond_instances 123
12+
select * from information_schema.global_variables
13+
where variable_name='performance_schema_max_cond_instances';
14+
VARIABLE_NAME VARIABLE_VALUE
15+
PERFORMANCE_SCHEMA_MAX_COND_INSTANCES 123
16+
select * from information_schema.session_variables
17+
where variable_name='performance_schema_max_cond_instances';
18+
VARIABLE_NAME VARIABLE_VALUE
19+
PERFORMANCE_SCHEMA_MAX_COND_INSTANCES 123
20+
set global performance_schema_max_cond_instances=1;
21+
ERROR HY000: Variable 'performance_schema_max_cond_instances' is a read only variable
22+
set session performance_schema_max_cond_instances=1;
23+
ERROR HY000: Variable 'performance_schema_max_cond_instances' is a read only variable
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
select @@global.performance_schema_max_file_classes;
2+
@@global.performance_schema_max_file_classes
3+
123
4+
select @@session.performance_schema_max_file_classes;
5+
ERROR HY000: Variable 'performance_schema_max_file_classes' is a GLOBAL variable
6+
show global variables like 'performance_schema_max_file_classes';
7+
Variable_name Value
8+
performance_schema_max_file_classes 123
9+
show session variables like 'performance_schema_max_file_classes';
10+
Variable_name Value
11+
performance_schema_max_file_classes 123
12+
select * from information_schema.global_variables
13+
where variable_name='performance_schema_max_file_classes';
14+
VARIABLE_NAME VARIABLE_VALUE
15+
PERFORMANCE_SCHEMA_MAX_FILE_CLASSES 123
16+
select * from information_schema.session_variables
17+
where variable_name='performance_schema_max_file_classes';
18+
VARIABLE_NAME VARIABLE_VALUE
19+
PERFORMANCE_SCHEMA_MAX_FILE_CLASSES 123
20+
set global performance_schema_max_file_classes=1;
21+
ERROR HY000: Variable 'performance_schema_max_file_classes' is a read only variable
22+
set session performance_schema_max_file_classes=1;
23+
ERROR HY000: Variable 'performance_schema_max_file_classes' is a read only variable
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
select @@global.performance_schema_max_file_handles;
2+
@@global.performance_schema_max_file_handles
3+
123
4+
select @@session.performance_schema_max_file_handles;
5+
ERROR HY000: Variable 'performance_schema_max_file_handles' is a GLOBAL variable
6+
show global variables like 'performance_schema_max_file_handles';
7+
Variable_name Value
8+
performance_schema_max_file_handles 123
9+
show session variables like 'performance_schema_max_file_handles';
10+
Variable_name Value
11+
performance_schema_max_file_handles 123
12+
select * from information_schema.global_variables
13+
where variable_name='performance_schema_max_file_handles';
14+
VARIABLE_NAME VARIABLE_VALUE
15+
PERFORMANCE_SCHEMA_MAX_FILE_HANDLES 123
16+
select * from information_schema.session_variables
17+
where variable_name='performance_schema_max_file_handles';
18+
VARIABLE_NAME VARIABLE_VALUE
19+
PERFORMANCE_SCHEMA_MAX_FILE_HANDLES 123
20+
set global performance_schema_max_file_handles=1;
21+
ERROR HY000: Variable 'performance_schema_max_file_handles' is a read only variable
22+
set session performance_schema_max_file_handles=1;
23+
ERROR HY000: Variable 'performance_schema_max_file_handles' is a read only variable
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
select @@global.performance_schema_max_file_instances;
2+
@@global.performance_schema_max_file_instances
3+
123
4+
select @@session.performance_schema_max_file_instances;
5+
ERROR HY000: Variable 'performance_schema_max_file_instances' is a GLOBAL variable
6+
show global variables like 'performance_schema_max_file_instances';
7+
Variable_name Value
8+
performance_schema_max_file_instances 123
9+
show session variables like 'performance_schema_max_file_instances';
10+
Variable_name Value
11+
performance_schema_max_file_instances 123
12+
select * from information_schema.global_variables
13+
where variable_name='performance_schema_max_file_instances';
14+
VARIABLE_NAME VARIABLE_VALUE
15+
PERFORMANCE_SCHEMA_MAX_FILE_INSTANCES 123
16+
select * from information_schema.session_variables
17+
where variable_name='performance_schema_max_file_instances';
18+
VARIABLE_NAME VARIABLE_VALUE
19+
PERFORMANCE_SCHEMA_MAX_FILE_INSTANCES 123
20+
set global performance_schema_max_file_instances=1;
21+
ERROR HY000: Variable 'performance_schema_max_file_instances' is a read only variable
22+
set session performance_schema_max_file_instances=1;
23+
ERROR HY000: Variable 'performance_schema_max_file_instances' is a read only variable
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
select @@global.performance_schema_max_mutex_classes;
2+
@@global.performance_schema_max_mutex_classes
3+
123
4+
select @@session.performance_schema_max_mutex_classes;
5+
ERROR HY000: Variable 'performance_schema_max_mutex_classes' is a GLOBAL variable
6+
show global variables like 'performance_schema_max_mutex_classes';
7+
Variable_name Value
8+
performance_schema_max_mutex_classes 123
9+
show session variables like 'performance_schema_max_mutex_classes';
10+
Variable_name Value
11+
performance_schema_max_mutex_classes 123
12+
select * from information_schema.global_variables
13+
where variable_name='performance_schema_max_mutex_classes';
14+
VARIABLE_NAME VARIABLE_VALUE
15+
PERFORMANCE_SCHEMA_MAX_MUTEX_CLASSES 123
16+
select * from information_schema.session_variables
17+
where variable_name='performance_schema_max_mutex_classes';
18+
VARIABLE_NAME VARIABLE_VALUE
19+
PERFORMANCE_SCHEMA_MAX_MUTEX_CLASSES 123
20+
set global performance_schema_max_mutex_classes=1;
21+
ERROR HY000: Variable 'performance_schema_max_mutex_classes' is a read only variable
22+
set session performance_schema_max_mutex_classes=1;
23+
ERROR HY000: Variable 'performance_schema_max_mutex_classes' is a read only variable
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
select @@global.performance_schema_max_mutex_instances;
2+
@@global.performance_schema_max_mutex_instances
3+
123
4+
select @@session.performance_schema_max_mutex_instances;
5+
ERROR HY000: Variable 'performance_schema_max_mutex_instances' is a GLOBAL variable
6+
show global variables like 'performance_schema_max_mutex_instances';
7+
Variable_name Value
8+
performance_schema_max_mutex_instances 123
9+
show session variables like 'performance_schema_max_mutex_instances';
10+
Variable_name Value
11+
performance_schema_max_mutex_instances 123
12+
select * from information_schema.global_variables
13+
where variable_name='performance_schema_max_mutex_instances';
14+
VARIABLE_NAME VARIABLE_VALUE
15+
PERFORMANCE_SCHEMA_MAX_MUTEX_INSTANCES 123
16+
select * from information_schema.session_variables
17+
where variable_name='performance_schema_max_mutex_instances';
18+
VARIABLE_NAME VARIABLE_VALUE
19+
PERFORMANCE_SCHEMA_MAX_MUTEX_INSTANCES 123
20+
set global performance_schema_max_mutex_instances=1;
21+
ERROR HY000: Variable 'performance_schema_max_mutex_instances' is a read only variable
22+
set session performance_schema_max_mutex_instances=1;
23+
ERROR HY000: Variable 'performance_schema_max_mutex_instances' is a read only variable
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
select @@global.performance_schema_max_rwlock_classes;
2+
@@global.performance_schema_max_rwlock_classes
3+
123
4+
select @@session.performance_schema_max_rwlock_classes;
5+
ERROR HY000: Variable 'performance_schema_max_rwlock_classes' is a GLOBAL variable
6+
show global variables like 'performance_schema_max_rwlock_classes';
7+
Variable_name Value
8+
performance_schema_max_rwlock_classes 123
9+
show session variables like 'performance_schema_max_rwlock_classes';
10+
Variable_name Value
11+
performance_schema_max_rwlock_classes 123
12+
select * from information_schema.global_variables
13+
where variable_name='performance_schema_max_rwlock_classes';
14+
VARIABLE_NAME VARIABLE_VALUE
15+
PERFORMANCE_SCHEMA_MAX_RWLOCK_CLASSES 123
16+
select * from information_schema.session_variables
17+
where variable_name='performance_schema_max_rwlock_classes';
18+
VARIABLE_NAME VARIABLE_VALUE
19+
PERFORMANCE_SCHEMA_MAX_RWLOCK_CLASSES 123
20+
set global performance_schema_max_rwlock_classes=1;
21+
ERROR HY000: Variable 'performance_schema_max_rwlock_classes' is a read only variable
22+
set session performance_schema_max_rwlock_classes=1;
23+
ERROR HY000: Variable 'performance_schema_max_rwlock_classes' is a read only variable
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
select @@global.performance_schema_max_rwlock_instances;
2+
@@global.performance_schema_max_rwlock_instances
3+
123
4+
select @@session.performance_schema_max_rwlock_instances;
5+
ERROR HY000: Variable 'performance_schema_max_rwlock_instances' is a GLOBAL variable
6+
show global variables like 'performance_schema_max_rwlock_instances';
7+
Variable_name Value
8+
performance_schema_max_rwlock_instances 123
9+
show session variables like 'performance_schema_max_rwlock_instances';
10+
Variable_name Value
11+
performance_schema_max_rwlock_instances 123
12+
select * from information_schema.global_variables
13+
where variable_name='performance_schema_max_rwlock_instances';
14+
VARIABLE_NAME VARIABLE_VALUE
15+
PERFORMANCE_SCHEMA_MAX_RWLOCK_INSTANCES 123
16+
select * from information_schema.session_variables
17+
where variable_name='performance_schema_max_rwlock_instances';
18+
VARIABLE_NAME VARIABLE_VALUE
19+
PERFORMANCE_SCHEMA_MAX_RWLOCK_INSTANCES 123
20+
set global performance_schema_max_rwlock_instances=1;
21+
ERROR HY000: Variable 'performance_schema_max_rwlock_instances' is a read only variable
22+
set session performance_schema_max_rwlock_instances=1;
23+
ERROR HY000: Variable 'performance_schema_max_rwlock_instances' is a read only variable
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
select @@global.performance_schema_max_table_handles;
2+
@@global.performance_schema_max_table_handles
3+
123
4+
select @@session.performance_schema_max_table_handles;
5+
ERROR HY000: Variable 'performance_schema_max_table_handles' is a GLOBAL variable
6+
show global variables like 'performance_schema_max_table_handles';
7+
Variable_name Value
8+
performance_schema_max_table_handles 123
9+
show session variables like 'performance_schema_max_table_handles';
10+
Variable_name Value
11+
performance_schema_max_table_handles 123
12+
select * from information_schema.global_variables
13+
where variable_name='performance_schema_max_table_handles';
14+
VARIABLE_NAME VARIABLE_VALUE
15+
PERFORMANCE_SCHEMA_MAX_TABLE_HANDLES 123
16+
select * from information_schema.session_variables
17+
where variable_name='performance_schema_max_table_handles';
18+
VARIABLE_NAME VARIABLE_VALUE
19+
PERFORMANCE_SCHEMA_MAX_TABLE_HANDLES 123
20+
set global performance_schema_max_table_handles=1;
21+
ERROR HY000: Variable 'performance_schema_max_table_handles' is a read only variable
22+
set session performance_schema_max_table_handles=1;
23+
ERROR HY000: Variable 'performance_schema_max_table_handles' is a read only variable

0 commit comments

Comments
 (0)