Re: Logical replication slots on slaves/replicas?

From: Piotr Andreassen Blasiak <piotr(at)attendium(dot)com>
To: Torsten Förtsch <tfoertsch123(at)gmail(dot)com>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Logical replication slots on slaves/replicas?
Date: 2024-08-01 14:18:54
Message-ID: E9D10E18-9D37-4A36-AE72-F79B64907C7A@attendium.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

That´s a great point. Thank you.

Piotr Andreassen Blasiak

> On 1 Aug 2024, at 12:03, Torsten Förtsch <tfoertsch123(at)gmail(dot)com> wrote:
>
> 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 <mailto: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

Browse pgsql-general by date

  From Date Subject
Next Message Jim Vanns 2024-08-01 15:54:49 VACUUM on temp table blocks VACUUM on another...
Previous Message KK CHN 2024-08-01 10:48:04 Re: PgBackRest PTR recovery: After table drop to get dropped state