forked from facebook/mysql-5.6
-
Notifications
You must be signed in to change notification settings - Fork 3
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) (fa…
…cebook#1084) (facebook#1084) 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. Reference patch: facebook@b840ad76249 Pull Request resolved: facebook#1084 Differential Revision: D19357091 Pulled By: mzait
- Loading branch information
Showing
15 changed files
with
139 additions
and
24 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
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,18 @@ | ||
SET @save.high_precision_processlist=@@session.high_precision_processlist; | ||
Test #1: variable is off (low precision) | ||
SET @@session.high_precision_processlist=OFF; | ||
SELECT case when time=round(time) then 'success' else 'failure' end status | ||
FROM information_schema.processlist WHERE user="root"; | ||
status | ||
success | ||
Warnings: | ||
Warning 1287 'INFORMATION_SCHEMA.PROCESSLIST' is deprecated and will be removed in a future release. Please use performance_schema.processlist instead | ||
Test #2: variable is on (high precision) | ||
SET @@session.high_precision_processlist=ON; | ||
SELECT case when time!=round(time) then 'success' else 'failure' end status | ||
FROM information_schema.processlist WHERE user="root"; | ||
status | ||
success | ||
Warnings: | ||
Warning 1287 'INFORMATION_SCHEMA.PROCESSLIST' is deprecated and will be removed in a future release. Please use performance_schema.processlist instead | ||
SET @@session.high_precision_processlist=@save.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
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,22 @@ | ||
|
||
### the test relies on information_schema.processlist where | ||
### it is easier to process the time using SQL statements | ||
|
||
SET @save.high_precision_processlist=@@session.high_precision_processlist; | ||
|
||
### 1: use high precision time, round yields same value for sub-sec time | ||
--echo Test #1: variable is off (low precision) | ||
SET @@session.high_precision_processlist=OFF; | ||
|
||
SELECT case when time=round(time) then 'success' else 'failure' end status | ||
FROM information_schema.processlist WHERE user="root"; | ||
|
||
### 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 case when time!=round(time) then 'success' else 'failure' end status | ||
FROM information_schema.processlist WHERE user="root"; | ||
|
||
### restore the variable to its default value | ||
SET @@session.high_precision_processlist=@save.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
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