From c0da3161ba4fe9b6a9bbbf747ffa4811ecca5531 Mon Sep 17 00:00:00 2001 From: Mario Splivalo Date: Fri, 6 Feb 2015 10:48:02 +0100 Subject: [PATCH] Implements configuring innodb_file_per_table (fixes: lp1418570) --- config.yaml | 9 +++++++++ hooks/percona_hooks.py | 3 ++- templates/my.cnf | 11 +++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/config.yaml b/config.yaml index d924e3a..fe725f9 100644 --- a/config.yaml +++ b/config.yaml @@ -60,3 +60,12 @@ options: order for this charm to function correctly, the privacy extension must be disabled and a non-temporary address must be configured/available on your network interface. + innodb-file-per-table: + type: boolean + default: True + description: | + Turns on innodb_file_per_table option, which will make MySQL put each + InnoDB table into separate .idb file. Existing InnoDB tables will remain + in ibdata1 file - full dump/import is needed to get rid of large + ibdata1 file + \ No newline at end of file diff --git a/hooks/percona_hooks.py b/hooks/percona_hooks.py index 5e4c6e9..20d588e 100755 --- a/hooks/percona_hooks.py +++ b/hooks/percona_hooks.py @@ -109,7 +109,8 @@ def render_config(clustered=False, hosts=[], mysql_password=None): 'clustered': clustered, 'cluster_hosts': ",".join(hosts), 'sst_method': 'xtrabackup', - 'sst_password': mysql_password + 'sst_password': mysql_password, + 'innodb_file_per_table': config('innodb-file-per-table') } if config('prefer-ipv6'): diff --git a/templates/my.cnf b/templates/my.cnf index c1690ad..30f1114 100644 --- a/templates/my.cnf +++ b/templates/my.cnf @@ -33,6 +33,17 @@ innodb_locks_unsafe_for_binlog=1 # This changes how InnoDB autoincrement locks are managed and is a requirement for Galera innodb_autoinc_lock_mode=2 +# This enables storing InnoDB tables in separate .ibd files. Note that, however +# existing InnoDB tables will remain in ibdata file(s) unles OPTIMIZE is run +# on them. Still, the ibdata1 file will NOT shrink - a full dump/import of the +# data is needed in order to get rid of large ibdata file. + +{% if innodb_file_per_table %} +innodb_file_per_table = 1 +{% else %} +innodb_file_per_table = 0 +{% endif %} + # Node #1 address wsrep_node_address={{ private_address }}