worf
worf · Logical replication with replication sets, multiple providers and configurable conflict resolution.
Overview
PostgreSQL · 15, 16, 17, 18
Usage
Sources:
- README.md
- LICENSE
- src/Worf/Worf.csproj
- src/Worf/worf.control
- src/Worf/Worf.cs
- src/Worf/Node.cs
- .github/workflows/ci.yml
worf provides per-database logical replication with replication sets, multiple providers and configurable conflict handling. This C#/.NET Native AOT source declares version 0.1.0 in both its Ankus project and runtime; Ankus generates the matching control and versioned SQL from the control file and SQL attributes. No tagged release was available at review. Upstream supports PostgreSQL 15–19.
Configure Both Nodes
Install matching files on provider and subscriber. Preserve existing preload libraries, configure logical WAL and enough workers, slots and senders, then restart PostgreSQL:
These capacities are example values; size them for the actual nodes and other consumers. On PostgreSQL 15.19, 16.15, 17.11, 18.6, 19 or newer, the provider must also allow worf in the output-plugin allow-list while preserving other required plugins:
Superuser administration is required. Install in each participating database, and create matching schemas, tables, column types and primary keys on both sides. Subscriber constraints must be no stricter than the provider’s.
Provider and Subscriber
On the provider:
On the subscriber:
Configure provider authentication for normal database replication connections, and protect connection credentials. The fixed worf schema contains node, subscription and replication-set state. worf.replicate_ddl_command can queue an explicitly chosen DDL operation; ordinary DDL is not automatically replicated. worf_create_subscriber clones with a full base backup and does not limit the copy to selected replication sets.
Conflicts and Maintenance Boundaries
The default conflict policy is apply_remote, which can overwrite local rows; the example deliberately chooses error to stop for review. Timestamp-based policies and keep_local require track_commit_timestamp. Multi-provider conflict handling does not establish complete multi-master semantics. Monitor replication slots and WAL retention, synchronization state and logged conflicts.
UPDATE/DELETE require a usable primary key or replica identity; REPLICA IDENTITY FULL is unsupported. Extra unique constraints can stop conflict application, and deferrable unique indexes are unsupported. Foreign-key constraints are not enforced during apply. UNLOGGED/TEMPORARY tables and large objects are not replicated. Sequence state propagates periodically rather than per increment. Table resynchronization truncates immediately and leaves the table empty while data is copied. Plan schema changes and synchronization as maintenance operations, not automatic failover guarantees.