Indenting mysqltuner at 2024-02-06T17:58:52+01:00

This commit is contained in:
Jean-Marie Renouard 2024-02-06 17:58:57 +01:00
parent 30d1d9ecc6
commit dd2ed72642

View file

@ -238,7 +238,8 @@ $opt{structstat} = 0
; # Don't print table struct information
$opt{myisamstat} = 1
if ( not defined( $opt{myisamstat} ) );
$opt{myisamstat} = 0 if ($opt{nomyisamstat} == 1 ); # Don't print MyISAM table information
$opt{myisamstat} = 0
if ( $opt{nomyisamstat} == 1 ); # Don't print MyISAM table information
# for RPM distributions
$opt{cvefile} = "/usr/share/mysqltuner/vulnerabilities.csv"
@ -814,7 +815,8 @@ sub mysql_setup {
if ( $opt{socket} ne 0 ) {
if ( $opt{port} ne 0 ) {
$remotestring = " -S $opt{socket} -P $opt{port}";
} else {
}
else {
$remotestring = " -S $opt{socket}";
}
}
@ -1579,7 +1581,9 @@ sub log_file_recommendations {
$numLi++;
debugprint "$numLi: $logLi"
if $logLi =~ /warning|error/i and $logLi !~ /Logging to/;
$nbErrLog++ if $logLi =~ /error/i and $logLi !~ /(Logging to|\[Warning\].*ERROR_FOR_DIVISION_BY_ZERO)/;
$nbErrLog++
if $logLi =~ /error/i
and $logLi !~ /(Logging to|\[Warning\].*ERROR_FOR_DIVISION_BY_ZERO)/;
$nbWarnLog++ if $logLi =~ /warning/i;
push @lastShutdowns, $logLi
if $logLi =~ /Shutdown complete/ and $logLi !~ /Innodb/i;
@ -3211,10 +3215,11 @@ sub calculations {
) 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;');
"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(
@ -6367,11 +6372,12 @@ sub mysql_innodb {
#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'} . '%';
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 )
@ -6533,7 +6539,8 @@ sub mysql_innodb {
. $mycalc{'pct_read_efficiency'} . "% ("
. $mystat{'Innodb_buffer_pool_read_requests'}
. " hits / "
. ( $mystat{'Innodb_buffer_pool_reads'} + $mystat{'Innodb_buffer_pool_read_requests'} )
. ( $mystat{'Innodb_buffer_pool_reads'} +
$mystat{'Innodb_buffer_pool_read_requests'} )
. " total)";
}
else {
@ -6541,7 +6548,8 @@ sub mysql_innodb {
. $mycalc{'pct_read_efficiency'} . "% ("
. $mystat{'Innodb_buffer_pool_read_requests'}
. " hits / "
. ( $mystat{'Innodb_buffer_pool_reads'} + $mystat{'Innodb_buffer_pool_read_requests'} )
. ( $mystat{'Innodb_buffer_pool_reads'} +
$mystat{'Innodb_buffer_pool_read_requests'} )
. " total)";
}
@ -6711,6 +6719,7 @@ sub mysql_databases {
print "\n" unless ( $opt{'silent'} or $opt{'json'} );
my $nbViews = 0;
my $nbTables = 0;
foreach (@dblist) {
my @dbinfo = split /\s/,
select_one(
@ -7099,7 +7108,8 @@ ENDSQL
my $nbTables = select_one(
"SELECT count(*) from information_schema.TABLES WHERE TABLE_TYPE ='BASE TABLE' AND TABLE_SCHEMA='$dbname'"
);
badprint "No index found for $dbname database" if $found == 0 and $nbTables>1;
badprint "No index found for $dbname database"
if $found == 0 and $nbTables > 1;
push @generalrec, "Add indexes on tables from $dbname database"
if $found == 0 and $nbTables > 1;
}