Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 1e78d81

Browse files
committed
Don't open a WAL segment for writing at end of recovery.
Since commit ba94518, 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 ba94518, 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.
1 parent 79af9a1 commit 1e78d81

File tree

1 file changed

+0
-5
lines changed
  • src/backend/access/transam

1 file changed

+0
-5
lines changed

src/backend/access/transam/xlog.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5646,7 +5646,6 @@ StartupXLOG(void)
56465646
XLogRecPtr RecPtr,
56475647
checkPointLoc,
56485648
EndOfLog;
5649-
XLogSegNo startLogSegNo;
56505649
TimeLineID PrevTimeLineID;
56515650
XLogRecord *record;
56525651
TransactionId oldestActiveXID;
@@ -6633,7 +6632,6 @@ StartupXLOG(void)
66336632
*/
66346633
record = ReadRecord(xlogreader, LastRec, PANIC, false);
66356634
EndOfLog = EndRecPtr;
6636-
XLByteToSeg(EndOfLog, startLogSegNo);
66376635

66386636
/*
66396637
* Complain if we did not roll forward far enough to render the backup
@@ -6741,9 +6739,6 @@ StartupXLOG(void)
67416739
* buffer cache using the block containing the last record from the
67426740
* previous incarnation.
67436741
*/
6744-
openLogSegNo = startLogSegNo;
6745-
openLogFile = XLogFileOpen(openLogSegNo);
6746-
openLogOff = 0;
67476742
Insert = &XLogCtl->Insert;
67486743
Insert->PrevBytePos = XLogRecPtrToBytePos(LastRec);
67496744
Insert->CurrBytePos = XLogRecPtrToBytePos(EndOfLog);

0 commit comments

Comments
 (0)