Merge lp:~percona-toolkit-dev/percona-toolkit/pt-sift-processlist-aggregation-fix-bug-945842 into lp:percona-toolkit/2.0

Proposed by Baron Schwartz
Status: Superseded
Proposed branch: lp:~percona-toolkit-dev/percona-toolkit/pt-sift-processlist-aggregation-fix-bug-945842
Merge into: lp:percona-toolkit/2.0
Diff against target: 27 lines (+17/-1)
1 file modified
bin/pt-sift (+17/-1)
To merge this branch: bzr merge lp:~percona-toolkit-dev/percona-toolkit/pt-sift-processlist-aggregation-fix-bug-945842
Reviewer Review Type Date Requested Status
Baron Schwartz (community) Needs Fixing
Daniel Nichter Pending
Review via email: mp+95825@code.launchpad.net

Description of the change

The old processlist format was one sample in a single file. The new one is many samples. This change makes awk exit after it sees the start of the second sample.

To post a comment you must log in.
Revision history for this message
Baron Schwartz (baron-xaprb) wrote :

Dammit! Why do my "merge upstream" changes show up as a changeset? Why can't I bzr merge upstream, make a change, and then push only that changeset into a new branch?

review: Needs Fixing

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/pt-sift'
2--- bin/pt-sift 2012-03-02 20:23:54 +0000
3+++ bin/pt-sift 2012-03-05 01:03:21 +0000
4@@ -356,7 +356,23 @@
5 fi
6 for word in State Command; do
7 echo " $word"
8- awk -F: "/^ *$word:/{print \$2}" "${PROCESSLIST_FILE}" \
9+ awk -F: -v column="$word" '
10+ BEGIN {
11+ regex = "^ *" column
12+ }
13+ {
14+ if ( $1 ~ regex ) {
15+ print $2;
16+ }
17+ # Newer versions of pt-stalk gather several samples. We will
18+ # analyze only the first sample.
19+ if ( $0 ~ /^TS/ ) {
20+ ts++;
21+ if (ts > 1) {
22+ exit
23+ }
24+ }
25+ }' "${PROCESSLIST_FILE}" \
26 | sort | uniq -c | sort -rn | head -n 5
27 done
28

Subscribers

People subscribed via source and target branches