Browse Source

Merge "mysql: do not stop container when upgrade doesn't update mysql image"

changes/44/630644/33
Zuul 3 years ago
committed by Gerrit Code Review
parent
commit
57d23df6be
  1. 10
      docker/services/database/mysql.yaml

10
docker/services/database/mysql.yaml

@ -246,8 +246,9 @@ outputs:
# LP 1810136
# After upgrade, the new mariadb (e.g. 10.3) might not be able
# to replay the redo log of an older one (e.g. 10.1) if mysql
# stopped unexpectedly. Force it to stop and clean the redo log
# here to avoid issue after upgrade.
# stopped unexpectedly. If the container image differs, force
# mysql to stop and clean the redo log here to avoid issue after
# upgrade.
- name: Stop MySQL server and ensure redo log is cleaned up before upgrade
when: step|int == 2
block:
@ -272,6 +273,9 @@ outputs:
- name: Mysql container facts
set_fact:
mysql_json: "{{ mysql_paunch_docker.stdout if mysql_paunch_docker.changed else mysql_paunch.stdout | from_json }}"
- name: Mysql container image after upgrade
set_fact:
post_upgrade_mysql_image: {get_param: DockerMysqlImage}
- name: Redo log clean-up script
set_fact:
# The purpose of this script is to start mysql so that it
@ -290,6 +294,7 @@ outputs:
shell: |
{{ mysql_json.cli }} update --restart=unless-stopped mysql
{{ mysql_json.cli }} stop mysql
when: mysql_json.image != post_upgrade_mysql_image
- name: Clean up redo log by running a transient mysql server
shell:
str_replace:
@ -300,6 +305,7 @@ outputs:
IMAGE: "{{ mysql_json.image }}"
VOLUMES: "-v {{ mysql_clean_up_volumes | join(' -v ') }}"
SCRIPT: "{{ mysql_clean_up_script }}"
when: mysql_json.image != post_upgrade_mysql_image
post_upgrade_tasks:
- when: step|int == 1
import_role:

Loading…
Cancel
Save