public inbox for [email protected]  
help / color / mirror / Atom feed
From: Torsten Förtsch <[email protected]>
To: Piotr Andreassen Blasiak <[email protected]>
Cc: [email protected]
Subject: Re: Logical replication slots on slaves/replicas?
Date: Thu, 1 Aug 2024 12:03:41 +0200
Message-ID: <CAKkG4_n+TTJS9RAH5B_Hzjbwedb+j4hOqqZyuTaqPTAgz4g9xA@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>

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 <
[email protected]> 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
>
>
>
>
>


reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: Logical replication slots on slaves/replicas?
  In-Reply-To: <CAKkG4_n+TTJS9RAH5B_Hzjbwedb+j4hOqqZyuTaqPTAgz4g9xA@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox