Re: [HACKERS] Unlogged tables cleanup

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Kuntal Ghosh <kuntalghosh(dot)2007(at)gmail(dot)com>, konstantin knizhnik <k(dot)knizhnik(at)postgrespro(dot)ru>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [HACKERS] Unlogged tables cleanup
Date: 2019-05-13 16:24:05
Message-ID: 20190513162405.GA19333@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message gilberto.castillo 2019-05-13 16:25:53 Re: PostgreSQL 12: Feature Highlights
Previous Message Peter Geoghegan 2019-05-13 16:23:08 Re: PostgreSQL 12: Feature Highlights