mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-21 08:29:39 +08:00
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.
This commit is contained in:
parent
5787c6730e
commit
594041311c
@ -7523,9 +7523,9 @@ CreateRestartPoint(int flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Calculate the last segment that we need to retain because of
|
* Retreat *logSegNo to the last segment that we need to retain because of
|
||||||
* wal_keep_segments, by subtracting wal_keep_segments from
|
* wal_keep_segments. This is calculated by subtracting wal_keep_segments
|
||||||
* the given xlog location, recptr.
|
* from the given xlog location, recptr.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
KeepLogSeg(XLogRecPtr recptr, XLogSegNo *logSegNo)
|
KeepLogSeg(XLogRecPtr recptr, XLogSegNo *logSegNo)
|
||||||
@ -7541,7 +7541,7 @@ KeepLogSeg(XLogRecPtr recptr, XLogSegNo *logSegNo)
|
|||||||
if (segno <= wal_keep_segments)
|
if (segno <= wal_keep_segments)
|
||||||
segno = 1;
|
segno = 1;
|
||||||
else
|
else
|
||||||
segno = *logSegNo - wal_keep_segments;
|
segno = segno - wal_keep_segments;
|
||||||
|
|
||||||
/* don't delete WAL segments newer than the calculated segment */
|
/* don't delete WAL segments newer than the calculated segment */
|
||||||
if (segno < *logSegNo)
|
if (segno < *logSegNo)
|
||||||
|
Loading…
Reference in New Issue
Block a user