pt-stalk removes non-empty files that start with empty line

Bug #1425478 reported by Robert Wunderer on 2015-02-25
6
This bug affects 1 person
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.

Changed in percona-toolkit:
status: New → In Progress
importance: Undecided → Medium
assignee: nobody → Frank Cizmich (frank-cizmich)
milestone: none → 2.2.14
Frank Cizmich (frank-cizmich) wrote :

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.

Changed in percona-toolkit:
status: In Progress → Fix Committed
Frank Cizmich (frank-cizmich) wrote :

Fixed as mentioned in above.

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-676

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

Other bug subscribers