Re: 64-bit XIDs again

From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: Alexander Korotkov <a(dot)korotkov(at)postgrespro(dot)ru>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: 64-bit XIDs again
Date: 2015-08-11 15:28:13
Message-ID: CANP8+j+=8gHLJRAbHTff0+MFqydH6oNqp0Hi1qB5+xYR534VOg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 30 July 2015 at 14:26, Alexander Korotkov <a(dot)korotkov(at)postgrespro(dot)ru>
wrote:

> As I mentioned in CSN thread, it would be nice to replace XID with CSN
> when setting hint bits for tuple. In this case when hint bits are set we
> don't need any additional lookups to check visibility.
>
> http://www.postgresql.org/message-id/CAPpHfdv7BMwGv=OfUg3S-jGVFKqHi79pR_ZK1Wsk-13oZ+cy5g@mail.gmail.com
> Introducing 32-bit CSN doesn't seem reasonable for me, because it would
> double our troubles with wraparound.
>

Your idea to replace XIDs with CSNs instead of hinting them was a good one.
It removes the extra-lookup we thought we needed to check visibility with
CSN snapshots.

I agree 32-bit CSNs would not be a good idea though, a 64-bit CSN is needed.

If we break a CSN down into an Epoch and a 32-bit value then it becomes
more easily possible. The Epoch for XID and CSN can be the same - whichever
wraps first we just increment the Epoch.

By doing this we can reuse the page-level epoch for both XID and CSN. Now
hinting a tuple is just replacing a 32-bit XID with a 32-bit CSN.

We would probably need an extra flag bit for the case where the CSN is one
epoch later than the XID.

--
Simon Riggs http://www.2ndQuadrant.com/
<http://www.2ndquadrant.com/>
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2015-08-11 15:42:37 GinPageIs* don't actually return a boolean
Previous Message Fabien COELHO 2015-08-11 15:15:22 Re: checkpointer continuous flushing