On Fri, May 30, 2025 at 4:32 PM Amit Kapila <amit.kapil...@gmail.com> wrote:
>
> On Fri, May 30, 2025 at 4:05 PM Amul Sul <sula...@gmail.com> wrote:
> >
> > Quick question -- due to my limited understanding of this area: why
> > can't we perform an action similar to pg_logical_slot_get_changes()
> > implicitly from pg_sync_replication_slots()? Would there be any
> > implications of doing so?
> >
>
> Yes, there would be implications if we did it that way. It would mean
> that the consumer of the slot may not process those changes (for which
> sync_slot API has done the get_changes) and send it to the client.
> Consider a publisher-subscriber and physical standby setup. In this
> setup, the subscriber creates a logical slot corresponding to the
> subscription on the publisher. Now, the publisher process changes and
> sends it to the subscriber; then the slot is advanced (both its xmin
> and WAL locations) once the corresponding changes are sent to the
> client.
>
> If we allow pg_sync_replication_slots() to do
> pg_logical_slot_get_changes or equivalent in some way, then we may end
> up advancing the slot without sending the changes to the subscriber,
> which would be considered a data loss for the subscriber.
>
> I have explained in terms of built-in logical replication, but the
> external plugins using these APIs (pg_logical_*) should be doing
> something similar to process the changes and advance the slot.
>
> Does this answer your question and make sense to you?
>

Yes, understood. Thank you!

Regards,
Amul


Reply via email to