mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-26 23:45:44 +00:00
Remove trailing spaces (#665)
* Remove trailing spaces * PR-665 - Remove trailing spaces - Updated not stable test t/pt-online-schema-change/preserve_triggers.t - Updated utilities in bin directory * PR-665 - Remove trailing spaces - Fixed typos * PR-665 - Remove trailing spaces - Fixed typos --------- Co-authored-by: Sveta Smirnova <sveta.smirnova@percona.com>
This commit is contained in:
@@ -20,17 +20,17 @@ DELIMITER $$
|
||||
CREATE DEFINER='root'@'localhost' FUNCTION extract_schema_from_file_name (
|
||||
path VARCHAR(512)
|
||||
)
|
||||
RETURNS VARCHAR(64)
|
||||
RETURNS VARCHAR(64)
|
||||
COMMENT '
|
||||
Description
|
||||
-----------
|
||||
|
||||
Takes a raw file path, and attempts to extract the schema name from it.
|
||||
|
||||
Useful for when interacting with Performance Schema data
|
||||
Useful for when interacting with Performance Schema data
|
||||
concerning IO statistics, for example.
|
||||
|
||||
Currently relies on the fact that a table data file will be within a
|
||||
Currently relies on the fact that a table data file will be within a
|
||||
specified database directory (will not work with partitions or tables
|
||||
that specify an individual DATA_DIRECTORY).
|
||||
|
||||
|
@@ -20,14 +20,14 @@ DELIMITER $$
|
||||
CREATE DEFINER='root'@'localhost' FUNCTION extract_table_from_file_name (
|
||||
path VARCHAR(512)
|
||||
)
|
||||
RETURNS VARCHAR(64)
|
||||
RETURNS VARCHAR(64)
|
||||
COMMENT '
|
||||
Description
|
||||
-----------
|
||||
|
||||
Takes a raw file path, and extracts the table name from it.
|
||||
|
||||
Useful for when interacting with Performance Schema data
|
||||
Useful for when interacting with Performance Schema data
|
||||
concerning IO statistics, for example.
|
||||
|
||||
Parameters
|
||||
|
@@ -26,7 +26,7 @@ CREATE DEFINER='root'@'localhost' FUNCTION format_path (
|
||||
-----------
|
||||
|
||||
Takes a raw path value, and strips out the datadir or tmpdir
|
||||
replacing with @@datadir and @@tmpdir respectively.
|
||||
replacing with @@datadir and @@tmpdir respectively.
|
||||
|
||||
Also normalizes the paths across operating systems, so backslashes
|
||||
on Windows are converted to forward slashes
|
||||
@@ -69,7 +69,7 @@ BEGIN
|
||||
DECLARE v_undo_dir VARCHAR(1024);
|
||||
|
||||
-- OSX hides /private/ in variables, but Performance Schema does not
|
||||
IF path LIKE '/private/%'
|
||||
IF path LIKE '/private/%'
|
||||
THEN SET v_path = REPLACE(path, '/private', '');
|
||||
ELSE SET v_path = path;
|
||||
END IF;
|
||||
|
@@ -26,7 +26,7 @@ CREATE DEFINER='root'@'localhost' FUNCTION format_path (
|
||||
-----------
|
||||
|
||||
Takes a raw path value, and strips out the datadir or tmpdir
|
||||
replacing with @@datadir and @@tmpdir respectively.
|
||||
replacing with @@datadir and @@tmpdir respectively.
|
||||
|
||||
Also normalizes the paths across operating systems, so backslashes
|
||||
on Windows are converted to forward slashes
|
||||
@@ -69,7 +69,7 @@ BEGIN
|
||||
DECLARE v_undo_dir VARCHAR(1024);
|
||||
|
||||
-- OSX hides /private/ in variables, but Performance Schema does not
|
||||
IF path LIKE '/private/%'
|
||||
IF path LIKE '/private/%'
|
||||
THEN SET v_path = REPLACE(path, '/private', '');
|
||||
ELSE SET v_path = path;
|
||||
END IF;
|
||||
|
@@ -28,16 +28,16 @@ CREATE DEFINER='root'@'localhost' FUNCTION format_statement (
|
||||
Formats a normalized statement, truncating it if it is > 64 characters long by default.
|
||||
|
||||
To configure the length to truncate the statement to by default, update the `statement_truncate_len`
|
||||
variable with `sys_config` table to a different value. Alternatively, to change it just for just
|
||||
variable with `sys_config` table to a different value. Alternatively, to change it just for just
|
||||
your particular session, use `SET @sys.statement_truncate_len := <some new value>`.
|
||||
|
||||
Useful for printing statement related data from Performance Schema from
|
||||
Useful for printing statement related data from Performance Schema from
|
||||
the command line.
|
||||
|
||||
Parameters
|
||||
-----------
|
||||
|
||||
statement (LONGTEXT):
|
||||
statement (LONGTEXT):
|
||||
The statement to format.
|
||||
|
||||
Returns
|
||||
@@ -73,7 +73,7 @@ BEGIN
|
||||
|
||||
IF CHAR_LENGTH(statement) > @sys.statement_truncate_len THEN
|
||||
RETURN REPLACE(CONCAT(LEFT(statement, (@sys.statement_truncate_len/2)-2), ' ... ', RIGHT(statement, (@sys.statement_truncate_len/2)-2)), '\n', ' ');
|
||||
ELSE
|
||||
ELSE
|
||||
RETURN REPLACE(statement, '\n', ' ');
|
||||
END IF;
|
||||
END$$
|
||||
|
@@ -28,15 +28,15 @@ CREATE DEFINER='root'@'localhost' FUNCTION format_time (
|
||||
-----------
|
||||
|
||||
Takes a raw picoseconds value, and converts it to a human readable form.
|
||||
|
||||
Picoseconds are the precision that all latency values are printed in
|
||||
|
||||
Picoseconds are the precision that all latency values are printed in
|
||||
within Performance Schema, however are not user friendly when wanting
|
||||
to scan output from the command line.
|
||||
|
||||
Parameters
|
||||
-----------
|
||||
|
||||
picoseconds (TEXT):
|
||||
picoseconds (TEXT):
|
||||
The raw picoseconds value to convert.
|
||||
|
||||
Returns
|
||||
|
@@ -18,21 +18,21 @@ DROP FUNCTION IF EXISTS ps_is_account_enabled;
|
||||
DELIMITER $$
|
||||
|
||||
CREATE DEFINER='root'@'localhost' FUNCTION ps_is_account_enabled (
|
||||
in_host VARCHAR(60),
|
||||
in_host VARCHAR(60),
|
||||
in_user VARCHAR(16)
|
||||
)
|
||||
)
|
||||
RETURNS ENUM('YES', 'NO')
|
||||
COMMENT '
|
||||
Description
|
||||
-----------
|
||||
|
||||
Determines whether instrumentation of an account is enabled
|
||||
Determines whether instrumentation of an account is enabled
|
||||
within Performance Schema.
|
||||
|
||||
Parameters
|
||||
-----------
|
||||
|
||||
in_host VARCHAR(60):
|
||||
in_host VARCHAR(60):
|
||||
The hostname of the account to check.
|
||||
in_user (VARCHAR(16)):
|
||||
The username of the account to check.
|
||||
@@ -54,8 +54,8 @@ CREATE DEFINER='root'@'localhost' FUNCTION ps_is_account_enabled (
|
||||
1 row in set (0.01 sec)
|
||||
'
|
||||
SQL SECURITY INVOKER
|
||||
DETERMINISTIC
|
||||
READS SQL DATA
|
||||
DETERMINISTIC
|
||||
READS SQL DATA
|
||||
BEGIN
|
||||
RETURN IF(EXISTS(SELECT 1
|
||||
FROM performance_schema.setup_actors
|
||||
|
@@ -18,21 +18,21 @@ DROP FUNCTION IF EXISTS ps_is_account_enabled;
|
||||
DELIMITER $$
|
||||
|
||||
CREATE DEFINER='root'@'localhost' FUNCTION ps_is_account_enabled (
|
||||
in_host VARCHAR(60),
|
||||
in_host VARCHAR(60),
|
||||
in_user VARCHAR(32)
|
||||
)
|
||||
)
|
||||
RETURNS ENUM('YES', 'NO')
|
||||
COMMENT '
|
||||
Description
|
||||
-----------
|
||||
|
||||
Determines whether instrumentation of an account is enabled
|
||||
Determines whether instrumentation of an account is enabled
|
||||
within Performance Schema.
|
||||
|
||||
Parameters
|
||||
-----------
|
||||
|
||||
in_host VARCHAR(60):
|
||||
in_host VARCHAR(60):
|
||||
The hostname of the account to check.
|
||||
in_user VARCHAR(32):
|
||||
The username of the account to check.
|
||||
@@ -54,8 +54,8 @@ CREATE DEFINER='root'@'localhost' FUNCTION ps_is_account_enabled (
|
||||
1 row in set (0.01 sec)
|
||||
'
|
||||
SQL SECURITY INVOKER
|
||||
DETERMINISTIC
|
||||
READS SQL DATA
|
||||
DETERMINISTIC
|
||||
READS SQL DATA
|
||||
BEGIN
|
||||
RETURN IF(EXISTS(SELECT 1
|
||||
FROM performance_schema.setup_actors
|
||||
|
@@ -31,7 +31,7 @@ CREATE DEFINER='root'@'localhost' FUNCTION ps_is_consumer_enabled (
|
||||
Parameters
|
||||
-----------
|
||||
|
||||
in_consumer VARCHAR(64):
|
||||
in_consumer VARCHAR(64):
|
||||
The name of the consumer to check.
|
||||
|
||||
Returns
|
||||
@@ -51,8 +51,8 @@ CREATE DEFINER='root'@'localhost' FUNCTION ps_is_consumer_enabled (
|
||||
1 row in set (0.00 sec)
|
||||
'
|
||||
SQL SECURITY INVOKER
|
||||
DETERMINISTIC
|
||||
READS SQL DATA
|
||||
DETERMINISTIC
|
||||
READS SQL DATA
|
||||
BEGIN
|
||||
RETURN (
|
||||
SELECT (CASE
|
||||
|
@@ -19,7 +19,7 @@ DELIMITER $$
|
||||
|
||||
CREATE DEFINER='root'@'localhost' FUNCTION ps_is_instrument_default_enabled (
|
||||
in_instrument VARCHAR(128)
|
||||
)
|
||||
)
|
||||
RETURNS ENUM('YES', 'NO')
|
||||
COMMENT '
|
||||
Description
|
||||
@@ -30,7 +30,7 @@ CREATE DEFINER='root'@'localhost' FUNCTION ps_is_instrument_default_enabled (
|
||||
Parameters
|
||||
-----------
|
||||
|
||||
in_instrument VARCHAR(128):
|
||||
in_instrument VARCHAR(128):
|
||||
The instrument to check.
|
||||
|
||||
Returns
|
||||
@@ -50,8 +50,8 @@ CREATE DEFINER='root'@'localhost' FUNCTION ps_is_instrument_default_enabled (
|
||||
1 row in set (0.00 sec)
|
||||
'
|
||||
SQL SECURITY INVOKER
|
||||
DETERMINISTIC
|
||||
READS SQL DATA
|
||||
DETERMINISTIC
|
||||
READS SQL DATA
|
||||
BEGIN
|
||||
DECLARE v_enabled ENUM('YES', 'NO');
|
||||
|
||||
|
@@ -19,7 +19,7 @@ DELIMITER $$
|
||||
|
||||
CREATE DEFINER='root'@'localhost' FUNCTION ps_is_instrument_default_timed (
|
||||
in_instrument VARCHAR(128)
|
||||
)
|
||||
)
|
||||
RETURNS ENUM('YES', 'NO')
|
||||
COMMENT '
|
||||
Description
|
||||
@@ -30,7 +30,7 @@ CREATE DEFINER='root'@'localhost' FUNCTION ps_is_instrument_default_timed (
|
||||
Parameters
|
||||
-----------
|
||||
|
||||
in_instrument VARCHAR(128):
|
||||
in_instrument VARCHAR(128):
|
||||
The instrument to check.
|
||||
|
||||
Returns
|
||||
@@ -50,8 +50,8 @@ CREATE DEFINER='root'@'localhost' FUNCTION ps_is_instrument_default_timed (
|
||||
1 row in set (0.00 sec)
|
||||
'
|
||||
SQL SECURITY INVOKER
|
||||
DETERMINISTIC
|
||||
READS SQL DATA
|
||||
DETERMINISTIC
|
||||
READS SQL DATA
|
||||
BEGIN
|
||||
DECLARE v_timed ENUM('YES', 'NO');
|
||||
|
||||
|
@@ -59,7 +59,7 @@ BEGIN
|
||||
END IF;
|
||||
|
||||
SELECT INSTRUMENTED INTO v_enabled
|
||||
FROM performance_schema.threads
|
||||
FROM performance_schema.threads
|
||||
WHERE PROCESSLIST_ID = in_connection_id;
|
||||
|
||||
IF (v_enabled IS NULL) THEN
|
||||
|
@@ -46,8 +46,8 @@ RETURNS LONGTEXT CHARSET latin1
|
||||
mysql> SELECT sys.ps_thread_stack(37, FALSE) AS thread_stack\\G
|
||||
*************************** 1. row ***************************
|
||||
thread_stack: {"rankdir": "LR","nodesep": "0.10","stack_created": "2014-02-19 13:39:03",
|
||||
"mysql_version": "5.7.3-m13","mysql_user": "root@localhost","events":
|
||||
[{"nesting_event_id": "0", "event_id": "10", "timer_wait": 256.35, "event_info":
|
||||
"mysql_version": "5.7.3-m13","mysql_user": "root@localhost","events":
|
||||
[{"nesting_event_id": "0", "event_id": "10", "timer_wait": 256.35, "event_info":
|
||||
"sql/select", "wait_info": "select @@version_comment limit 1\\nerrors: 0\\nwarnings: 0\\nlock time:
|
||||
...
|
||||
'
|
||||
@@ -73,7 +73,7 @@ BEGIN
|
||||
, CONCAT('"nesting_event_id": "', IF(nesting_event_id IS NULL, '0', nesting_event_id), '"')
|
||||
, CONCAT('"event_id": "', event_id, '"')
|
||||
-- Convert from picoseconds to microseconds
|
||||
, CONCAT( '"timer_wait": ', ROUND(timer_wait/1000000, 2))
|
||||
, CONCAT( '"timer_wait": ', ROUND(timer_wait/1000000, 2))
|
||||
, CONCAT( '"event_info": "'
|
||||
, CASE
|
||||
WHEN event_name NOT LIKE 'wait/io%' THEN REPLACE(SUBSTRING_INDEX(event_name, '/', -2), '\\', '\\\\')
|
||||
@@ -87,7 +87,7 @@ BEGIN
|
||||
-- If debug is enabled, add the file:lineno information for waits
|
||||
, CONCAT( '"source": "', IF(true AND event_name LIKE 'wait%', IFNULL(wait_info, ''), ''), '"')
|
||||
-- Depending on the type of event, name it appropriately
|
||||
, CASE
|
||||
, CASE
|
||||
WHEN event_name LIKE 'wait/io/file%' THEN '"event_type": "io/file"'
|
||||
WHEN event_name LIKE 'wait/io/table%' THEN '"event_type": "io/table"'
|
||||
WHEN event_name LIKE 'wait/io/socket%' THEN '"event_type": "io/socket"'
|
||||
@@ -98,8 +98,8 @@ BEGIN
|
||||
WHEN event_name LIKE 'statement/%' THEN '"event_type": "stmt"'
|
||||
WHEN event_name LIKE 'stage/%' THEN '"event_type": "stage"'
|
||||
WHEN event_name LIKE '%idle%' THEN '"event_type": "idle"'
|
||||
ELSE ''
|
||||
END
|
||||
ELSE ''
|
||||
END
|
||||
)
|
||||
, '}'
|
||||
)
|
||||
@@ -108,7 +108,7 @@ BEGIN
|
||||
FROM (
|
||||
/*!50600
|
||||
-- Select all statements, with the extra tracing information available
|
||||
(SELECT thread_id, event_id, event_name, timer_wait, timer_start, nesting_event_id,
|
||||
(SELECT thread_id, event_id, event_name, timer_wait, timer_start, nesting_event_id,
|
||||
CONCAT(sql_text, '\\n',
|
||||
'errors: ', errors, '\\n',
|
||||
'warnings: ', warnings, '\\n',
|
||||
@@ -122,7 +122,7 @@ BEGIN
|
||||
'select full join: ', select_full_join, '\\n',
|
||||
'select full range join: ', select_full_range_join, '\\n',
|
||||
'select range: ', select_range, '\\n',
|
||||
'select range check: ', select_range_check, '\\n',
|
||||
'select range check: ', select_range_check, '\\n',
|
||||
'sort merge passes: ', sort_merge_passes, '\\n',
|
||||
'sort rows: ', sort_rows, '\\n',
|
||||
'sort range: ', sort_range, '\\n',
|
||||
@@ -131,19 +131,19 @@ BEGIN
|
||||
'no good index used: ', IF(no_good_index_used, 'TRUE', 'FALSE'), '\\n'
|
||||
) AS wait_info
|
||||
FROM performance_schema.events_statements_history_long WHERE thread_id = thd_id)
|
||||
UNION
|
||||
UNION
|
||||
-- Select all stages
|
||||
(SELECT thread_id, event_id, event_name, timer_wait, timer_start, nesting_event_id, null AS wait_info
|
||||
FROM performance_schema.events_stages_history_long WHERE thread_id = thd_id)
|
||||
FROM performance_schema.events_stages_history_long WHERE thread_id = thd_id)
|
||||
UNION */
|
||||
-- Select all events, adding information appropriate to the event
|
||||
(SELECT thread_id, event_id,
|
||||
CONCAT(event_name ,
|
||||
IF(event_name NOT LIKE 'wait/synch/mutex%', IFNULL(CONCAT(' - ', operation), ''), ''),
|
||||
(SELECT thread_id, event_id,
|
||||
CONCAT(event_name ,
|
||||
IF(event_name NOT LIKE 'wait/synch/mutex%', IFNULL(CONCAT(' - ', operation), ''), ''),
|
||||
IF(number_of_bytes IS NOT NULL, CONCAT(' ', number_of_bytes, ' bytes'), ''),
|
||||
IF(event_name LIKE 'wait/io/file%', '\\n', ''),
|
||||
IF(object_schema IS NOT NULL, CONCAT('\\nObject: ', object_schema, '.'), ''),
|
||||
IF(object_name IS NOT NULL,
|
||||
IF(object_schema IS NOT NULL, CONCAT('\\nObject: ', object_schema, '.'), ''),
|
||||
IF(object_name IS NOT NULL,
|
||||
IF (event_name LIKE 'wait/io/socket%',
|
||||
-- Print the socket if used, else the IP:port as reported
|
||||
CONCAT(IF (object_name LIKE ':0%', @@socket, object_name)),
|
||||
@@ -152,11 +152,11 @@ BEGIN
|
||||
/*!50600 IF(index_name IS NOT NULL, CONCAT(' Index: ', index_name), ''),*/'\\n'
|
||||
) AS event_name,
|
||||
timer_wait, timer_start, nesting_event_id, source AS wait_info
|
||||
FROM performance_schema.events_waits_history_long WHERE thread_id = thd_id)) events
|
||||
FROM performance_schema.events_waits_history_long WHERE thread_id = thd_id)) events
|
||||
ORDER BY event_id;
|
||||
|
||||
RETURN CONCAT('{',
|
||||
CONCAT_WS(',',
|
||||
RETURN CONCAT('{',
|
||||
CONCAT_WS(',',
|
||||
'"rankdir": "LR"',
|
||||
'"nodesep": "0.10"',
|
||||
CONCAT('"stack_created": "', NOW(), '"'),
|
||||
|
@@ -24,10 +24,10 @@ CREATE DEFINER='root'@'localhost' FUNCTION ps_thread_trx_info (
|
||||
Description
|
||||
-----------
|
||||
|
||||
Returns a JSON object with info on the given threads current transaction,
|
||||
Returns a JSON object with info on the given threads current transaction,
|
||||
and the statements it has already executed, derived from the
|
||||
performance_schema.events_transactions_current and
|
||||
performance_schema.events_statements_history tables (so the consumers
|
||||
performance_schema.events_statements_history tables (so the consumers
|
||||
for these also have to be enabled within Performance Schema to get full
|
||||
data in the object).
|
||||
|
||||
@@ -167,7 +167,7 @@ BEGIN
|
||||
|
||||
SET v_output = (
|
||||
SELECT CONCAT('[', IFNULL(GROUP_CONCAT(trx_info ORDER BY event_id), ''), '\n]') AS trx_info
|
||||
FROM (SELECT trxi.thread_id,
|
||||
FROM (SELECT trxi.thread_id,
|
||||
trxi.event_id,
|
||||
GROUP_CONCAT(
|
||||
IFNULL(
|
||||
@@ -180,8 +180,8 @@ BEGIN
|
||||
' "isolation": "', IFNULL(trxi.isolation_level, ''), '",\n',
|
||||
' "statements_executed": [', IFNULL(s.stmts, ''), IF(s.stmts IS NULL, ' ]\n', '\n ]\n'),
|
||||
' }'
|
||||
),
|
||||
'')
|
||||
),
|
||||
'')
|
||||
ORDER BY event_id) AS trx_info
|
||||
|
||||
FROM (
|
||||
@@ -214,8 +214,8 @@ BEGIN
|
||||
WHERE sql_text IS NOT NULL
|
||||
AND thread_id = in_thread_id
|
||||
GROUP BY thread_id, nesting_event_id
|
||||
) AS s
|
||||
ON trxi.thread_id = s.thread_id
|
||||
) AS s
|
||||
ON trxi.thread_id = s.thread_id
|
||||
AND trxi.event_id = s.nesting_event_id
|
||||
WHERE trxi.thread_id = in_thread_id
|
||||
GROUP BY trxi.thread_id, trxi.event_id
|
||||
|
@@ -87,7 +87,7 @@ BEGIN
|
||||
|
||||
-- Check if we have the variable in the sys.sys_config table
|
||||
SET v_value = (SELECT value FROM sys.sys_config WHERE variable = in_variable_name);
|
||||
|
||||
|
||||
-- Protection against the variable not existing in sys_config
|
||||
IF (v_value IS NULL) THEN
|
||||
SET v_value = in_default_value;
|
||||
|
Reference in New Issue
Block a user