Re: Usage of epoch in txid_current

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Cc: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, Andres Freund <andres(at)anarazel(dot)de>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Alexander Korotkov <a(dot)korotkov(at)postgrespro(dot)ru>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Andrey Borodin <x4mmm(at)yandex-team(dot)ru>
Subject: Re: Usage of epoch in txid_current
Date: 2019-05-04 17:45:18
Message-ID: CAMkU=1yUTv-FqR3PeUHzosCQfFxMZPhNGF71HeFdVZO4mzguWw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, May 4, 2019 at 1:34 PM Jeff Janes <jeff(dot)janes(at)gmail(dot)com> wrote:

> On Thu, Mar 28, 2019 at 1:30 AM Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
> wrote:
>
>> On Thu, Mar 28, 2019 at 1:48 AM Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
>> wrote:
>> > Once we have the FullTransactionId type and basic macros in place, I'm
>> > sure we could tidy up a bunch of code by using them.
>
>
> Thanks for the reviews! Pushed.
>>
>
> I think that this might be broken.
>
> We have this change:
>
> @@ -73,7 +75,8 @@ GetNewTransactionId(bool isSubXact)
>
> LWLockAcquire(XidGenLock, LW_EXCLUSIVE);
>
> - xid = XidFromFullTransactionId(ShmemVariableCache->nextFullXid);
> + full_xid = ShmemVariableCache->nextFullXid;
> + xid = XidFromFullTransactionId(full_xid);
>
> But then later on in an little-used code path around line 164:
>
> /* Re-acquire lock and start over */
> LWLockAcquire(XidGenLock, LW_EXCLUSIVE);
> xid = XidFromFullTransactionId(ShmemVariableCache->nextFullXid);
>
> full_xid does not get updated, but then later on full_xid gets returned in
> lieu of xid.
>
> Is there a reason that this is OK?
>
>
Ah, sorry for the noise. I see that this has been fixed already. I wasn't
looking at HEAD, or at the other email thread, when I "discovered" this.

Sorry for the noise.

Cheers,

Jeff

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2019-05-04 19:55:05 Re: First-draft release notes for back branches are up
Previous Message Jeff Janes 2019-05-04 17:34:06 Re: Usage of epoch in txid_current