1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
|
--echo ##
--echo ## Test the Performance Schema-based implementation of SHOW PROCESSLIST.
--echo ##
--echo ## Verify the Host field (hostname:port) against the legacy implementation.
--echo ##
--source include/no_protocol.inc
--source include/not_embedded.inc
--echo
--echo ### Setup ###
--echo
select @@global.performance_schema_show_processlist into @save_processlist;
--echo
--echo # Control user
create user user0@localhost;
grant ALL on *.* to user0@localhost;
--echo # Test users
--echo
create user user1@localhost, user2@localhost,
user3@localhost, user4@localhost;
--echo
# Grant no privileges to user1 to ensure only one process
grant USAGE on *.* to user1@localhost;
grant ALL on *.* to user2@localhost;
grant ALL on *.* to user3@localhost;
grant ALL on *.* to user4@localhost;
--echo
flush privileges;
--echo
show grants for user1@localhost;
--echo
--echo # Connect (con_user0, 127.0.0.1, user0, , , MASTER_MYPORT, )
connect (con_user0, 127.0.0.1, user0, , , $MASTER_MYPORT, );
--echo
select connection_id() into @con_user0_id;
--echo # Connect (con_user1, 127.0.0.1, user1, , , MASTER_MYPORT, )
connect (con_user1, 127.0.0.1, user1, , , $MASTER_MYPORT, );
--echo # Connect (con_user2, 127.0.0.1, user2, , , MASTER_MYPORT, )
connect (con_user2, 127.0.0.1, user2, , , $MASTER_MYPORT, );
--echo # Connect (con_user3, 127.0.0.1, user3, , , MASTER_MYPORT, )
connect (con_user3, 127.0.0.1, user3, , , $MASTER_MYPORT, );
--echo # Connect (con_user4, 127.0.0.1, user4, , , MASTER_MYPORT, )
connect (con_user4, 127.0.0.1, user4, , , $MASTER_MYPORT, );
--echo # Connection user0
--connection con_user0
let $wait_condition = select connection_id() = @con_user0_id;
--source include/wait_condition.inc
--echo
--echo ### Compare the SHOW PROCESSLIST Host column between the new and old implementations
--echo
--echo ## New SHOW PROCESSLIST
let $pfs_spl = on;
--source ../include/processlist_set.inc
--source ../include/processlist_load.inc
--echo
--echo # Connection user1
--connection con_user1
--echo # Get Host:Port, new
let $host_new = query_get_value(SHOW FULL PROCESSLIST, Host, 1);
--echo
--echo ## Legacy SHOW PROCESSLIST
--connection con_user0
let $pfs_spl = off;
--source ../include/processlist_set.inc
--source ../include/processlist_load.inc
--echo
--echo # Connection user1
--connection con_user1
--echo # Get Host:Port, legacy
let $host_old = query_get_value(SHOW FULL PROCESSLIST, Host, 1);
--echo
## DEBUG ONLY
## --echo DEBUG: New: $host_new Old: $host_old
if ($host_new == $host_old)
{
--echo ***SUCCESS*** The SHOW PROCESSLIST Host fields match
}
if ($host_new != $host_old)
{
--echo ***ERROR*** SHOW PROCESSLIST Host fields do not match. New: $host_new Old: $host_old
}
--echo
--echo ### Compare the processlist Host column between Performance Schema and the Information Schema
--echo
--echo # Connection con_user0
--connection con_user0
let $count_new = `select count(*) from performance_schema.processlist`;
let $count_old = `select count(*) from information_schema.processlist`;
let $count_join = `select count(*) from performance_schema.processlist pspl
left join information_schema.processlist ispl on pspl.host = ispl.host and pspl.id = ispl.id`;
--echo
if ($count_old == $count_join)
{
--echo ***SUCCESS*** The processlist Host fields match between the Performance Schema and the Information Schema
}
if ($count_old != $count_join)
{
--echo ***ERROR*** The processlist Host fields do not match
--echo Count new: $count_new Count old: $count_old Count join: $count_join
--echo
select * from performance_schema.processlist order by host, id;
--echo
select * from information_schema.processlist order by host, id;
--echo
select * from performance_schema.processlist pspl
left join information_schema.processlist ispl on pspl.host = ispl.host and pspl.id = ispl.id;
}
--echo
--echo
--echo ### Clean up ###
--echo
--echo # Disconnect con_user0
--connection con_user0
--disconnect con_user0
--echo # Disconnect con_user1
--connection con_user1
--disconnect con_user1
--echo # Disconnect con_user2
--connection con_user2
--disconnect con_user2
--echo # Disconnect con_user3
--connection con_user3
--disconnect con_user3
--echo # Disconnect con_user4
--connection con_user4
--disconnect con_user4
--echo # Connection default
--connection default
--echo
drop user user0@localhost;
drop user user1@localhost;
drop user user2@localhost;
drop user user3@localhost;
drop user user4@localhost;
--echo
set @@global.performance_schema_show_processlist = @save_processlist;
|