pt-stalk --no-stalk silently clobbers other options, acts magically

Reported by Ryan Lowe on 2013-02-14
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona Toolkit
Medium
Daniel Nichter

Bug Description

pt-stalk exists "because no more iterations" incorrectly:

pi@raspberrypi ~ $ ./pt-stalk --version
pt-stalk 2.1.9

pi@raspberrypi ~ $ PTDEBUG=1 ./pt-stalk --collect --no-stalk --interval=1 --iterations=3600
2013_02_14_15_23_00 Starting ./pt-stalk --function=status --variable=Threads_running --threshold=25 --match= --cycles=0 --interval=0 --iterations=1 --run-time=30 --sleep=0 --dest=/var/lib/pt-stalk --prefix= --notify-by-email= --log=/var/log/pt-stalk.log --pid=/var/run/pt-stalk.pid --plugin=
2013_02_14_15_23_00 Not running with root privileges!
2013_02_14_15_23_00 Not stalking; collect triggered immediately
2013_02_14_15_23_00 Collect 1 triggered
2013_02_14_15_23_00 Collect 1 PID 30319
2013_02_14_15_23_00 Collect 1 done
2013_02_14_15_23_01 Waiting up to 90 seconds for collectors to finish...
2013_02_14_15_24_33 Killing collector 30319
2013_02_14_15_24_33 Exiting because no more iterations
2013_02_14_15_24_33 ./pt-stalk exit status 0

Note that it's --iterations=3600 in my command, but --iterations=1 in what was invoked. I'm confused.

Daniel Nichter (daniel-nichter) wrote :

I think --no-stalk is the reason: iirc, that option causes the tool to collect once (hence --iterations=1) and exit.

tags: added: pt-stalk
Daniel Nichter (daniel-nichter) wrote :

It's not a bug, we just need to update the docs which currently only say:

"""
If this option is negate, L<"--daemonize">, L<"--log">, L<"--pid">, and other
stalking-related options have no effect; the tool simply collects diagnostic
data and exits.
"""

Daniel Nichter (daniel-nichter) wrote :

We can use Ryan's branch that I just linked to make further changes.

Changed in percona-toolkit:
status: New → Triaged
importance: Undecided → Medium
assignee: nobody → Daniel Nichter (daniel-nichter)
milestone: none → 2.2.1
summary: - pt-stalk exiting prematurely when invoked with -collect, --no-stalk,
- --interval, --iterations
+ pt-stalk --no-stalk silently clobbers explicit --iterations
summary: - pt-stalk --no-stalk silently clobbers explicit --iterations
+ pt-stalk --no-stalk clobbers other options

Ok, I decided to change this a little. The 2.1 way of --no-stalk is magical, and magic usually doesn't turn out well. 2.1 --no-stalk clobbers these options:

      OPT_ITERATIONS=1
      OPT_CYCLES=0
      OPT_SLEEP=0
      OPT_INTERVAL=0

There's no way to override that. So 2.1 --no-stalk is magically "collect once and exit", rather than simply being "don't stalk, just collect." as one would more reasonably expect, I think.

So in 2.2, i.e. in the attached branch, I have made --no-stalk do just that, and all other options* are left-as-is. *Not all options: --cycles is disabled because if we're not stalking then we're not waiting for it to be true. And --pid, --log, and --daemonize still have no affect. This is all documented.

These changes mean that now to collect once and exit, you must: --no-stalk --iterations 1. Also, as the docs state: " You probably also want to specify values for L<"--interval">, L<"--iterations">, and L<"--sleep">." This is because the tool uses its defaults, so simply doing --no-stalk will result in 60s collections every 5 minutes forever.

summary: - pt-stalk --no-stalk clobbers other options
+ pt-stalk --no-stalk silently clobbers other options, acts magically
Changed in percona-toolkit:
status: Triaged → Fix Committed
Changed in percona-toolkit:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers