pt-stalk removes non-empty files that start with empty line
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Percona Toolkit moved to https://jira.percona.com/projects/PT |
Fix Released
|
Medium
|
Frank Cizmich |
Bug Description
pt-stalk 2.2.13
Percona Server version 5.6.21-70.0-log
The code for removing empty files also deletes files that are not empty, but start with an empty line. The behaviour does not depend on any command line options or user settings.
E.g: The output produced by pt-stalk and written to the files
*-innodbstatus[12]
starts with an empty line:
-------
=======
2015-02-24 17:27:52 7eb6d3fc2700 INNODB MONITOR OUTPUT
=======
Per second averages calculated from the last 31 seconds
...
-------
Thus the expression in line 1003
-z "$(grep -v '^TS ' --max-count 1 "$file")"
holds true and the files get deleted even though it holds useful information.
Related branches
- Daniel Nichter: Approve
-
Diff: 12 lines (+1/-1)1 file modifiedbin/pt-stalk (+1/-1)
Changed in percona-toolkit: | |
status: | New → In Progress |
importance: | Undecided → Medium |
assignee: | nobody → Frank Cizmich (frank-cizmich) |
milestone: | none → 2.2.14 |
Changed in percona-toolkit: | |
status: | In Progress → Fix Committed |
Changed in percona-toolkit: | |
status: | Fix Committed → Fix Released |
Could only partially reproduce but the code seems clear.
When "SHOW INNODB STATUS" fails for some reason, pt-stalk resorts to fetching data from /proc/< mysql_pid> /fd/<N> , where N is the file descriptor that contains innodb status data.
In that case, the first line is indeed empty.
Simplest fix is to increase --max-count to a higher number.