Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfb886c1

Browse files
committed
Fix possibility of creating a "phantom" segment after promotion.
When promoting a standby just after a XLOG_SWITCH record was replayed,and next segment(s) are already are locally available (via walsender,restore_command + trigger/recovery target), that segment couldaccidentally be recycled onto the past of the new timeline. Latercheckpointer would create a .ready file for it, assuming there was anerror during creation, and it would get archived. That causes troubleif another standby is later brought up from a basebackup from beforethe timeline creation, because it would try to read thesegment, because XLogFileReadAnyTLI just tries all possible timelines,which doesn't have valid contents. Thus replay would fail.The problem, if already occurred, can be fixed by removing the segmentand/or having restore_command filter it out.The reason for the creation of such "phantom" segments was, that afteran XLOG_SWITCH record the EndOfLog variable points to the beginning ofthe next segment, and RemoveXlogFile() used XLByteToPrevSeg().Normally RemoveXlogFile() doing so is harmless, because the lastsegment will still exist preventing InstallXLogFileSegment() fromcausing harm, but just after promotion there's no previous segment onthe new timeline.Fix that by using XLByteToSeg() instead of XLByteToPrevSeg().Author: Andres FreundReported-By: Greg BurekDiscussion:https://postgr.es/m/20170619073026.zcwpe6mydsaz5ygd@alap3.anarazel.deBackpatch: 9.2-, bug older than all supported versions
1 parent780b3a4 commitfb886c1

File tree

1 file changed

+1
-1
lines changed
  • src/backend/access/transam

1 file changed

+1
-1
lines changed

‎src/backend/access/transam/xlog.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3974,7 +3974,7 @@ RemoveXlogFile(const char *segname, XLogRecPtr PriorRedoPtr, XLogRecPtr endptr)
39743974
/*
39753975
* Initialize info about where to try to recycle to.
39763976
*/
3977-
XLByteToPrevSeg(endptr,endlogSegNo);
3977+
XLByteToSeg(endptr,endlogSegNo);
39783978
if (PriorRedoPtr==InvalidXLogRecPtr)
39793979
recycleSegNo=endlogSegNo+10;
39803980
else

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp