Re: Logical replication slots on slaves/replicas?

From: Torsten Förtsch <tfoertsch123(at)gmail(dot)com>
To: Piotr Andreassen Blasiak <piotr(at)attendium(dot)com>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Logical replication slots on slaves/replicas?
Date: 2024-08-01 10:03:41
Message-ID: CAKkG4_n+TTJS9RAH5B_Hzjbwedb+j4hOqqZyuTaqPTAgz4g9xA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

A COMMIT record in the WAL has an LSN. I don't know much about debezuim but
wal2json can give you this LSN. Then there is this
function, pg_last_wal_replay_lsn(). I think you could run it on the replica
to see if you are after the point of commit. If you are, you should be able
to see the changes made by the transaction.

BTW, I am sure I can construct a situation where you see your transaction
in the logical wal stream before it becomes visible on the master. In
particular, this is possible with a sync replication setup. So, I would not
trust to always be able to see the transaction on the master as soon as it
is reported committed in the wal stream.

All the best,
Torsten

On Thu, Aug 1, 2024 at 10:42 AM Piotr Andreassen Blasiak <
piotr(at)attendium(dot)com> wrote:

> Hi,
>
> I know that currently logical replication slots are available only for
> primary servers. Is there any plan to add this feature to read slaves as
> well? My problem is this:
>
> I want to use debezium to stream changes from postgresql. But, if I stream
> changes from the master I can not query my read slaves for related data to
> these changes - I need to always query the master which is not scalable. So
> either I need a way to be able to know when the change has been propagated
> to my read replica so that I can reliably query it, or I am hoping I can
> simply read all the changes from the read replica which will mean it is
> already up to date when I query it.
>
> Piotr Andreassen Blasiak
>
>
>
>
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message KK CHN 2024-08-01 10:32:08 Re: PgBackRest PTR recovery: After table drop to get dropped state
Previous Message KK CHN 2024-08-01 10:02:46 PgBackRest PTR recovery: After table drop to get dropped state