Compare commits

..

1 Commits

Author SHA1 Message Date
Carlos Salguero
1352db81b6 PT-1398 Updated way of getting MySQL PID 2021-09-30 15:51:47 -03:00
3 changed files with 44 additions and 65 deletions

View File

@@ -1,31 +1,9 @@
Changelog for Percona Toolkit
v3.3.2 WIP release date not set yet
* Improvement PT-1417: Inconsistent creation of toolkit tables
* Fixed bug PT-1627: pt-mysql-summary doesn't verify which version of jemalloc is in use
* Fixed bug PT-1747: pt-online-schema-change: metadata lock can break database for rebuild_constraints
* Improvement PT-1800: PTDEBUG=1 exposes passwords
* Fixed bug PT-1900: pt-query-digest not hiding parameter properly sometimes when parameter=binary
* Improvement PT-1940: ptsoc dropswap with mysql8: revise rejection (Thanks duxthefux)
* Fixed bug PT-1953: pt-summary typo: Memory mamagement.
* Fixed bug PT-1959: go part of the toolkit still has the version 3.3.0
* Improvement PT-1974: Support fingerprinting for --print in pt-kill (Thanks Iwo Panowicz)
* Fixed bug PT-1966: Fixed test (Thanks @yoku0825)
* Fixed bug PT-1965: pt-stalk --mysql-only doesn't collect mysqladmin outputs (Thanks Sergey Kuzmichev)
* Fixed bug PT-1966: Test no_drop_no_swap for the pt-online-schema-change is broken (Thanks Tsubasa Tanaka)
* Fixed bug PT-1974: Support fingerprinting for --print in pt-kill
* Fixed bug PT-1983: pt-summary missing one DIMM
* Admin task PT-2009: Update Go Lang dependencies
* Admin task PT-2011: Make build reproducible
v3.3.1 release 2021-04-28
* Fixed bug PT-716 : pt-summary reports wrong memory size
* Fixed bug PT-1914: Column data lost when 'Generated' is in the column comment
* Fixed bug PT-1919: pt-online-schema change drop_swap can lose triggers. (Thanks Bob)
* Fixed bug PT-1943: BEFORE triggers are dropped after pt-online-schema-change run
v3.3.0 release 2021-01-14
* Improvement PT-1940: Added mysql version check for bug fix introduced in 8.0.14 (Thanks duxthefux)
* Fixed bug PT-1919: pt-online-schema change drop_swap can lose triggers. (Thanks Bob)
* Fixed bug PT-1914: Column data lost when 'Generated' is in the column comment
@@ -34,17 +12,17 @@ v3.3.0 release 2021-01-14
v3.3.0 release 2021-01-14
* Fixed bug PT-169 : pt-online-schema-change FKs error handling.
* Fixed bug PT-1518: pt-table-checksum gives error CRC32. (Thanks @ovidiustanila)
* Fixed bug PT-1822: pt-mongodb-summary fails on standalone mongodb instances
* Fixed bug PT-1829: pt-heartbeat doesn't reconnect for check-read-only
* Improvement PT-1836: Review and consider lintian reported issues
* Improvement PT-1851: Backslashes missing from documentation
* Improvement PT-1853: Added --no-check-foreing-keys to pt-osc
* Fixed bug PT-1857: pt-heartbeat cannot reconnect.
* Fixed bug PT-1859: pt-pg-summary fails for Postgres12 (Thanks Sergey Kuzmichev)
* Fixed bug PT-1881: pt-upgrade fails when query including format strings and SQL errors is given (Thanks Nayuta Yanagisawa)
* Fixed bug PT-169 : pt-online-schema-change FKs error handling.
* Fixed bug PT-1892: pt-summary says sshd not running
* Fixed bug PT-1881: pt-upgrade fails when query including format strings and SQL errors is given (Thanks Nayuta Yanagisawa)
* Fixed bug PT-1859: pt-pg-summary fails for Postgres12 (Thanks Sergey Kuzmichev)
* Improvement PT-1853: Added --no-check-foreing-keys to pt-osc
* Improvement PT-1851: Backslashes missing from documentation
* Improvement PT-1836: Review and consider lintian reported issues
* Fixed bug PT-1829: pt-heartbeat doesn't reconnect for check-read-only
* Fixed bug PT-1822: pt-mongodb-summary fails on standalone mongodb instances
* Fixed bug PT-1518: pt-table-checksum gives error CRC32. (Thanks @ovidiustanila)
v3.2.0 release 2020-04-23

View File

