avoid unnecessary failure to open restored WAL files

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: avoid unnecessary failure to open restored WAL files
Date: 2012-08-02 16:18:43
Message-ID: CAHGQGwFSb=JSgvz5Ru3R=MjoR6oN43mYcQOCeHSXyE9rSgRQJg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

In HEAD and 9.2, the following scenario happens in archive recovery.

1. The archived WAL file is restored onto the temporary file name
"RECOVERYXLOG".
2. The restored WAL file is renamed to the correct file name like
000000010000000000000002.
3. The startup process tries to open the temporary file even though
it's already been renamed
and doesn't exist. This always fails.
4. The startup process retries to open the correct file as a WAL file
in pg_xlog directory instead
of the archived file. This succeeds.

The above failure of file open is unnecessary, so I think we can avoid
that. Attached patch
changes the startup process so that it opens the correct restored WAL
file after restoring the
archived WAL file.

Regards,

--
Fujii Masao

Attachment Content-Type Size
file_open_failure_v1.patch application/octet-stream 440 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kevin Grittner 2012-08-02 16:28:53 Re: WIP Patch: Use sortedness of CSV foreign tables for query planning
Previous Message Tom Lane 2012-08-02 15:05:34 Re: Reminder: 9.2beta3 wraps tonight