mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-10 13:11:32 +00:00
Merge lp:~percona-toolkit-dev/percona-toolkit/pt-sift-processlist-aggregation-fix-bug-945842.
This commit is contained in:
18
bin/pt-sift
18
bin/pt-sift
@@ -356,7 +356,23 @@ main() {
|
||||
fi
|
||||
for word in State Command; do
|
||||
echo " $word"
|
||||
awk -F: "/^ *$word:/{print \$2}" "${PROCESSLIST_FILE}" \
|
||||
awk -F: -v column="$word" '
|
||||
BEGIN {
|
||||
regex = "^ *" column
|
||||
}
|
||||
{
|
||||
if ( $1 ~ regex ) {
|
||||
print $2;
|
||||
}
|
||||
# Newer versions of pt-stalk gather several samples. We will
|
||||
# analyze only the first sample.
|
||||
if ( $0 ~ /^TS/ ) {
|
||||
ts++;
|
||||
if (ts > 1) {
|
||||
exit
|
||||
}
|
||||
}
|
||||
}' "${PROCESSLIST_FILE}" \
|
||||
| sort | uniq -c | sort -rn | head -n 5
|
||||
done
|
||||
|
||||
|
Reference in New Issue
Block a user