-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDEV-33501 Extend query_response_time plugin to be compatible with Pe…
…rcona 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.
- Loading branch information
Showing
27 changed files
with
2,093 additions
and
449 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
plugin/query_response_time/mysql-test/query_response_time/query_response_time-check.inc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME WHERE count != 0; | ||
SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME_READ WHERE count != 0; | ||
SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME_WRITE WHERE count != 0; | ||
|
||
--disable_query_log | ||
|
||
--let $assert_text= The sum of query counts in read and write tables must be equal to query count of the common table | ||
SELECT SUM(COUNT) INTO @common_count FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; | ||
SELECT SUM(COUNT) INTO @ro_count FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME_READ; | ||
SELECT SUM(COUNT) INTO @rw_count FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME_WRITE; | ||
--let $assert_cond= @common_count = @ro_count + @rw_count; | ||
--source include/assert.inc | ||
|
||
# | ||
# Bug 1552428: table contents should not depend on the table case name | ||
# | ||
--let $assert_text= QUERY_RESPONSE_TIME query counts must be equal regardless of the table name case | ||
SELECT SUM(COUNT) INTO @common_count_lc FROM information_schema.query_response_time; | ||
--let $assert_cond= @common_count = @common_count_lc | ||
--source include/assert.inc | ||
|
||
--let $assert_text= QUERY_RESPONSE_TIME_READ query counts must be equal regardless of the table name case | ||
SELECT SUM(COUNT) INTO @ro_count_lc FROM information_schema.query_response_time_read; | ||
--let $assert_cond= @ro_count = @ro_count_lc | ||
--source include/assert.inc | ||
|
||
--let $assert_text= QUERY_RESPONSE_TIME_WRITE query counts must be equal regardless of the table name case | ||
SELECT SUM(COUNT) INTO @rw_count_lc FROM information_schema.query_response_time_write; | ||
--let $assert_cond= @rw_count = @rw_count_lc | ||
--source include/assert.inc | ||
|
||
--enable_query_log |
15 changes: 15 additions & 0 deletions
15
plugin/query_response_time/mysql-test/query_response_time/query_response_time-rw-begin.inc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--disable_query_log | ||
--disable_result_log | ||
SET GLOBAL QUERY_RESPONSE_TIME_STATS = 0; | ||
SET SESSION QUERY_RESPONSE_TIME_EXEC_TIME_DEBUG = 500000; | ||
FLUSH QUERY_RESPONSE_TIME; | ||
--enable_query_log | ||
--enable_result_log | ||
--source query_response_time-check.inc | ||
--disable_query_log | ||
--disable_result_log | ||
SET GLOBAL QUERY_RESPONSE_TIME_STATS = 1; | ||
FLUSH QUERY_RESPONSE_TIME; | ||
--enable_query_log | ||
--enable_result_log | ||
--echo ------------------Test body begin-------------------- |
6 changes: 6 additions & 0 deletions
6
plugin/query_response_time/mysql-test/query_response_time/query_response_time-rw-end.inc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--echo ------------------Test body end---------------------- | ||
--disable_query_log | ||
SET GLOBAL QUERY_RESPONSE_TIME_STATS = 0; | ||
SET SESSION QUERY_RESPONSE_TIME_EXEC_TIME_DEBUG = DEFAULT; | ||
--enable_query_log | ||
--source query_response_time-check.inc |
Oops, something went wrong.