postgresql/src/backend
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
..
access Refactor checking whether we've reached the recovery target. 2014-01-09 14:00:39 +02:00
bootstrap Update copyright for 2014 2014-01-07 16:05:30 -05:00
catalog Update copyright for 2014 2014-01-07 16:05:30 -05:00
commands Update copyright for 2014 2014-01-07 16:05:30 -05:00
executor Fix "cannot accept a set" error when only some arms of a CASE return a set. 2014-01-08 20:18:58 -05:00
foreign Update copyright for 2014 2014-01-07 16:05:30 -05:00
lib Update copyright for 2014 2014-01-07 16:05:30 -05:00
libpq Update copyright for 2014 2014-01-07 16:05:30 -05:00
main Update copyright for 2014 2014-01-07 16:05:30 -05:00
nodes Update copyright for 2014 2014-01-07 16:05:30 -05:00
optimizer Update copyright for 2014 2014-01-07 16:05:30 -05:00
parser Update copyright for 2014 2014-01-07 16:05:30 -05:00
po Translation updates 2013-12-02 00:17:07 -05:00
port Update copyright for 2014 2014-01-07 16:05:30 -05:00
postmaster Reduce the number of semaphores used under --disable-spinlocks. 2014-01-08 18:58:00 -05:00
regex Update copyright for 2014 2014-01-07 16:05:30 -05:00
replication Update copyright for 2014 2014-01-07 16:05:30 -05:00
rewrite Update copyright for 2014 2014-01-07 16:05:30 -05:00
snowball Update copyright for 2014 2014-01-07 16:05:30 -05:00
storage We don't need to include pg_sema.h in s_lock.h anymore. 2014-01-08 20:58:22 -05:00
tcop Update copyright for 2014 2014-01-07 16:05:30 -05:00
tsearch Update copyright for 2014 2014-01-07 16:05:30 -05:00
utils Avoid extra AggCheckCallContext() checks in ordered-set aggregates. 2014-01-08 14:33:52 -05:00
.gitignore Add gitignore for mingw/cygwin build outputs 2011-06-09 18:11:47 +02:00
common.mk Remove maintainer-check target, fold into normal build 2013-10-10 20:11:56 -04:00
Makefile Update copyright for 2014 2014-01-07 16:05:30 -05:00
nls.mk Add libpgcommon to backend gettext source files 2013-10-19 13:49:05 -04:00