Databases & Storage

Achieving zero downtime PostgreSQL major upgrades with Spock

Key Takeaway

Using the Spock multi-master extension allows for rolling major version upgrades in a distributed cluster without losing writable endpoints.

Summary

A technical guide details how to perform major PostgreSQL upgrades on a distributed cluster with zero downtime. By utilizing the open-source Spock extension for multi-master logical replication, administrators can add new nodes running newer PostgreSQL versions to an existing cluster, migrate traffic, and retire old nodes one by one. This method avoids the write pauses required by standard blue-green upgrade strategies.

The rolling upgrade process

  • Uses Spock, an open-source multi-master logical replication extension.
  • Employs Zodan scripts to automate adding and removing nodes without downtime.
  • Requires disabling automatic DDL replication during the upgrade window to prevent schema mismatches.
  • The process involves building a fresh node on the target PostgreSQL version, syncing data/schema, and replacing physical standbys managed by Patroni.
  • Unlike PostgreSQL 19's built-in blue-green upgrade, this method does not require pausing writes during cutover.

Why it matters

This approach provides a high-availability path for mission-critical distributed databases that cannot afford the write-pause latency of standard upgrade tools.

Original reference: postgr.es →