Skip to content

Commit 243b9f3

Browse files
montywivuvova
authored andcommitted
MDEV-33501 Extend query_response_time plugin to be compatible with Percona server
This is to update the plugin to be compatible with Percona's query_response_time plugin, with some additions. Some of the tests are taken from Percona server. - Added plugins QUERY_RESPONSE_TIME_READ, QUERY_RESPONSE_TIME_WRITE and QUERY_RESPONSE_TIME_READ_WRITE. - Added option query_response_time_session_stats, with possible values GLOBAL, ON or OFF, to the query_response_time plugin. Notes: - All modules are dependent on QUERY_RESPONSE_READ_TIME. This must always be enabled if any of the other modules are used. This will be auto-enabled in the near future. - Accounting are done per statement. Stored functions are regarded as part of the original statement. - For stored procedures the accounting are done per statement executed in the stored procedure. CALL will not be accounted because of this. - FLUSH commands will not be accounted for. This is to ensure that FLUSH QUERY_RESPONSE_TIME is not part of the statistics. (This helps when testing with mtr and otherwise). - FLUSH QUERY_RESPONSE_TIME_READ and FLUSH QUERY_RESPONSE_TIME_READ only resets the corresponding status. - FLUSH QUERY_RESPONSE_TIME and FLUSH QUERY_RESPONSE_TIME_READ_WRITE or changing the value of query_response_time_range_base followed by any FLUSH of QUERY_RESPOSNSE_TIME resets all status.
1 parent 5296f90 commit 243b9f3

27 files changed

+2093
-449
lines changed

plugin/query_response_time/mysql-test/query_response_time/basic.result

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ SHOW VARIABLES WHERE VARIABLE_NAME LIKE 'query_response_time%' AND VARIABLE_NAME
22
Variable_name Value
33
query_response_time_flush OFF
44
query_response_time_range_base 10
5+
query_response_time_session_stats GLOBAL
56
query_response_time_stats OFF
67
SHOW CREATE TABLE INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
78
Table Create Table
@@ -18,6 +19,27 @@ PLUGIN_AUTHOR Percona and Sergey Vojtovich
1819
PLUGIN_DESCRIPTION Query Response Time Distribution INFORMATION_SCHEMA Plugin
1920
PLUGIN_LICENSE GPL
2021
PLUGIN_MATURITY Stable
22+
PLUGIN_NAME QUERY_RESPONSE_TIME_READ
23+
PLUGIN_VERSION 1.0
24+
PLUGIN_TYPE INFORMATION SCHEMA
25+
PLUGIN_AUTHOR Percona and Sergey Vojtovich
26+
PLUGIN_DESCRIPTION Query Response Time Distribution INFORMATION_SCHEMA Plugin
27+
PLUGIN_LICENSE GPL
28+
PLUGIN_MATURITY Stable
29+
PLUGIN_NAME QUERY_RESPONSE_TIME_WRITE
30+
PLUGIN_VERSION 1.0
31+
PLUGIN_TYPE INFORMATION SCHEMA
32+
PLUGIN_AUTHOR Percona and Sergey Vojtovich
33+
PLUGIN_DESCRIPTION Query Response Time Distribution INFORMATION_SCHEMA Plugin
34+
PLUGIN_LICENSE GPL
35+
PLUGIN_MATURITY Stable
36+
PLUGIN_NAME QUERY_RESPONSE_TIME_READ_WRITE
37+
PLUGIN_VERSION 1.0
38+
PLUGIN_TYPE INFORMATION SCHEMA
39+
PLUGIN_AUTHOR Monty
40+
PLUGIN_DESCRIPTION Query Response Time Distribution INFORMATION_SCHEMA Plugin
41+
PLUGIN_LICENSE GPL
42+
PLUGIN_MATURITY Stable
2143
PLUGIN_NAME QUERY_RESPONSE_TIME_AUDIT
2244
PLUGIN_VERSION 1.0
2345
PLUGIN_TYPE AUDIT
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME WHERE count != 0;
2+
SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME_READ WHERE count != 0;
3+
SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME_WRITE WHERE count != 0;
4+
5+
--disable_query_log
6+
7+
--let $assert_text= The sum of query counts in read and write tables must be equal to query count of the common table
8+
SELECT SUM(COUNT) INTO @common_count FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
9+
SELECT SUM(COUNT) INTO @ro_count FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME_READ;
10+
SELECT SUM(COUNT) INTO @rw_count FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME_WRITE;
11+
--let $assert_cond= @common_count = @ro_count + @rw_count;
12+
--source include/assert.inc
13+
14+
#
15+
# Bug 1552428: table contents should not depend on the table case name
16+
#
17+
--let $assert_text= QUERY_RESPONSE_TIME query counts must be equal regardless of the table name case
18+
SELECT SUM(COUNT) INTO @common_count_lc FROM information_schema.query_response_time;
19+
--let $assert_cond= @common_count = @common_count_lc
20+
--source include/assert.inc
21+
22+
--let $assert_text= QUERY_RESPONSE_TIME_READ query counts must be equal regardless of the table name case
23+
SELECT SUM(COUNT) INTO @ro_count_lc FROM information_schema.query_response_time_read;
24+
--let $assert_cond= @ro_count = @ro_count_lc
25+
--source include/assert.inc
26+
27+
--let $assert_text= QUERY_RESPONSE_TIME_WRITE query counts must be equal regardless of the table name case
28+
SELECT SUM(COUNT) INTO @rw_count_lc FROM information_schema.query_response_time_write;
29+
--let $assert_cond= @rw_count = @rw_count_lc
30+
--source include/assert.inc
31+
32+
--enable_query_log
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
--disable_query_log
2+
--disable_result_log
3+
SET GLOBAL QUERY_RESPONSE_TIME_STATS = 0;
4+
SET SESSION QUERY_RESPONSE_TIME_EXEC_TIME_DEBUG = 500000;
5+
FLUSH QUERY_RESPONSE_TIME;
6+
--enable_query_log
7+
--enable_result_log
8+
--source query_response_time-check.inc
9+
--disable_query_log
10+
--disable_result_log
11+
SET GLOBAL QUERY_RESPONSE_TIME_STATS = 1;
12+
FLUSH QUERY_RESPONSE_TIME;
13+
--enable_query_log
14+
--enable_result_log
15+
--echo ------------------Test body begin--------------------
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
--echo ------------------Test body end----------------------
2+
--disable_query_log
3+
SET GLOBAL QUERY_RESPONSE_TIME_STATS = 0;
4+
SET SESSION QUERY_RESPONSE_TIME_EXEC_TIME_DEBUG = DEFAULT;
5+
--enable_query_log
6+
--source query_response_time-check.inc

0 commit comments

Comments
 (0)