Re: lastOverflowedXid does not handle transaction ID wraparound - Mailing list pgsql-hackers

From Dmitry Dolgov
Subject Re: lastOverflowedXid does not handle transaction ID wraparound
Date
Msg-id 20211017165521.74xzmnqisv6rywnc@localhost
Whole thread Raw
In response to lastOverflowedXid does not handle transaction ID wraparound  (Stan Hu <stanhu@gmail.com>)
Responses Re: lastOverflowedXid does not handle transaction ID wraparound  (Andrey Borodin <x4mmm@yandex-team.ru>)
List pgsql-hackers
> On Tue, Oct 12, 2021 at 09:53:22PM -0700, Stan Hu wrote:
>
> I described how PostgreSQL can enter into a suboverflow condition on
> the replica under a number of conditions:
>
> 1. A long transaction starts.
> 2. A single SAVEPOINT is issued.
> 3. Many rows are updated on the primary, and the same rows are read
> from the replica.
>
> I noticed that lastOverflowedXid doesn't get cleared even after all
> subtransactions have been completed. On a replica, it only seems to be
> updated via a XLOG_XACT_ASSIGNMENT, but no such message will be sent
> if subtransactions halt. If the XID wraps around again and a long
> transaction starts before lastOverflowedXid, the replica might
> unnecessarily enter in the suboverflow condition again.

Hi,

that's an interesting finding, thanks for the investigation. I didn't
reproduce it fully (haven't checked the wraparound part), but indeed
lastOverflowedXid is not changing that often, only every
PGPROC_MAX_CACHED_SUBXIDS subtransactions. I wonder what would be side
effects of clearing it when the snapshot is not suboverfloved anymore?



pgsql-hackers by date:

Previous
From: Mikhail
Date:
Subject: Re: [PATCH] Make ENOSPC not fatal in semaphore creation
Next
From: Tom Lane
Date:
Subject: pg_dump does way too much before acquiring table locks