| 1 |
## |
| 2 |
## Test the Performance Schema-based implementation of SHOW PROCESSLIST. |
| 3 |
## |
| 4 |
## Verify the Host field (hostname:port) against the legacy implementation. |
| 5 |
## |
| 6 |
|
| 7 |
### Setup ### |
| 8 |
|
| 9 |
select @@global.performance_schema_show_processlist into @save_processlist; |
| 10 |
|
| 11 |
# Control user |
| 12 |
create user user0@localhost; |
| 13 |
grant ALL on *.* to user0@localhost; |
| 14 |
# Test users |
| 15 |
|
| 16 |
create user user1@localhost, user2@localhost, |
| 17 |
user3@localhost, user4@localhost; |
| 18 |
|
| 19 |
grant USAGE on *.* to user1@localhost; |
| 20 |
grant ALL on *.* to user2@localhost; |
| 21 |
grant ALL on *.* to user3@localhost; |
| 22 |
grant ALL on *.* to user4@localhost; |
| 23 |
|
| 24 |
flush privileges; |
| 25 |
|
| 26 |
show grants for user1@localhost; |
| 27 |
Grants for user1@localhost |
| 28 |
GRANT USAGE ON *.* TO `user1`@`localhost` |
| 29 |
|
| 30 |
# Connect (con_user0, 127.0.0.1, user0, , , MASTER_MYPORT, ) |
| 31 |
|
| 32 |
select connection_id() into @con_user0_id; |
| 33 |
# Connect (con_user1, 127.0.0.1, user1, , , MASTER_MYPORT, ) |
| 34 |
# Connect (con_user2, 127.0.0.1, user2, , , MASTER_MYPORT, ) |
| 35 |
# Connect (con_user3, 127.0.0.1, user3, , , MASTER_MYPORT, ) |
| 36 |
# Connect (con_user4, 127.0.0.1, user4, , , MASTER_MYPORT, ) |
| 37 |
# Connection user0 |
| 38 |
|
| 39 |
### Compare the SHOW PROCESSLIST Host column between the new and old implementations |
| 40 |
|
| 41 |
## New SHOW PROCESSLIST |
| 42 |
set @@global.performance_schema_show_processlist = on; |
| 43 |
Warnings: |
| 44 |
Warning 4166 '@@performance_schema_show_processlist' is deprecated and will be removed in a future release. When it is removed, SHOW PROCESSLIST will always use the performance schema implementation. |
| 45 |
|
| 46 |
SHOW FULL PROCESSLIST; |
| 47 |
Id User Host db Command Time State Info |
| 48 |
<Id> event_scheduler <Host> NULL <Command> <Time> <State> NULL |
| 49 |
<Id> root <Host> test <Command> <Time> <State> NULL |
| 50 |
<Id> user0 <Host> test Query <Time> <State> SHOW FULL PROCESSLIST |
| 51 |
<Id> user1 <Host> test <Command> <Time> <State> NULL |
| 52 |
<Id> user2 <Host> test <Command> <Time> <State> NULL |
| 53 |
<Id> user3 <Host> test <Command> <Time> <State> NULL |
| 54 |
<Id> user4 <Host> test <Command> <Time> <State> NULL |
| 55 |
|
| 56 |
# Performance Schema processlist table |
| 57 |
|
| 58 |
select * from performance_schema.processlist order by user, id; |
| 59 |
ID USER HOST DB COMMAND TIME STATE INFO EXECUTION_ENGINE |
| 60 |
<Id> event_scheduler <Host> NULL <Command> <Time> <State> NULL PRIMARY |
| 61 |
<Id> root <Host> test <Command> <Time> <State> NULL PRIMARY |
| 62 |
<Id> user0 <Host> test Query <Time> <State> select * from performance_schema.processlist order by user, id PRIMARY |
| 63 |
<Id> user1 <Host> test <Command> <Time> <State> NULL PRIMARY |
| 64 |
<Id> user2 <Host> test <Command> <Time> <State> NULL PRIMARY |
| 65 |
<Id> user3 <Host> test <Command> <Time> <State> NULL PRIMARY |
| 66 |
<Id> user4 <Host> test <Command> <Time> <State> NULL PRIMARY |
| 67 |
|
| 68 |
# Information Schema processlist table |
| 69 |
|
| 70 |
select * from information_schema.processlist order by user, id; |
| 71 |
ID USER HOST DB COMMAND TIME STATE INFO |
| 72 |
<Id> event_scheduler <Host> NULL <Command> <Time> <State> NULL |
| 73 |
<Id> root <Host> test <Command> <Time> <State> NULL |
| 74 |
<Id> user0 <Host> test Query <Time> <State> select * from information_schema.processlist order by user, id |
| 75 |
<Id> user1 <Host> test <Command> <Time> <State> NULL |
| 76 |
<Id> user2 <Host> test <Command> <Time> <State> NULL |
| 77 |
<Id> user3 <Host> test <Command> <Time> <State> NULL |
| 78 |
<Id> user4 <Host> test <Command> <Time> <State> NULL |
| 79 |
Warnings: |
| 80 |
<Id> 1287 <Host> |
| 81 |
|
| 82 |
# Connection user1 |
| 83 |
# Get Host:Port, new |
| 84 |
|
| 85 |
## Legacy SHOW PROCESSLIST |
| 86 |
set @@global.performance_schema_show_processlist = off; |
| 87 |
Warnings: |
| 88 |
Warning 4166 '@@performance_schema_show_processlist' is deprecated and will be removed in a future release. When it is removed, SHOW PROCESSLIST will always use the performance schema implementation. |
| 89 |
|
| 90 |
SHOW FULL PROCESSLIST; |
| 91 |
Id User Host db Command Time State Info |
| 92 |
<Id> 1287 <Host> |
| 93 |
<Id> event_scheduler <Host> NULL <Command> <Time> <State> NULL |
| 94 |
<Id> root <Host> test <Command> <Time> <State> NULL |
| 95 |
<Id> user0 <Host> test Query <Time> <State> SHOW FULL PROCESSLIST |
| 96 |
<Id> user1 <Host> test <Command> <Time> <State> NULL |
| 97 |
<Id> user2 <Host> test <Command> <Time> <State> NULL |
| 98 |
<Id> user3 <Host> test <Command> <Time> <State> NULL |
| 99 |
<Id> user4 <Host> test <Command> <Time> <State> NULL |
| 100 |
Warnings: |
| 101 |
|
| 102 |
# Performance Schema processlist table |
| 103 |
|
| 104 |
select * from performance_schema.processlist order by user, id; |
| 105 |
ID USER HOST DB COMMAND TIME STATE INFO EXECUTION_ENGINE |
| 106 |
<Id> event_scheduler <Host> NULL <Command> <Time> <State> NULL PRIMARY |
| 107 |
<Id> root <Host> test <Command> <Time> <State> NULL PRIMARY |
| 108 |
<Id> user0 <Host> test Query <Time> <State> select * from performance_schema.processlist order by user, id PRIMARY |
| 109 |
<Id> user1 <Host> test <Command> <Time> <State> NULL PRIMARY |
| 110 |
<Id> user2 <Host> test <Command> <Time> <State> NULL PRIMARY |
| 111 |
<Id> user3 <Host> test <Command> <Time> <State> NULL PRIMARY |
| 112 |
<Id> user4 <Host> test <Command> <Time> <State> NULL PRIMARY |
| 113 |
|
| 114 |
# Information Schema processlist table |
| 115 |
|
| 116 |
select * from information_schema.processlist order by user, id; |
| 117 |
ID USER HOST DB COMMAND TIME STATE INFO |
| 118 |
<Id> event_scheduler <Host> NULL <Command> <Time> <State> NULL |
| 119 |
<Id> root <Host> test <Command> <Time> <State> NULL |
| 120 |
<Id> user0 <Host> test Query <Time> <State> select * from information_schema.processlist order by user, id |
| 121 |
<Id> user1 <Host> test <Command> <Time> <State> NULL |
| 122 |
<Id> user2 <Host> test <Command> <Time> <State> NULL |
| 123 |
<Id> user3 <Host> test <Command> <Time> <State> NULL |
| 124 |
<Id> user4 <Host> test <Command> <Time> <State> NULL |
| 125 |
Warnings: |
| 126 |
<Id> 1287 <Host> |
| 127 |
|
| 128 |
# Connection user1 |
| 129 |
# Get Host:Port, legacy |
| 130 |
|
| 131 |
***SUCCESS*** The SHOW PROCESSLIST Host fields match |
| 132 |
|
| 133 |
### Compare the processlist Host column between Performance Schema and the Information Schema |
| 134 |
|
| 135 |
# Connection con_user0 |
| 136 |
|
| 137 |
***SUCCESS*** The processlist Host fields match between the Performance Schema and the Information Schema |
| 138 |
|
| 139 |
|
| 140 |
### Clean up ### |
| 141 |
|
| 142 |
# Disconnect con_user0 |
| 143 |
# Disconnect con_user1 |
| 144 |
# Disconnect con_user2 |
| 145 |
# Disconnect con_user3 |
| 146 |
# Disconnect con_user4 |
| 147 |
# Connection default |
| 148 |
|
| 149 |
drop user user0@localhost; |
| 150 |
drop user user1@localhost; |
| 151 |
drop user user2@localhost; |
| 152 |
drop user user3@localhost; |
| 153 |
drop user user4@localhost; |
| 154 |
|
| 155 |
set @@global.performance_schema_show_processlist = @save_processlist; |
| 156 |
Warnings: |
| 157 |
Warning 4166 '@@performance_schema_show_processlist' is deprecated and will be removed in a future release. When it is removed, SHOW PROCESSLIST will always use the performance schema implementation. |