Re: Serious problem: media recovery fails after system or PostgreSQL crash - Mailing list pgsql-hackers

From Kevin Grittner
Subject Re: Serious problem: media recovery fails after system or PostgreSQL crash
Date
Msg-id 20121206165246.142840@gmx.com
Whole thread Raw
Responses Re: Serious problem: media recovery fails after system or PostgreSQL crash
List pgsql-hackers
MauMau wrote:

> [Problem]
> I'm using PostgreSQL 9.1.6 on Linux. I encountered a serious
> problem that media recovery failed showing the following message:
> 
> FATAL: archive file "000000010000008000000028" has wrong size:
> 7340032 instead of 16777216
> 
> I'm using normal cp command to archive WAL files. That is:
> 
>  archive_command = '/path/to/my_script.sh "%p"
"/backup/archive_log/%f"'
> 
> <<my_script.sh>>
> --------------------------------------------------
> #!/bin/sh
> some processing...
> cp "$1" "$2"
> other processing...
> --------------------------------------------------
> 
> 
> The media recovery was triggered by power failure. The disk drive
> that stored $PGDATA failed after a power failure. So I replaced
> the failed disk, and performed media recovery by creating
> recovery.conf and running pg_ctl start. However, pg_ctl failed
> with the above error message.

If you are attempting a PITR-style recovery and you want to include
WAL entries from the partially-copied file, pad a copy of it with
NUL bytes to the expected length.

-Kevin



pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: Functional dependency in GROUP BY through JOINs
Next
From: Stephen Frost
Date:
Subject: Re: Commits 8de72b and 5457a1 (COPY FREEZE)