Re: Something is wrong with wal_compression

From: Andres Freund <andres(at)anarazel(dot)de>
To: Andrey Borodin <amborodin86(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Michael Paquier <michael(at)paquier(dot)xyz>, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, Justin Pryzby <pryzby(at)telsasoft(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Something is wrong with wal_compression
Date: 2023-01-28 04:26:25
Message-ID: 20230128042625.ryrdb7uyuqvf73rl@awork3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2023-01-27 19:57:35 -0800, Andrey Borodin wrote:
> On Fri, Jan 27, 2023 at 7:40 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> >
> > What are you using it for, that you don't care whether the answer
> > is trustworthy?
> >
>
> It's not trustworthy anyway. Xid wraparound might happen during
> reconnect.

I think that part would be approximately fine, as long as you can live with
an answer of "too old". The xid returned by txid_status/pg_current_xact_id()
is 64bit, and there is code to verify that the relevant range is covered by
the clog.

However - there's nothing preventing the xid to become too old in case of a
crash.

If you have an open connection, you can prevent the clog from being truncated
by having an open snapshot. But you can't really without using e.g. 2PC if you
want to handle crashes - obviously snapshots don't survive them.

I really don't think txid_status() can be used for anything but informational
probing of the clog / procarray.

> I suspect we can design a test that will show that it does not always show
> correct results during xid->2pc conversion (there is a point in time when
> xid is not in regular and not in 2pc, and I'm not sure ProcArrayLock is
> held). Maybe there are other edge cases.

Unless I am missing something, that would be very bad [TM], completely
independent of txid_status(). The underlying functions like
TransactionIdIsInProgress() are used for MVCC.

Greetings,

Andres Freund

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Takamichi Osumi (Fujitsu) 2023-01-28 04:28:29 RE: Time delayed LR (WAS Re: logical replication restrictions)
Previous Message Tom Lane 2023-01-28 04:18:39 Re: lockup in parallel hash join on dikkop (freebsd 14.0-current)