Skip to content

Commit 9851aca

Browse files
committed
MDEV-13257 - main.kill-2 failed in buildbot
Test output was affected by incompletely closed preceding connections. Make test agnostic to concurrent connections by querying information_schema.processlist only for connections that it uses. Avoid querying for i_s.processlist db column. It is unstable due to trylock_short(), can be "" if concurrent connection is holding LOCK_thd_data.
1 parent 21be9fb commit 9851aca

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

mysql-test/main/kill-2.result

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@
44
create user foo@'127.0.0.1';
55
connect con1,127.0.0.1,foo,,;
66
connection default;
7-
select user from information_schema.processlist;
7+
select user from information_schema.processlist where id=$con1_id;
88
user
99
foo
10-
root
1110
kill user foo@'127.0.0.1';
1211
drop user foo@'127.0.0.1';
1312
#
@@ -28,11 +27,11 @@ Id User Host db Command Time State Info Progress
2827
kill user a;
2928
kill user x;
3029
connection a;
31-
show processlist;
32-
Id User Host db Command Time State Info Progress
33-
# root # test # # # # #
34-
# a # NULL # # # # #
35-
# b # test # # # # #
30+
select user from information_schema.processlist where id in (connection_id(), $b_id, $default_id) order by user;
31+
user
32+
a
33+
b
34+
root
3635
kill user b;
3736
ERROR HY000: Operation KILL USER failed for b@%
3837
connection default;

mysql-test/main/kill-2.test

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@
1616
create user foo@'127.0.0.1';
1717

1818
--connect (con1,127.0.0.1,foo,,)
19+
let $con1_id= `select connection_id()`;
1920

2021
--connection default
21-
select user from information_schema.processlist;
22+
evalp select user from information_schema.processlist where id=$con1_id;
2223
kill user foo@'127.0.0.1';
2324

2425
let $wait_condition=
@@ -31,20 +32,21 @@ drop user foo@'127.0.0.1';
3132
--echo #
3233
--echo # KILL USER and missing privileges
3334
--echo #
35+
let $default_id= `select connection_id()`;
3436
create user a@'127.0.0.1';
3537
create user b@'127.0.0.1';
3638
grant process on *.* to a@'127.0.0.1';
3739
grant select on *.* to b@'127.0.0.1';
3840
--connect a,127.0.0.1,a
3941
show grants;
4042
--connect b,127.0.0.1,b
43+
let $b_id= `select connection_id()`;
4144
--replace_column 1 # 3 # 5 # 6 # 9 #
4245
show processlist;
4346
kill user a; # existing connection, but not visible to current_user
4447
kill user x; # not existing connection
4548
--connection a
46-
--replace_column 1 # 3 # 5 # 6 # 7 # 8 # 9 #
47-
show processlist;
49+
evalp select user from information_schema.processlist where id in (connection_id(), $b_id, $default_id) order by user;
4850
--error ER_KILL_DENIED_ERROR
4951
kill user b;
5052
--connection default

0 commit comments

Comments
 (0)