Stop BDR from replicating DROP TABLE or CREATE TABLE

1.4k Views Asked by At

I have two databases with tables that I want to sync. I don't want to sync any other table. I'm using Postgres-BDR to do that.

Those tables are part of replication set common. There are some circumstances where other tables share a name across nodes (but are NOT in common), and a node will call DROP TABLE and then CREATE TABLE. Even though those tables aren't part of the common replication set, these commands are still replicated to the other nodes, causing the other node to lose all of its data in its table and then create an empty table.

How can I stop this? I only want commands that affect common to be replicated to the other nodes.

1

There are 1 best solutions below

13
ABeard89 On

Nevermind, I found it. It's available with bdr.skip_ddl_replication.

I just put bdr.skip_ddl_replication = on in postgresql.conf, restarted the server, and BOOM! Works like a charm.

EDIT

It would be prudent of me to point out that the documentation warns that this option could break database replication if used improperly. But since I'll be VERY tightly controlling the table schema, it shouldn't cause any problems.