-
Notifications
You must be signed in to change notification settings - Fork 5
Description
Design Doc
This is a design document for the upgrade of the major version of postgres(#12).
Goal
As we all know, workflow database uses postgresql, but at present it is still postgresql-9.4. How to establish a long-term upgrade mechanism is the main problem to be solved in this design. The goal of this design is to ensure seamless auto upgrade of major postgresql, the main implementation mechanism is using pg_upgrade tool.
Off-Cluster Storage Required
A Workflow upgrade requires using off-cluster object storage, since the default
in-cluster storage is ephemeral. Upgrading Workflow with the in-cluster default
of Minio will result in data loss.
See: https://docs.teamhephy.com/installing-workflow/configuring-object-storage/
Code Change
- Modify
Dockerfileto usepostgres:11-alpine, and addPGDATA_RECOVERYto docker image. - Adding
rootfs/bin/do_upgradeis used to implement the main upgrade function, because the old database is needed on the pg_upgrade mechanism, so the previous database binary program needs to be downloaded. - The upgrade mainly involves two main branches:
- One is the cluster using gluster/ceph and other block storage services, the upgrade scheme is detailed in
rootfs/docker-entrypoint.sh. - The other
rootfs/docker-entrypoint-initdb.d/003_restore_from_backup.sh, is using WALE to upgrade.
- One is the cluster using gluster/ceph and other block storage services, the upgrade scheme is detailed in
- For data security reasons, the
PGDATA_RECOVERYcontent will not be deleted after the upgrade is successful. After confirming that there is no problem, it needs to be deleted manually, and not deleting it will not affect the service.
Tests
I added some test cases to ensure its robustness, which will run with the make test command. See in detail postgres/contrib/ci/test-upgrade.sh