mysql: do not stop container when upgrade doesn't update mysql image
In 0015cc7441
we added the ability
to stop gracefully the mysql container during a major upgrade, to
allow upgrade to versions of mysql with different redo log format [1].
Stopping mysql is OK as long as paunch restarts it during the deploy
tasks. However, paunch only (re)start mysql if the mysql config hash
changes, it doesn't check whether mysql is stopped or not. So running
"undercloud upgrade" with identical mysql container image now fails.
Fix the upgrade strategy by stopping mysql only when needed, that is
when mysql container image is to be updated.
[1] https://jira.mariadb.org/browse/MDEV-14848
Change-Id: I88f1913581e6c9e279bcaf99ad4260dd940636c3
This commit is contained in:
parent
9c887d2340
commit
99b87fba18
|
@ -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…
Reference in New Issue