Re: [HACKERS] Unlogged tables cleanup - Mailing list pgsql-hackers

From Andres Freund
Subject Re: [HACKERS] Unlogged tables cleanup
Date
Msg-id 20190513173834.kgddkwrsvq7inapg@alap3.anarazel.de
Whole thread Raw
In response to Re: [HACKERS] Unlogged tables cleanup  (Alvaro Herrera <alvherre@2ndquadrant.com>)
List pgsql-hackers
Hi,

On 2019-05-13 13:21:33 -0400, Alvaro Herrera wrote:
> On 2019-May-13, Robert Haas wrote:
> > If that's the scenario, I'm not sure the smgrimmedsync() call is
> > sufficient.  Suppose we log_smgrcreate() but then crash before
> > smgrimmedsync()... seems like we'd need to do them in the other order,
> > or else maybe just pass a flag to copy_file() telling it not to be so
> > picky.
> 
> Well, if we do modify copy_file and thus we don't think the deletion
> step serves any purpose, why not just get rid of the deletion step
> entirely?

Well, it does serve a purpose:
        /*
         * We're in recovery, so unlogged relations may be trashed and must be
         * reset.  This should be done BEFORE allowing Hot Standby
         * connections, so that read-only backends don't try to read whatever
         * garbage is left over from before.
         */

but I'm somewhat doubtful that this logic is correct.

Greetings,

Andres Freund



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: [HACKERS] Unlogged tables cleanup
Next
From: Andrew Gierth
Date:
Subject: Re: SQL-spec incompatibilities in similar_escape() and related stuff