Re: pg_serial early wraparound

Thomas Munro <thomas.munro@enterprisedb.com>

From: Thomas Munro <thomas.munro@enterprisedb.com>
To: Pg Hackers <pgsql-hackers@postgresql.org>
Date: 2017-02-27T06:33:10Z
Lists: pgsql-hackers

Attachments

On Mon, Feb 27, 2017 at 7:28 PM, Thomas Munro
<thomas.munro@enterprisedb.com> wrote:
> On Wed, Nov 9, 2016 at 11:07 AM, Thomas Munro
> <thomas.munro@enterprisedb.com> wrote:
>> The SLRU managed by predicate.c can wrap around and overwrite data if
>> you have more than 1 billion active XIDs.  That's because when SSI was
>> implemented, slru.c was limited to four digit segment names, which
>> implied a page limit that wasn't enough for pg_serial to have space
>> for every possible XID.  We should probably rip that code out, because
>> SLRUs now support five digit segment names.  Something like the
>> attached.  I'll post a test script to demonstrate correct wraparound
>> behaviour around in time for one of the later CFs.
>
> Here is a shell script that shows a full rotation through xid space if
> you build PostgreSQL with TEST_OLDSERXID, which you can do by
> uncommenting a line in predicate.c.  On master we see the SLRU
> segments go around the clock twice for each time xid goes around.
> With the patch it goes around just once, adding an extra character to
> the segment name to double the space.

I attached the wrong version.  Here is the right one.

-- 
Thomas Munro
http://www.enterprisedb.com

Commits

  1. Remove obsolete SLRU wrapping and warnings from predicate.c.

  2. Remove incorrect assertion in clog.c

  3. Keep track of transaction commit timestamps

  4. Handle 5-char filenames in SlruScanDirectory