@@ -822,7 +822,7 @@ collect() {
local mysql_version="$(awk '/^version[^_]/{print substr($2,1,3)}' "$d/$p-variables")"
local mysql_error_log="$(awk '/^log_error /{print $2}' "$d/$p-variables")"
local mysql_error_log="$(awk '/^log_error/{print $2}' "$d/$p-variables")"
if [ -z "$mysql_error_log" -a "$mysqld_pid" ]; then
mysql_error_log="$(ls -l /proc/$mysqld_pid/fd | awk '/ 2 ->/{print $NF}')"
fi
@@ -833,10 +833,10 @@ collect() {
tail -f "$mysql_error_log" >"$d/$p-log_error" &
tail_error_log_pid=$!
$CMD_MYSQLADMIN $EXT_ARGV
$CMD_MYSQLADMIN $EXT_ARGV debug
else
log "Could not find the MySQL error log"
fi
fi
if [ "${mysql_version}" '>' "5.1" ]; then
local mutex="SHOW ENGINE INNODB MUTEX"
else
@@ -869,12 +869,7 @@ collect() {
local strace_pid=$!
fi
local cnt=$(($OPT_RUN_TIME / $OPT_SLEEP_COLLECT))
$CMD_MYSQLADMIN $EXT_ARGV ext -i$OPT_SLEEP_COLLECT -c$cnt >>"$d/$p-mysqladmin" &
local mysqladmin_pid=$!
if [ ! "$OPT_MYSQL_ONLY" ]; then
if [ ! "$OPT_MYSQL_ONLY" ]; then
ps -eaF >> "$d/$p-ps" &
top -bn${OPT_RUN_TIME} >> "$d/$p-top" &
@@ -887,9 +882,10 @@ collect() {
if [ "$CMD_DMESG" ]; then
local UPTIME=`cat /proc/uptime | awk '{ print $1 }'`
local START_TIME=$(echo "$UPTIME 60" | awk '{print ($1 - $2)}')
$CMD_DMESG | perl -ne 'm/\[\s*(\d+)\./; if ($1 > '${START_TIME}') { print }' >> "$d/$p-dmesg" &
$CMD_DMESG | perl -ne 'm/\[\s*(\d+)\./; if ($1 > '${START_TIME}') { print }' >> "$d/$p-dmesg" &
fi
local cnt=$(($OPT_RUN_TIME / $OPT_SLEEP_COLLECT))
if [ "$CMD_VMSTAT" ]; then
$CMD_VMSTAT $OPT_SLEEP_COLLECT $cnt >> "$d/$p-vmstat" &
$CMD_VMSTAT $OPT_RUN_TIME 2 >> "$d/$p-vmstat-overall" &
@@ -902,7 +898,10 @@ collect() {
$CMD_MPSTAT -P ALL $OPT_SLEEP_COLLECT $cnt >> "$d/$p-mpstat" &
$CMD_MPSTAT -P ALL $OPT_RUN_TIME 1 >> "$d/$p-mpstat-overall" &
fi
fi
$CMD_MYSQLADMIN $EXT_ARGV ext -i$OPT_SLEEP_COLLECT -c$cnt >>"$d/$p-mysqladmin" &
local mysqladmin_pid=$!
fi
local have_lock_waits_table=""
$CMD_MYSQL $EXT_ARGV -e "SHOW TABLES FROM INFORMATION_SCHEMA" \
@@ -917,7 +916,7 @@ collect() {
local ps_instrumentation_enabled=$($CMD_MYSQL $EXT_ARGV -e 'SELECT ENABLED FROM performance_schema.setup_instruments WHERE NAME = "transaction";' \
| sed "2q;d" | sed 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/')
if [ !$ps_instrumentation_enabled = "yes" ]; then
if [ $ps_instrumentation_enabled != "yes" ]; then
log "Performance Schema instrumentation is disabled"
fi
@@ -956,12 +955,12 @@ collect() {
(echo $ts; df -k) >> "$d/$p-df" &
(echo $ts; netstat -antp) >> "$d/$p-netstat" &
(echo $ts; netstat -s) >> "$d/$p-netstat_s" &
fi
($CMD_MYSQL $EXT_ARGV -e "SHOW FULL PROCESSLIST\G") \
fi
(echo $ts; $CMD_MYSQL $EXT_ARGV -e "SHOW FULL PROCESSLIST\G") \
>> "$d/$p-processlist" &
if [ "$have_lock_waits_table" ]; then
(lock_waits) >>"$d/$p-lock-waits" &
(transactions) >>"$d/$p-transactions" &
(echo $ts; lock_waits) >>"$d/$p-lock-waits" &
(echo $ts; transactions) >>"$d/$p-transactions" &
fi
if [ "${mysql_version}" '>' "5.6" ] && [ $ps_instrumentation_enabled == "yes" ]; then
@@ -969,10 +968,10 @@ collect() {
fi
if [ "${mysql_version}" '>' "5.6" ]; then
(ps_prepared_statements) >> "$d/$p-prepared-statements" &
(echo $ts; ps_prepared_statements) >> "$d/$p-prepared-statements" &
fi
slave_status "$d/$p-slave-status" "${mysql_version}"
slave_status "$d/$p-slave-status" "${mysql_version}"
curr_time=$(date +'%s')
done
@@ -1077,7 +1076,7 @@ lock_waits() {
LEFT JOIN INFORMATION_SCHEMA.PROCESSLIST AS p ON p.id = b.trx_mysql_thread_id
ORDER BY wait_time DESC\G"
$CMD_MYSQL $EXT_ARGV -e "$sql2"
}
}
transactions() {
$CMD_MYSQL $EXT_ARGV -e "SELECT SQL_NO_CACHE * FROM INFORMATION_SCHEMA.INNODB_TRX ORDER BY trx_id\G"
@@ -1126,8 +1125,8 @@ rocksdb_status() {
}
ps_locks_transactions() {
local outfile=$1
local outfile=$1
$CMD_MYSQL $EXT_ARGV -e 'select @@performance_schema' | grep "1" &>/dev/null
if [ $? -eq 0 ]; then
@@ -1163,27 +1162,28 @@ slave_status() {
local outfile=$1
local mysql_version=$2
local sql="SHOW SLAVE STATUS\G"
echo -e "\n$sql\n" >> $outfile
$CMD_MYSQL $EXT_ARGV -e "$sql" >> $outfile
if [ "${mysql_version}" '>' "5.6" ]; then
if [ "${mysql_version}" '<' "5.7" ]; then
local sql="SHOW SLAVE STATUS\G"
echo -e "\n$sql\n" >> $outfile
$CMD_MYSQL $EXT_ARGV -e "$sql" >> $outfile
else
local sql="SELECT * FROM performance_schema.replication_connection_configuration JOIN performance_schema.replication_applier_configuration USING(channel_name)\G"
echo -e "\n$sql\n" >> $outfile
$CMD_MYSQL $EXT_ARGV -e "$sql" >> $outfile
sql="SELECT * FROM performance_schema.replication_connection_status\G"
sql="SELECT * FROM replication_connection_status\G"
echo -e "\n$sql\n" >> $outfile
$CMD_MYSQL $EXT_ARGV -e "$sql" >> $outfile
sql="SELECT * FROM performance_schema.replication_applier_status JOIN performance_schema.replication_applier_status_by_coordinator USING(channel_name)\G"
sql="SELECT * FROM replication_applier_status JOIN replication_applier_status_by_coordinator USING(channel_name)\G"
echo -e "\n$sql\n" >> $outfile
$CMD_MYSQL $EXT_ARGV -e "$sql" >> $outfile
fi
}
collect_mysql_variables() {
local outfile=$1
local outfile=$1
local sql="SHOW GLOBAL VARIABLES"
echo -e "\n$sql\n" >> $outfile
@@ -1192,11 +1192,11 @@ collect_mysql_variables() {
sql="select * from performance_schema.variables_by_thread order by thread_id, variable_name;"
echo -e "\n$sql\n" >> $outfile
$CMD_MYSQL $EXT_ARGV -e "$sql" >> $outfile
sql="select * from performance_schema.user_variables_by_thread order by thread_id, variable_name;"
echo -e "\n$sql\n" >> $outfile
$CMD_MYSQL $EXT_ARGV -e "$sql" >> $outfile
sql="select * from performance_schema.status_by_thread order by thread_id, variable_name; "
echo -e "\n$sql\n" >> $outfile
$CMD_MYSQL $EXT_ARGV -e "$sql" >> $outfile

View File

@@ -52,7 +52,8 @@ collect() {
local mysqld_pid=""
# Get pidof mysqld.
if [ ! "$OPT_MYSQL_ONLY" ]; then
mysqld_pid=$(_pidof mysqld | awk '{print $1; exit;}')
port=$(mysql -ss -e 'SELECT @@port')
mysqld_pid=$(lsof -i ":${port}" | grep -i listen | cut -f 3 -d" ")
fi
# Get memory allocation info before anything else.