mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-09 07:30:02 +00:00
Fix for 1046440: pt-stalk purge_samples slows down checks
Like the bug submitter noted, the fix was simply to make purge_samples only come into effect if the collection has been triggered. I added a second purge_samples after the collect loop, which should maintain the previous behavior for the non-collect case, and purge any leftover files that passed the threshold during a stalk that never triggered collection.
This commit is contained in:
15
bin/pt-stalk
15
bin/pt-stalk
@@ -1189,6 +1189,11 @@ stalk() {
|
|||||||
# There will not be enough disk space, so do not collect.
|
# There will not be enough disk space, so do not collect.
|
||||||
warn "Collect canceled because there will not be enough disk space after collecting another $margin MB"
|
warn "Collect canceled because there will not be enough disk space after collecting another $margin MB"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Purge old collect files.
|
||||||
|
if [ -d "$OPT_DEST" ]; then
|
||||||
|
purge_samples "$OPT_DEST" "$OPT_RETENTION_TIME"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ##################################################################
|
# ##################################################################
|
||||||
@@ -1204,13 +1209,13 @@ stalk() {
|
|||||||
# Trigger/check/value is ok, sleep until next check.
|
# Trigger/check/value is ok, sleep until next check.
|
||||||
sleep_ok "$OPT_INTERVAL"
|
sleep_ok "$OPT_INTERVAL"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Purge old collect file between checks.
|
|
||||||
if [ -d "$OPT_DEST" ]; then
|
|
||||||
purge_samples "$OPT_DEST" "$OPT_RETENTION_TIME"
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# One final purge of old collect files, but only if in collect mode.
|
||||||
|
if [ "$OPT_COLLECT" -a -d "$OPT_DEST" ]; then
|
||||||
|
purge_samples "$OPT_DEST" "$OPT_RETENTION_TIME"
|
||||||
|
fi
|
||||||
|
|
||||||
# Before exiting, the last collector may still be running.
|
# Before exiting, the last collector may still be running.
|
||||||
# Wait for it to finish in case the tool is part of a script,
|
# Wait for it to finish in case the tool is part of a script,
|
||||||
# or part of a test, so the caller has access to the collected
|
# or part of a test, so the caller has access to the collected
|
||||||
|
Reference in New Issue
Block a user