Skip to content

Commit

Permalink
Merge branch 'merge-perfschema-5.7' into 10.5
Browse files Browse the repository at this point in the history
  • Loading branch information
sanja-byelkin committed Jan 28, 2022
2 parents 430d60d + 157e662 commit 880d543
Show file tree
Hide file tree
Showing 275 changed files with 1,124 additions and 922 deletions.
4 changes: 2 additions & 2 deletions include/mysql/psi/mysql_file.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2008, 2021, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
Expand Down Expand Up @@ -216,7 +216,7 @@
With the instrumentation, mysql_fclose(NULL, ...) will safely return 0,
which is an extension compared to my_fclose and is therefore compliant.
mysql_fclose is on purpose *not* implementing
@code DBUG_ASSERT(file != NULL) @endcode,
@code assert(file != NULL) @endcode,
since doing so could introduce regressions.
*/
#ifdef HAVE_PSI_FILE_INTERFACE
Expand Down
2 changes: 1 addition & 1 deletion include/mysql/psi/mysql_idle.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2011, 2021, Oracle and/or its affiliates
Copyright (c) 2017, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
Expand Down
2 changes: 1 addition & 1 deletion include/mysql/psi/mysql_mdl.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2012, 2021, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
Expand Down
2 changes: 1 addition & 1 deletion include/mysql/psi/mysql_memory.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2012, 2021, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
Expand Down
2 changes: 1 addition & 1 deletion include/mysql/psi/mysql_ps.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2014, 2021, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
Expand Down
2 changes: 1 addition & 1 deletion include/mysql/psi/mysql_socket.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2010, 2021, Oracle and/or its affiliates.
Copyright (c) 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
Expand Down
2 changes: 1 addition & 1 deletion include/mysql/psi/mysql_sp.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2013, 2021, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
Expand Down
2 changes: 1 addition & 1 deletion include/mysql/psi/mysql_stage.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2010, 2021, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
Expand Down
2 changes: 1 addition & 1 deletion include/mysql/psi/mysql_statement.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2010, 2021, Oracle and/or its affiliates.
Copyright (c) 2017, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
Expand Down
2 changes: 1 addition & 1 deletion include/mysql/psi/mysql_table.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2010, 2021, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2017, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
Expand Down
2 changes: 1 addition & 1 deletion include/mysql/psi/mysql_thread.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2008, 2013, Oracle and/or its affiliates.
/* Copyright (c) 2008, 2021, Oracle and/or its affiliates.
Copyright (c) 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
Expand Down
2 changes: 1 addition & 1 deletion include/mysql/psi/mysql_transaction.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2013, 2021, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
Expand Down
2 changes: 1 addition & 1 deletion include/mysql/psi/psi.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2008, 2021, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
Expand Down
2 changes: 1 addition & 1 deletion include/mysql/psi/psi_abi_v0.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2011, 2021, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
Expand Down
2 changes: 1 addition & 1 deletion include/mysql/psi/psi_abi_v1.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2008, 2021, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
Expand Down
2 changes: 1 addition & 1 deletion include/mysql/psi/psi_abi_v2.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2008, 2021, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
Expand Down
2 changes: 1 addition & 1 deletion include/mysql/psi/psi_base.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2008, 2021, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
Expand Down
2 changes: 1 addition & 1 deletion include/mysql/psi/psi_memory.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2013, 2021, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
Expand Down
122 changes: 122 additions & 0 deletions mysql-test/suite/perfschema/r/digest_view.result
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,125 @@ test SHOW WARNINGS 10
test TRUNCATE TABLE `performance_schema` . `events_statements_summary_by_digest` 1
DROP VIEW test.v1;
DROP TABLE test.t1;
CREATE TABLE test.v1 (a int, b int);
INSERT INTO test.v1 VALUES (1, 100), (2, 200), (3, 300);
CREATE TABLE test.t1 (a int, b int);
INSERT INTO test.t1 VALUES (1, 100), (2, 200), (3, 300);
TRUNCATE TABLE performance_schema.events_statements_summary_by_digest;
EXPLAIN SELECT * from test.v1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE v1 ALL NULL NULL NULL NULL 3
EXPLAIN SELECT * from test.v1 where a = 1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE v1 ALL NULL NULL NULL NULL 3 Using where
EXPLAIN SELECT * from test.v1 where b > 100;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE v1 ALL NULL NULL NULL NULL 3 Using where
EXPLAIN SELECT a, b from test.v1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE v1 ALL NULL NULL NULL NULL 3
EXPLAIN SELECT b, a from test.v1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE v1 ALL NULL NULL NULL NULL 3
SELECT * from test.v1;
a b
1 100
2 200
3 300
SELECT * from test.v1 where a = 1;
a b
1 100
SELECT * from test.v1 where b > 100;
a b
2 200
3 300
SELECT a, b from test.v1;
a b
1 100
2 200
3 300
SELECT b, a from test.v1;
b a
100 1
200 2
300 3
#
# DIGESTS SEEN ON TABLE
#
SELECT SCHEMA_NAME, DIGEST, DIGEST_TEXT, COUNT_STAR
FROM performance_schema.events_statements_summary_by_digest
ORDER BY DIGEST_TEXT;
SCHEMA_NAME DIGEST DIGEST_TEXT COUNT_STAR
test 23ae4223590751444a6b28bccc269f28 EXPLAIN SELECT * FROM `test` . `v1` 1
test 1cea0b70727d5ebcf423c7a9f5f11e6a EXPLAIN SELECT * FROM `test` . `v1` WHERE `a` = ? 1
test db9391c55423cefa082674b57b142d3f EXPLAIN SELECT * FROM `test` . `v1` WHERE `b` > ? 1
test 1a1d023e039f4b639d112aff4b1787fd EXPLAIN SELECT `a` , `b` FROM `test` . `v1` 1
test 2f203319e6a88ebe4bd24c3e27007755 EXPLAIN SELECT `b` , `a` FROM `test` . `v1` 1
test c63bf2a3ef2f495ade3c4a629742adb2 SELECT * FROM `test` . `v1` 1
test 9afbda4813b5a6ed6ecfd87a5e24bf70 SELECT * FROM `test` . `v1` WHERE `a` = ? 1
test b062dbe5e87b6251de0d8c66d39aa7ae SELECT * FROM `test` . `v1` WHERE `b` > ? 1
test 5ee734b34d15e310711c33db7f70897e SELECT `a` , `b` FROM `test` . `v1` 1
test fc86a08f68e26afb06d7f52081ea4bee SELECT `b` , `a` FROM `test` . `v1` 1
test 8cbee21c5c16d7162a0569e1f95221af TRUNCATE TABLE `performance_schema` . `events_statements_summary_by_digest` 1
DROP TABLE test.v1;
CREATE VIEW test.v1 AS SELECT * FROM test.t1;
EXPLAIN SELECT * from test.v1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
EXPLAIN SELECT * from test.v1 where a = 1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where
EXPLAIN SELECT * from test.v1 where b > 100;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where
EXPLAIN SELECT a, b from test.v1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
EXPLAIN SELECT b, a from test.v1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
SELECT * from test.v1;
a b
1 100
2 200
3 300
SELECT * from test.v1 where a = 1;
a b
1 100
SELECT * from test.v1 where b > 100;
a b
2 200
3 300
SELECT a, b from test.v1;
a b
1 100
2 200
3 300
SELECT b, a from test.v1;
b a
100 1
200 2
300 3
#
# DIGESTS SEEN ON VIEW
#
SELECT SCHEMA_NAME, DIGEST, DIGEST_TEXT, COUNT_STAR
FROM performance_schema.events_statements_summary_by_digest
ORDER BY DIGEST_TEXT;
SCHEMA_NAME DIGEST DIGEST_TEXT COUNT_STAR
test fcffd7e32486e50d54cf33df37ee4844 CREATE VIEW `test` . `v1` AS SELECT * FROM `test` . `t1` 1
test c8ded4479c089b2439ac159e3758e991 DROP TABLE `test` . `v1` 1
test 23ae4223590751444a6b28bccc269f28 EXPLAIN SELECT * FROM `test` . `v1` 2
test 1cea0b70727d5ebcf423c7a9f5f11e6a EXPLAIN SELECT * FROM `test` . `v1` WHERE `a` = ? 2
test db9391c55423cefa082674b57b142d3f EXPLAIN SELECT * FROM `test` . `v1` WHERE `b` > ? 2
test 1a1d023e039f4b639d112aff4b1787fd EXPLAIN SELECT `a` , `b` FROM `test` . `v1` 2
test 2f203319e6a88ebe4bd24c3e27007755 EXPLAIN SELECT `b` , `a` FROM `test` . `v1` 2
test c63bf2a3ef2f495ade3c4a629742adb2 SELECT * FROM `test` . `v1` 2
test 9afbda4813b5a6ed6ecfd87a5e24bf70 SELECT * FROM `test` . `v1` WHERE `a` = ? 2
test b062dbe5e87b6251de0d8c66d39aa7ae SELECT * FROM `test` . `v1` WHERE `b` > ? 2
test 5cec4fed7d65064b4f6dfbcba4caf51b SELECT SCHEMA_NAME , `DIGEST` , `DIGEST_TEXT` , `COUNT_STAR` FROM `performance_schema` . `events_statements_summary_by_digest` ORDER BY `DIGEST_TEXT` 1
test 5ee734b34d15e310711c33db7f70897e SELECT `a` , `b` FROM `test` . `v1` 2
test fc86a08f68e26afb06d7f52081ea4bee SELECT `b` , `a` FROM `test` . `v1` 2
test 8cbee21c5c16d7162a0569e1f95221af TRUNCATE TABLE `performance_schema` . `events_statements_summary_by_digest` 1
DROP VIEW test.v1;
DROP TABLE test.t1;
4 changes: 4 additions & 0 deletions mysql-test/suite/perfschema/r/show_sanity.result
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,8 @@ SHOW_MODE SOURCE VARIABLE_NAME
5.6 I_S.SESSION_VARIABLES INNODB_STATS_INCLUDE_DELETE_MARKED
5.6 I_S.SESSION_VARIABLES KEYRING_OPERATIONS
5.6 I_S.SESSION_VARIABLES LOG_STATEMENTS_UNSAFE_FOR_BINLOG
5.6 I_S.SESSION_VARIABLES REPLICATION_OPTIMIZE_FOR_STATIC_PLUGIN_CONFIG
5.6 I_S.SESSION_VARIABLES REPLICATION_SENDER_OBSERVE_COMMIT_ONLY
5.6 I_S.SESSION_VARIABLES TLS_VERSION

================================================================================
Expand Down Expand Up @@ -442,6 +444,8 @@ SHOW_MODE SOURCE VARIABLE_NAME
5.6 I_S.SESSION_VARIABLES INNODB_STATS_INCLUDE_DELETE_MARKED
5.6 I_S.SESSION_VARIABLES KEYRING_OPERATIONS
5.6 I_S.SESSION_VARIABLES LOG_STATEMENTS_UNSAFE_FOR_BINLOG
5.6 I_S.SESSION_VARIABLES REPLICATION_OPTIMIZE_FOR_STATIC_PLUGIN_CONFIG
5.6 I_S.SESSION_VARIABLES REPLICATION_SENDER_OBSERVE_COMMIT_ONLY
5.6 I_S.SESSION_VARIABLES TLS_VERSION

================================================================================
Expand Down
76 changes: 76 additions & 0 deletions mysql-test/suite/perfschema/t/digest_view.test
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,79 @@ SELECT SCHEMA_NAME, DIGEST_TEXT, COUNT_STAR
DROP VIEW test.v1;
DROP TABLE test.t1;

# ----------------------------------------------------
# Tests for the performance schema statement Digests.
# ----------------------------------------------------

# Test case to show behavior of statements digest when
# using a view

--source include/not_embedded.inc
--source include/have_perfschema.inc
--source include/no_protocol.inc

CREATE TABLE test.v1 (a int, b int);
INSERT INTO test.v1 VALUES (1, 100), (2, 200), (3, 300);

CREATE TABLE test.t1 (a int, b int);
INSERT INTO test.t1 VALUES (1, 100), (2, 200), (3, 300);


TRUNCATE TABLE performance_schema.events_statements_summary_by_digest;

#
# test.v1 is a table.
# Every query here is different, and should have a different digest.
#

EXPLAIN SELECT * from test.v1;
EXPLAIN SELECT * from test.v1 where a = 1;
EXPLAIN SELECT * from test.v1 where b > 100;
EXPLAIN SELECT a, b from test.v1;
EXPLAIN SELECT b, a from test.v1;

SELECT * from test.v1;
SELECT * from test.v1 where a = 1;
SELECT * from test.v1 where b > 100;
SELECT a, b from test.v1;
SELECT b, a from test.v1;

--echo #
--echo # DIGESTS SEEN ON TABLE
--echo #

SELECT SCHEMA_NAME, DIGEST, DIGEST_TEXT, COUNT_STAR
FROM performance_schema.events_statements_summary_by_digest
ORDER BY DIGEST_TEXT;

DROP TABLE test.v1;
CREATE VIEW test.v1 AS SELECT * FROM test.t1;

#
# test.v1 is now a view.
# the query digests should be unchanged.
#

EXPLAIN SELECT * from test.v1;
EXPLAIN SELECT * from test.v1 where a = 1;
EXPLAIN SELECT * from test.v1 where b > 100;
EXPLAIN SELECT a, b from test.v1;
EXPLAIN SELECT b, a from test.v1;

SELECT * from test.v1;
SELECT * from test.v1 where a = 1;
SELECT * from test.v1 where b > 100;
SELECT a, b from test.v1;
SELECT b, a from test.v1;

--echo #
--echo # DIGESTS SEEN ON VIEW
--echo #

SELECT SCHEMA_NAME, DIGEST, DIGEST_TEXT, COUNT_STAR
FROM performance_schema.events_statements_summary_by_digest
ORDER BY DIGEST_TEXT;

DROP VIEW test.v1;
DROP TABLE test.t1;

2 changes: 1 addition & 1 deletion storage/perfschema/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2009, 2021, Oracle and/or its affiliates.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, version 2.0,
Expand Down
2 changes: 1 addition & 1 deletion storage/perfschema/cursor_by_account.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2011, 2021, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
Expand Down
2 changes: 1 addition & 1 deletion storage/perfschema/cursor_by_account.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2011, 2021, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
Expand Down
2 changes: 1 addition & 1 deletion storage/perfschema/cursor_by_host.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2011, 2021, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
Expand Down
2 changes: 1 addition & 1 deletion storage/perfschema/cursor_by_host.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2011, 2021, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
Expand Down
2 changes: 1 addition & 1 deletion storage/perfschema/cursor_by_thread.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2011, 2021, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
Expand Down
2 changes: 1 addition & 1 deletion storage/perfschema/cursor_by_thread.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2011, 2021, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
Expand Down
2 changes: 1 addition & 1 deletion storage/perfschema/cursor_by_thread_connect_attr.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2008, 2021, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
Expand Down
2 changes: 1 addition & 1 deletion storage/perfschema/cursor_by_thread_connect_attr.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2012, 2021, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
Expand Down
Loading

0 comments on commit 880d543

Please sign in to comment.