Re: Hot Backup with rsync fails at pg_clog if under load

From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Florian Pflug <fgp(at)phlo(dot)org>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Aidan Van Dyk <aidan(at)highrise(dot)ca>, Linas Virbalas <linas(dot)virbalas(at)continuent(dot)com>, Euler Taveira de Oliveira <euler(at)timbira(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Hot Backup with rsync fails at pg_clog if under load
Date: 2011-09-23 16:58:30
Message-ID: 4E7CBAB6.6010205@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 23.09.2011 19:49, Florian Pflug wrote:
> On Sep23, 2011, at 18:45 , Robert Haas wrote:
>> Ah. I think you are right - Heikki made the same point. Maybe some
>> of the stuff that happens just after this comment:
>>
>> /*
>> * Initialize for Hot Standby, if enabled. We won't let backends in
>> * yet, not until we've reached the min recovery point specified in
>> * control file and we've established a recovery snapshot from a
>> * running-xacts WAL record.
>> */
>>
>>
>> ...actually needs to be postponed until after we've reached consistency?
>
> I came the the same conclusion. It seems the before we've reached consistency,
> we shouldn't attempt to read anything because the data can be pretty arbitrarily
> garbled.

There are pretty clear rules on what state clog can be in. When you
launch postmaster in a standby:

* Any clog preceding the nextXid from the checkpoint record we start
recovery from, must either be valid, or the clog file must be missing
altogether (which can happen when it was vacuumed away while the backup
in progress - if the clog is still needed at the end of backup it must
not be missing, of course).
* Any clog following nextXid can be garbled or missing.

Recovery will overwrite any clog after nextXid from the WAL, but not the
clog before it.

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2011-09-23 17:00:23 Re: citext operator precedence fix
Previous Message Josh Berkus 2011-09-23 16:51:29 Re: unite recovery.conf and postgresql.conf