Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing 'innodb_log_file_size' needs manual intervention #70

Closed
eliasp opened this issue Apr 24, 2015 · 2 comments
Closed

Changing 'innodb_log_file_size' needs manual intervention #70

eliasp opened this issue Apr 24, 2015 · 2 comments

Comments

@eliasp
Copy link

eliasp commented Apr 24, 2015

When changing innodb_log_file_size, mysqld won't start anymore without moving /var/lib/mysql/ib_logfile* out of the way.

See also this article for details.

I think it could be basically implemented like this:

{% for section, data in mysql.config.sections.iteritems() %}
  {% if 'innodb_log_file_size' in data %}
    {% set innodb_log_file_workaround = true %}
  {% endif %}
{% endfor %}
{% if innodb_log_file_workaround is defined and innodb_log_file_workaround is sameas true %}
mysqld-stopped-for-logfile-workaround:
  service.dead:
    - name: {{ mysql.service }}
    - prereq:
      - module: innodb-logfile-workaround
    - require:
      - pkg: mysqld

  {% set curtime = None | strftime("%Y-%m-%d-%H:%M:%S") %}
  {% set backup_dir = mysql.config.sections.mysqld.datadir ~ '/../ib_logfile-backup-' ~ curtime ~ '/' %}
innodb-logfile-backupdir:
  file.directory:
    - name: {{ backup_dir }}
    - makedirs: true

innodb-logfile-workaround:
  module.run:
    - name:   cmd.run
    - cmd:    "mv {{ mysql.config.sections.mysqld.datadir }}/ib_logfile* {{ backup_dir }}"
    - onlyif: "ls {{ mysql.config.sections.mysqld.datadir }}/ib_logfile*"
    - prereq:
      - file: mysql_config
    - require:
      - file: innodb-logfile-backupdir
{% endif %}

This is not fully working yet and a bit hackish - other ideas/sugestions/PRs welcome!

@daks
Copy link
Member

daks commented Nov 25, 2016

i think it duplicate #127

@noelmcloughlin
Copy link
Member

Duplicates #127

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants