Thanks, Ashutosh for the reply.

I think those messages are useful when debugging logical replication
> problems (imagine missing transaction or inconsistent data between
> publisher and subscriber). I don't think pg_logical_slot_get_changes()
> or pg_logical_slot_peek_changes() are expected to be called frequently
> in a loop.


Yeah right. But can you please shed some light on when these functions
should be called, or are they used only for testing purposes?

Instead you should open a replication connection to
> continue to receive logical changes ... forever.
>

Yes, this is what I have decided to resort to now.

Why do you need to call pg_logical_slot_peek_changes() and
> pg_logical_slot_get_changes() frequently?
>

I was just playing around to do something for logical replication and
thought
of doing this quick test where every time interval I read using
pg_logical_slot_peek_changes(), make sure to consume them to a consistent
state, and only then use pg_logical_slot_get_changes() to advance the slot.

Regards,
Jeevan Ladhe

Reply via email to