0

I followed this guide (https://docs.citusdata.com/en/stable/develop/integrations.html) to implement logical replication of the "items" table between two postgres db. On DB1 the "items" table is distributed using the citus extension (1 coordinator + 2 worker nodes), on DB2 the citus extension is installed but the "items" table is not distributed (single node).

In detail: On DB1 I created the items_pub publication:

CREATE PUBLICATION items_pub FOR TABLE items;

and then I created the replication slots:

SELECT * FROM run_command_on_all_nodes(
   $$ SELECT pg_create_logical_replication_slot('cdc_slot', 'pgoutput', false) $$
);

On DB2 I created the subscriptions:

create subscription sub
   connection 'host=10.100.100.37 user=user dbname=DB1 password=password port=5432'
   publication items_pub
   WITH (copy_data=true,create_slot=false,slot_name='cdc_slot');

create subscription sub_1
   connection 'host=10.100.100.38 user=user dbname=DB1 password=password port=5432'
   publication items_pub
   WITH (copy_data=false,create_slot=false,slot_name='cdc_slot');

create subscription sub_2
   connection 'host=10.100.100.39 user=user dbname=DB1 password=password port=5432'
   publication items_pub
   WITH (copy_data=false,create_slot=false,slot_name='cdc_slot');

Everything works perfectly and every event of INSERT, DELETE, UPDATE on the items table of DB1 is propagated correctly to the items table of DB2.

The problem arises when I transform the "items" table on DB2 into a distributed table via Citus. (again with 1 coordinator + 2 worker nodes). At this point any event coming from DB1 is not received by DB2. I have tried several solutions without success. I would like to understand if what I am trying to implement is possible or not and if possibly there are other solutions.

3
  • Did you have a chance to look at the Postgres logs on the publisher and subscriber nodes?
    – mustaccio
    Commented Jul 10 at 12:17
  • The logs from the subscriber simply report: "the logical replication application worker for subscription sub_XXX has started" Publisher side no relevant events are reported in the postgresql log. Commented Jul 10 at 13:13
  • I noticed wal segments are properly sent from DB 1 worker nodes to DB2 worker nodes. But when I read wal segments on DB2, related for examples to 1 INSERT, I see: NEW_CID - INSERT off - INSERT_LEAF - INVALIDATION - ; inval msgs: catcache 62 - COMMIT what is the meaning of INVALIDATION statement? Commented Jul 11 at 8:39

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.