Re: preserving forensic information when we freeze - Mailing list pgsql-hackers

From Andres Freund
Subject Re: preserving forensic information when we freeze
Date
Msg-id 20131121144725.GB31748@awork2.anarazel.de
Whole thread Raw
In response to preserving forensic information when we freeze  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: preserving forensic information when we freeze  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
Hi,

As promised I'm currently updating the patch. Some questions arose
during that:

* Should HeapTupleHeaderXminFrozen also check for FrozenTransactionId?
  It seems quite possible that people think they've delt with frozen
  xmin entirely after checking, but they still might get
  FrozenTransactionId back in a pg_upgraded cluster.
* Existing htup_details boolean checks contain an 'Is', but
  HeapTupleHeaderXminCommitted, HeapTupleHeaderXminInvalid,
  HeapTupleHeaderXminFrozen don't contain any verb. Not sure.
* EvalPlanQualFetch() uses priorXmax like logic to find updated versions
  of tuples. I am not 100% sure there aren't cases where that's
  problematic even with the current code, but I think it's better not to
  use the raw xid there - priorXmax can never be FrozenTransactionId, so
  comparing it to the GetXmin() seems better.
  It also has the following wrong comment:
     * ....  (Should be safe to examine xmin without getting
     * buffer's content lock, since xmin never changes in an existing
     * tuple.)
  But I don't see that causing any problems.
* ri_trigger.c did do a TransactionIdIsCurrentTransactionId() on a raw
  xmin value, the consequences are minor though.

The rewrite to introduce HeapTupleHeaderGet[Raw]Xmin() indeed somewhat
increases the patchsize - but I think it's enough increase in
expressiveness to be well worth the cost. Indeed it led me to find at
least one issue (with minor consequences).

I think once we have this we should start opportunistically try to
freeze tuples during vacuum using OldestXmin instead of FreezeLimit if
the page is already dirty.

Patch 01 is a rebased version of Robert's patch without further changes,
02 contains my suggested modifications.

Greetings,

Andres Freund

--
 Andres Freund                       http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services

Attachment

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Proof of concept: standalone backend with full FE/BE protocol
Next
From: Dean Rasheed
Date:
Subject: Re: WIP patch for updatable security barrier views