Re: Do we need so many hint bits? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Do we need so many hint bits?
Date
Msg-id 15965.1353448726@sss.pgh.pa.us
Whole thread Raw
In response to Re: Do we need so many hint bits?  (Merlin Moncure <mmoncure@gmail.com>)
List pgsql-hackers
Merlin Moncure <mmoncure@gmail.com> writes:
> Hm, I wonder if you could squeeze two bits out. ISTM here are the
> interesting cases enumerated:

> 0: xmin unknown
> 1: xmin invalid
> 2: xmin valid, xmax unknown
> 3: xmin valid, xmax invalid
> 4: xmin valid, xmax valid

> Did I miss any?

Yes.  xmin unknown, xmax unknown is possible and different from all the
above, ie a tuple can be deleted by the creating transaction.  (But it
could still be visible to some of that transaction's snapshots, so you
can't equate this state to "xmin invalid".)

There's a fairly big problem with any of these ideas, and it's not
even on-disk compatibility.  It is that we assume that hint bits can be
set without exclusive lock on the buffer.  If any of the transitions
xmin unknown -> xmin committed, xmin unknown -> xmin aborted,
xmax unknown -> xmax committed, xmax unknown -> xmax aborted
aren't expressed by setting a bit that wasn't set before, we probably
lose that property, and thereby a whole lot of concurrency.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: [PATCH] binary heap implementation
Next
From: Jeff Janes
Date:
Subject: Re: StrategyGetBuffer questions