pt-kill option --filter does not work

Bug #1488685 reported by Sveta Smirnova on 2015-08-25
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Percona Toolkit moved to https://jira.percona.com/projects/PT
Fix Released
High
Frank Cizmich

Bug Description

Try to use pt-kill's option --filter. You will find it would not work.

Reason is this code:

# Apply --filter to the processlist events.
     my $filtered_proclist;
     if ( $filter_sub && $proclist && @$proclist ) {
        foreach my $proc ( @$proclist ) {
               #_d($proc->{Info});
           push @$filtered_proclist, $proc if $filter_sub->($proc);
        }
     }
     else {
        $filtered_proclist = $proclist;
     }

It works fine, but $filtered_proclist is not used anywhere else!

How to repeat:

Run queries like:

select sleep(200000) as foo
select sleep(100000)
select sleep(100000)

Then try to filter one with world foo.

~/Downloads/percona-toolkit-2.2.13/bin/pt-kill-mod --print h=127.0.0.1,P=13000,u=root,D=test --interval=1 --victims all --match-command Query --filter 'defined($event->{Info}) && $event->{Info} =~ /select.*foo/'

Suggested fix:

--- /home/sveta/Downloads/percona-toolkit-2.2.13/bin/pt-kill 2015-08-26 01:25:52.908069819 +0300
+++ /home/sveta/Downloads/percona-toolkit-2.2.13/bin/pt-kill-mod 2015-08-26 01:25:45.736069965 +0300
@@ -7041,6 +7042,8 @@
$filtered_proclist = $proclist;
}

+ $proclist = $filtered_proclist;
+
my @queries;
if ( $proclist ) {

Changed in percona-toolkit:
status: New → Confirmed
Changed in percona-toolkit:
assignee: nobody → Frank Cizmich (frank-cizmich)
tags: added: pt-stalk
Changed in percona-toolkit:
importance: Undecided → High
Changed in percona-toolkit:
milestone: none → 2.3.1
status: Confirmed → In Progress
Changed in percona-toolkit:
status: In Progress → Fix Committed
Changed in percona-toolkit:
milestone: 2.3.1 → 2.2.16
Changed in percona-toolkit:
status: Fix Committed → Fix Released

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PT-392

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers