pgsql: If backup-end record is not seen, and we reach end of recovery f

From: Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: If backup-end record is not seen, and we reach end of recovery f
Date: 2011-08-10 06:22:56
Message-ID: E1Qr2Bs-000560-5k@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

If backup-end record is not seen, and we reach end of recovery from a
streamed backup, throw an error and refuse to start up. The restore has not
finished correctly in that case and the data directory is possibly corrupt.
We already errored out in case of archive recovery, but could not during
crash recovery because we couldn't distinguish between the case that
pg_start_backup() was called and the database then crashed (must not error,
data is OK), and the case that we're restoring from a backup and not all
the needed WAL was replayed (data can be corrupt).

To distinguish those cases, add a line to backup_label to indicate
whether the backup was taken with pg_start/stop_backup(), or by streaming
(ie. pg_basebackup).

This requires re-initdb, because of a new field added to the control file.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/41f9ffd928b6fdcedd685483e777b0fa71ece47c

Modified Files
--------------
src/backend/access/transam/xlog.c | 39 +++++++++++++++++++++++++++++++-----
src/include/catalog/pg_control.h | 9 +++++++-
2 files changed, 41 insertions(+), 7 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Heikki Linnakangas 2011-08-10 06:29:24 pgsql: Oops, we're working on version 9.2 already, not 9.1. Update the
Previous Message Tom Lane 2011-08-09 22:52:57 pgsql: Measure WaitLatch's timeout parameter in milliseconds, not micro