Bi-Directional Replication (BDR) PostgreSQL extension to enable asynchronous multi-master replication.

BDR (Bi-Directional Replication for PostgreSQL) is a PostgreSQL extension that adds support for asynchronous multi-master replication.

Applications written for PostgreSQL will generally require changes before they can safely operate with multiple write masters under BDR.

BDR is eventually consistent, though it ensures constraints and foreign keys are always consistent within any given node. There is no global lock manager or global transaction manager. Row and relation locks on one node are not replicated to other nodes.

No external ticker or replay daemon(s) are required to manage replication. No triggers are required. DDL is performed directly on the target node and replicated to other nodes without external tooling. There's no central control server, and the system is tolerant of latency and temporary partitions.

BDR provides global sequence generation, selective replication, user-defined conflict resolution handlers, and a number of other features to ease application design.

It's generally safe to run an application on BDR if it's configured to only write to one node though; this uses BDR much like a streaming replica but without the issues with query cancellation, temp tables, etc that normal streaming replication encounters.