diff --git a/bin/pt-mysql-summary b/bin/pt-mysql-summary index a4783bed..a183e45b 100755 --- a/bin/pt-mysql-summary +++ b/bin/pt-mysql-summary @@ -1959,7 +1959,7 @@ report_mysql_summary () { section Table_cache local open_tables=$(get_var Open_tables "$dir/mysql-status") - local table_cache=$(get_table_cache "$dir/mysql-status") + local table_cache=$(get_table_cache "$dir/mysql-variables") name_val Size $table_cache name_val Usage "$(fuzzy_pct ${open_tables} ${table_cache})" @@ -2014,7 +2014,7 @@ report_mysql_summary () { local dbtodump="" read dbtodump local trg_arg="$( get_mysqldump_args "$dir/mysql-variables" )" - get_mysqldump_for "$dir/mysqldump" "${trg_arg}" "${dbtodump}" + get_mysqldump_for "${trg_arg}" "${dbtodump}" > "$dir/mysqldump" fi if [ -e "$dir/mysqldump" -a -s "$dir/mysqldump" ] \ diff --git a/lib/bash/report_mysql_info.sh b/lib/bash/report_mysql_info.sh index 9f803880..a0aadab1 100644 --- a/lib/bash/report_mysql_info.sh +++ b/lib/bash/report_mysql_info.sh @@ -1123,7 +1123,7 @@ report_mysql_summary () { # ######################################################################## section Table_cache local open_tables=$(get_var Open_tables "$dir/mysql-status") - local table_cache=$(get_table_cache "$dir/mysql-status") + local table_cache=$(get_table_cache "$dir/mysql-variables") name_val Size $table_cache name_val Usage "$(fuzzy_pct ${open_tables} ${table_cache})" @@ -1195,7 +1195,7 @@ report_mysql_summary () { local dbtodump="" read dbtodump local trg_arg="$( get_mysqldump_args "$dir/mysql-variables" )" - get_mysqldump_for "$dir/mysqldump" "${trg_arg}" "${dbtodump}" + get_mysqldump_for "${trg_arg}" "${dbtodump}" > "$dir/mysqldump" fi # Test the result by checking the file, not by the exit status, because we diff --git a/t/lib/bash/collect_system_info.sh b/t/lib/bash/collect_system_info.sh index 3be24fa1..2d0b2cbe 100644 --- a/t/lib/bash/collect_system_info.sh +++ b/t/lib/bash/collect_system_info.sh @@ -21,6 +21,8 @@ mkdir "$p" parse_options "$BIN_DIR/pt-summary" --sleep 1 +setup_commands + collect_system_data "$p" cat < "$TMPDIR/expected" diff --git a/t/lib/bash/report_formatting.sh b/t/lib/bash/report_formatting.sh index 391bc366..3a3c33da 100644 --- a/t/lib/bash/report_formatting.sh +++ b/t/lib/bash/report_formatting.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -plan 17 +plan 19 . "$LIB_DIR/report_formatting.sh" @@ -90,6 +90,20 @@ is \ is $(fuzz 11) "10" "fuzz 11" is $(fuzz 49) "50" "fuzz 49" +# fuzzy_pct + +is \ + "$( fuzzy_pct 28 64 )" \ + "45%" \ + "fuzzy_pct of 64 and 28 is 45" + + +is \ + "$( fuzzy_pct 40 400 )" \ + "10%" \ + "fuzzy_pct of 40 and 400 is 10" + + # ########################################################################### # Done # ########################################################################### diff --git a/t/lib/bash/summary_common.sh b/t/lib/bash/summary_common.sh index fb55378f..3c68bdc4 100644 --- a/t/lib/bash/summary_common.sh +++ b/t/lib/bash/summary_common.sh @@ -26,4 +26,3 @@ is \ "$(get_var "test::1" "$p")" \ "abcdef" \ "get_var works if the 'key' has colons" - diff --git a/t/pt-mysql-summary/samples/expected_output_temp002.txt b/t/pt-mysql-summary/samples/expected_output_temp002.txt index fbc406f0..b3b83ed0 100644 --- a/t/pt-mysql-summary/samples/expected_output_temp002.txt +++ b/t/pt-mysql-summary/samples/expected_output_temp002.txt @@ -111,8 +111,8 @@ Sort_scan 45 Table_locks_immediate 80 Uptime 90000 1 1 # Table cache ################################################ - Size | 0 - Usage | 0% + Size | 400 + Usage | 10% # Key Percona Server features ################################ Table & Index Stats | Not Supported Multiple I/O Threads | Enabled diff --git a/t/pt-mysql-summary/samples/expected_output_temp003.txt b/t/pt-mysql-summary/samples/expected_output_temp003.txt index 8a9b96de..f8090732 100644 --- a/t/pt-mysql-summary/samples/expected_output_temp003.txt +++ b/t/pt-mysql-summary/samples/expected_output_temp003.txt @@ -87,8 +87,8 @@ Table_locks_immediate 1500 Threads_created 1750 1 Uptime 90000 1 1 # Table cache ################################################ - Size | 0 - Usage | 0% + Size | 64 + Usage | 35% # Key Percona Server features ################################ Table & Index Stats | Not Supported Multiple I/O Threads | Not Supported diff --git a/t/pt-mysql-summary/samples/expected_output_temp004.txt b/t/pt-mysql-summary/samples/expected_output_temp004.txt index de7d580b..d895c167 100644 --- a/t/pt-mysql-summary/samples/expected_output_temp004.txt +++ b/t/pt-mysql-summary/samples/expected_output_temp004.txt @@ -86,8 +86,8 @@ Table_locks_immediate 3500 Threads_created 4000 1 Uptime 90000 1 1 # Table cache ################################################ - Size | 0 - Usage | 0% + Size | 64 + Usage | 60% # Key Percona Server features ################################ Table & Index Stats | Not Supported Multiple I/O Threads | Not Supported diff --git a/t/pt-mysql-summary/samples/expected_result_report_summary.txt b/t/pt-mysql-summary/samples/expected_result_report_summary.txt index 965ddc90..12168991 100644 --- a/t/pt-mysql-summary/samples/expected_result_report_summary.txt +++ b/t/pt-mysql-summary/samples/expected_result_report_summary.txt @@ -95,8 +95,8 @@ Table_locks_immediate 12500 3 Threads_created 500 Uptime 90000 1 1 # Table cache ################################################ - Size | 0 - Usage | 0% + Size | 64 + Usage | 35% # Key Percona Server features ################################ Table & Index Stats | Not Supported Multiple I/O Threads | Not Supported