Recovery, failover and rollback
Before the first subscription
Upgrade physical standbys, failover hosts and PITR environments first. A new standby was able to follow a pre-Spock primary. Verify replay and the matching backup tools and keys, then switch the primary. Take a restorable base backup and record a pre-activation recovery point. Archive continuously. A backup of one node preserves that database’s physical state at its recovery point. Writes committed only on a disconnected peer require a separate reconciliation.
Restore and verify
Recover a separate, network-isolated copy using a kernel with the 200 / 201 changes. Keep subscriptions from reconnecting to live peers during the drill. With TDE, follow the key and backup procedure. Restore through the target WAL, pause at the chosen target and check pg_is_in_recovery() and pg_get_wal_replay_pause_state(). Compare representative rows, xmin and pg_xact_commit_timestamp(xmin) against values recorded at the target. Verify the table and index encryption status, and the absence of a transaction committed after the target.
The test restored ordinary and encrypted tables to a named point after Delta Apply, with both plaintext and encrypted WAL on the full kernel. Before promoting a physical standby to serve both writers, verify slots, origins, subscriptions and convergence with the other node. On Debian 13 amd64, r4 passed all seven Spock checks. After standby catch-up and promotion, row values, commit timestamps and origins matched the primary. The concurrent test verified two subscription apply workers.
How far can an older reader go?
| Situation | Operational decision |
|---|---|
| Before Spock activation | A prior same-major reader handled ordinary WAL in the tested combination. Preserve a pre-activation backup and target for a rollback drill. |
Replay crosses CommitTs/SUBTRANS_TS | Keep the matching RC2 recovery environment for archives with the old 0x20 record. At cutover, quiesce writes and subscriptions and shut down cleanly. Equip the primary and recovery hosts with r4, take a new full backup and rebuild physical standbys from it before resuming replication. |
| Return to an older system and keep later writes | Recover first with the matching kernel. Quiesce or reconcile writers, migrate representable application data logically and compare the rows. The fallback test moved one business table. Rebuild and validate roles, sequences, keys and topology separately. |
In the earlier physical-reader test the old kernel reached a pre-conflict point with balance 113. The new kernel restored the same backup through the conflict and read 120. A marked directory also enforces its kernel requirements at startup. Keep the feature marker intact. Control-file version and a successful clean start alone cannot qualify a recovery reader. How Spock changes replay