Re: snapshot too old issues, first around wraparound and then more.

From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Peter Geoghegan <pg(at)bowt(dot)ie>, Robert Haas <robertmhaas(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, Kevin Grittner <kgrittn(at)gmail(dot)com>
Subject: Re: snapshot too old issues, first around wraparound and then more.
Date: 2020-04-17 05:17:18
Message-ID: CA+hUKG+uDW+NNsss+cwk1O3X=4Ua+vN89jBQV5Sa_txuJ8mOfQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Apr 17, 2020 at 3:37 PM Thomas Munro <thomas(dot)munro(at)gmail(dot)com> wrote:
> On Mon, Apr 13, 2020 at 5:14 PM Andres Freund <andres(at)anarazel(dot)de> wrote:
> > FWIW, I think the part that is currently harder to fix is the time->xmin
> > mapping and some related pieces. Second comes the test
> > infrastructure. Compared to those, adding additional checks for old
> > snapshots wouldn't be too hard - although I'd argue that the approach of
> > sprinkling these tests everywhere isn't that scalable...
>
> Just trying out some ideas here...
> ... so I guess maybe I'll
> need to go and figure out how to write some perl.

Here's a very rough sketch of what I mean. Patches 0001-0003 are
stolen directly from Robert. I think 0005's t/001_truncate.pl
demonstrates that the map is purged of old xids as appropriate. I
suppose this style of testing based on manually advancing the hands of
time should also allow for testing early pruning, but it may be Monday
before I can try that so I'm sharing what I have so far in case it's
useful... I think this really wants to be in src/test/modules, not
contrib, but I just bolted it on top of what Robert posted.

Attachment Content-Type Size
v1-0001-Expose-oldSnapshotControl.patch text/x-patch 6.7 KB
v1-0002-contrib-old_snapshot-time-xid-mapping.patch text/x-patch 7.9 KB
v1-0003-Fix-bugs-in-MaintainOldSnapshotTimeMapping.patch text/x-patch 2.6 KB
v1-0004-Add-pg_clobber_current_snapshot_timestamp.patch text/x-patch 1.9 KB
v1-0005-Truncate-old-snapshot-XIDs-before-truncating-CLOG.patch text/x-patch 7.1 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Noah Misch 2020-04-17 05:41:46 Re: 001_rep_changes.pl stalls
Previous Message Michael Paquier 2020-04-17 04:54:39 Re: It is not documented that pg_promote can exit standby mode