From 46bab4b71c2e57102551ecf65fdf437bcea669b6 Mon Sep 17 00:00:00 2001
From: Julien Muchembled <jm@nexedi.com>
Date: Wed, 4 Sep 2013 14:54:27 +0200
Subject: [PATCH] erp5.mariadb: leave unsafe performance settings as comments
 if disabled

It is useful to temporary enable such settings while preparing an instance.
---
 stack/erp5/buildout.cfg |  2 +-
 stack/erp5/my.cnf.in    | 15 ++++++++-------
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/stack/erp5/buildout.cfg b/stack/erp5/buildout.cfg
index 7998ff65c..e80993a46 100644
--- a/stack/erp5/buildout.cfg
+++ b/stack/erp5/buildout.cfg
@@ -201,7 +201,7 @@ md5sum = c4c42d06c63d33de703fc03415e34d84
 [template-my-cnf]
 < = download-base
 filename = my.cnf.in
-md5sum = dc7c5db29474f7c65a696586734a5c52
+md5sum = 774b0e5d167b75a0ad8ead45fa2eadf6
 
 [template-mariadb-initial-setup]
 < = download-base
diff --git a/stack/erp5/my.cnf.in b/stack/erp5/my.cnf.in
index 22b57c484..a40dc0be6 100644
--- a/stack/erp5/my.cnf.in
+++ b/stack/erp5/my.cnf.in
@@ -54,15 +54,16 @@ innodb_locks_unsafe_for_binlog = 1
 log_bin = {{ log_bin }}
 {% set binlog_expire_days = parameter_dict['binlog-expire-days'] -%}
 {% if binlog_expire_days > 0 %}expire_logs_days = {{ binlog_expire_days }}{% endif %}
-{% endif -%}
+{% endif %}
 
+# Some dangerous settings you may want to uncomment temporarily
+# if you only want performance or less disk access.
 {# Note: strictly check equality to one, as a last line of defense against users not reading the doc. -#}
-{% if parameter_dict['relaxed-writes'] -%}
-innodb_flush_log_at_trx_commit = 0
-innodb_flush_method = nosync
-innodb_doublewrite = 0
-sync_frm = 0
-{% endif -%}
+{% set x = '' if parameter_dict['relaxed-writes'] else '#' -%}
+{{x}}innodb_flush_log_at_trx_commit = 0
+{{x}}innodb_flush_method = nosync
+{{x}}innodb_doublewrite = 0
+{{x}}sync_frm = 0
 
 # Force utf8 usage
 collation_server = utf8_unicode_ci
-- 
2.30.9