diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2015-01-07 16:11:33 +0200 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2015-01-07 16:20:20 +0200 |
commit | 1e78d81e883d7987de8da559d985958335820cc8 (patch) | |
tree | aed83bd57d63e3d5579988f2ff66ac723ee82a01 /src/backend/access/transam/xlog.c | |
parent | 79af9a1d2668c9edc8171f03c39e7fed571eeb98 (diff) | |
download | postgresql-1e78d81e883d7987de8da559d985958335820cc8.tar.gz postgresql-1e78d81e883d7987de8da559d985958335820cc8.zip |
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.
Diffstat (limited to 'src/backend/access/transam/xlog.c')
-rw-r--r-- | src/backend/access/transam/xlog.c | 5 |
1 files changed, 0 insertions, 5 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 218de876e4d..839ea7c7a05 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -5646,7 +5646,6 @@ StartupXLOG(void) XLogRecPtr RecPtr, checkPointLoc, EndOfLog; - XLogSegNo startLogSegNo; TimeLineID PrevTimeLineID; XLogRecord *record; TransactionId oldestActiveXID; @@ -6633,7 +6632,6 @@ StartupXLOG(void) */ record = ReadRecord(xlogreader, LastRec, PANIC, false); EndOfLog = EndRecPtr; - XLByteToSeg(EndOfLog, startLogSegNo); /* * Complain if we did not roll forward far enough to render the backup @@ -6741,9 +6739,6 @@ StartupXLOG(void) * buffer cache using the block containing the last record from the * previous incarnation. */ - openLogSegNo = startLogSegNo; - openLogFile = XLogFileOpen(openLogSegNo); - openLogOff = 0; Insert = &XLogCtl->Insert; Insert->PrevBytePos = XLogRecPtrToBytePos(LastRec); Insert->CurrBytePos = XLogRecPtrToBytePos(EndOfLog); |