Merge pt-kill-log-dsn.

This commit is contained in:
Daniel Nichter
2012-07-19 11:20:29 -06:00
4 changed files with 915 additions and 33 deletions

View File

@@ -75,6 +75,7 @@ sub new {
last_poll => 0,
active_cxn => {}, # keyed off ID
event_cache => [],
_reasons_for_matching => {},
};
return bless $self, $class;
}
@@ -475,7 +476,15 @@ sub find {
PTDEBUG && _d("Query isn't running long enough");
next QUERY;
}
PTDEBUG && _d('Exceeds busy time');
my $reason = 'Exceeds busy time';
PTDEBUG && _d($reason);
# Saving the reasons for each query in the objct is a bit nasty,
# but the alternatives are worse:
# - Saving internal data in the query
# - Instead of using the stringified hashref as a key, using
# a checksum of the hashes' contents. Which could occasionally
# fail miserably due to timing-related issues.
push @{$self->{_reasons_for_matching}->{$query} ||= []}, $reason;
$matched++;
}
@@ -486,7 +495,9 @@ sub find {
PTDEBUG && _d("Query isn't idle long enough");
next QUERY;
}
PTDEBUG && _d('Exceeds idle time');
my $reason = 'Exceeds idle time';
PTDEBUG && _d($reason);
push @{$self->{_reasons_for_matching}->{$query} ||= []}, $reason;
$matched++;
}
@@ -507,7 +518,9 @@ sub find {
PTDEBUG && _d('Query does not match', $property, 'spec');
next QUERY;
}
PTDEBUG && _d('Query matches', $property, 'spec');
my $reason = 'Query matches ' . $property . ' spec';
PTDEBUG && _d($reason);
push @{$self->{_reasons_for_matching}->{$query} ||= []}, $reason;
$matched++;
}
}