aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2017-07-03 10:35:30 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2017-07-06 12:42:38 -0400
commit8b2d4047774ead6223adf2b98e30b9e6ca9ca3d2 (patch)
tree4e8d37307cabf91edeb8151fa14251efd5a9ca6c
parentad6c4e9c9118bd81a73c49e923670a2787842e9b (diff)
Add option for innodb_flush_log_at_trx_commit = 2 for Galera only
The innodb_flush_log_at_trx_commit flag changes the timing of when the log buffer is written to disk for writes. At its default of 1, transactions are written to disk and the buffer flushed on a per-transaction basis; but when set to 2, the flush of the buffer proceeds only once per second. This removes the durability guarantee for the single node. However the central concept of Galera is that durability is achieved via the cluster as a whole, in that transactions are replicated to other nodes before the commit succeeds (though not necessarily written to disk unless wsrep_causal_reads is set). In this model, data would only be lost of all nodes of the Galera cluster were killed within one second of each other. Percona's blog post at https://www.percona.com/blog/2014/11/17/typical-misconceptions-on-galera-for-mysql/ recommends that the value of 2 should be considered "safe" for a Galera cluster unless you are in fact worried that all three nodes will be powered off simultaneously. The value here is added as an option only, defaulting to the usual default of "1", flush per transaction. Change-Id: Id5a30f1daf978e094a74db2d284febbc9ae64bb3
-rw-r--r--manifests/profile/pacemaker/database/mysql.pp79
-rw-r--r--releasenotes/notes/innodb_flush_log_at_trx_commit-eb7d99749ca3c911.yaml17
2 files changed, 61 insertions, 35 deletions
diff --git a/manifests/profile/pacemaker/database/mysql.pp b/manifests/profile/pacemaker/database/mysql.pp
index 22adbe9..b9f2a65 100644
--- a/manifests/profile/pacemaker/database/mysql.pp
+++ b/manifests/profile/pacemaker/database/mysql.pp
@@ -52,6 +52,13 @@
# connections from other nodes in the cluster.
# Defaults to hiera('mysql_bind_host')
#
+# [*innodb_flush_log_at_trx_commit*]
+# (Optional) Disk flush behavior for MySQL under Galera. A value of
+# '1' indicates flush to disk per transaction. A value of '2' indicates
+# flush to disk every second, flushing all unflushed transactions in
+# one step.
+# Defaults to hiera('innodb_flush_log_at_trx_commit', '1')
+#
# [*step*]
# (Optional) The current step in deployment. See tripleo-heat-templates
# for more details.
@@ -62,14 +69,15 @@
# Defaults to hiera('pcs_tries', 20)
#
class tripleo::profile::pacemaker::database::mysql (
- $bootstrap_node = hiera('mysql_short_bootstrap_node_name'),
- $bind_address = $::hostname,
- $ca_file = undef,
- $certificate_specs = hiera('tripleo::profile::base::database::mysql::certificate_specs', {}),
- $enable_internal_tls = hiera('enable_internal_tls', false),
- $gmcast_listen_addr = hiera('mysql_bind_host'),
- $step = Integer(hiera('step')),
- $pcs_tries = hiera('pcs_tries', 20),
+ $bootstrap_node = hiera('mysql_short_bootstrap_node_name'),
+ $bind_address = $::hostname,
+ $ca_file = undef,
+ $certificate_specs = hiera('tripleo::profile::base::database::mysql::certificate_specs', {}),
+ $enable_internal_tls = hiera('enable_internal_tls', false),
+ $gmcast_listen_addr = hiera('mysql_bind_host'),
+ $innodb_flush_log_at_trx_commit = hiera('innodb_flush_log_at_trx_commit', '1'),
+ $step = Integer(hiera('step')),
+ $pcs_tries = hiera('pcs_tries', 20),
) {
if $::hostname == downcase($bootstrap_node) {
$pacemaker_master = true
@@ -109,33 +117,34 @@ class tripleo::profile::pacemaker::database::mysql (
$mysqld_options = {
'mysqld' => {
- 'skip-name-resolve' => '1',
- 'binlog_format' => 'ROW',
- 'default-storage-engine' => 'innodb',
- 'innodb_autoinc_lock_mode' => '2',
- 'innodb_locks_unsafe_for_binlog'=> '1',
- 'innodb_file_per_table' => 'ON',
- 'query_cache_size' => '0',
- 'query_cache_type' => '0',
- 'bind-address' => $bind_address,
- 'max_connections' => hiera('mysql_max_connections'),
- 'open_files_limit' => '-1',
- 'wsrep_on' => 'ON',
- 'wsrep_provider' => '/usr/lib64/galera/libgalera_smm.so',
- 'wsrep_cluster_name' => 'galera_cluster',
- 'wsrep_cluster_address' => "gcomm://${galera_nodes}",
- 'wsrep_slave_threads' => '1',
- 'wsrep_certify_nonPK' => '1',
- 'wsrep_max_ws_rows' => '131072',
- 'wsrep_max_ws_size' => '1073741824',
- 'wsrep_debug' => '0',
- 'wsrep_convert_LOCK_to_trx' => '0',
- 'wsrep_retry_autocommit' => '1',
- 'wsrep_auto_increment_control' => '1',
- 'wsrep_drupal_282555_workaround'=> '0',
- 'wsrep_causal_reads' => '0',
- 'wsrep_sst_method' => 'rsync',
- 'wsrep_provider_options' => "gmcast.listen_addr=tcp://${gmcast_listen_addr}:4567;${tls_options}",
+ 'skip-name-resolve' => '1',
+ 'binlog_format' => 'ROW',
+ 'default-storage-engine' => 'innodb',
+ 'innodb_autoinc_lock_mode' => '2',
+ 'innodb_locks_unsafe_for_binlog' => '1',
+ 'innodb_file_per_table' => 'ON',
+ 'innodb_flush_log_at_trx_commit' => $innodb_flush_log_at_trx_commit,
+ 'query_cache_size' => '0',
+ 'query_cache_type' => '0',
+ 'bind-address' => $bind_address,
+ 'max_connections' => hiera('mysql_max_connections'),
+ 'open_files_limit' => '-1',
+ 'wsrep_on' => 'ON',
+ 'wsrep_provider' => '/usr/lib64/galera/libgalera_smm.so',
+ 'wsrep_cluster_name' => 'galera_cluster',
+ 'wsrep_cluster_address' => "gcomm://${galera_nodes}",
+ 'wsrep_slave_threads' => '1',
+ 'wsrep_certify_nonPK' => '1',
+ 'wsrep_max_ws_rows' => '131072',
+ 'wsrep_max_ws_size' => '1073741824',
+ 'wsrep_debug' => '0',
+ 'wsrep_convert_LOCK_to_trx' => '0',
+ 'wsrep_retry_autocommit' => '1',
+ 'wsrep_auto_increment_control' => '1',
+ 'wsrep_drupal_282555_workaround' => '0',
+ 'wsrep_causal_reads' => '0',
+ 'wsrep_sst_method' => 'rsync',
+ 'wsrep_provider_options' => "gmcast.listen_addr=tcp://${gmcast_listen_addr}:4567;${tls_options}",
}
}
diff --git a/releasenotes/notes/innodb_flush_log_at_trx_commit-eb7d99749ca3c911.yaml b/releasenotes/notes/innodb_flush_log_at_trx_commit-eb7d99749ca3c911.yaml
new file mode 100644
index 0000000..7dbd5a7
--- /dev/null
+++ b/releasenotes/notes/innodb_flush_log_at_trx_commit-eb7d99749ca3c911.yaml
@@ -0,0 +1,17 @@
+---
+features:
+ - |
+ Enable innodb_flush_log_at_trx_commit configuration for Galera only.
+upgrade:
+ - |
+ Setting the innodb_flush_log_at_trx_commit flag to the value of "2" instead
+ of its default value of "1" means that the underlying MySQL/MariaDB engine
+ will no longer flush transactions to disk on a per-transaction basis;
+ instead, flushes occur once per second. This leads to far fewer
+ disk writes and can dramatically improve write performance, at the cost
+ of durability (e.g. will lose the last second's worth of transactions)
+ if the database engine is ungracefully shut down. The
+ clustered nature of Galera mitigates this risk in that transactions
+ are replicated to other nodes before completion, and the setting of
+ "2" is considered to be generally safe for a Galera cluster, with the
+ exception case of simultaneous power loss for all nodes.