pgpilot

2026Go, PostgreSQL, LSN fencingactive sachhg/pgpilot


Read replicas work fine until someone writes a row and reads it back before replication catches up. pgpilot sits in front of the cluster and handles that case. It speaks the Postgres wire protocol, so an application points at it instead of the primary and nothing else has to change.

It fences on LSN. When a session writes, the router records the log sequence number that transaction committed at. Later reads from the same session only go to a replica that has replayed past that point, and to the primary if none has. That gives you read-your-writes consistency across a primary/replica cluster without putting routing decisions in application code.


All projects