How to use logical decoding to build a custom replication system
summary
A custom system named Connemara streams logical WAL using replication slots and the libpq replication protocol, decodes records with wal2json, and tracks progress with replication origin. Bootstrapping uses a base backup with an exported snapshot; one C daemon per source/target pair writes JSON payloads to a spool table and a single replayer applies changes into per-source schemas. It works in staging and is near production; main pain points are schema renames (AST rewrite with pg_last), heavy JSON overhead, and tricky DDL/sequence edge cases.
AI-written summary · about
