Fix lastReplayedEndRecPtr calculation when starting from shutdown checkpoint.
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Wed, 5 Mar 2014 11:27:18 +0000 (13:27 +0200)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Wed, 5 Mar 2014 11:51:19 +0000 (13:51 +0200)
commitaf246c37c056e3b16be04e899e94e3a100f3918e
treee53257c2cee8775c354b1a9ef82e551f9914c36f
parenteb933162cdcbcaa5c56c75eb21b9c055af9748a0
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.
src/backend/access/transam/xlog.c