Failover and Recovery¶
Postgres Stream handles both sink failures and slot invalidation automatically.
How It Works¶
Events are stored in a partitioned table, not just the WAL. This means:
- WAL can be released immediately
- Recovery reads from the table, not the WAL
- 7-day partition retention = 7-day recovery window
Sink Failure¶
When the sink is unavailable:
- Checkpoint saved at failed event
- Retries until sink recovers
- Replays missed events via
COPY - Resumes normal streaming
Slot Invalidation¶
When the replication slot is invalidated:
- Queries last confirmed LSN from invalidated slot
- Sets checkpoint to first event after that LSN
- Drops slot and restarts pipeline
- Replays from checkpoint
No operator intervention required.
Guarantees¶
- Zero data loss - As long as downtime < partition retention (7 days)
- At-least-once delivery - Events may repeat during replay
- Order preserved - Events replay in order