Thread: WAL files required to make base backup consistent

WAL files required to make base backup consistent

From
Virupaksha Kanjilal
Date:
Hi

I perform a pg_basebackup with tar option and do not bring in the WAL segments created during the backup. Now I want to make the backup a consistent copy and for that I need the WAL segments. How can I know which all WAL segments to apply to bring the backup to a consistent state?

Thanks
Viru

Re: WAL files required to make base backup consistent

From
Amit Langote
Date:
On Thu, May 23, 2013 at 6:30 AM, Virupaksha Kanjilal
<v.kanjilal@gmail.com> wrote:
> Hi
>
> I perform a pg_basebackup with tar option and do not bring in the WAL
> segments created during the backup. Now I want to make the backup a
> consistent copy and for that I need the WAL segments. How can I know which
> all WAL segments to apply to bring the backup to a consistent state?
>

By "bringing backup to a consistent state", you mean "restoring from
it to a consistent state", right?
Do you have archiving turned on?

--
Amit Langote


Re: WAL files required to make base backup consistent

From
Jerry Sievers
Date:
Virupaksha Kanjilal <v.kanjilal@gmail.com> writes:

> Hi
>
> I perform a pg_basebackup with tar option and do not bring in the WAL segments created during the backup. Now I want
> to make the backup a consistent copy and for that I need the WAL segments. How can I know which all WAL segments to
> apply to bring the backup to a consistent state?

Look in your WAL repository for files named *.backup.

The prefix part will match the name of a regular WALf file from when
the backup was started and the .backup file itself will contain some
human readable text indicating the last WAL segment that you'll need
for a consistent recovery.

HTH

> Thanks
> Viru
>

--
Jerry Sievers
Postgres DBA/Development Consulting
e: postgres.consulting@comcast.net
p: 312.241.7800


Re: WAL files required to make base backup consistent

From
Sergey Konoplev
Date:
Do you use archive_command or pg_receivexlog to archive your WAL files?

If you use archive_command, then, as Jarry has already stated, you
will have *.backup files in your WAL archive, the latest of which
points to the beginning of the WAL files set needed for the latest
base backup.

If you use pg_receivexlog, you will not have *.backup in the archive,
but could either get the starting WAL segment's name from the
backup_label file, that you can find in the root of your base backup,
or to just get all the WAL files that  was modified not earlier than
the time your base backup file/directory was created.

BTW, the modification/creation time technique works for me, but I
would like to ask the community if there could be any caveats in this
case?

On Tue, May 28, 2013 at 3:03 PM, Jerry Sievers <gsievers19@comcast.net> wrote:
> Virupaksha Kanjilal <v.kanjilal@gmail.com> writes:
>
>> Hi
>>
>> I perform a pg_basebackup with tar option and do not bring in the WAL segments created during the backup. Now I want
>> to make the backup a consistent copy and for that I need the WAL segments. How can I know which all WAL segments to
>> apply to bring the backup to a consistent state?
>
> Look in your WAL repository for files named *.backup.
>
> The prefix part will match the name of a regular WALf file from when
> the backup was started and the .backup file itself will contain some
> human readable text indicating the last WAL segment that you'll need
> for a consistent recovery.
>
> HTH
>
>> Thanks
>> Viru
>>
>
> --
> Jerry Sievers
> Postgres DBA/Development Consulting
> e: postgres.consulting@comcast.net
> p: 312.241.7800
>
>
> --
> Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-admin



--
Kind regards,
Sergey Konoplev
PostgreSQL Consultant and DBA

Profile: http://www.linkedin.com/in/grayhemp
Phone: USA +1 (415) 867-9984, Russia +7 (901) 903-0499, +7 (988) 888-1979
Skype: gray-hemp
Jabber: gray.ru@gmail.com