-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding experimental option avoiding runtime errors #762
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#!/usr/bin/perl | ||
# mysqltuner.pl - Version 2.5.2 | ||
#!env perl | ||
# mysqltuner.pl - Version 2.5.3 | ||
# High Performance MySQL Tuning Script | ||
# Copyright (C) 2015-2023 Jean-Marie Renouard - [email protected] | ||
# Copyright (C) 2006-2023 Major Hayden - [email protected] | ||
|
@@ -57,7 +57,7 @@ package main; | |
#use Env; | ||
|
||
# Set up a few variables for use in the script | ||
my $tunerversion = "2.5.2"; | ||
my $tunerversion = "2.5.3"; | ||
my ( @adjvars, @generalrec ); | ||
|
||
# Set defaults | ||
|
@@ -109,6 +109,7 @@ package main; | |
"prettyjson" => 0, | ||
"reportfile" => 0, | ||
"verbose" => 0, | ||
"experimental" => 0, | ||
"defaults-file" => '', | ||
"defaults-extra-file" => '', | ||
"protocol" => '', | ||
|
@@ -151,7 +152,7 @@ package main; | |
'server-log=s', 'protocol=s', | ||
'defaults-extra-file=s', 'dumpdir=s', | ||
'feature=s', 'dbgpattern=s', | ||
'defaultarch=i' | ||
'defaultarch=i', 'experimental' | ||
) | ||
or pod2usage( | ||
-exitval => 1, | ||
|
@@ -209,6 +210,11 @@ package main; | |
|
||
$opt{dbgpattern} = '.*' if ( $opt{dbgpattern} eq '' ); | ||
|
||
# Activate debug variables | ||
#if ( $opt{debug} ne '' ) { $opt{debug} = 2; } | ||
# Activate experimental calculations and analysis | ||
#if ( $opt{experimental} ne '' ) { $opt{experimental} = 1; } | ||
|
||
# check if we need to enable verbose mode | ||
if ( $opt{feature} ne '' ) { $opt{verbose} = 1; } | ||
if ( $opt{verbose} ) { | ||
|
@@ -2530,7 +2536,7 @@ sub check_architecture { | |
} | ||
elsif ( `uname` =~ /Darwin/ && `uname -m` =~ /x86_64/ ) { | ||
|
||
# Darwin gibas.local 12.5.2 Darwin Kernel Version 12.3.0: Sun Jan 6 22:37:10 PST 2013; root:xnu-2050.22.13~1/RELEASE_X86_64 x86_64 | ||
# Darwin gibas.local 12.5.3 Darwin Kernel Version 12.3.0: Sun Jan 6 22:37:10 PST 2013; root:xnu-2050.22.13~1/RELEASE_X86_64 x86_64 | ||
$arch = 64; | ||
goodprint "Operating on 64-bit architecture"; | ||
} | ||
|
@@ -3219,8 +3225,8 @@ sub calculations { | |
"select round( 100* sum(allocated)/( select VARIABLE_VALUE " | ||
. "FROM performance_schema.global_variables " | ||
. "WHERE VARIABLE_NAME='innodb_buffer_pool_size' ) ,2)" | ||
. 'FROM sys.x\$innodb_buffer_stats_by_table;' ); | ||
|
||
. 'FROM sys.x\$innodb_buffer_stats_by_table;' ) | ||
if ($opt{experimental}); | ||
# Binlog Cache | ||
if ( $myvar{'log_bin'} ne 'OFF' ) { | ||
$mycalc{'pct_binlog_cache'} = percentage( | ||
|
@@ -6372,14 +6378,16 @@ sub mysql_innodb { | |
# ,2) as "PCT ALLOC/BUFFER POOL" | ||
#from sys.x$innodb_buffer_stats_by_table; | ||
|
||
if (defined $mycalc{innodb_buffer_alloc_pct}) { | ||
if ( $mycalc{innodb_buffer_alloc_pct} < 80 ) { | ||
badprint "Ratio Buffer Pool allocated / Buffer Pool Size: " | ||
. $mycalc{'innodb_buffer_alloc_pct'} . '%'; | ||
} | ||
else { | ||
goodprint "Ratio Buffer Pool allocated / Buffer Pool Size: " | ||
. $mycalc{'innodb_buffer_alloc_pct'} . '%'; | ||
if ( $opt{experimental} ) { | ||
if (defined $mycalc{innodb_buffer_alloc_pct}) { | ||
if ( $mycalc{innodb_buffer_alloc_pct} < 80 ) { | ||
badprint "Ratio Buffer Pool allocated / Buffer Pool Size: " | ||
. $mycalc{'innodb_buffer_alloc_pct'} . '%'; | ||
} | ||
else { | ||
goodprint "Ratio Buffer Pool allocated / Buffer Pool Size: " | ||
. $mycalc{'innodb_buffer_alloc_pct'} . '%'; | ||
} | ||
} | ||
} | ||
if ( $mycalc{'innodb_log_size_pct'} < 20 | ||
|
@@ -6408,7 +6416,7 @@ sub mysql_innodb { | |
. $myvar{'innodb_log_files_in_group'} . " / " | ||
. hr_bytes( $myvar{'innodb_buffer_pool_size'} ) | ||
. " should be equal to 25%"; | ||
push( | ||
push( | ||
@adjvars, | ||
"innodb_log_file_size should be (=" | ||
. hr_bytes_rnd( | ||
|
@@ -7201,6 +7209,8 @@ sub headerprint { | |
. "\t * Major Hayden <major\@mhtx.net>\n" | ||
. " >> Bug reports, feature requests, and downloads at http://mysqltuner.pl/\n" | ||
. " >> Run with '--help' for additional options and output filtering"; | ||
debugprint("Debug: ".$opt{debug}); | ||
debugprint("Experimental: ".$opt{experimental}); | ||
} | ||
|
||
sub string2file { | ||
|
@@ -7211,12 +7221,12 @@ sub string2file { | |
"Unable to open $filename in write mode. Please check permissions for this file or directory"; | ||
print $fh $content if defined($content); | ||
close $fh; | ||
debugprint $content if ( $opt{'debug'} ); | ||
debugprint $content; | ||
} | ||
|
||
sub file2array { | ||
my $filename = shift; | ||
debugprint "* reading $filename" if ( $opt{'debug'} ); | ||
debugprint "* reading $filename"; | ||
my $fh; | ||
open( $fh, q(<), "$filename" ) | ||
or die "Couldn't open $filename for reading: $!\n"; | ||
|
@@ -7402,7 +7412,7 @@ sub which { | |
|
||
=head1 NAME | ||
|
||
MySQLTuner 2.5.2 - MySQL High Performance Tuning Script | ||
MySQLTuner 2.5.3 - MySQL High Performance Tuning Script | ||
|
||
=head1 IMPORTANT USAGE GUIDELINES | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removing the full path breaks the shebang when using bash
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we make such change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.