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

Commitb5b4c0f

Browse files
committed
Fix uninitialized value in segno calculation
Remove previous hack in KeepLogSeg that added a case to deal with a(badly represented) invalid segment number. This was added for the sakeof GetWALAvailability. But it's not needed if in that function weinitialize the segment number to be retreated to the currently beingwritten segment, so do that instead.Per valgrind-running buildfarm member skink, and some sparc64 animals.Discussion:https://postgr.es/m/1724648.1594230917@sss.pgh.pa.us
1 parent25fe5ac commitb5b4c0f

File tree

1 file changed

+9
-6
lines changed
  • src/backend/access/transam

1 file changed

+9
-6
lines changed

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

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9523,13 +9523,13 @@ GetWALAvailability(XLogRecPtr targetLSN)
95239523
if (XLogRecPtrIsInvalid(targetLSN))
95249524
returnWALAVAIL_INVALID_LSN;
95259525

9526-
currpos=GetXLogWriteRecPtr();
9527-
95289526
/*
9529-
* calculate the oldest segment currently reserved by all slots,
9530-
* considering wal_keep_segments and max_slot_wal_keep_size
9527+
* Calculate the oldest segment currently reserved by all slots,
9528+
* considering wal_keep_segments and max_slot_wal_keep_size. Initialize
9529+
* oldestSlotSeg to the current segment.
95319530
*/
9532-
XLByteToSeg(targetLSN,targetSeg,wal_segment_size);
9531+
currpos=GetXLogWriteRecPtr();
9532+
XLByteToSeg(currpos,oldestSlotSeg,wal_segment_size);
95339533
KeepLogSeg(currpos,&oldestSlotSeg);
95349534

95359535
/*
@@ -9548,6 +9548,9 @@ GetWALAvailability(XLogRecPtr targetLSN)
95489548
else
95499549
oldestSegMaxWalSize=1;
95509550

9551+
/* the segment we care about */
9552+
XLByteToSeg(targetLSN,targetSeg,wal_segment_size);
9553+
95519554
/*
95529555
* No point in returning reserved or extended status values if the
95539556
* targetSeg is known to be lost.
@@ -9624,7 +9627,7 @@ KeepLogSeg(XLogRecPtr recptr, XLogSegNo *logSegNo)
96249627
}
96259628

96269629
/* don't delete WAL segments newer than the calculated segment */
9627-
if (XLogRecPtrIsInvalid(*logSegNo)||segno<*logSegNo)
9630+
if (segno<*logSegNo)
96289631
*logSegNo=segno;
96299632
}
96309633

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp