pt-kill does not consider the ignore-user when multiple users

Folks,

I’ve got recently an interesting scenario and a very regular one; I need to ignore two users when killing the Sleepers, but, just the sleepers who sleep for more than --idle-time=300.

An example of the problem I found is below. When passing one user, it’s OK, but, when you have two, three user to ignore, none are ignored and just the time is considered before killing.

[root@db1 ~]# pt-kill --ignore-user a,b --verbose --idle-time 300 --test-matching proclist --print
# 2018-01-28T23:03:34 /bin/pt-kill starting
# 2018-01-28T23:03:34 Test matching files proclist
# 2018-01-28T23:03:34 Find spec: $VAR1 = {
all => undef,
busy_time => undef,
idle_time => '300',
ignore => {
Command => undef,
Host => undef,
Id => undef,
Info => undef,
State => 'Locked',
User => 'a,b',
db => undef
},
match => {
Command => undef,
Host => undef,
Info => undef,
State => undef,
User => undef,
db => undef
},
replication_threads => undef
};

# 2018-01-28T23:03:34 Checking processlist
# 2018-01-28T23:03:34 Matched 1 queries
# 2018-01-28T23:03:34 KILL 30 (Sleep 763 sec) NULL
# 2018-01-28T23:03:34 Checking processlist
# 2018-01-28T23:03:34 Processlist returned no queries
# 2018-01-28T23:03:34 Checking processlist
# 2018-01-28T23:03:34 /bin/pt-kill ending
[root@db1 ~]# cat proclist
Id User Host db Command Time State Info Progress
30 a localhost NULL Sleep 763 NULL 0.000
31 b localhost NULL Sleep 749 NULL 0.000
38 root localhost NULL Query 0 init show processlist 0.000

As you can see above, pt-kill is killing the user based on the idle-time, but, not considering that user as ignored. If we follow what was showed on the $VAR1, we can say that; when the current idle time on SHOW PROCESSLIST is higher than the one passed on the --idle-time parameter, the thread will be killed; but, the user is being ignored, in an inner part of the JSON. Is it what the algos are doing?

In this case, I need to ignore the user, and I don’t want to consider evaluating the idle time for its connection. Is it perhaps a bug or I am missing something? It’s good to say that, if I pass only one user on the --ignore-user, things work as expected.
Thanks, guys!

Hi,
I created [url][PT-1476] pt-kill does not consider the ignore-user when multiple users - Percona JIRA to track this issue.

Regards

Gracias, Carlos!