Re: Local visibility with logical decoding

From: Andres Freund <andres(at)anarazel(dot)de>
To: Marko Tiikkaja <marko(at)joh(dot)to>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Local visibility with logical decoding
Date: 2020-07-20 20:21:34
Message-ID: 20200720202134.av7nr72ysijrhq3n@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2020-07-20 17:27:30 +0300, Marko Tiikkaja wrote:
> It appears that when logical decoding sends out the data from the output
> plugin, it is not guaranteed that the decoded transaction's effects are
> visible on the source server. Is this the way it's supposed to work?

At the moment the visibility behaviour is basically the same as crash
recovery / standbys. And they just look at the WAL...

> If so, would doing something like this in the output plugin be reasonable?
>
> TransactionId xid = transaction->xid;
> if (transaction->is_known_as_subxact)
> xid = transaction->toplevel_xid;
>
> if (TransactionIdIsInProgress(xid))
> XactLockTableWait(xid, NULL, NULL, XLTW_None);

I'd not be surprised if this had a potential to cause deadlocks.

Greetings,

Andres Freund

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2020-07-20 20:30:46 Re: Allow ERROR from heap_prepare_freeze_tuple to be downgraded to WARNING
Previous Message Robert Haas 2020-07-20 19:47:00 Re: Issue with cancel_before_shmem_exit while searching to remove a particular registered exit callbacks