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@xxxxxxxxxxxxx> 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