Re: 64-bit XIDs again - Mailing list pgsql-hackers

From Simon Riggs
Subject Re: 64-bit XIDs again
Date
Msg-id CANP8+j+=8gHLJRAbHTff0+MFqydH6oNqp0Hi1qB5+xYR534VOg@mail.gmail.com
Whole thread Raw
In response to 64-bit XIDs again  (Alexander Korotkov <a.korotkov@postgrespro.ru>)
List pgsql-hackers
On 30 July 2015 at 14:26, Alexander Korotkov <a.korotkov@postgrespro.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/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

pgsql-hackers by date:

Previous
From: Fabien COELHO
Date:
Subject: Re: checkpointer continuous flushing
Next
From: Andres Freund
Date:
Subject: GinPageIs* don't actually return a boolean