pgsql: Fix lastReplayedEndRecPtr calculation when starting from shutdow - Mailing list pgsql-committers

From Heikki Linnakangas
Subject pgsql: Fix lastReplayedEndRecPtr calculation when starting from shutdow
Date
Msg-id E1WLAnL-0006mK-H9@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Fix lastReplayedEndRecPtr calculation when starting from shutdown checkpoint.

When entering crash recovery followed by archive recovery, and the latest
checkpoint is a shutdown checkpoint, and there are no more WAL records to
replay before transitioning from crash to archive recovery, we would not
immediately allow read-only connections in hot standby mode even if we
could. That's because when starting from a shutdown checkpoint, we set
lastReplayedEndRecPtr incorrectly to the record before the checkpoint
record, instead of the checkpoint record itself. We don't run the redo
routine of the shutdown checkpoint record, but starting recovery from it
goes through the same motions, so it should be considered as replayed.

Reported by Kyotaro HORIGUCHI. All versions with hot standby are affected,
so backpatch to 9.0.

Branch
------
master

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

Modified Files
--------------
src/backend/access/transam/xlog.c |   12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)


pgsql-committers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: pgsql: Fix lastReplayedEndRecPtr calculation when starting from shutdow
Next
From: Heikki Linnakangas
Date:
Subject: pgsql: Fix lastReplayedEndRecPtr calculation when starting from shutdow