mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-09 18:30:16 +00:00
PT-2140 - Update modules in the main branch (#570)
* PT-2140 - Update modules in the main branch Updated modules for: - pt-align - pt-archiver - pt-config-diff - pt-deadlock-logger - pt-diskstats - pt-duplicate-key-checker - pt-fifo-split - pt-find - pt-fingerprint - pt-fk-error-logger - pt-heartbeat - pt-index-usage - pt-ioprofile - pt-kill - pt-mext - pt-mysql-summary - pt-online-schema-change - pt-pmp - pt-query-digest - pt-show-grants - pt-sift - pt-slave-delay - pt-slave-find - pt-slave-restart - pt-summary - pt-table-sync - pt-upgrade - pt-variable-advisor Added execute bit for pt-query-digest * PT-2140 Update modules in the main branch Fixed Daemon.pm plugin usage Updated all tests, related to the Daemon plugin. I intentionally did not fix failing tests, not related to Daemon plugin, to avoid making this PR too big. - bin/pt-archiver - PT-2141 - Fixed usage of Daemon.pm - PT-2141 - Updated t/pt-archiver/standard_options.t - bin/pt-deadlock-logger - PT-2143 - Fixed usage of Daemon.pm - PT-2143 - Updated t/pt-deadlock-logger/standard_options.t - bin/pt-fifo-split - PT-2144 - Fixed usage of Daemon.pm - PT-2144 - Updated t/pt-fifo-split/pt-fifo-split.t - bin/pt-find - PT-2145 - Fixed usage of Daemon.pm - PT-2145 - Updated t/pt-find/pt-find.t - bin/pt-fk-error-logger - PT-2146 - Fixed usage of Daemon.pm - PT-2146 - Updated t/pt-fk-error-logger/basics.t - bin/pt-heartbeat - PT-2147 - Fixed usage of Daemon.pm - PT-2147 - Updated t/pt-heartbeat/standard_options.t, t/pt-heartbeat/basics.t - bin/pt-kill - PT-2148 - Fixed usage of Daemon.pm - PT-2148 - Updated t/pt-kill/standard_options.t - bin/pt-show-grants - PT-2152 - Fixed usage of Daemon.pm - PT-2152 - Updated t/pt-show-grants/standard_options.t - bin/pt-slave-delay - Fixed usage of Daemon.pm - Updated t/pt-slave-delay/standard_options.t - bin/pt-slave-find - PT-2153 - Fixed usage of Daemon.pm - PT-2153 -Updated t/pt-slave-find/pt-slave-find.t - bin/pt-slave-restart - Fixed usage of Daemon.pm - Updated t/pt-slave-restart/pt-slave-restart.t - bin/pt-table-sync - PT-2154 - Fixed usage of Daemon.pm - PT-2154 -Updated t/pt-table-sync/standard_options.t
This commit is contained in:
@@ -9,10 +9,10 @@ set -u
|
||||
# ###########################################################################
|
||||
# log_warn_die 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,
|
||||
# with comments and its test file can be found in the GitHub repository at,
|
||||
# lib/bash/log_warn_die.sh
|
||||
# t/lib/bash/log_warn_die.sh
|
||||
# See https://launchpad.net/percona-toolkit for more information.
|
||||
# See https://github.com/percona/percona-toolkit for more information.
|
||||
# ###########################################################################
|
||||
|
||||
|
||||
@@ -57,10 +57,10 @@ _d () {
|
||||
# ###########################################################################
|
||||
# parse_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,
|
||||
# with comments and its test file can be found in the GitHub repository at,
|
||||
# lib/bash/parse_options.sh
|
||||
# t/lib/bash/parse_options.sh
|
||||
# See https://launchpad.net/percona-toolkit for more information.
|
||||
# See https://github.com/percona/percona-toolkit for more information.
|
||||
# ###########################################################################
|
||||
|
||||
|
||||
@@ -282,7 +282,7 @@ _eval_po() {
|
||||
*)
|
||||
echo "Invalid attribute in $opt_spec: $line" >&2
|
||||
exit 1
|
||||
esac
|
||||
esac
|
||||
done < "$opt_spec"
|
||||
|
||||
if [ -z "$opt" ]; then
|
||||
@@ -406,7 +406,6 @@ _parse_command_line() {
|
||||
else
|
||||
spec=$(grep "^short form:-$opt\$" "$PT_TMPDIR"/po/* | cut -d ':' -f 1)
|
||||
if [ -z "$spec" ]; then
|
||||
option_error "Unknown option: $real_opt"
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
@@ -422,7 +421,7 @@ _parse_command_line() {
|
||||
if [ "$val" ]; then
|
||||
option_error "Option $real_opt does not take a value"
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
if [ "$opt_is_negated" ]; then
|
||||
val=""
|
||||
else
|
||||
@@ -465,10 +464,10 @@ size_to_bytes() {
|
||||
# ###########################################################################
|
||||
# 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,
|
||||
# with comments and its test file can be found in the GitHub repository at,
|
||||
# lib/bash/mysql_options.sh
|
||||
# t/lib/bash/mysql_options.sh
|
||||
# See https://launchpad.net/percona-toolkit for more information.
|
||||
# See https://github.com/percona/percona-toolkit for more information.
|
||||
# ###########################################################################
|
||||
|
||||
|
||||
@@ -494,20 +493,20 @@ mysql_options() {
|
||||
if [ -n "$OPT_ASK_PASS" ]; then
|
||||
stty -echo
|
||||
>&2 printf "Enter MySQL password: "
|
||||
read GIVEN_PASS
|
||||
read GIVEN_PASS
|
||||
stty echo
|
||||
printf "\n"
|
||||
MYSQL_ARGS="$MYSQL_ARGS --password=$GIVEN_PASS"
|
||||
elif [ -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
|
||||
@@ -516,7 +515,7 @@ arrange_mysql_options() {
|
||||
rearranged="$rearranged $opt"
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
echo "$rearranged"
|
||||
}
|
||||
|
||||
@@ -527,10 +526,10 @@ arrange_mysql_options() {
|
||||
# ###########################################################################
|
||||
# tmpdir 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,
|
||||
# with comments and its test file can be found in the GitHub repository at,
|
||||
# lib/bash/tmpdir.sh
|
||||
# t/lib/bash/tmpdir.sh
|
||||
# See https://launchpad.net/percona-toolkit for more information.
|
||||
# See https://github.com/percona/percona-toolkit for more information.
|
||||
# ###########################################################################
|
||||
|
||||
|
||||
@@ -568,10 +567,10 @@ rm_tmpdir() {
|
||||
# ###########################################################################
|
||||
# alt_cmds 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,
|
||||
# with comments and its test file can be found in the GitHub repository at,
|
||||
# lib/bash/alt_cmds.sh
|
||||
# t/lib/bash/alt_cmds.sh
|
||||
# See https://launchpad.net/percona-toolkit for more information.
|
||||
# See https://github.com/percona/percona-toolkit for more information.
|
||||
# ###########################################################################
|
||||
|
||||
|
||||
@@ -615,10 +614,10 @@ _which() {
|
||||
# ###########################################################################
|
||||
# report_formatting 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,
|
||||
# with comments and its test file can be found in the GitHub repository at,
|
||||
# lib/bash/report_formatting.sh
|
||||
# t/lib/bash/report_formatting.sh
|
||||
# See https://launchpad.net/percona-toolkit for more information.
|
||||
# See https://github.com/percona/percona-toolkit for more information.
|
||||
# ###########################################################################
|
||||
|
||||
|
||||
@@ -707,10 +706,10 @@ group_concat () {
|
||||
# ###########################################################################
|
||||
# summary_common 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,
|
||||
# with comments and its test file can be found in the GitHub repository at,
|
||||
# lib/bash/summary_common.sh
|
||||
# t/lib/bash/summary_common.sh
|
||||
# See https://launchpad.net/percona-toolkit for more information.
|
||||
# See https://github.com/percona/percona-toolkit for more information.
|
||||
# ###########################################################################
|
||||
|
||||
|
||||
@@ -827,7 +826,7 @@ setup_data_dir () {
|
||||
get_var () {
|
||||
local varname="$1"
|
||||
local file="$2"
|
||||
awk -v pattern="${varname}" '$1 == pattern { if (length($2)) { len = length($1); print substr($0, len+index(substr($0, len+1), $2)) } }' "${file}" | tr -d '\r'
|
||||
awk -v pattern="${varname}" '$1 == pattern { if (length($2)) { len = length($1); print substr($0, len+index(substr($0, len+1), $2)) } }' "${file}"
|
||||
}
|
||||
|
||||
# ###########################################################################
|
||||
@@ -837,10 +836,10 @@ get_var () {
|
||||
# ###########################################################################
|
||||
# collect_mysql_info 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,
|
||||
# with comments and its test file can be found in the GitHub repository at,
|
||||
# lib/bash/collect_mysql_info.sh
|
||||
# t/lib/bash/collect_mysql_info.sh
|
||||
# See https://launchpad.net/percona-toolkit for more information.
|
||||
# See https://github.com/percona/percona-toolkit for more information.
|
||||
# ###########################################################################
|
||||
|
||||
|
||||
@@ -1039,7 +1038,7 @@ collect_mysql_info () {
|
||||
collect_mysql_slave_status > "$dir/mysql-slave"
|
||||
collect_mysql_innodb_status > "$dir/innodb-status"
|
||||
collect_mysql_ndb_status > "$dir/ndb-status"
|
||||
collect_mysql_processlist > "$dir/mysql-processlist"
|
||||
collect_mysql_processlist > "$dir/mysql-processlist"
|
||||
collect_mysql_users > "$dir/mysql-users"
|
||||
collect_mysql_roles > "$dir/mysql-roles"
|
||||
|
||||
@@ -1090,10 +1089,10 @@ collect_mysql_info () {
|
||||
# ###########################################################################
|
||||
# report_mysql_info 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,
|
||||
# with comments and its test file can be found in the GitHub repository at,
|
||||
# lib/bash/report_mysql_info.sh
|
||||
# t/lib/bash/report_mysql_info.sh
|
||||
# See https://launchpad.net/percona-toolkit for more information.
|
||||
# See https://github.com/percona/percona-toolkit for more information.
|
||||
# ###########################################################################
|
||||
|
||||
|
||||
@@ -1222,7 +1221,7 @@ parse_mysqld_instances () {
|
||||
defaults_file="$(echo "${word}" | cut -d= -f2)"
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
if [ -n "${defaults_file:-""}" -a -r "${defaults_file:-""}" ]; then
|
||||
socket="${socket:-"$(grep "^socket\>" "$defaults_file" | tail -n1 | cut -d= -f2 | sed 's/^[ \t]*//;s/[ \t]*$//')"}"
|
||||
port="${port:-"$(grep "^port\>" "$defaults_file" | tail -n1 | cut -d= -f2 | sed 's/^[ \t]*//;s/[ \t]*$//')"}"
|
||||
@@ -1236,7 +1235,7 @@ parse_mysqld_instances () {
|
||||
oom="?"
|
||||
fi
|
||||
printf " %5s %-26s %-4s %-3s %s\n" "${port}" "${datadir}" "${nice:-"?"}" "${oom:-"?"}" "${socket}"
|
||||
|
||||
|
||||
defaults_file=""
|
||||
socket=""
|
||||
port=""
|
||||
@@ -1366,7 +1365,7 @@ summarize_processlist () {
|
||||
}
|
||||
\$1 == \"Time:\" {
|
||||
t = \$2;
|
||||
if ( t == \"NULL\" ) {
|
||||
if ( t == \"NULL\" ) {
|
||||
t = 0;
|
||||
}
|
||||
}
|
||||
@@ -1404,15 +1403,15 @@ pretty_print_cnf_file () {
|
||||
|
||||
perl -n -l -e '
|
||||
my $line = $_;
|
||||
if ( $line =~ /^\s*[a-zA-Z[]/ ) {
|
||||
if ( $line=~/\s*(.*?)\s*=\s*(.*)\s*$/ ) {
|
||||
printf("%-35s = %s\n", $1, $2)
|
||||
}
|
||||
elsif ( $line =~ /\s*\[/ ) {
|
||||
print "\n$line"
|
||||
if ( $line =~ /^\s*[a-zA-Z[]/ ) {
|
||||
if ( $line=~/\s*(.*?)\s*=\s*(.*)\s*$/ ) {
|
||||
printf("%-35s = %s\n", $1, $2)
|
||||
}
|
||||
elsif ( $line =~ /\s*\[/ ) {
|
||||
print "\n$line"
|
||||
} else {
|
||||
print $line
|
||||
}
|
||||
}
|
||||
}' "$file"
|
||||
|
||||
}
|
||||
@@ -1618,7 +1617,7 @@ format_keyring_plugins() {
|
||||
local keyring_plugins="$1"
|
||||
local encrypted_tables="$2"
|
||||
|
||||
if [ -z "$keyring_plugins" ]; then
|
||||
if [ -z "$keyring_plugins" ]; then
|
||||
echo "No keyring plugins found"
|
||||
if [ ! -z "$encrypted_tables" ]; then
|
||||
echo "Warning! There are encrypted tables but keyring plugins are not loaded"
|
||||
@@ -1952,7 +1951,7 @@ section_percona_server_features () {
|
||||
|
||||
name_val "Fast Server Restarts" \
|
||||
"$(feat_on_renamed "$file" innodb_auto_lru_dump innodb_buffer_pool_restore_at_startup)"
|
||||
|
||||
|
||||
name_val "Enhanced Logging" \
|
||||
"$(feat_on "$file" log_slow_verbosity ne microtime)"
|
||||
name_val "Replica Perf Logging" \
|
||||
@@ -1970,7 +1969,7 @@ section_percona_server_features () {
|
||||
fi
|
||||
fi
|
||||
name_val "Smooth Flushing" "$smooth_flushing"
|
||||
|
||||
|
||||
name_val "HandlerSocket NoSQL" \
|
||||
"$(feat_on "$file" handlersocket_port)"
|
||||
name_val "Fast Hash UDFs" \
|
||||
@@ -2128,7 +2127,7 @@ _semi_sync_stats_for () {
|
||||
trace_extra="Unknown setting"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
name_val "${target} semisync status" "${semisync_status}"
|
||||
name_val "${target} trace level" "${semisync_trace}, ${trace_extra}"
|
||||
|
||||
@@ -2241,10 +2240,10 @@ section_percona_xtradb_cluster () {
|
||||
|
||||
name_val "SST Method" "$(get_var "wsrep_sst_method" "$mysql_var")"
|
||||
name_val "Slave Threads" "$(get_var "wsrep_slave_threads" "$mysql_var")"
|
||||
|
||||
|
||||
name_val "Ignore Split Brain" "$( parse_wsrep_provider_options "pc.ignore_sb" "$mysql_var" )"
|
||||
name_val "Ignore Quorum" "$( parse_wsrep_provider_options "pc.ignore_quorum" "$mysql_var" )"
|
||||
|
||||
|
||||
name_val "gcache Size" "$( parse_wsrep_provider_options "gcache.size" "$mysql_var" )"
|
||||
name_val "gcache Directory" "$( parse_wsrep_provider_options "gcache.dir" "$mysql_var" )"
|
||||
name_val "gcache Name" "$( parse_wsrep_provider_options "gcache.name" "$mysql_var" )"
|
||||
@@ -2272,7 +2271,7 @@ report_jemalloc_enabled() {
|
||||
grep -qc jemalloc /proc/${pid}/environ || ldd $(which mysqld) 2>/dev/null | grep -qc jemalloc
|
||||
jemalloc_status=$?
|
||||
if [ $jemalloc_status = 1 ]; then
|
||||
echo "jemalloc is not enabled in mysql config for process with id ${pid}"
|
||||
echo "jemalloc is not enabled in mysql config for process with id ${pid}"
|
||||
else
|
||||
echo "jemalloc enabled in mysql config for process with id ${pid}"
|
||||
GENERAL_JEMALLOC_STATUS=1
|
||||
@@ -2280,16 +2279,14 @@ report_jemalloc_enabled() {
|
||||
done
|
||||
|
||||
if [ $GENERAL_JEMALLOC_STATUS -eq 1 ]; then
|
||||
for pid in $(pidof mysqld); do
|
||||
JEMALLOC_LOCATION=$(strings /proc/${pid}/environ | grep jemalloc)
|
||||
if [ -z "$JEMALLOC_LOCATION" ]; then
|
||||
echo "Jemalloc library for process ${pid} not found"
|
||||
else
|
||||
echo "Process with PID ${pid} is using jemalloc from $JEMALLOC_LOCATION"
|
||||
fi
|
||||
done
|
||||
JEMALLOC_LOCATION=$(find /usr/lib64/ /usr/lib/x86_64-linux-gnu /usr/lib -name "libjemalloc.*" 2>/dev/null | head -n 1)
|
||||
if [ -z "$JEMALLOC_LOCATION" ]; then
|
||||
echo "Jemalloc library not found"
|
||||
else
|
||||
echo "Using jemalloc from $JEMALLOC_LOCATION"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
}
|
||||
|
||||
report_mysql_summary () {
|
||||
@@ -2360,9 +2357,10 @@ report_mysql_summary () {
|
||||
section_percona_server_features "$dir/mysql-variables"
|
||||
|
||||
section "Percona XtraDB Cluster"
|
||||
local has_wsrep=$($CMD_MYSQL $EXT_ARGV -ss -e 'show session variables like "%wsrep_on%";' | cut -f2 | grep -i "on")
|
||||
local has_wsrep="$(get_var "wsrep_on" "$dir/mysql-variables")"
|
||||
if [ -n "${has_wsrep:-""}" ]; then
|
||||
if [ "${has_wsrep:-""}" = "ON" ]; then
|
||||
local wsrep_on="$(feat_on "$dir/mysql-variables" "wsrep_on")"
|
||||
if [ "${wsrep_on:-""}" = "Enabled" ]; then
|
||||
section_percona_xtradb_cluster "$dir/mysql-variables" "$dir/mysql-status"
|
||||
else
|
||||
name_val "wsrep_on" "OFF"
|
||||
@@ -2522,7 +2520,7 @@ report_mysql_summary () {
|
||||
local keyring_plugins="$(collect_keyring_plugins)"
|
||||
local encrypted_tables=""
|
||||
local encrypted_tablespaces=""
|
||||
if [ "${OPT_LIST_ENCRYPTED_TABLES}" = 'yes' ]; then
|
||||
if [ "${OPT_LIST_ENCRYPTED_TABLES}" = 'yes' ]; then
|
||||
encrypted_tables="$(collect_encrypted_tables)"
|
||||
encrypted_tablespaces="$(collect_encrypted_tablespaces)"
|
||||
fi
|
||||
|
Reference in New Issue
Block a user