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

From Alvaro Herrera
Subject Re: [HACKERS] Unlogged tables cleanup
Date
Msg-id 20190513162405.GA19333@alvherre.pgsql
Whole thread Raw
In response to Re: [HACKERS] Unlogged tables cleanup  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: [HACKERS] Unlogged tables cleanup  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
I agree that the wording "recovery may as well" is incorrect and that
"may well" makes it correct.

On 2019-May-13, Robert Haas wrote:

> My guess, just shooting from the hip, is that the smgrimmedsync call
> can be removed here.  If that's wrong, then we need a better
> explanation for why it's needed, and we possibly need to add it to
> every single place that does smgrcreate that doesn't have it already.

AFAICS ResetUnloggedRelations copies the init fork after replaying WAL,
so it would be sufficient to have the init fork be recovered from WAL
for that to work.  However, we also do ResetUnloggedRelations *before*
replaying WAL in order to remove leftover not-init-fork files, and that
process requires that the init fork is present at that time.  So I think
the immedsync call is necessary (otherwise the cleanup may fail).  I
don't quite understand why the log_smgrcreate is necessary, but I think
it is for reasons that are not adequately explained by the existing
comments.

IMO if you can remove either the immedsync or the log_smgrcreate call
and no test fails, then we're either missing test cases, or (one of) the
calls is unnecessary.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



pgsql-hackers by date:

Previous
From: Alexander Kuzmenkov
Date:
Subject: Re: Removing unneeded self joins
Next
From: Andres Freund
Date:
Subject: Re: [HACKERS] Unlogged tables cleanup