A journey into postgresql logical replication
summary
Built an in-house CDC pipeline using Postgres logical replication and a Golang logical replication client, the team finds that two wrong assumptions cause production data loss: LSNs are not globally incremental under concurrency, and acknowledging only data-changing events (not transaction end) lets restarts replay or skip needed changes. A custom WAL parser and discussions with Postgres devs lead to the rule commit only on transaction end; that fixes loss but forces transaction batching and splitting to avoid messaging-size and duplication issues.
AI-written summary · about
chapters (9)
- 0:00Motivation for custom CDC
- 2:22Building the Golang client
- 5:13Understanding LSN offsets
- 8:56Concurrency and replication
- 13:09Common replication pitfalls
- 18:16Correcting replication errors
- 22:28Refined replication approach
- 26:13Handling capacity constraints
- 29:59Q&A and concluding remarks
related talks
29mLogical replication theory and concepts
42mlesser known Superpower of Postgres Logical Replication
53mThe journey towards active replication in PostgreSQL
59mLogical Replication...LIVE!
56mLogical Replication of DDLs
31mPast, Present, and Future: Logical Decoding and Replication in PostgreSQL
54mUnderstanding Logical Decoding and Replication
22mSecuring Postgres with streaming replication
