diff --git a/mysqltuner.pl b/mysqltuner.pl index 95601b2..f7a328f 100755 --- a/mysqltuner.pl +++ b/mysqltuner.pl @@ -1,5 +1,5 @@ #!/usr/bin/env perl -# mysqltuner.pl - Version 1.7.0 +# mysqltuner.pl - Version 1.7.1 # High Performance MySQL Tuning Script # Copyright (C) 2006-2016 Major Hayden - major@mhtx.net # @@ -31,6 +31,7 @@ # Simon Greenaway Adam Stein Isart Montane # Baptiste M. Cole Turner Major Hayden # Joe Ashcraft Jean-Marie Renouard Christian Loos +# Julien Francoz # # Inspired by Matthew Montgomery's tuning-primer.sh script: # http://forge.mysql.com/projects/view.php?id=44 @@ -54,7 +55,7 @@ $Data::Dumper::Pair = " : "; #use Env; # Set up a few variables for use in the script -my $tunerversion = "1.7.0"; +my $tunerversion = "1.7.1"; my ( @adjvars, @generalrec ); # Set defaults @@ -5064,24 +5065,47 @@ having sum(if(c.column_key in ('PRI','UNI'), 1,0)) = 0" { badprint "gcs.limit should be equal to 5 * wsrep_slave_threads"; push @adjvars, "gcs.limit= wsrep_slave_threads * 5"; + } else { + goodprint "wsrep_slave_threads is equal to 3 or 4 times number of CPU(s)"; } - else { - goodprint "gcs.limit is equal to 5 * wsrep_slave_threads"; + + if (get_wsrep_option('wsrep_slave_threads') > 1) { + badprint "wsrep parallel slave can cause frequent inconsistency crash."; + push @adjvars, "Set wsrep_slave_threads to 1 in case of HA_ERR_FOUND_DUPP_KEY crash on slave"; + # check options for parallel slave + if (get_wsrep_option('wsrep_slave_FK_checks') eq "OFF") { + badprint "wsrep_slave_FK_checks is off with parallel slave"; + push @adjvars, "wsrep_slave_FK_checks should be ON when using parallel slave"; + } + # wsrep_slave_UK_checks seems useless in MySQL source code + if ($myvar{'innodb_autoinc_lock_mode'} != 2) { + badprint "innodb_autoinc_lock_mode is incorrect with parallel slave"; + push @adjvars, "innodb_autoinc_lock_mode should be 2 when using parallel slave"; + } } - if ( get_wsrep_option('gcs.fc_factor') == 0.8 ) { + + if (get_wsrep_option('gcs.fc_limit') != $myvar{'wsrep_slave_threads'} * 5 ) { + badprint "gcs.fc_limit should be equal to 5 * wsrep_slave_threads"; + push @adjvars, "gcs.fc_limit= wsrep_slave_threads * 5"; + } else { + goodprint "gcs.fc_limit is equal to 5 * wsrep_slave_threads"; + } + + if (get_wsrep_option('gcs.fc_factor') != 0.8 ) { badprint "gcs.fc_factor should be equal to 0.8"; push @adjvars, "gcs.fc_factor=0.8"; } else { - goodprint "gcs.limit is equal to 5 * wsrep_slave_threads"; + goodprint "gcs.fc_factor is equal to 0.8"; } - if ( get_wsrep_option('wsrep_flow_control_paused') > 0.02 ) { + if ( get_wsrep_option('wsrep_flow_control_paused') > 0.02 ) { badprint "Fraction of time node pause flow control > 0.02"; } else { goodprint "Flow control fraction seems to be OK (wsrep_flow_control_paused<=0.02)"; } + if ( scalar(@primaryKeysNbTables) > 0 ) { badprint "Following table(s) don't have primary key:"; foreach my $badtable (@primaryKeysNbTables) { @@ -6034,7 +6058,7 @@ __END__ =head1 NAME - MySQLTuner 1.7.0 - MySQL High Performance Tuning Script + MySQLTuner 1.7.1 - MySQL High Performance Tuning Script =head1 IMPORTANT USAGE GUIDELINES