Re: deferred writing of two-phase state files adds fragility

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: deferred writing of two-phase state files adds fragility
Date: 2024-12-04 17:44:05
Message-ID: CA+TgmoZW9iLXu=4tJZ46uakZ0hJZof7mV-PbELx_SoJKDOL-tw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Dec 4, 2024 at 12:19 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> > You can't execute COMMIT
> > TRANSACTION or ROLLBACK TRANSACTION, so there's now way to resolve the
> > prepared transaction.
>
> Could we fix it so ROLLBACK TRANSACTION removes the GID from the
> list of prepared xacts that need to be written out? Then we'd
> no longer have a pending requirement to read the broken WAL record.

That would be nice, but I'm not sure that it's possible. As currently
implemented, FinishPreparedTransaction() always reads the two-phase
state data either from the two-phase file or the WAL, whether it's
committing or rolling back. One might expect the commit or rollback to
proceed purely on the basis of in-memory state, but I think that does
not work because nsubxacts might be greater than
PGPROC_MAX_CACHED_SUBXIDS. Even when it isn't, we have no shared
memory record of abortrels or abortstats.

--
Robert Haas
EDB: http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2024-12-04 17:58:43 Re: deferred writing of two-phase state files adds fragility
Previous Message Tom Lane 2024-12-04 17:32:13 Re: generic plans and "initial" pruning