Fixed the Table Cache bugs.

Also makes t/lib/bash/collect_system_info.sh actually call setup_commands.
This commit is contained in:
Brian Fraser fraserb@gmail.com
2012-03-28 15:29:57 -03:00
parent 4bb5968c23
commit 3ee8f9ba71
9 changed files with 29 additions and 14 deletions

View File

@@ -1959,7 +1959,7 @@ report_mysql_summary () {
section Table_cache section Table_cache
local open_tables=$(get_var Open_tables "$dir/mysql-status") 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 Size $table_cache
name_val Usage "$(fuzzy_pct ${open_tables} ${table_cache})" name_val Usage "$(fuzzy_pct ${open_tables} ${table_cache})"
@@ -2014,7 +2014,7 @@ report_mysql_summary () {
local dbtodump="" local dbtodump=""
read dbtodump read dbtodump
local trg_arg="$( get_mysqldump_args "$dir/mysql-variables" )" 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 fi
if [ -e "$dir/mysqldump" -a -s "$dir/mysqldump" ] \ if [ -e "$dir/mysqldump" -a -s "$dir/mysqldump" ] \

View File

@@ -1123,7 +1123,7 @@ report_mysql_summary () {
# ######################################################################## # ########################################################################
section Table_cache section Table_cache
local open_tables=$(get_var Open_tables "$dir/mysql-status") 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 Size $table_cache
name_val Usage "$(fuzzy_pct ${open_tables} ${table_cache})" name_val Usage "$(fuzzy_pct ${open_tables} ${table_cache})"
@@ -1195,7 +1195,7 @@ report_mysql_summary () {
local dbtodump="" local dbtodump=""
read dbtodump read dbtodump
local trg_arg="$( get_mysqldump_args "$dir/mysql-variables" )" 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 fi
# Test the result by checking the file, not by the exit status, because we # Test the result by checking the file, not by the exit status, because we

View File

@@ -21,6 +21,8 @@ mkdir "$p"
parse_options "$BIN_DIR/pt-summary" --sleep 1 parse_options "$BIN_DIR/pt-summary" --sleep 1
setup_commands
collect_system_data "$p" collect_system_data "$p"
cat <<EOF > "$TMPDIR/expected" cat <<EOF > "$TMPDIR/expected"

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
plan 17 plan 19
. "$LIB_DIR/report_formatting.sh" . "$LIB_DIR/report_formatting.sh"
@@ -90,6 +90,20 @@ is \
is $(fuzz 11) "10" "fuzz 11" is $(fuzz 11) "10" "fuzz 11"
is $(fuzz 49) "50" "fuzz 49" 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 # Done
# ########################################################################### # ###########################################################################

View File

@@ -26,4 +26,3 @@ is \
"$(get_var "test::1" "$p")" \ "$(get_var "test::1" "$p")" \
"abcdef" \ "abcdef" \
"get_var works if the 'key' has colons" "get_var works if the 'key' has colons"

View File

@@ -111,8 +111,8 @@ Sort_scan 45
Table_locks_immediate 80 Table_locks_immediate 80
Uptime 90000 1 1 Uptime 90000 1 1
# Table cache ################################################ # Table cache ################################################
Size | 0 Size | 400
Usage | 0% Usage | 10%
# Key Percona Server features ################################ # Key Percona Server features ################################
Table & Index Stats | Not Supported Table & Index Stats | Not Supported
Multiple I/O Threads | Enabled Multiple I/O Threads | Enabled

View File

@@ -87,8 +87,8 @@ Table_locks_immediate 1500
Threads_created 1750 1 Threads_created 1750 1
Uptime 90000 1 1 Uptime 90000 1 1
# Table cache ################################################ # Table cache ################################################
Size | 0 Size | 64
Usage | 0% Usage | 35%
# Key Percona Server features ################################ # Key Percona Server features ################################
Table & Index Stats | Not Supported Table & Index Stats | Not Supported
Multiple I/O Threads | Not Supported Multiple I/O Threads | Not Supported

View File

@@ -86,8 +86,8 @@ Table_locks_immediate 3500
Threads_created 4000 1 Threads_created 4000 1
Uptime 90000 1 1 Uptime 90000 1 1
# Table cache ################################################ # Table cache ################################################
Size | 0 Size | 64
Usage | 0% Usage | 60%
# Key Percona Server features ################################ # Key Percona Server features ################################
Table & Index Stats | Not Supported Table & Index Stats | Not Supported
Multiple I/O Threads | Not Supported Multiple I/O Threads | Not Supported

View File

@@ -95,8 +95,8 @@ Table_locks_immediate 12500 3
Threads_created 500 Threads_created 500
Uptime 90000 1 1 Uptime 90000 1 1
# Table cache ################################################ # Table cache ################################################
Size | 0 Size | 64
Usage | 0% Usage | 35%
# Key Percona Server features ################################ # Key Percona Server features ################################
Table & Index Stats | Not Supported Table & Index Stats | Not Supported
Multiple I/O Threads | Not Supported Multiple I/O Threads | Not Supported