From: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
---|---|
To: | Amul Sul <sulamul(at)gmail(dot)com> |
Cc: | "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Suraj Kharage <suraj(dot)kharage(at)enterprisedb(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Replication slot is not able to sync up |
Date: | 2025-05-30 11:02:28 |
Message-ID: | CAA4eK1J=vJ0UhkFppwykN+KtDPri-r_XeB6fhbw5o0Y4tGe8CQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Fri, May 30, 2025 at 4:05 PM Amul Sul <sulamul(at)gmail(dot)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?
--
With Regards,
Amit Kapila.
From | Date | Subject | |
---|---|---|---|
Next Message | David Rowley | 2025-05-30 11:08:58 | Re: Add comment explaining why queryid is int64 in pg_stat_statements |
Previous Message | Daniil Davydov | 2025-05-30 11:01:16 | Speedup truncations of temporary relation forks |