Indenting mysqltuner at 2024-07-15T22:41:49+02:00

This commit is contained in:
Jean-Marie Renouard 2024-07-15 22:41:54 +02:00
parent def7f81455
commit 13d2783348

View file

@ -595,7 +595,8 @@ sub os_setup {
chomp($physical_memory); chomp($physical_memory);
chomp($swap_memory); chomp($swap_memory);
chomp($os); chomp($os);
$physical_memory=$opt{forcemem} if (defined($opt{forcemem}) and $opt{forcemem} gt 0); $physical_memory = $opt{forcemem}
if ( defined( $opt{forcemem} ) and $opt{forcemem} gt 0 );
$result{'OS'}{'OS Type'} = $os; $result{'OS'}{'OS Type'} = $os;
$result{'OS'}{'Physical Memory'}{'bytes'} = $physical_memory; $result{'OS'}{'Physical Memory'}{'bytes'} = $physical_memory;
$result{'OS'}{'Physical Memory'}{'pretty'} = hr_bytes($physical_memory); $result{'OS'}{'Physical Memory'}{'pretty'} = hr_bytes($physical_memory);
@ -2062,7 +2063,8 @@ sub system_recommendations {
. percentage( $omem, $physical_memory ) . "% (" . percentage( $omem, $physical_memory ) . "% ("
. hr_bytes_rnd($omem) . " / " . hr_bytes_rnd($omem) . " / "
. hr_bytes_rnd($physical_memory) . ")"; . hr_bytes_rnd($physical_memory) . ")";
} else { }
else {
badprint badprint
"Other user process except mysqld used more than 15% of total physical memory " "Other user process except mysqld used more than 15% of total physical memory "
@ -3234,12 +3236,14 @@ sub calculations {
$mystat{'Innodb_buffer_pool_pages_total'} $mystat{'Innodb_buffer_pool_pages_total'}
) if defined $mystat{'Innodb_buffer_pool_pages_total'}; ) if defined $mystat{'Innodb_buffer_pool_pages_total'};
my $lreq= "select ROUND( 100* sum(allocated)/ ". my $lreq =
$myvar{'innodb_buffer_pool_size'} . "select ROUND( 100* sum(allocated)/ "
',1) FROM sys.x\$innodb_buffer_stats_by_table;'; . $myvar{'innodb_buffer_pool_size'}
. ',1) FROM sys.x\$innodb_buffer_stats_by_table;';
debugprint("lreq: $lreq"); debugprint("lreq: $lreq");
$mycalc{'innodb_buffer_alloc_pct'} = select_one($lreq) $mycalc{'innodb_buffer_alloc_pct'} = select_one($lreq)
if ( $opt{experimental} ); if ( $opt{experimental} );
# Binlog Cache # Binlog Cache
if ( $myvar{'log_bin'} ne 'OFF' ) { if ( $myvar{'log_bin'} ne 'OFF' ) {
$mycalc{'pct_binlog_cache'} = percentage( $mycalc{'pct_binlog_cache'} = percentage(
@ -3379,20 +3383,23 @@ sub mysql_stats {
. " ($mycalc{'pct_max_physical_memory'}% of installed RAM)"; . " ($mycalc{'pct_max_physical_memory'}% of installed RAM)";
} }
if ( $physical_memory < if ( $physical_memory <
( $mycalc{'max_peak_memory'} + get_other_process_memory() ) ) ( $mycalc{'max_peak_memory'} + get_other_process_memory() ) )
{ {
if ( $opt{nondedicated} ) { if ( $opt{nondedicated} ) {
infoprint "No warning with --nondedicated option"; infoprint "No warning with --nondedicated option";
infoprint "Overall possible memory usage with other process exceeded memory"; infoprint
} else { "Overall possible memory usage with other process exceeded memory";
}
else {
badprint badprint
"Overall possible memory usage with other process exceeded memory"; "Overall possible memory usage with other process exceeded memory";
push( @generalrec, push( @generalrec,
"Dedicate this server to your database for highest performance." ); "Dedicate this server to your database for highest performance."
);
} }
} else { }
else {
goodprint goodprint
"Overall possible memory usage with other process is compatible with memory available"; "Overall possible memory usage with other process is compatible with memory available";
} }
@ -6391,15 +6398,18 @@ sub mysql_innodb {
} }
# select round( 100* sum(allocated)/( select VARIABLE_VALUE # select round( 100* sum(allocated)/( select VARIABLE_VALUE
# FROM performance_schema.global_variables # FROM information_schema.global_variables
# where VARIABLE_NAME='innodb_buffer_pool_size' ) # where VARIABLE_NAME='innodb_buffer_pool_size' )
# ,2) as "PCT ALLOC/BUFFER POOL" # ,2) as "PCT ALLOC/BUFFER POOL"
#from sys.x$innodb_buffer_stats_by_table; #from sys.x$innodb_buffer_stats_by_table;
if ( $opt{experimental} ) { if ( $opt{experimental} ) {
debugprint ('innodb_buffer_alloc_pct: "'.$mycalc{innodb_buffer_alloc_pct}.'"'); debugprint( 'innodb_buffer_alloc_pct: "'
if (defined $mycalc{innodb_buffer_alloc_pct} and . $mycalc{innodb_buffer_alloc_pct}
$mycalc{innodb_buffer_alloc_pct} ne '' ) { . '"' );
if ( defined $mycalc{innodb_buffer_alloc_pct}
and $mycalc{innodb_buffer_alloc_pct} ne '' )
{
if ( $mycalc{innodb_buffer_alloc_pct} < 80 ) { if ( $mycalc{innodb_buffer_alloc_pct} < 80 ) {
badprint "Ratio Buffer Pool allocated / Buffer Pool Size: " badprint "Ratio Buffer Pool allocated / Buffer Pool Size: "
. $mycalc{'innodb_buffer_alloc_pct'} . '%'; . $mycalc{'innodb_buffer_alloc_pct'} . '%';