Skip to content

Commit 5940413

Browse files
committed
Fix calculation of how many segments to retain for wal_keep_segments.
KeepLogSeg function was broken when we switched to use a 64-bit int for the segment number. Per report from Jeff Janes.
1 parent 5787c67 commit 5940413

File tree

1 file changed

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

1 file changed

+4
-4
lines changed

src/backend/access/transam/xlog.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7523,9 +7523,9 @@ CreateRestartPoint(int flags)
75237523
}
75247524

75257525
/*
7526-
* Calculate the last segment that we need to retain because of
7527-
* wal_keep_segments, by subtracting wal_keep_segments from
7528-
* the given xlog location, recptr.
7526+
* Retreat *logSegNo to the last segment that we need to retain because of
7527+
* wal_keep_segments. This is calculated by subtracting wal_keep_segments
7528+
* from the given xlog location, recptr.
75297529
*/
75307530
static void
75317531
KeepLogSeg(XLogRecPtr recptr, XLogSegNo *logSegNo)
@@ -7541,7 +7541,7 @@ KeepLogSeg(XLogRecPtr recptr, XLogSegNo *logSegNo)
75417541
if (segno <= wal_keep_segments)
75427542
segno = 1;
75437543
else
7544-
segno = *logSegNo - wal_keep_segments;
7544+
segno = segno - wal_keep_segments;
75457545

75467546
/* don't delete WAL segments newer than the calculated segment */
75477547
if (segno < *logSegNo)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy