Re: lastOverflowedXid does not handle transaction ID wraparound
x4mmm@yandex-team.ru
From: Andrey Borodin <x4mmm@yandex-team.ru>
To: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Cc: Stan Hu <stanhu@gmail.com>,
Dmitry Dolgov <9erthalion6@gmail.com>,
pgsql-hackers@lists.postgresql.org
Date: 2021-11-03T08:44:49Z
Lists: pgsql-hackers
> 21 окт. 2021 г., в 09:01, Kyotaro Horiguchi <horikyota.ntt@gmail.com> написал(а):
>
> If the discussion so far is correct, the following diff will fix the
> issue.
>
> diff --git a/src/backend/storage/ipc/procarray.c b/src/backend/storage/ipc/procarray.c
> index bd3c7a47fe..19682b73ec 100644
> --- a/src/backend/storage/ipc/procarray.c
> +++ b/src/backend/storage/ipc/procarray.c
> @@ -4463,6 +4463,12 @@ ExpireOldKnownAssignedTransactionIds(TransactionId xid)
> {
> LWLockAcquire(ProcArrayLock, LW_EXCLUSIVE);
> KnownAssignedXidsRemovePreceding(xid);
> + /*
> + * reset lastOverflowedXid if we know transactions that have been possiblly
> + * running are being gone.
> + */
> + if (TransactionIdPrecedes(procArray->lastOverflowedXid, xid))
> + procArray->lastOverflowedXid = InvalidTransactionId;
> LWLockRelease(ProcArrayLock);
> }
The patch seems correct bugfix to me. The only question I have: is it right place from modularity standpoint? procArray->lastOverflowedXid is not a part of KnownAssignedTransactionIds?
Best regards, Andrey Borodin.
Commits
-
Reset lastOverflowedXid on standby when needed
- 05e6e78c1840 15.0 landed
- b0f6bd48f35d 14.1 landed
- 7381b79ade47 9.6.24 landed
- 774d00573966 10.19 landed
- 691c0df73a74 11.14 landed
- 8f779a1a3eb6 12.9 landed
- e1fee28a0441 13.5 landed
-
Fix variable shadowing in procarray.c.
- dc899146dbf0 15.0 cited
-
Move InRecovery and standbyState global vars to xlogutils.c.
- 317632f3073f 15.0 cited