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

From Michael Paquier
Subject Re: [HACKERS] Unlogged tables cleanup
Date
Msg-id 20190527021124.GE1963@paquier.xyz
Whole thread Raw
In response to Re: [HACKERS] Unlogged tables cleanup  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: [HACKERS] Unlogged tables cleanup  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
On Thu, May 23, 2019 at 09:14:59AM -0400, Robert Haas wrote:
> Suppose we create an unlogged table and then crash. The main fork
> makes it to disk, and the init fork does not.  Before WAL replay, we
> remove any main forks that have init forks, but because the init fork
> was lost, that does not happen.  Recovery recreates the init fork.
> After WAL replay, we try to copy_file() each _init fork to the
> corresponding main fork. That fails, because copy_file() expects to be
> able to create the target file, and here it can't do that because it
> already exists.

Ah, sorry.  Now I understand your point.  I got your previous message
wrong as I thought about the fact that init forks are logged, hence
after a crash you should still have these at the end of recovery, and
I got confused when you wrote that init forks just disappear.  However
you were referring to the state of a cluster before recovery begins,
and I was thinking about the state where the cluster has run recovery
and has reached consistency.

If we should do something about such cases, then this brings us back
to do (INIT | CLEANUP) at the end of recovery anyway?
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Inconsistent error message wording for REINDEX CONCURRENTLY
Next
From: Michael Paquier
Date:
Subject: Re: initdb recommendations