Re: xlogdump fixups and WAL log question.

From: "Simon Riggs" <simon(at)2ndquadrant(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Alvaro Herrera" <alvherre(at)commandprompt(dot)com>, "Theo Schlossnagle" <jesus(at)omniti(dot)com>, "Martijn van Oosterhout" <kleptog(at)svana(dot)org>, <pgsql-hackers(at)postgresql(dot)org>, "Diogo Biazus" <diogob(at)gmail(dot)com>
Subject: Re: xlogdump fixups and WAL log question.
Date: 2006-10-22 21:39:12
Message-ID: 1161553152.4211.116.camel@silverbirch.site
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, 2006-10-22 at 12:12 -0400, Tom Lane wrote:
> Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:
> > Simon Riggs wrote:
> >> I think it is possible to detect this case without making catalog
> >> entries, so I'll give this a try. Methinks that the truncate *must* be
> >> the immediately preceding command, otherwise we might have a trigger
> >> executing to put rows back into the table before we COPY.
>
> > Hmm, is it possible to save the "is empty" info somewhere in local
> > memory, perhaps the relcache (not necessarily propagated), and have
> > heap_insert turn it off?
>
> The relcache isn't a very safe place to store state --- it's a cache,
> not stable storage.

I was imagining adding this onto the Relation struct, just as we do with
rd_createSubid and rd_targblock. That isn't a safe place to store that
state so we can't do this across multiple backends. We wouldn't want
that anyway since otherwise various statements would need to access
shared state before they can act, which is not good.

> However, I don't understand why Simon is on about "empty". ISTM the
> important state is "new relfilenode assigned in this transaction".

Thank you for supplying clarity of thought; empty would be important if
we were taking full table locks, which we don't want to do (Christmas
Past...). So we need not have the DML immediately following a truncate,
only that a truncate has previously occurred within the top level
transaction or an unaborted subtransaction.

--
Simon Riggs
EnterpriseDB http://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2006-10-22 22:06:13 Re: New CRC algorithm: Slicing by 8
Previous Message Marko Kreen 2006-10-22 20:25:49 Re: New CRC algorithm: Slicing by 8