pgsql: Fix lastReplayedEndRecPtr calculation when starting from shutdow

From: Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix lastReplayedEndRecPtr calculation when starting from shutdow
Date: 2014-03-05 12:19:31
Message-ID: E1WLAnL-0006mR-Mm@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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
------
REL9_1_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/7552d3d1aba33198141f4953379f819df23988cf

Modified Files
--------------
src/backend/access/transam/xlog.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Heikki Linnakangas 2014-03-05 12:51:24 pgsql: Do wal_level and hot standby checks when doing crash-then-archiv
Previous Message Thom Brown 2014-03-05 11:48:02 Re: pgsql: Fix issues with pg_ctl