Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit 96be5b1

Browse files
committed
merge master
2 parents ecf4c34 + 761c8d0 commit 96be5b1

30 files changed

+992
-91
lines changed

COPYING

Lines changed: 339 additions & 0 deletions
Large diffs are not rendered by default.

NEWS.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Change history for the MySQL sys schema
2+
3+
## 1.1.0
4+
5+
### Improvements
6+
7+
### Bug Fixes
8+
9+
* Removed unintentially committed sys_56_rds.sql file (See Issue #5, which is still outstanding)
10+
11+
## 1.0.1 (23/05/2014)
12+
13+
### Improvements
14+
15+
* Added procedures to enable / disable Performance Schema consumers. (Contributed by the MySQL QA Team)
16+
* `ps_setup_disable_consumers(<LIKE string>)` allows disabling any consumers matching the LIKE string.
17+
* `ps_setup_enable_consumers(<LIKE string>)` allows enabling any consumers matching the LIKE string.
18+
19+
* Added procedures to show both enabled and disbled consumers or instruments individually, these are more useful for tooling than the `ps_setup_show_enabled`/`ps_setup_show_disabled` procedures which show all configuration in multiple result sets. (Contributed by the MySQL QA Team)
20+
* `ps_setup_show_disabled_consumers` shows only disabled consumers.
21+
* `ps_setup_show_disabled_instruments` shows only disabled instruments.
22+
* `ps_setup_show_enabled_consumers` shows only enabled consumers.
23+
* `ps_setup_show_enabled_instruments` shows only enabled instruments.
24+
25+
### Bug Fixes
26+
27+
* Running the installation scripts sometimes failed because of the comment format. (#1) (Contributed by Joe Grasse)
28+
* Some views did not work with the ERROR_FOR_DIVISION_BY_ZERO SQL mode. (#6) (Contributed by Joe Grasse)
29+
* On Windows the `ps_thread_stack()` stored function failed to escape file path backslashes correctly within the JSON output.
30+
31+
## 1.0.0 (11/04/2004)

README.md

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1582,6 +1582,42 @@ mysql> CALL sys.ps_setup_disable_instrument('');
15821582
1 row in set (0.01 sec)
15831583
```
15841584

1585+
#### ps_setup_disable_consumers
1586+
1587+
##### Description
1588+
1589+
Disables consumers within Performance Schema matching the input pattern.
1590+
1591+
Requires the SUPER privilege for "SET sql_log_bin = 0;".
1592+
1593+
##### Parameters
1594+
1595+
* consumer (VARCHAR(128)): A LIKE pattern match (using "%consumer%") of consumers to disable
1596+
1597+
##### Example
1598+
1599+
To disable all consumers:
1600+
```SQL
1601+
mysql> CALL sys.ps_setup_disable_consumers('');
1602+
+--------------------------+
1603+
| summary |
1604+
+--------------------------+
1605+
| Disabled 15 consumers |
1606+
+--------------------------+
1607+
1 row in set (0.02 sec)
1608+
```
1609+
1610+
To disable just the event_stage consumers:
1611+
```SQL
1612+
mysql> CALL sys.ps_setup_disable_consumers('stage');
1613+
+------------------------+
1614+
| summary |
1615+
+------------------------+
1616+
| Disabled 3 consumers |
1617+
+------------------------+
1618+
1 row in set (0.00 sec)
1619+
```
1620+
15851621
#### ps_setup_disable_thread
15861622

15871623
##### Description
@@ -1638,6 +1674,42 @@ mysql> CALL sys.ps_setup_enable_background_threads();
16381674
1 row in set (0.00 sec)
16391675
```
16401676

1677+
#### ps_setup_enable_consumers
1678+
1679+
##### Description
1680+
1681+
Enables consumers within Performance Schema matching the input pattern.
1682+
1683+
Requires the SUPER privilege for "SET sql_log_bin = 0;".
1684+
1685+
##### Parameters
1686+
1687+
* consumer (VARCHAR(128)): A LIKE pattern match (using "%consumer%") of consumers to enable
1688+
1689+
##### Example
1690+
1691+
To enable all consumers:
1692+
```SQL
1693+
mysql> CALL sys.ps_setup_enable_consumers('');
1694+
+-------------------------+
1695+
| summary |
1696+
+-------------------------+
1697+
| Enabled 10 consumers |
1698+
+-------------------------+
1699+
1 row in set (0.02 sec)
1700+
```
1701+
1702+
To enable just "waits" consumers:
1703+
```SQL
1704+
mysql> CALL sys.ps_setup_enable_consumers('waits');
1705+
+-----------------------+
1706+
| summary |
1707+
+-----------------------+
1708+
| Enabled 3 consumers |
1709+
+-----------------------+
1710+
1 row in set (0.00 sec)
1711+
```
1712+
16411713
#### ps_setup_enable_instrument
16421714

16431715
##### Description
@@ -1891,6 +1963,48 @@ Empty set (0.00 sec)
18911963
Query OK, 0 rows affected (0.01 sec)
18921964
```
18931965

1966+
#### ps_setup_show_disabled_consumers
1967+
1968+
##### Description
1969+
1970+
Shows all currently disabled consumers.
1971+
1972+
##### Parameters
1973+
1974+
None
1975+
1976+
##### Example
1977+
1978+
```SQL
1979+
mysql> CALL sys.ps_setup_show_disabled_consumers();
1980+
1981+
+---------------------------+
1982+
| disabled_consumers |
1983+
+---------------------------+
1984+
| events_statements_current |
1985+
| global_instrumentation |
1986+
| thread_instrumentation |
1987+
| statements_digest |
1988+
+---------------------------+
1989+
4 rows in set (0.05 sec)
1990+
```
1991+
1992+
#### ps_setup_show_disabled_instruments
1993+
1994+
##### Description
1995+
1996+
Shows all currently disabled instruments.
1997+
1998+
##### Parameters
1999+
2000+
None
2001+
2002+
##### Example
2003+
2004+
```SQL
2005+
mysql> CALL sys.ps_setup_show_disabled_instruments();
2006+
```
2007+
18942008
#### ps_setup_show_enabled
18952009

18962010
##### Description
@@ -1965,6 +2079,48 @@ mysql> CALL sys.ps_setup_show_enabled(TRUE, TRUE);
19652079
Query OK, 0 rows affected (0.89 sec)
19662080
```
19672081

2082+
#### ps_setup_show_enabled_consumers
2083+
2084+
##### Description
2085+
2086+
Shows all currently enabled consumers.
2087+
2088+
##### Parameters
2089+
2090+
None
2091+
2092+
##### Example
2093+
2094+
```SQL
2095+
mysql> CALL sys.ps_setup_show_enabled_consumers();
2096+
2097+
+---------------------------+
2098+
| enabled_consumers |
2099+
+---------------------------+
2100+
| events_statements_current |
2101+
| global_instrumentation |
2102+
| thread_instrumentation |
2103+
| statements_digest |
2104+
+---------------------------+
2105+
4 rows in set (0.05 sec)
2106+
```
2107+
2108+
#### ps_setup_show_enabled_instruments
2109+
2110+
##### Description
2111+
2112+
Shows all currently enabled instruments.
2113+
2114+
##### Parameters
2115+
2116+
None
2117+
2118+
##### Example
2119+
2120+
```SQL
2121+
mysql> CALL sys.ps_setup_show_enabled_instruments();
2122+
```
2123+
19682124
#### ps_statement_avg_latency_histogram
19692125

19702126
##### Description

before_setup.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ CREATE DATABASE IF NOT EXISTS sys DEFAULT CHARACTER SET utf8;
2121

2222
USE sys;
2323

24-
CREATE OR REPLACE VIEW version AS SELECT '1.1.0' AS sys_version, version() AS mysql_version;
24+
CREATE OR REPLACE VIEW version AS SELECT '1.1.0' AS sys_version, version() AS mysql_version;

functions/ps_thread_stack.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ BEGIN
7575
/* Convert from picoseconds to microseconds */
7676
, CONCAT( '"timer_wait": ', ROUND(timer_wait/1000000, 2))
7777
, CONCAT( '"event_info": "'
78-
, CASE
79-
WHEN event_name NOT LIKE 'wait/io%' THEN SUBSTRING_INDEX(event_name, '/', -2)
80-
WHEN event_name NOT LIKE 'wait/io/file%' OR event_name NOT LIKE 'wait/io/socket%' THEN SUBSTRING_INDEX(event_name, '/', -4)
78+
, CASE
79+
WHEN event_name NOT LIKE 'wait/io%' THEN REPLACE(SUBSTRING_INDEX(event_name, '/', -2), '\\', '\\\\')
80+
WHEN event_name NOT LIKE 'wait/io/file%' OR event_name NOT LIKE 'wait/io/socket%' THEN REPLACE(SUBSTRING_INDEX(event_name, '/', -4), '\\', '\\\\')
8181
ELSE event_name
8282
END
8383
, '"'
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
/* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
15+
16+
DROP PROCEDURE IF EXISTS ps_setup_disable_consumers;
17+
18+
DELIMITER $$
19+
20+
CREATE DEFINER='root'@'localhost' PROCEDURE ps_setup_disable_consumers (
21+
IN consumer VARCHAR(128)
22+
)
23+
COMMENT '
24+
Description
25+
-----------
26+
27+
Disables consumers within Performance Schema
28+
matching the input pattern.
29+
30+
Requires the SUPER privilege for "SET sql_log_bin = 0;".
31+
32+
Parameters
33+
-----------
34+
35+
consumer (VARCHAR(128)):
36+
A LIKE pattern match (using "%consumer%") of consumers to disable
37+
38+
Example
39+
-----------
40+
41+
To disable all consumers:
42+
43+
mysql> CALL sys.ps_setup_disable_comsumers(\'\');
44+
+--------------------------+
45+
| summary |
46+
+--------------------------+
47+
| Disabled 15 consumers |
48+
+--------------------------+
49+
1 row in set (0.02 sec)
50+
51+
To disable just the event_stage consumers:
52+
53+
mysql> CALL sys.ps_setup_disable_comsumers(\'stage\');
54+
+------------------------+
55+
| summary |
56+
+------------------------+
57+
| Disabled 3 consumers |
58+
+------------------------+
59+
1 row in set (0.00 sec)
60+
'
61+
SQL SECURITY INVOKER
62+
NOT DETERMINISTIC
63+
MODIFIES SQL DATA
64+
BEGIN
65+
SET @log_bin := @@sql_log_bin;
66+
SET sql_log_bin = 0;
67+
68+
UPDATE performance_schema.setup_consumers
69+
SET enabled = 'NO'
70+
WHERE name LIKE CONCAT('%', consumer, '%');
71+
72+
SELECT CONCAT('Disabled ', @rows := ROW_COUNT(), ' consumer', IF(@rows != 1, 's', '')) AS summary;
73+
74+
SET sql_log_bin = @log_bin;
75+
END$$
76+
77+
DELIMITER ;
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
/* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
15+
16+
DROP PROCEDURE IF EXISTS ps_setup_enable_consumers;
17+
18+
DELIMITER $$
19+
20+
CREATE DEFINER='root'@'localhost' PROCEDURE ps_setup_enable_consumers (
21+
IN consumer VARCHAR(128)
22+
)
23+
COMMENT '
24+
Description
25+
-----------
26+
27+
Enables consumers within Performance Schema
28+
matching the input pattern.
29+
30+
Requires the SUPER privilege for "SET sql_log_bin = 0;".
31+
32+
Parameters
33+
-----------
34+
35+
consumer (VARCHAR(128)):
36+
A LIKE pattern match (using "%consumer%") of consumers to enable
37+
38+
Example
39+
-----------
40+
41+
To enable all consumers:
42+
43+
mysql> CALL sys.ps_setup_enable_consumers(\'\');
44+
+-------------------------+
45+
| summary |
46+
+-------------------------+
47+
| Enabled 10 consumers |
48+
+-------------------------+
49+
1 row in set (0.02 sec)
50+
51+
Query OK, 0 rows affected (0.02 sec)
52+
53+
To enable just "waits" consumers:
54+
55+
mysql> CALL sys.ps_setup_enable_consumers(\'waits\');
56+
+-----------------------+
57+
| summary |
58+
+-----------------------+
59+
| Enabled 3 consumers |
60+
+-----------------------+
61+
1 row in set (0.00 sec)
62+
63+
Query OK, 0 rows affected (0.00 sec)
64+
'
65+
SQL SECURITY INVOKER
66+
NOT DETERMINISTIC
67+
MODIFIES SQL DATA
68+
BEGIN
69+
SET @log_bin := @@sql_log_bin;
70+
SET sql_log_bin = 0;
71+
72+
UPDATE performance_schema.setup_consumers
73+
SET enabled = 'YES'
74+
WHERE name LIKE CONCAT('%', consumer, '%');
75+
76+
SELECT CONCAT('Enabled ', @rows := ROW_COUNT(), ' consumer', IF(@rows != 1, 's', '')) AS summary;
77+
78+
SET sql_log_bin = @log_bin;
79+
END$$
80+
81+
DELIMITER ;

0 commit comments

Comments
 (0)