From e8ad42955d49e37adf632e029d6693791f9f905e Mon Sep 17 00:00:00 2001 From: guriandoro Date: Wed, 22 Mar 2017 10:53:34 -0400 Subject: [PATCH] PT-90 Adding collect for LP:1642750 pt-stalk will now also collect from P_S.prepared_statements_instances --- lib/bash/collect.sh | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/lib/bash/collect.sh b/lib/bash/collect.sh index 8f68a615..09ad96f6 100644 --- a/lib/bash/collect.sh +++ b/lib/bash/collect.sh @@ -100,9 +100,7 @@ collect() { $CMD_MYSQLADMIN $EXT_ARGV debug else log "Could not find the MySQL error log" - fi - - + fi # Get a sample of these right away, so we can get these without interaction # with the other commands we're about to run. if [ "${mysql_version}" '>' "5.1" ]; then @@ -251,6 +249,10 @@ collect() { ps_locks_transactions "$d/$p-ps-locks-transactions" fi + if [ "${mysql_version}" '>' "5.6" ]; then + (echo $ts; ps_prepared_statements) >> "$d/$p-prepared-statements" & + fi + curr_time=$(date +'%s') done log "Loop end: $(date +'TS %s.%N %F %T')" @@ -427,6 +429,14 @@ ps_locks_transactions() { } +ps_prepared_statements() { + $CMD_MYSQL $EXT_ARGV -e "SELECT t.processlist_id, pse.* \ + FROM performance_schema.prepared_statements_instances pse \ + JOIN performance_schema.threads t \ + ON (pse.OWNER_THREAD_ID=t.thread_id)\G" +} + + # ########################################################################### # End collect package # ###########################################################################