Merge lp:~percona-toolkit-dev/percona-toolkit/pt-query-digest-waits-for-STDIN-if-file-dosnt-exist-1404313 into lp:~percona-toolkit-dev/percona-toolkit/release-2.2.14
Status: | Merged |
---|---|
Approved by: | Daniel Nichter |
Approved revision: | 629 |
Merged at revision: | 620 |
Proposed branch: | lp:~percona-toolkit-dev/percona-toolkit/pt-query-digest-waits-for-STDIN-if-file-dosnt-exist-1404313 |
Merge into: | lp:~percona-toolkit-dev/percona-toolkit/release-2.2.14 |
Diff against target: |
14 lines (+4/-0) 1 file modified
bin/pt-query-digest (+4/-0) |
To merge this branch: | bzr merge lp:~percona-toolkit-dev/percona-toolkit/pt-query-digest-waits-for-STDIN-if-file-dosnt-exist-1404313 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Daniel Nichter | Approve | ||
Review via email: mp+253745@code.launchpad.net |
Description of the change
Problem:
When an single file is given as input, if it is does not exist the tool considers it to be a DSN (used for special purposes within the tool , specifically to parse mysql style dates when the --since or --until option are used)
Since the tool assumes no log file was given, it defaults to STDIN input.
This is confusing for the user since it seems the tool is just doing nothing.
Note:
This is very tricky to solve completely (throw a proper error) given the current options format described in the documentation, since many strings can be considered either a file or a dsn. (a single string like "thisisafile" is parsed as dsn host=thisisafile)
Solution:
Detect when a file handle is of type STDIN and issue a message to user that the tool is waiting for STDIN input.