postgresql/src
Heikki Linnakangas c945af80cf Refactor checking whether we've reached the recovery target.
Makes the replay loop slightly more readable, by separating the concerns of
whether to stop and whether to delay, and how to extract the timestamp from
a record.

This has the user-visible change that the timestamp of the last applied
record is now updated after actually applying it. Before, it was updated
just before applying it. That meant that pg_last_xact_replay_timestamp()
could return the timestamp of a commit record that is in process of being
replayed, but not yet applied. Normally the difference is small, but if
min_recovery_apply_delay is set, there could be a significant delay between
reading a record and applying it.

Another behavioral change is that if you recover to a restore point, we stop
after the restore point record, not before it. It makes no difference as far
as running queries on the server is concerned, as applying a restore point
record changes nothing, but if examine the timeline history you will see
that the new timeline branched off just after the restore point record, not
before it. One practical consequence is that if you do PITR to the new
timeline, and set recovery target to the same named restore point again, it
will find and stop recovery at the same restore point. Conceptually, I think
it makes more sense to consider the restore point as part of the new
timeline's history than not.

In principle, setting the last-replayed timestamp before actually applying
the record was a bug all along, but it doesn't seem worth the risk to
backpatch, since min_recovery_apply_delay was only added in 9.4.
2014-01-09 14:00:39 +02:00
..
backend Refactor checking whether we've reached the recovery target. 2014-01-09 14:00:39 +02:00
bin Update copyright for 2014 2014-01-07 16:05:30 -05:00
common Update copyright for 2014 2014-01-07 16:05:30 -05:00
include We don't need to include pg_sema.h in s_lock.h anymore. 2014-01-08 20:58:22 -05:00
interfaces Update copyright for 2014 2014-01-07 16:05:30 -05:00
makefiles Remove leftovers of IRIX port 2013-11-12 06:39:36 -05:00
pl Update copyright for 2014 2014-01-07 16:05:30 -05:00
port Update copyright for 2014 2014-01-07 16:05:30 -05:00
template Remove leftovers of IRIX port 2013-11-12 06:39:36 -05:00
test Fix "cannot accept a set" error when only some arms of a CASE return a set. 2014-01-08 20:18:58 -05:00
timezone Update copyright for 2014 2014-01-07 16:05:30 -05:00
tools Update copyright for 2014 2014-01-07 16:05:30 -05:00
tutorial Update copyright for 2014 2014-01-07 16:05:30 -05:00
.gitignore Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:04 +02:00
bcc32.mak Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
DEVELOPERS Replace a couple of references to files that no longer exist in the source 2009-05-04 08:08:47 +00:00
Makefile Create libpgcommon, and move pg_malloc et al to it 2013-02-12 11:21:05 -03:00
Makefile.global.in build: pass EXTRA_REGRESS_OPTS to secondary regression tests 2013-12-04 10:14:45 -05:00
Makefile.shlib Remove IRIX port. 2013-10-18 08:14:21 -04:00
nls-global.mk Remove maintainer-check target, fold into normal build 2013-10-10 20:11:56 -04:00
win32.mak Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00