Re: lastOverflowedXid does not handle transaction ID wraparound

From: Stan Hu <stanhu(at)gmail(dot)com>
To: Andrey Borodin <x4mmm(at)yandex-team(dot)ru>
Cc: Dmitry Dolgov <9erthalion6(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: lastOverflowedXid does not handle transaction ID wraparound
Date: 2021-10-20 15:55:12
Message-ID: CAMBWrQn8VSPCW+_AtLMNanLRwUp-fixEJEJXT+OmDgzeaupdkA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Oct 20, 2021 at 4:00 AM Andrey Borodin <x4mmm(at)yandex-team(dot)ru> wrote:

>
>
> > 17 окт. 2021 г., в 21:55, Dmitry Dolgov <9erthalion6(at)gmail(dot)com>
> написал(а):
> > I wonder what would be side
> > effects of clearing it when the snapshot is not suboverfloved anymore?
>
> I think we should just invalidate lastOverflowedXid on every
> XLOG_RUNNING_XACTS if subxid_overflow == false. I can't find a reason not
> to do so.
>
>
On a replica, I think it's possible for lastOverflowedXid to be set even if
subxid_overflow is false on the primary and secondary (
https://github.com/postgres/postgres/blob/dc899146dbf0e1d23fb24155a5155826ddce34c9/src/backend/storage/ipc/procarray.c#L1327).
I thought subxid_overflow only gets set if there are more than
PGPROC_MAX_CACHED_SUBXIDS (64) used in a given transaction.

Should the replica be invalidating lastOverflowedXid if subxcnt goes to
zero in XLOG_RUNNING_XACTS? But if there's an outstanding snapshot with an
xmin that precedes lastOverflowedXid we might violate MVCC if we invalidate
this, so I wonder if we also need to check the snapshot with the lowest
xmin?

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2021-10-20 16:01:56 Re: [RFC] building postgres with meson
Previous Message Dilip Kumar 2021-10-20 15:19:36 Re: pgsql: Document XLOG_INCLUDE_XID a little better