pgsql: Refactor checking whether we've reached the recovery target.

Поиск
Список
Период
Сортировка
От Heikki Linnakangas
Тема pgsql: Refactor checking whether we've reached the recovery target.
Дата
Msg-id E1W1EI8-0003pj-Us@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
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.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/c945af80cfdaf72adb91d6688fb3a4c4f17c0757

Modified Files
--------------
src/backend/access/transam/xlog.c |  357 +++++++++++++++++++++----------------
1 file changed, 200 insertions(+), 157 deletions(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: pgsql: pgcrypto: Make header files stand alone
Следующее
От: Michael Meskes
Дата:
Сообщение: pgsql: Fix descriptor output in ECPG.