Re: Low hanging fruit in lazy-XID-assignment patch?

From: "Florian G(dot) Pflug" <fgp(at)phlo(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Low hanging fruit in lazy-XID-assignment patch?
Date: 2007-09-08 00:46:26
Message-ID: 46E1F0E2.2030600@phlo.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> Here's some revised text for the README file, based on using Florian's idea
> of a global latestCompletedXid variable. As I worked through it I realized
> that in this design, XidGenLock gates entry of new XIDs into the ProcArray
> while ProcArrayLock gates their removal. Which is an interesting sort of
> symmetry property. It also turns out that the reason we need to gate entry
> with XidGenLock is to keep from breaking GetOldestXmin, rather than to ensure
> correctness of snapshots per se.
I believe it would break both, no? If an xid <= latestCompletedXid is
not included in the snapshot, but later used for updates, the snapshot
will see those changes as committed when they really are not.

But other than that, it really sounds fine. It certainly explains things much
better than the comments in the existing code.

I noticed two rather cosmetic issues
.) latestCompletedXid sounds as it might refer to the *last* completed xid,
but it actually refers to the largest / highest completed xid. So maybe we
should call it highestCompletedXid or largestCompletedXid.

.) Since you mention that we assume reading and writing int4s are atomic
operations, maybe we should mention that for safety's sake we mark the
corresponding pointers with volatile?

greetings, Florian Pflug

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2007-09-08 01:20:27 Re: Low hanging fruit in lazy-XID-assignment patch?
Previous Message Avery Payne 2007-09-07 22:38:58 Re: A Silly Idea for Vertically-Oriented Databases