pgsql: Don't open a WAL segment for writing at end of recovery.

From: Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Don't open a WAL segment for writing at end of recovery.
Date: 2015-01-07 14:20:39
Message-ID: E1Y8rTT-0000c1-N9@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Don't open a WAL segment for writing at end of recovery.

Since commit ba94518a, we used XLogFileOpen to open the next segment for
writing, but if the end-of-recovery happens exactly at a segment boundary,
the new segment might not exist yet. (Before ba94518a, XLogFileOpen was
correct, because we would open the previous segment if the switch happened
at the boundary.)

Instead of trying to create it if necessary, it's simpler to not bother
opening the segment at all. XLogWrite() will open or create it soon anyway,
after writing the checkpoint or end-of-recovery record.

Reported by Andres Freund.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/1e78d81e883d7987de8da559d985958335820cc8

Modified Files
--------------
src/backend/access/transam/xlog.c | 5 -----
1 file changed, 5 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Heikki Linnakangas 2015-01-07 14:24:02 Re: [COMMITTERS] pgsql: Change how first WAL segment on new timeline after promotion is
Previous Message Peter Eisentraut 2015-01-07 04:14:06 pgsql: Fix namespace handling in xpath function