Re: Usage of epoch in txid_current

From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Cc: 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-03-27 11:44:17
Message-ID: CA+hUKGJ4gFRSWY1-7Xw3CGoNgorWVGPN=jmm5P6AkaRnMjT=mw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Mar 26, 2019 at 12:58 PM Thomas Munro <thomas(dot)munro(at)gmail(dot)com> wrote:
> On Tue, Mar 26, 2019 at 3:23 AM Heikki Linnakangas <hlinnaka(at)iki(dot)fi> wrote:
> > Looks good.

I did some testing and proof-reading and made a few minor changes:

* I tidied up the code that serialises transaction state. It was
already hammering round pegs into square holes, and the previous patch
made that even worse, so I added a new struct
SerializedTransactionState to do this properly.

* I open-coded Get{Current,Top}TransactionId[IfAny](), rather than
having them call the "Full" variants, so that nobody could accuse me
of adding an extra function call that might not be inlined. It's just
a couple of lines anyway.

* I kept the name GetNewTransactionId(), since it's referred to in
many places in comments etc. Previously I had called it
GetNewFullTransactionId() and had GetNewTransactionId() just call that
and truncate to 32 bits, but there wasn't much point without an
in-tree caller for the narrow version. If there is any out-of-tree
code calling this, it will now fail to compile thanks to our
non-convertible return type.

These are the patches I'm planning to push tomorrow.

I still need to look into Andres's suggestion about getting rid of
epoch from various user interfaces and showing 64 bit numbers. I
should probably also find a place in the relevant README to explain
this new scheme. I will post follow-up patches for those.

--
Thomas Munro
https://enterprisedb.com

Attachment Content-Type Size
0001-Add-basic-infrastructure-for-64-bit-transaction-I-v8.patch application/octet-stream 48.0 KB
0002-Use-FullTransactionId-for-the-transaction-stack-v8.patch application/octet-stream 23.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ryan Lambert 2019-03-27 12:22:43 Re: Fix XML handling with DOCTYPE
Previous Message Alexander Korotkov 2019-03-27 11:23:47 Re: jsonpath