From 591e5e00f35a8eb37e9259511c65f134cd9c4b5d Mon Sep 17 00:00:00 2001 From: Daniel Nichter Date: Thu, 12 Dec 2013 05:02:34 +0000 Subject: [PATCH] Add back blank lines around Schema section contents. Use default vals for OPT_DATABASE, OPT_ALL_DATABASES, and OPT_READ_SAMPLE in report_mysql_info.sh to avoid errors in unit tests. --- bin/pt-mysql-summary | 3 +++ lib/bash/report_mysql_info.sh | 8 +++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/bin/pt-mysql-summary b/bin/pt-mysql-summary index ef1b7e77..95875d1e 100755 --- a/bin/pt-mysql-summary +++ b/bin/pt-mysql-summary @@ -1568,6 +1568,7 @@ format_overall_db_stats () { [ -e "$file" ] || return + echo awk ' BEGIN { db = "{chosen}"; @@ -1838,6 +1839,7 @@ format_overall_db_stats () { local hdr=$(grep -n Database "$tmpfile" | cut -d: -f1); head -n${hdr} "$tmpfile" tail -n +$((${hdr} + 1)) "$tmpfile" | sort + echo } section_percona_server_features () { @@ -2719,6 +2721,7 @@ the percentage of the cache in use and the hit-to-insert ratio. The latter two are fuzzy-rounded. # Schema ##################################################### + Database Tables Views SPs Trigs Funcs FKs Partn mysql 24 performance_schema 17 diff --git a/lib/bash/report_mysql_info.sh b/lib/bash/report_mysql_info.sh index b2e91577..ac3722ae 100644 --- a/lib/bash/report_mysql_info.sh +++ b/lib/bash/report_mysql_info.sh @@ -575,6 +575,7 @@ format_overall_db_stats () { [ -e "$file" ] || return + echo # We keep counts of everything in an associative array keyed by db name, and # what it is. The num_dbs counter is to ensure sort order is consistent when # we run the awk commands following this one. @@ -860,6 +861,7 @@ format_overall_db_stats () { local hdr=$(grep -n Database "$tmpfile" | cut -d: -f1); head -n${hdr} "$tmpfile" tail -n +$((${hdr} + 1)) "$tmpfile" | sort + echo } section_percona_server_features () { @@ -1316,9 +1318,9 @@ report_mysql_summary () { # Schema, databases, data type, other analysis. # ######################################################################## section "Schema" - if [ "${OPT_DATABASES}" ] \ - || [ "${OPT_ALL_DATABASES}" ] \ - || [ "${OPT_READ_SAMPLES}" ]; then + if [ "${OPT_DATABASES:-""}" ] \ + || [ "${OPT_ALL_DATABASES:-""}" ] \ + || [ "${OPT_READ_SAMPLES:-""}" ]; then if [ -z "$OPT_READ_SAMPLES" ]; then # --databases or --all-databases was specified