citusdata / citus

Distributed PostgreSQL as an extension
https://www.citusdata.com
GNU Affero General Public License v3.0
10.43k stars 662 forks source link

Add replication slot propagation #6905

Open marcocitus opened 1 year ago

marcocitus commented 1 year ago

When using logical decoding and adding a new node, you currently have to create a slot on the new node before rebalancing to make sure you do not miss any changes. This will prevent scenarios like automatic rebalancing.

It would be useful if replication slots can be propagated to new and existing nodes.

In this case, we cannot use pg_dist_object for bookkeeping, since replication slots do not have an OID. We might need a new metadata table that is synchronized across nodes.

Alternatively, we could automatically propagate all logical slots from the coordinator that do not belong to Citus when adding a node.

onderkalaci commented 1 year ago

In this case, we cannot use pg_dist_object for bookkeeping, since replication slots do not have an OID. We might need a new metadata table that is synchronized across nodes.

Maybe we keep an internal reference table if there is no OID involved?

(I have not thought enough about the implications, but throwing the idea here not to forget about it)

marcocitus commented 1 year ago

Then we'll need to figure out how to do schema changes on extension-owned Citus table during upgrades, which would be a good thing to figure out.