Go to file
Heikki Linnakangas abf5c5c9a4 If recovery.conf is created after "pg_ctl stop -m i", do crash recovery.
If you create a base backup using an atomic filesystem snapshot, and try to
perform PITR starting from that base backup, or if you just kill a master
server and create recovery.conf to put it into standby mode, we don't know
how far we need to recover before reaching consistency. Normally in crash
recovery, we replay all the WAL present in pg_xlog, and assume that we're
consistent after that. And normally in archive recovery, minRecoveryPoint,
backupEndRequired, or backupEndPoint is set in the control file, indicating
how far we need to replay to reach consistency. But if the server was
previously up and running normally, and you kill -9 it or take an atomic
filesystem snapshot, none of those fields are set in the control file.

The solution is to perform crash recovery first, replaying all the WAL in
pg_xlog. After that's done, we assume that the system is consistent like in
normal crash recovery, and switch to archive recovery mode after that.

Per report from Kyotaro HORIGUCHI. In his scenario, recovery.conf was
created after "pg_ctl stop -m i". I'm not sure we need to support that exact
scenario, but we should support backing up using a filesystem snapshot,
which looks identical.

This issue goes back to at least 9.0, where hot standby was introduced and
we started to track when consistency is reached. In 9.1 and 9.2, we would
open up for hot standby too early, and queries could briefly see an
inconsistent state. But 9.2 made it more visible, as we started to PANIC if
we see a reference to a non-existing page during recovery, if we've already
reached consistency. This is a fairly big patch, so back-patch to 9.2 only,
where the issue is more visible. We can consider back-patching further after
this has received some more testing in 9.2 and master.
2013-02-22 12:32:41 +02:00
config Improve handling of ereport(ERROR) and elog(ERROR). 2013-01-13 18:40:09 -05:00
contrib Need to decorate XactIsoLevel as PGDLLIMPORT for postgres_fdw. 2013-02-21 09:28:42 -05:00
doc Add postgres_fdw contrib module. 2013-02-21 05:27:16 -05:00
src If recovery.conf is created after "pg_ctl stop -m i", do crash recovery. 2013-02-22 12:32:41 +02:00
.gitignore Gitignore vcxproj files. 2013-01-23 03:44:37 -05:00
COPYRIGHT Update copyrights for 2013 2013-01-01 17:15:01 -05:00
GNUmakefile.in Make init-po and update-po recursive make targets 2012-06-29 14:01:54 +03:00
Makefile Allow make check in PL directories 2011-02-15 06:52:12 +02:00
README Remove useless whitespace at end of lines 2010-11-23 22:34:55 +02:00
README.git Trivial typo fix. 2010-09-21 14:16:00 -04:00
aclocal.m4 Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
configure Improve handling of ereport(ERROR) and elog(ERROR). 2013-01-13 18:40:09 -05:00
configure.in Improve handling of ereport(ERROR) and elog(ERROR). 2013-01-13 18:40:09 -05:00

README

PostgreSQL Database Management System
=====================================

This directory contains the source code distribution of the PostgreSQL
database management system.

PostgreSQL is an advanced object-relational database management system
that supports an extended subset of the SQL standard, including
transactions, foreign keys, subqueries, triggers, user-defined types
and functions.  This distribution also contains C language bindings.

PostgreSQL has many language interfaces, many of which are listed here:

	http://www.postgresql.org/download

See the file INSTALL for instructions on how to build and install
PostgreSQL.  That file also lists supported operating systems and
hardware platforms and contains information regarding any other
software packages that are required to build or run the PostgreSQL
system.  Changes between all PostgreSQL releases are recorded in the
file HISTORY.  Copyright and license information can be found in the
file COPYRIGHT.  A comprehensive documentation set is included in this
distribution; it can be read as described in the installation
instructions.

The latest version of this software may be obtained at
http://www.postgresql.org/download/.  For more information look at our
web site located at http://www.postgresql.org/.