Skip to content

Commit

Permalink
changed if condition more readable
Browse files Browse the repository at this point in the history
  • Loading branch information
MASTERGOKUL committed Jul 11, 2024
1 parent 3d800e4 commit fbf144c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
6 changes: 1 addition & 5 deletions bin/pt-mysql-summary
Original file line number Diff line number Diff line change
Expand Up @@ -2098,14 +2098,10 @@ section_innodb () {

local mysql_version=$(get_var version "$variables_file" | awk -F'-' '{print $1}')
local transaction_isolation_var="tx_isolation"
version_greater_equal() { # Function to compare versions
[ "$(printf '%s\n' "$1" "$2" | sort -V | head -n1)" = "$2" ]
}
if version_greater_equal "$mysql_version" "5.7.20"; then # true if version >= 5.7.20
if [ "$mysql_version" '>' "5.7.19" ]; then # true if version >= 5.7.20
transaction_isolation_var="transaction_isolation"
fi


name_val "Buffer Pool Fill" "$(fuzzy_pct ${bp_fill} ${bp_pags})"
name_val "Buffer Pool Dirty" "$(fuzzy_pct ${bp_dirt} ${bp_pags})"

Expand Down
6 changes: 1 addition & 5 deletions lib/bash/report_mysql_info.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1018,14 +1018,10 @@ section_innodb () {
# dynamically allocate variable name - transaction_isolation
local mysql_version=$(get_var version "$variables_file" | awk -F'-' '{print $1}')
local transaction_isolation_var="tx_isolation"
version_greater_equal() { # Function to compare versions
[ "$(printf '%s\n' "$1" "$2" | sort -V | head -n1)" = "$2" ]
}
if version_greater_equal "$mysql_version" "5.7.20"; then # true if version >= 5.7.20
if [ "$mysql_version" '>' "5.7.19" ]; then # true if version >= 5.7.20
transaction_isolation_var="transaction_isolation"
fi


name_val "Buffer Pool Fill" "$(fuzzy_pct ${bp_fill} ${bp_pags})"
name_val "Buffer Pool Dirty" "$(fuzzy_pct ${bp_dirt} ${bp_pags})"

Expand Down

0 comments on commit fbf144c

Please sign in to comment.