| From: | Andrey Borodin <x4mmm(at)yandex-team(dot)ru> |
|---|---|
| To: | Alexander Korotkov <aekorotkov(at)gmail(dot)com> |
| Cc: | Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, Stan Hu <stanhu(at)gmail(dot)com>, Dmitry Dolgov <9erthalion6(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: lastOverflowedXid does not handle transaction ID wraparound |
| Date: | 2021-11-03 09:32:51 |
| Message-ID: | 3AED5C70-9CEA-4044-B844-9A97D002D831@yandex-team.ru |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
> 3 нояб. 2021 г., в 14:08, Alexander Korotkov <aekorotkov(at)gmail(dot)com> написал(а):
>
> ( a.On Wed, Nov 3, 2021 at 11:44 AM Andrey Borodin <x4mmm(at)yandex-team(dot)ru> wrote:
>>> 21 окт. 2021 г., в 09:01, Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)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?
>
> It seems the right place because we take ProcArrayLock here.
Oh.. I see. ProcArrayApplyRecoveryInfo() is taking ProcArrayLock in so many places.
> It would
> be undesirable to take it twice. We could give a better name for
> ExpireOldKnownAssignedTransactionIds() indicating that it could modify
> lastOverflowedXid as well. Any ideas?
Looking more I think the name is OK. KnownAssignedXidsReset() and KnownAssignedXidsRemovePreceding() interferes with procArray a lot.
> Should ExpireAllKnownAssignedTransactionIds() be also involved here?
I think it's good for unification, but I do not see how procArray->lastOverflowedXid can be used after ExpireAllKnownAssignedTransactionIds().
Best regards, Andrey Borodin.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Vik Fearing | 2021-11-03 10:07:58 | Re: Should we support new definition for Identity column : GENERATED BY DEFAULT ON NULL? |
| Previous Message | gkokolatos | 2021-11-03 09:11:24 | Re: Teach pg_receivewal to use lz4 compression |