diff --git a/bin/pt-stalk b/bin/pt-stalk index 86e0f0e6..e9a4dfd7 100755 --- a/bin/pt-stalk +++ b/bin/pt-stalk @@ -832,7 +832,6 @@ collect() { log "Could not find the MySQL error log" fi - slave_status "$d/$p-slave-status" $mysql_version if [ "${mysql_version}" '>' "5.1" ]; then local mutex="SHOW ENGINE INNODB MUTEX" @@ -948,6 +947,15 @@ collect() { (echo $ts; transactions) >>"$d/$p-transactions" & fi +<<<<<<< Updated upstream +======= + if [ $ps_instrumentation_enabled == "yes" ]; then + ps_locks_transactions "$d/$p-ps-locks-transactions" + fi + + slave_status "$d/$p-slave-status" $mysql_version + +>>>>>>> Stashed changes curr_time=$(date +'%s') done log "Loop end: $(date +'TS %s.%N %F %T')" @@ -1119,6 +1127,38 @@ slave_status() { } +slave_status() { + local outfile=$1 + local mysql_version=$2 + + if [ "${mysql_version}" '<' "5.7" ]; then + echo "MySQL < 5.7 detected" + local status="SHOW SLAVE STATUS\G" + $CMD_MYSQL $EXT_ARGV -e "$status" >> $outfile + else + local status=" + SELECT * + FROM performance_schema.replication_connection_configuration + JOIN performance_schema.replication_applier_configuration + USING (channel_name)\G" + echo -e "\n$status\n" >> $outfile + $CMD_MYSQL $EXT_ARGV -e "$status" >> $outfile + + local status="SELECT * + FROM replication_connection_status\G" + echo -e "\n$status\n" >> $outfile + $CMD_MYSQL $EXT_ARGV -e "$status" >> $outfile + + local status="SELECT * + FROM replication_applier_status + JOIN replication_applier_status_by_coordinator + USING (channel_name)\G" + echo -e "\n$status\n" >> $outfile + $CMD_MYSQL $EXT_ARGV -e "$status" >> $outfile + fi + +} + # ########################################################################### # End collect package # ########################################################################### diff --git a/lib/bash/collect.sh b/lib/bash/collect.sh index 8747ce8b..8f4acb17 100644 --- a/lib/bash/collect.sh +++ b/lib/bash/collect.sh @@ -242,6 +242,12 @@ collect() { (echo $ts; transactions) >>"$d/$p-transactions" & fi + if [ $ps_instrumentation_enabled == "yes" ]; then + ps_locks_transactions "$d/$p-ps-locks-transactions" + fi + + slave_status "$d/$p-slave-status" $mysql_version + curr_time=$(date +'%s') done log "Loop end: $(date +'TS %s.%N %F %T')" @@ -425,6 +431,40 @@ slave_status() { } +slave_status() { + local outfile=$1 + local mysql_version=$2 + + if [ "${mysql_version}" '<' "5.7" ]; then + echo "MySQL < 5.7 detected" + local status="SHOW SLAVE STATUS\G" + $CMD_MYSQL $EXT_ARGV -e "$status" >> $outfile + else + local status=" + SELECT * + FROM performance_schema.replication_connection_configuration + JOIN performance_schema.replication_applier_configuration + USING (channel_name)\G" + echo -e "\n$status\n" >> $outfile + $CMD_MYSQL $EXT_ARGV -e "$status" >> $outfile + + local status=" + SELECT * + FROM replication_connection_status\G" + echo -e "\n$status\n" >> $outfile + $CMD_MYSQL $EXT_ARGV -e "$status" >> $outfile + + local status=" + SELECT * + FROM replication_applier_status + JOIN replication_applier_status_by_coordinator + USING (channel_name)\G" + echo -e "\n$status\n" >> $outfile + $CMD_MYSQL $EXT_ARGV -e "$status" >> $outfile + fi + +} + # ########################################################################### # End collect package # ###########################################################################