add playbook physical_to_logical.yml
This is the first version of automation that can be integrated into various playbooks for PostgreSQL maintenance, for example, "pg-os-upgrade", "pg-upgrade", etc...
This playbook creates logical replication using a Standby Cluster created using physical replication. This method will avoid using pg_dump and copying all data from the main cluster, instead we can prepare a standby cluster from a WAL-G backup (see "bootstrap.method
" and "bootstrap.dcs.standby_cluster.create_replica_methods
"), then synchronize the data (delta) using physical replication. After that, we can switch to a logical replication.
With the logical replication, standby cluster will receive all changes from the main cluster, and at the same time we can perform pg_upgrade
(or reindex corrupted indexes
after update OS/glibc
). And only when the new cluster is fully ready, we switch traffic without long downtime, ideally we should talk about downtime for no more than 10 seconds (when switching traffic).
https://gitlab.com/gitlab-com/gl-infra/reliability/-/issues/16177