From adb33d3c375875e1d50a37db675b9586fd15b9bf Mon Sep 17 00:00:00 2001 From: "Oscar A. Figueroa" Date: Tue, 7 Mar 2017 12:48:43 +0100 Subject: [PATCH 1/3] Resolved issue #304 --- mysqltuner.pl | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/mysqltuner.pl b/mysqltuner.pl index 0efbfa4..11d8e51 100755 --- a/mysqltuner.pl +++ b/mysqltuner.pl @@ -5041,28 +5041,28 @@ group by c.table_schema,c.table_name having sum(if(c.column_key in ('PRI','UNI'), 1,0)) = 0" ); - if (get_wsrep_option('wsrep_slave_threads') > `nproc`*4 or get_wsrep_option('wsrep_slave_threads') < `nproc`*3) { - badprint "wsrep_slave_threads is not equal to 3 or 4 times number of CPU(s)"; - push @adjvars, "wsrep_slave_threads= Nb of Core CPU * 4"; + if ($myvar{'wsrep_slave_threads'} > `nproc` * 4 or $myvar{'wsrep_slave_threads'} < `nproc` * 2) { + badprint "wsrep_slave_threads is not equal to 2 or 4 times number of CPU(s)"; + push @adjvars, "wsrep_slave_threads= Nb of Core CPU * 2"; } else { - goodprint "wsrep_slave_threads is equal to 3 or 4 times number of CPU(s)"; + goodprint "wsrep_slave_threads is equal to 2 or 4 times number of CPU(s)"; } - if (get_wsrep_option('gcs.limit') != get_wsrep_option('wsrep_slave_threads') *5 ) { - badprint "gcs.limit should be equal to 5 * wsrep_slave_threads"; - push @adjvars, "gcs.limit= wsrep_slave_threads * 5"; + 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.limit is equal to 5 * wsrep_slave_threads"; + 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_limit is equal to 5 * wsrep_slave_threads"; } - if (get_wsrep_option('wsrep_flow_control_paused') > 0.02) { + if ($mystat{'wsrep_flow_control_paused'} > 0.02) { badprint "Fraction of time node pause flow control > 0.02"; } else { From f61cbce4f8d50e336ee75780d7ab79de5aa5f38e Mon Sep 17 00:00:00 2001 From: jfcoz Date: Tue, 7 Mar 2017 17:53:36 +0100 Subject: [PATCH 2/3] add checks for wsrep_slave_FK_check and innodb_autoinc_lock_mode when wsrep_slave_threads > 1 --- mysqltuner.pl | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/mysqltuner.pl b/mysqltuner.pl index 0efbfa4..b493308 100755 --- a/mysqltuner.pl +++ b/mysqltuner.pl @@ -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 @@ -5044,9 +5045,24 @@ having sum(if(c.column_key in ('PRI','UNI'), 1,0)) = 0" if (get_wsrep_option('wsrep_slave_threads') > `nproc`*4 or get_wsrep_option('wsrep_slave_threads') < `nproc`*3) { badprint "wsrep_slave_threads is not equal to 3 or 4 times number of CPU(s)"; push @adjvars, "wsrep_slave_threads= Nb of Core CPU * 4"; - } else { + } else { goodprint "wsrep_slave_threads is equal to 3 or 4 times number of CPU(s)"; - } + } + + if ($myvar{'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 ($myvar{'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.limit') != get_wsrep_option('wsrep_slave_threads') *5 ) { badprint "gcs.limit should be equal to 5 * wsrep_slave_threads"; From 24b901363c788a8ba08102f588b91fee897a74a7 Mon Sep 17 00:00:00 2001 From: "Oscar A. Figueroa" Date: Wed, 8 Mar 2017 11:50:02 +0100 Subject: [PATCH 3/3] Bugfix resolve #308 : gcs.fc_factor parameter evaluation and the message report, which referencing wsrep_slave_threads instead. --- mysqltuner.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mysqltuner.pl b/mysqltuner.pl index 11d8e51..dd50384 100755 --- a/mysqltuner.pl +++ b/mysqltuner.pl @@ -5055,12 +5055,12 @@ having sum(if(c.column_key in ('PRI','UNI'), 1,0)) = 0" else { goodprint "gcs.fc_limit is equal to 5 * wsrep_slave_threads"; } - if (get_wsrep_option('gcs.fc_factor') == 0.8 ) { + 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.fc_limit is equal to 5 * wsrep_slave_threads"; + goodprint "gcs.fc_factor is equal to 0.8"; } if ($mystat{'wsrep_flow_control_paused'} > 0.02) { badprint "Fraction of time node pause flow control > 0.02";