Skip to content

Commit

Permalink
Generate 2.5.2 sub version at 2024-02-06T17:58:35+01:00
Browse files Browse the repository at this point in the history
  • Loading branch information
jmrenouard committed Feb 6, 2024
1 parent b3a7765 commit 30d1d9e
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 44 deletions.
2 changes: 1 addition & 1 deletion USAGE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# NAME

MySQLTuner 2.5.1 - MySQL High Performance Tuning Script
MySQLTuner 2.5.2 - MySQL High Performance Tuning Script

# IMPORTANT USAGE GUIDELINES

Expand Down
104 changes: 61 additions & 43 deletions mysqltuner.pl
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env perl
# mysqltuner.pl - Version 2.5.1
# mysqltuner.pl - Version 2.5.2
# High Performance MySQL Tuning Script
# Copyright (C) 2015-2023 Jean-Marie Renouard - [email protected]
# Copyright (C) 2006-2023 Major Hayden - [email protected]
Expand Down Expand Up @@ -57,7 +56,7 @@ package main;
#use Env;

# Set up a few variables for use in the script
my $tunerversion = "2.5.1";
my $tunerversion = "2.5.2";
my ( @adjvars, @generalrec );

# Set defaults
Expand Down Expand Up @@ -197,7 +196,7 @@ package main;
$opt{pass} = $opt{password} if ( $opt{pass} eq 0 and $opt{password} ne 0 );

if ( $opt{dumpdir} ne '' ) {
$opt{dumpdir} = abs_path( $opt{dumpdir} );
$opt{dumpdir}= abs_path($opt{dumpdir});
if ( !-d $opt{dumpdir} ) {
mkdir $opt{dumpdir} or die "Cannot create directory $opt{dumpdir}: $!";
}
Expand Down Expand Up @@ -2526,7 +2525,7 @@ sub check_architecture {
}
elsif ( `uname` =~ /Darwin/ && `uname -m` =~ /x86_64/ ) {

# Darwin gibas.local 12.5.1 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.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
$arch = 64;
goodprint "Operating on 64-bit architecture";
}
Expand Down Expand Up @@ -3211,6 +3210,11 @@ sub calculations {
$mystat{'Innodb_buffer_pool_pages_total'}
) if defined $mystat{'Innodb_buffer_pool_pages_total'};

$mycalc{'innodb_buffer_alloc_pct'}=select_one(
"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;');
# Binlog Cache
if ( $myvar{'log_bin'} ne 'OFF' ) {
$mycalc{'pct_binlog_cache'} = percentage(
Expand Down Expand Up @@ -6355,46 +6359,60 @@ sub mysql_innodb {
. hr_bytes( $enginestats{'InnoDB'} )
. ") if possible." );
}

# select round( 100* sum(allocated)/( select VARIABLE_VALUE
# FROM performance_schema.global_variables
# where VARIABLE_NAME='innodb_buffer_pool_size' )
# ,2) as "PCT ALLOC/BUFFER POOL"
#from sys.x$innodb_buffer_stats_by_table;

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
or $mycalc{'innodb_log_size_pct'} > 30 )
{
if ( defined $myvar{'innodb_redo_log_capacity'} ) {
badprint
"Ratio InnoDB redo log capacity / InnoDB Buffer pool size ("
. $mycalc{'innodb_log_size_pct'} . "%): "
. hr_bytes( $myvar{'innodb_redo_log_capacity'} ) . " / "
. hr_bytes( $myvar{'innodb_buffer_pool_size'} )
. " should be equal to 25%";
push( @adjvars,
"innodb_redo_log_capacity should be (="
. hr_bytes_rnd( $myvar{'innodb_buffer_pool_size'} / 4 )
. ") if possible, so InnoDB Redo log Capacity equals 25% of buffer pool size."
);
push( @generalrec,
"Be careful, increasing innodb_redo_log_capacity means higher crash recovery mean time"
);
}
else {
badprint "Ratio InnoDB log file size / InnoDB Buffer pool size ("
. $mycalc{'innodb_log_size_pct'} . "%): "
. hr_bytes( $myvar{'innodb_log_file_size'} ) . " * "
. $myvar{'innodb_log_files_in_group'} . " / "
. hr_bytes( $myvar{'innodb_buffer_pool_size'} )
. " should be equal to 25%";
push(
@adjvars,
"innodb_log_file_size should be (="
. hr_bytes_rnd(
$myvar{'innodb_buffer_pool_size'} /
$myvar{'innodb_log_files_in_group'} / 4
)
. ") if possible, so InnoDB total log file size equals 25% of buffer pool size."
);
push( @generalrec,
"Be careful, increasing innodb_log_file_size / innodb_log_files_in_group means higher crash recovery mean time"
);
}
if ( mysql_version_le( 5, 6, 2 ) ) {
if ( defined $myvar{'innodb_redo_log_capacity'} ) {
badprint
"Ratio InnoDB redo log capacity / InnoDB Buffer pool size ("
. $mycalc{'innodb_log_size_pct'} . "%): "
. hr_bytes( $myvar{'innodb_redo_log_capacity'} ) . " / "
. hr_bytes( $myvar{'innodb_buffer_pool_size'} )
. " should be equal to 25%";
push( @adjvars,
"innodb_redo_log_capacity should be (="
. hr_bytes_rnd( $myvar{'innodb_buffer_pool_size'} / 4 )
. ") if possible, so InnoDB Redo log Capacity equals 25% of buffer pool size."
);
push( @generalrec,
"Be careful, increasing innodb_redo_log_capacity means higher crash recovery mean time"
);
}
else {
badprint "Ratio InnoDB log file size / InnoDB Buffer pool size ("
. $mycalc{'innodb_log_size_pct'} . "%): "
. hr_bytes( $myvar{'innodb_log_file_size'} ) . " * "
. $myvar{'innodb_log_files_in_group'} . " / "
. hr_bytes( $myvar{'innodb_buffer_pool_size'} )
. " should be equal to 25%";
push(
@adjvars,
"innodb_log_file_size should be (="
. hr_bytes_rnd(
$myvar{'innodb_buffer_pool_size'} /
$myvar{'innodb_log_files_in_group'} / 4
)
. ") if possible, so InnoDB total log file size equals 25% of buffer pool size."
);
push( @generalrec,
"Be careful, increasing innodb_log_file_size / innodb_log_files_in_group means higher crash recovery mean time"
);
}
if ( mysql_version_le( 5, 6, 2 ) ) {
push( @generalrec,
"For MySQL 5.6.2 and lower, total innodb_log_file_size should have a ceiling of (4096MB / log files in group) - 1MB."
);
Expand Down Expand Up @@ -7371,7 +7389,7 @@ sub which {
=head1 NAME
MySQLTuner 2.5.1 - MySQL High Performance Tuning Script
MySQLTuner 2.5.2 - MySQL High Performance Tuning Script
=head1 IMPORTANT USAGE GUIDELINES
Expand Down

0 comments on commit 30d1d9e

Please sign in to comment.