From: | Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl> |
---|---|
To: | Simon Riggs <simon(at)2ndquadrant(dot)com> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: PITR Redo Create Database fails |
Date: | 2004-07-08 15:19:33 |
Message-ID: | 20040708151933.GA8362@dcc.uchile.cl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thu, Jul 08, 2004 at 02:58:01PM +0100, Simon Riggs wrote:
> I've discovered that CREATE DATABASE doesn't redo correctly in an
> archive recovery test.
>
> This isn't a bug --in the current code--, because when crash recovery
> occurs, the database directories are already there, so this only doesn't
> work when using the PITR patches. During archive recovery, nothing is
> there, so needs to be created.
>
> It looks like CREATE DATABASE doesn't produce redo, nor is there a
> replay command created for it.
[...]
> The FileNameOpenFile fails when the first relation in the database is
> created. The code assumes that any failure of the FileNameOpenFile is
> because the file is already there, then tries to open it which also
> fails. The failure is caused by the fact that there is no directory (as
> well as no file), but that isn't tested for.
I don't think it's a good idea to just create a directory if it's not
already there. It would mean creating a spurious directory with an
empty file if the data is corrupted and a wrong RelFileNode is in memory
for whatever reason.
The correct solution would be to emit a XLog record for CREATE
DATABASE ...
--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"El destino baraja y nosotros jugamos" (A. Schopenhauer)
From | Date | Subject | |
---|---|---|---|
Next Message | Rod Taylor | 2004-07-08 16:24:21 | Bug: psql misquotes constraints |
Previous Message | Simon Riggs | 2004-07-08 13:58:01 | PITR Redo Create Database fails |