Re: How to perform PITR when all of the logs won't fit on the drive

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: Tony Sullivan <tony(at)exquisiteimages(dot)com>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: How to perform PITR when all of the logs won't fit on the drive
Date: 2018-03-02 16:29:22
Message-ID: CAMkU=1xt-Cy6m+1AXM4PPxs-8ZejTrZ5SLsm_q-De8p-GM11BA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Mar 1, 2018 at 2:28 PM, Tony Sullivan <tony(at)exquisiteimages(dot)com>
wrote:

> Hello,
>
> I have a situation where something was deleted from a database that
> shouldn't have been so I am having to take a base backup and perform a
> point-in-time-recovery. The problem I have is that the decompressed WAL
> files will not fit on the drive of the machine I am trying to do the
> restore on.
>
> I am wondering if I can arrange the WAL files by date and copy them to the
> directory where they belong and then copy another batch when those are
> restored or if I will need to find some other way of performing the
> recovery.
>
>
You could do that if your timing is right. You need to either make sure
the next batch shows up before the first file in that batch is requested,
or have you restore command wait and retry rather than throw an error when
it asks for a file that does not exist. But your restore command can copy
them from a network drive, or remotely with scp or rsync, and also
decompress them on the fly. That seems simpler.

Another problem you might run into is that the restored WAL records are
retained in pg_xlog for two restart points before being removed, and until
fairly recent versions of PostgreSQL restart points were governed only by
checkpoint_timeout, and not by WAL volume. So if your system restores far
faster than it took to generate the WAL in the first place, this could lead
to massive amounts of WAL kept in pg_xlog running you out of disk space.
So you should lower checkpoint_timeout for recovery to be much less than it
was in production.

Cheers,

Jeff

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2018-03-02 17:54:33 Re: jsonb_array_length: ERROR: 22023: cannot get array length of a scalar
Previous Message Adrian Klaver 2018-03-02 16:21:44 Re: jsonb_array_length: ERROR: 22023: cannot get array length of a scalar