Re: Automated way to find actual COMMIT LSN of subxact LSN

From: Jeremy Finzel <finzelj(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Automated way to find actual COMMIT LSN of subxact LSN
Date: 2019-03-21 19:06:49
Message-ID: CAMa1XUh8gTcVf_C+KmxB6rEF3cEso9SKLmBj4teq8yobMpBbcg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>
> I find this to be unactionably vague. What does it mean to claim "an
> LSN is visible"? An LSN might not even point to a WAL record, or it
> might point to one that has nontransactional effects. Moreover, any
> behavior of this sort would destroy what I regard as a bedrock property
> of recover-to-LSN, which is that there's a well defined, guaranteed-finite
> stopping point. (A property that recover-to-XID lacks, since the
> specified XID might've crashed without recording either commit or abort.)
>

I mentioned that my specific use case is that I am picking out an LSN or
XID within the context of logical decoding. So I don't think that's vague,
but let me clarify. When using the peek_changes or get_changes functions,
they only show a particular update to a particular row, with a
corresponding LSN and transaction ID. That's what I see using both
test_decoding and pglogical_output, both of which I have used in this way.
In that context at least, all LSNs and XIDs point to committed WAL data
only.

> I think what you ought to be doing is digging the xmin out of the inserted
> tuple you're concerned with and then doing recover-to-XID. There's
> definitely room for us to make it easier if the XID is a subxact rather
> than a main xact. But I think identifying the target XID is your job
> not the job of the recovery-stop-point mechanism.
>

I'm open to that, but how will it help if I can't guarantee that the tuple
wasn't updated again after the original insert/update of interest?

Thank you,
Jeremy

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Korotkov 2019-03-21 19:18:02 Re: Connections hang indefinitely while taking a gin index's LWLock buffer_content lock
Previous Message Robert Haas 2019-03-21 18:56:24 Re: pg_basebackup ignores the existing data directory permissions