mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-10 13:11:32 +00:00
Merge pt-ms-pt-stalk-standard-mysql-options.
This commit is contained in:
@@ -347,14 +347,14 @@ _parse_command_line() {
|
||||
|
||||
if [ "$next_opt_is_val" ]; then
|
||||
next_opt_is_val=""
|
||||
if [ $# -eq 0 ] || [ $(expr "$opt" : "-") -eq 1 ]; then
|
||||
if [ $# -eq 0 ] || [ $(expr "$opt" : "\-") -eq 1 ]; then
|
||||
option_error "$real_opt requires a $required_arg argument"
|
||||
continue
|
||||
fi
|
||||
val="$opt"
|
||||
opt_is_ok=1
|
||||
else
|
||||
if [ $(expr "$opt" : "-") -eq 0 ]; then
|
||||
if [ $(expr "$opt" : "\-") -eq 0 ]; then
|
||||
if [ -z "$ARGV" ]; then
|
||||
ARGV="$opt"
|
||||
else
|
||||
@@ -450,6 +450,61 @@ size_to_bytes() {
|
||||
# End parse_options package
|
||||
# ###########################################################################
|
||||
|
||||
# ###########################################################################
|
||||
# mysql_options package
|
||||
# This package is a copy without comments from the original. The original
|
||||
# with comments and its test file can be found in the Bazaar repository at,
|
||||
# lib/bash/mysql_options.sh
|
||||
# t/lib/bash/mysql_options.sh
|
||||
# See https://launchpad.net/percona-toolkit for more information.
|
||||
# ###########################################################################
|
||||
|
||||
|
||||
set -u
|
||||
|
||||
mysql_options() {
|
||||
local MYSQL_ARGS=""
|
||||
if [ -n "$OPT_DEFAULTS_FILE" ]; then
|
||||
MYSQL_ARGS="--defaults-file=$OPT_DEFAULTS_FILE"
|
||||
fi
|
||||
if [ -n "$OPT_PORT" ]; then
|
||||
MYSQL_ARGS="$MYSQL_ARGS --port=$OPT_PORT"
|
||||
fi
|
||||
if [ -n "$OPT_SOCKET" ]; then
|
||||
MYSQL_ARGS="$MYSQL_ARGS --socket=$OPT_SOCKET"
|
||||
fi
|
||||
if [ -n "$OPT_HOST" ]; then
|
||||
MYSQL_ARGS="$MYSQL_ARGS --host=$OPT_HOST"
|
||||
fi
|
||||
if [ -n "$OPT_USER" ]; then
|
||||
MYSQL_ARGS="$MYSQL_ARGS --user=$OPT_USER"
|
||||
fi
|
||||
if [ -n "$OPT_PASSWORD" ]; then
|
||||
MYSQL_ARGS="$MYSQL_ARGS --password=$OPT_PASSWORD"
|
||||
fi
|
||||
|
||||
echo $MYSQL_ARGS
|
||||
}
|
||||
|
||||
arrange_mysql_options() {
|
||||
local opts="$1"
|
||||
|
||||
local rearranged=""
|
||||
for opt in $opts; do
|
||||
if [ "$(echo $opt | awk -F= '{print $1}')" = "--defaults-file" ]; then
|
||||
rearranged="$opt $rearranged"
|
||||
else
|
||||
rearranged="$rearranged $opt"
|
||||
fi
|
||||
done
|
||||
|
||||
echo "$rearranged"
|
||||
}
|
||||
|
||||
# ###########################################################################
|
||||
# End mysql_options package
|
||||
# ###########################################################################
|
||||
|
||||
# ###########################################################################
|
||||
# tmpdir package
|
||||
# This package is a copy without comments from the original. The original
|
||||
@@ -788,7 +843,6 @@ collect_mysqld_instances () {
|
||||
echo "internal::oom_of_$pid $oom" >> "$variables_file"
|
||||
done
|
||||
|
||||
pids="$pids"
|
||||
pids="$(echo $pids | sed -e 's/ /,/g')"
|
||||
ps ww -p "$pids" 2>/dev/null
|
||||
else
|
||||
@@ -930,8 +984,13 @@ get_mysqldump_args () {
|
||||
collect_mysqld_executables () {
|
||||
local mysqld_instances="$1"
|
||||
|
||||
local ps_opt="cmd="
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
ps_opt="command="
|
||||
fi
|
||||
|
||||
for pid in $( grep '/mysqld' "$mysqld_instances" | awk '/^.*[0-9]/{print $1}' ); do
|
||||
ps -o cmd -p $pid | sed -e 's/^\(.*mysqld\) .*/\1/' | grep -v '^CMD$'
|
||||
ps -o $ps_opt -p $pid | sed -e 's/^\(.*mysqld\) .*/\1/'
|
||||
done | sort -u
|
||||
}
|
||||
|
||||
@@ -2320,6 +2379,7 @@ report_mysql_summary () {
|
||||
|
||||
section "Configuration File"
|
||||
local cnf_file="$(get_var "pt-summary-internal-Config_File_path" "$dir/mysql-variables")"
|
||||
|
||||
if [ -n "${cnf_file}" ]; then
|
||||
name_val "Config File" "${cnf_file}"
|
||||
pretty_print_cnf_file "$dir/mysql-config-file"
|
||||
@@ -2376,6 +2436,14 @@ main() {
|
||||
# Prepending SIG to these doesn't work with NetBSD's sh
|
||||
trap sigtrap HUP INT TERM
|
||||
|
||||
local MYSQL_ARGS="$(mysql_options)"
|
||||
EXT_ARGV="$(arrange_mysql_options "$EXT_ARGV $MYSQL_ARGS")"
|
||||
|
||||
# Check if mysql and mysqldump are there, otherwise bail out early.
|
||||
# But don't if they passed in --read-samples, since we don't need
|
||||
# a connection then.
|
||||
[ "$OPT_READ_SAMPLES" ] || check_mysql
|
||||
|
||||
local RAN_WITH="--sleep=$OPT_SLEEP --databases=$OPT_DATABASES --save-samples=$OPT_SAVE_SAMPLES"
|
||||
|
||||
_d "Starting $0 $RAN_WITH"
|
||||
@@ -2442,11 +2510,6 @@ if [ "${0##*/}" = "$TOOL" ] \
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Check if mysql and mysqldump are there, otherwise bail out early.
|
||||
# But don't if they passed in --read-samples, since we don't need
|
||||
# a connection then.
|
||||
[ "$OPT_READ_SAMPLES" ] || check_mysql
|
||||
|
||||
main "${@:-""}"
|
||||
fi
|
||||
|
||||
@@ -2462,7 +2525,7 @@ pt-mysql-summary - Summarize MySQL information nicely.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
Usage: pt-mysql-summary [OPTIONS] [-- MYSQL OPTIONS]
|
||||
Usage: pt-mysql-summary [OPTIONS]
|
||||
|
||||
pt-mysql-summary conveniently summarizes the status and configuration of a
|
||||
MySQL database server so that you can learn about it at a glance. It is not
|
||||
@@ -2498,7 +2561,7 @@ and other scripting languages.
|
||||
To use, simply execute it. Optionally add a double dash and then the same
|
||||
command-line options you would use to connect to MySQL, such as the following:
|
||||
|
||||
pt-mysql-summary -- --user=root
|
||||
pt-mysql-summary --user=root
|
||||
|
||||
The tool interacts minimally with the server upon which it runs. It assumes
|
||||
that you'll run it on the same server you're inspecting, and therefore it
|
||||
@@ -2889,22 +2952,6 @@ type: string
|
||||
Read this comma-separated list of config files. If specified, this must be the
|
||||
first option on the command line.
|
||||
|
||||
=item --help
|
||||
|
||||
Print help and exit.
|
||||
|
||||
=item --save-samples
|
||||
|
||||
type: string
|
||||
|
||||
Save the data files used to generate the summary in this directory.
|
||||
|
||||
=item --read-samples
|
||||
|
||||
type: string
|
||||
|
||||
Create a report from the files found in this directory.
|
||||
|
||||
=item --databases
|
||||
|
||||
type: string
|
||||
@@ -2913,12 +2960,65 @@ Names of databases to summarize. If you want all of them, you can use the value
|
||||
C<--all-databases>; you can also pass in a comma-separated list of database
|
||||
names. If not provided, the program will ask you for manual input.
|
||||
|
||||
=item --defaults-file
|
||||
|
||||
short form: -F; type: string
|
||||
|
||||
Only read mysql options from the given file. You must give an absolute
|
||||
pathname.
|
||||
|
||||
=item --help
|
||||
|
||||
Print help and exit.
|
||||
|
||||
=item --host
|
||||
|
||||
short form: -h; type: string
|
||||
|
||||
Host to connect to.
|
||||
|
||||
=item --password
|
||||
|
||||
short form: -p; type: string
|
||||
|
||||
Password to use when connecting.
|
||||
|
||||
=item --port
|
||||
|
||||
short form: -P; type: int
|
||||
|
||||
Port number to use for connection.
|
||||
|
||||
=item --read-samples
|
||||
|
||||
type: string
|
||||
|
||||
Create a report from the files found in this directory.
|
||||
|
||||
=item --save-samples
|
||||
|
||||
type: string
|
||||
|
||||
Save the data files used to generate the summary in this directory.
|
||||
|
||||
=item --sleep
|
||||
|
||||
type: int; default: 10
|
||||
|
||||
Seconds to sleep when gathering status counters.
|
||||
|
||||
=item --socket
|
||||
|
||||
short form: -S; type: string
|
||||
|
||||
Socket file to use for connection.
|
||||
|
||||
=item --user
|
||||
|
||||
short form: -u; type: string
|
||||
|
||||
User for login if not current user.
|
||||
|
||||
=item --version
|
||||
|
||||
Print tool's version and exit.
|
||||
|
103
bin/pt-stalk
103
bin/pt-stalk
@@ -399,14 +399,14 @@ _parse_command_line() {
|
||||
|
||||
if [ "$next_opt_is_val" ]; then
|
||||
next_opt_is_val=""
|
||||
if [ $# -eq 0 ] || [ $(expr "$opt" : "-") -eq 1 ]; then
|
||||
if [ $# -eq 0 ] || [ $(expr "$opt" : "\-") -eq 1 ]; then
|
||||
option_error "$real_opt requires a $required_arg argument"
|
||||
continue
|
||||
fi
|
||||
val="$opt"
|
||||
opt_is_ok=1
|
||||
else
|
||||
if [ $(expr "$opt" : "-") -eq 0 ]; then
|
||||
if [ $(expr "$opt" : "\-") -eq 0 ]; then
|
||||
if [ -z "$ARGV" ]; then
|
||||
ARGV="$opt"
|
||||
else
|
||||
@@ -502,6 +502,61 @@ size_to_bytes() {
|
||||
# End parse_options package
|
||||
# ###########################################################################
|
||||
|
||||
# ###########################################################################
|
||||
# mysql_options package
|
||||
# This package is a copy without comments from the original. The original
|
||||
# with comments and its test file can be found in the Bazaar repository at,
|
||||
# lib/bash/mysql_options.sh
|
||||
# t/lib/bash/mysql_options.sh
|
||||
# See https://launchpad.net/percona-toolkit for more information.
|
||||
# ###########################################################################
|
||||
|
||||
|
||||
set -u
|
||||
|
||||
mysql_options() {
|
||||
local MYSQL_ARGS=""
|
||||
if [ -n "$OPT_DEFAULTS_FILE" ]; then
|
||||
MYSQL_ARGS="--defaults-file=$OPT_DEFAULTS_FILE"
|
||||
fi
|
||||
if [ -n "$OPT_PORT" ]; then
|
||||
MYSQL_ARGS="$MYSQL_ARGS --port=$OPT_PORT"
|
||||
fi
|
||||
if [ -n "$OPT_SOCKET" ]; then
|
||||
MYSQL_ARGS="$MYSQL_ARGS --socket=$OPT_SOCKET"
|
||||
fi
|
||||
if [ -n "$OPT_HOST" ]; then
|
||||
MYSQL_ARGS="$MYSQL_ARGS --host=$OPT_HOST"
|
||||
fi
|
||||
if [ -n "$OPT_USER" ]; then
|
||||
MYSQL_ARGS="$MYSQL_ARGS --user=$OPT_USER"
|
||||
fi
|
||||
if [ -n "$OPT_PASSWORD" ]; then
|
||||
MYSQL_ARGS="$MYSQL_ARGS --password=$OPT_PASSWORD"
|
||||
fi
|
||||
|
||||
echo $MYSQL_ARGS
|
||||
}
|
||||
|
||||
arrange_mysql_options() {
|
||||
local opts="$1"
|
||||
|
||||
local rearranged=""
|
||||
for opt in $opts; do
|
||||
if [ "$(echo $opt | awk -F= '{print $1}')" = "--defaults-file" ]; then
|
||||
rearranged="$opt $rearranged"
|
||||
else
|
||||
rearranged="$rearranged $opt"
|
||||
fi
|
||||
done
|
||||
|
||||
echo "$rearranged"
|
||||
}
|
||||
|
||||
# ###########################################################################
|
||||
# End mysql_options package
|
||||
# ###########################################################################
|
||||
|
||||
# ###########################################################################
|
||||
# tmpdir package
|
||||
# This package is a copy without comments from the original. The original
|
||||
@@ -1370,6 +1425,9 @@ if [ "${0##*/}" = "$TOOL" ] \
|
||||
exit 0
|
||||
fi
|
||||
|
||||
MYSQL_ARGS="$(mysql_options)"
|
||||
EXT_ARGV="$(arrange_mysql_options "$EXT_ARGV $MYSQL_ARGS")"
|
||||
|
||||
# Check that mysql and mysqladmin are in PATH. If not, we're
|
||||
# already dead in the water, so don't bother with cmd line opts,
|
||||
# just error and exit.
|
||||
@@ -1439,7 +1497,7 @@ pt-stalk - Collect forensic data about MySQL when problems occur.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
Usage: pt-stalk [OPTIONS] [-- MYSQL OPTIONS]
|
||||
Usage: pt-stalk [OPTIONS]
|
||||
|
||||
pt-stalk waits for a trigger condition to occur, then collects data
|
||||
to help diagnose problems. The tool is designed to run as a daemon with root
|
||||
@@ -1633,6 +1691,13 @@ the trigger condition less likely to fire when the problem recovers quickly.
|
||||
Daemonize the tool. This causes the tool to fork into the background and log
|
||||
its output as specified in --log.
|
||||
|
||||
=item --defaults-file
|
||||
|
||||
short form: -F; type: string
|
||||
|
||||
Only read mysql options from the given file. You must give an absolute
|
||||
pathname.
|
||||
|
||||
=item --dest
|
||||
|
||||
type: string; default: /var/lib/pt-stalk
|
||||
@@ -1730,6 +1795,12 @@ file-specific global variables with "PLUGIN_" or make them local.
|
||||
|
||||
Print help and exit.
|
||||
|
||||
=item --host
|
||||
|
||||
short form: -h; type: string
|
||||
|
||||
Host to connect to.
|
||||
|
||||
=item --interval
|
||||
|
||||
type: int; default: 1
|
||||
@@ -1765,6 +1836,12 @@ type: string
|
||||
|
||||
Send an email to these addresses for every L<"--collect">.
|
||||
|
||||
=item --password
|
||||
|
||||
short form: -p; type: string
|
||||
|
||||
Password to use when connecting.
|
||||
|
||||
=item --pid
|
||||
|
||||
type: string; default: /var/run/pt-stalk.pid
|
||||
@@ -1839,6 +1916,12 @@ Plugins can stop the tool by setting the global variable C<OKTORUN>
|
||||
to C<1>. In this case, the global variable C<EXIT_REASON> should also
|
||||
be set to indicate why the tool was stopped.
|
||||
|
||||
=item --port
|
||||
|
||||
short form: -P; type: int
|
||||
|
||||
Port number to use for connection.
|
||||
|
||||
=item --prefix
|
||||
|
||||
type: string
|
||||
@@ -1886,6 +1969,12 @@ from triggering continuously, which might be a problem if the collection process
|
||||
It also prevents filling up the disk or gathering too much data to analyze
|
||||
reasonably.
|
||||
|
||||
=item --socket
|
||||
|
||||
short form: -S; type: string
|
||||
|
||||
Socket file to use for connection.
|
||||
|
||||
=item --stalk
|
||||
|
||||
default: yes; negatable: yes
|
||||
@@ -1915,6 +2004,12 @@ threshold to check for a L<"--variable"> value that is too low.
|
||||
|
||||
See also L<"--function">.
|
||||
|
||||
=item --user
|
||||
|
||||
short form: -u; type: string
|
||||
|
||||
User for login if not current user.
|
||||
|
||||
=item --variable
|
||||
|
||||
type: string; default: Threads_running
|
||||
@@ -2050,7 +2145,7 @@ Replace C<TOOL> with the name of any tool.
|
||||
=head1 AUTHORS
|
||||
|
||||
Baron Schwartz, Justin Swanhart, Fernando Ipar, Daniel Nichter,
|
||||
and Brian Fraser.
|
||||
and Brian Fraser
|
||||
|
||||
=head1 ABOUT PERCONA TOOLKIT
|
||||
|
||||
|
@@ -354,14 +354,14 @@ _parse_command_line() {
|
||||
|
||||
if [ "$next_opt_is_val" ]; then
|
||||
next_opt_is_val=""
|
||||
if [ $# -eq 0 ] || [ $(expr "$opt" : "-") -eq 1 ]; then
|
||||
if [ $# -eq 0 ] || [ $(expr "$opt" : "\-") -eq 1 ]; then
|
||||
option_error "$real_opt requires a $required_arg argument"
|
||||
continue
|
||||
fi
|
||||
val="$opt"
|
||||
opt_is_ok=1
|
||||
else
|
||||
if [ $(expr "$opt" : "-") -eq 0 ]; then
|
||||
if [ $(expr "$opt" : "\-") -eq 0 ]; then
|
||||
if [ -z "$ARGV" ]; then
|
||||
ARGV="$opt"
|
||||
else
|
||||
|
@@ -43,7 +43,6 @@ collect_mysqld_instances () {
|
||||
echo "internal::oom_of_$pid $oom" >> "$variables_file"
|
||||
done
|
||||
|
||||
pids="$pids"
|
||||
pids="$(echo $pids | sed -e 's/ /,/g')"
|
||||
ps ww -p "$pids" 2>/dev/null
|
||||
else
|
||||
@@ -201,8 +200,13 @@ get_mysqldump_args () {
|
||||
collect_mysqld_executables () {
|
||||
local mysqld_instances="$1"
|
||||
|
||||
local ps_opt="cmd="
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
ps_opt="command="
|
||||
fi
|
||||
|
||||
for pid in $( grep '/mysqld' "$mysqld_instances" | awk '/^.*[0-9]/{print $1}' ); do
|
||||
ps -o cmd -p $pid | sed -e 's/^\(.*mysqld\) .*/\1/' | grep -v '^CMD$'
|
||||
ps -o $ps_opt -p $pid | sed -e 's/^\(.*mysqld\) .*/\1/'
|
||||
done | sort -u
|
||||
}
|
||||
|
||||
|
68
lib/bash/mysql_options.sh
Normal file
68
lib/bash/mysql_options.sh
Normal file
@@ -0,0 +1,68 @@
|
||||
# This program is copyright 2011 Percona Inc.
|
||||
# Feedback and improvements are welcome.
|
||||
#
|
||||
# THIS PROGRAM IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||
# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
# MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify it under
|
||||
# the terms of the GNU General Public License as published by the Free Software
|
||||
# Foundation, version 2; OR the Perl Artistic License. On UNIX and similar
|
||||
# systems, you can issue `man perlgpl' or `man perlartistic' to read these
|
||||
# licenses.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along with
|
||||
# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
||||
# Place, Suite 330, Boston, MA 02111-1307 USA.
|
||||
# ###########################################################################
|
||||
# mysql_options package
|
||||
# ###########################################################################
|
||||
|
||||
# Package: mysql_options
|
||||
# Handle --defaults-file & related options
|
||||
|
||||
set -u
|
||||
|
||||
mysql_options() {
|
||||
local MYSQL_ARGS=""
|
||||
if [ -n "$OPT_DEFAULTS_FILE" ]; then
|
||||
MYSQL_ARGS="--defaults-file=$OPT_DEFAULTS_FILE"
|
||||
fi
|
||||
if [ -n "$OPT_PORT" ]; then
|
||||
MYSQL_ARGS="$MYSQL_ARGS --port=$OPT_PORT"
|
||||
fi
|
||||
if [ -n "$OPT_SOCKET" ]; then
|
||||
MYSQL_ARGS="$MYSQL_ARGS --socket=$OPT_SOCKET"
|
||||
fi
|
||||
if [ -n "$OPT_HOST" ]; then
|
||||
MYSQL_ARGS="$MYSQL_ARGS --host=$OPT_HOST"
|
||||
fi
|
||||
if [ -n "$OPT_USER" ]; then
|
||||
MYSQL_ARGS="$MYSQL_ARGS --user=$OPT_USER"
|
||||
fi
|
||||
if [ -n "$OPT_PASSWORD" ]; then
|
||||
MYSQL_ARGS="$MYSQL_ARGS --password=$OPT_PASSWORD"
|
||||
fi
|
||||
|
||||
echo $MYSQL_ARGS
|
||||
}
|
||||
|
||||
# This basically makes sure that --defaults-file comes first
|
||||
arrange_mysql_options() {
|
||||
local opts="$1"
|
||||
|
||||
local rearranged=""
|
||||
for opt in $opts; do
|
||||
if [ "$(echo $opt | awk -F= '{print $1}')" = "--defaults-file" ]; then
|
||||
rearranged="$opt $rearranged"
|
||||
else
|
||||
rearranged="$rearranged $opt"
|
||||
fi
|
||||
done
|
||||
|
||||
echo "$rearranged"
|
||||
}
|
||||
|
||||
# ###########################################################################
|
||||
# End mysql_options package
|
||||
# ###########################################################################
|
@@ -398,7 +398,7 @@ _parse_command_line() {
|
||||
|
||||
if [ "$next_opt_is_val" ]; then
|
||||
next_opt_is_val=""
|
||||
if [ $# -eq 0 ] || [ $(expr "$opt" : "-") -eq 1 ]; then
|
||||
if [ $# -eq 0 ] || [ $(expr "$opt" : "\-") -eq 1 ]; then
|
||||
option_error "$real_opt requires a $required_arg argument"
|
||||
continue
|
||||
fi
|
||||
@@ -406,7 +406,7 @@ _parse_command_line() {
|
||||
opt_is_ok=1
|
||||
else
|
||||
# If option does not begin with a hyphen (-), it's a filename, etc.
|
||||
if [ $(expr "$opt" : "-") -eq 0 ]; then
|
||||
if [ $(expr "$opt" : "\-") -eq 0 ]; then
|
||||
if [ -z "$ARGV" ]; then
|
||||
ARGV="$opt"
|
||||
else
|
||||
|
@@ -1489,6 +1489,7 @@ report_mysql_summary () {
|
||||
# ########################################################################
|
||||
section "Configuration File"
|
||||
local cnf_file="$(get_var "pt-summary-internal-Config_File_path" "$dir/mysql-variables")"
|
||||
|
||||
if [ -n "${cnf_file}" ]; then
|
||||
name_val "Config File" "${cnf_file}"
|
||||
pretty_print_cnf_file "$dir/mysql-config-file"
|
||||
|
30
t/lib/bash/mysql_options.sh
Normal file
30
t/lib/bash/mysql_options.sh
Normal file
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
plan 3
|
||||
|
||||
TMPFILE="$TEST_PT_TMPDIR/parse-opts-output"
|
||||
TOOL="pt-mysql-summary"
|
||||
PT_TMPDIR="$TEST_PT_TMPDIR"
|
||||
|
||||
source "$LIB_DIR/log_warn_die.sh"
|
||||
source "$LIB_DIR/parse_options.sh"
|
||||
source "$LIB_DIR/mysql_options.sh"
|
||||
|
||||
cnf="/tmp/12345/my.sandbox.cnf"
|
||||
|
||||
parse_options "$PERCONA_TOOLKIT_BRANCH/bin/pt-mysql-summary" --defaults-file $cnf
|
||||
is "$OPT_DEFAULTS_FILE" "$cnf" "--defaults-file works"
|
||||
|
||||
# ############################################################################
|
||||
# Short forms work
|
||||
# ############################################################################
|
||||
|
||||
parse_options "$PERCONA_TOOLKIT_BRANCH/bin/pt-mysql-summary" -F $cnf
|
||||
is "$OPT_DEFAULTS_FILE" "$cnf" "-F works"
|
||||
|
||||
parse_options "$PERCONA_TOOLKIT_BRANCH/bin/pt-mysql-summary" -u msandbox
|
||||
is "$OPT_USER" "msandbox" "-u works"
|
||||
|
||||
# ############################################################################
|
||||
# Done
|
||||
# ############################################################################
|
1
t/lib/bash/mysql_options.t
Symbolic link
1
t/lib/bash/mysql_options.t
Symbolic link
@@ -0,0 +1 @@
|
||||
../../../util/test-bash-functions
|
@@ -144,7 +144,7 @@ like(
|
||||
|
||||
cleanup();
|
||||
|
||||
$retval = system("$trunk/bin/pt-stalk --daemonize --pid $pid_file --log $log_file --dest $dest --verbose 3 -- --defaults-file=$cnf");
|
||||
$retval = system("$trunk/bin/pt-stalk --daemonize --pid $pid_file --log $log_file --variable Threads_running --dest $dest --verbose 3 -- --defaults-file=$cnf");
|
||||
|
||||
PerconaTest::wait_for_files($pid_file, $log_file);
|
||||
PerconaTest::wait_for_sh("grep -q 'Check results' $log_file >/dev/null");
|
||||
@@ -155,7 +155,7 @@ like(
|
||||
$output,
|
||||
qr/Check results: Threads_running=\d+, matched=no, cycles_true=0/,
|
||||
"Matching results logged with --verbose 3"
|
||||
) or diag(`cat $log_file 2>/dev/null`, `cat $dest/*-output 2>/dev/null`);
|
||||
) or diag(`cat $dest/*-output 2>/dev/null`);
|
||||
|
||||
# #############################################################################
|
||||
# --verbose 1 (just errors and warnings)
|
||||
|
Reference in New Issue
Block a user