-
Notifications
You must be signed in to change notification settings - Fork 713
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support high precision time in show processlist (I_S.processlist)
Summary: The time information from 'show processlist' and in information_schema.processlist is at the granularity of a second This diff provides an override (system variable) to display the time at the granularity of a micro-second (e.g, 0.001234) The variable is session settable Differential Revision: D17239783 fbshipit-source-id: 7d58e50
- Loading branch information
1 parent
8d1e178
commit b840ad7
Showing
18 changed files
with
397 additions
and
191 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
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
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,24 @@ | ||
Test #1: variable is off (low precision) | ||
SELECT @@session.high_precision_processlist; | ||
@@session.high_precision_processlist | ||
0 | ||
SELECT @@global.high_precision_processlist; | ||
@@global.high_precision_processlist | ||
0 | ||
select case when time=round(time) then 'success' else 'failure' end status | ||
from information_schema.processlist where time < 1; | ||
status | ||
success | ||
Test #2: variable is on (high precision) | ||
set @@session.high_precision_processlist=on; | ||
SELECT @@session.high_precision_processlist; | ||
@@session.high_precision_processlist | ||
1 | ||
SELECT @@global.high_precision_processlist; | ||
@@global.high_precision_processlist | ||
0 | ||
select case when time!=round(time) then 'success' else 'failure' end status | ||
from information_schema.processlist where time < 1; | ||
status | ||
success | ||
set @@session.high_precision_processlist=off; |
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
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
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
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
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
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
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
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
20 changes: 20 additions & 0 deletions
20
mysql-test/suite/sys_vars/r/high_precision_processlist_basic.result
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,20 @@ | ||
Default value of high_precision_processlist is OFF | ||
SELECT @@session.high_precision_processlist; | ||
@@session.high_precision_processlist | ||
0 | ||
Can set session value and is different from global | ||
set @@session.high_precision_processlist=on; | ||
SELECT @@session.high_precision_processlist; | ||
@@session.high_precision_processlist | ||
1 | ||
SELECT @@global.high_precision_processlist; | ||
@@global.high_precision_processlist | ||
0 | ||
Setting it globally does not affects the session value | ||
set @@global.high_precision_processlist = off; | ||
SELECT @@session.high_precision_processlist; | ||
@@session.high_precision_processlist | ||
1 | ||
SELECT @@global.high_precision_processlist; | ||
@@global.high_precision_processlist | ||
0 |
23 changes: 23 additions & 0 deletions
23
mysql-test/suite/sys_vars/t/high_precision_processlist_basic.test
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,23 @@ | ||
-- source include/load_sysvars.inc | ||
|
||
#### | ||
# Verify default value is OFF | ||
#### | ||
--echo Default value of high_precision_processlist is OFF | ||
SELECT @@session.high_precision_processlist; | ||
|
||
#### | ||
# Verify that this is a session variable | ||
#### | ||
--echo Can set session value and is different from global | ||
set @@session.high_precision_processlist=on; | ||
SELECT @@session.high_precision_processlist; | ||
SELECT @@global.high_precision_processlist; | ||
|
||
#### | ||
## Verify that setting it globally does not affect the session | ||
#### | ||
--echo Setting it globally does not affects the session value | ||
set @@global.high_precision_processlist = off; | ||
SELECT @@session.high_precision_processlist; | ||
SELECT @@global.high_precision_processlist; |
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,23 @@ | ||
|
||
### the test relies on information_schema.processlist where | ||
### it is easier to process the time using SQL statements | ||
|
||
### 1: use high precision time, round yields same value for sub-sec time | ||
--echo Test #1: variable is off (low precision) | ||
SELECT @@session.high_precision_processlist; | ||
SELECT @@global.high_precision_processlist; | ||
|
||
select case when time=round(time) then 'success' else 'failure' end status | ||
from information_schema.processlist where time < 1; | ||
|
||
### 2: use high precision time, round yields higher value for sub-sec time | ||
--echo Test #2: variable is on (high precision) | ||
set @@session.high_precision_processlist=on; | ||
SELECT @@session.high_precision_processlist; | ||
SELECT @@global.high_precision_processlist; | ||
|
||
select case when time!=round(time) then 'success' else 'failure' end status | ||
from information_schema.processlist where time < 1; | ||
|
||
### restore the variable to its default value | ||
set @@session.high_precision_processlist=off; |
Oops, something went wrong.