mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-09-30 19:21:16 +02:00
Prevent underflow in KeepLogSeg().
The call to XLogGetReplicationSlotMinimumLSN() might return a
greater LSN than the one given to the function. Subsequent segment
number calculations might then underflow, which could result in
unexpected behavior when removing or recyling WAL files. This was
introduced with max_slot_wal_keep_size in c655077639
. To fix, skip
the block of code for replication slots if the LSN is greater.
Reported-by: Xu Xingwang
Author: Kyotaro Horiguchi
Reviewed-by: Junwang Zhao
Discussion: https://postgr.es/m/17903-4288d439dee856c6%40postgresql.org
Backpatch-through: 13
This commit is contained in:
parent
85ec8bcce2
commit
c98b06e2f8
@ -7298,7 +7298,7 @@ KeepLogSeg(XLogRecPtr recptr, XLogSegNo *logSegNo)
|
|||||||
* max_slot_wal_keep_size.
|
* max_slot_wal_keep_size.
|
||||||
*/
|
*/
|
||||||
keep = XLogGetReplicationSlotMinimumLSN();
|
keep = XLogGetReplicationSlotMinimumLSN();
|
||||||
if (keep != InvalidXLogRecPtr)
|
if (keep != InvalidXLogRecPtr && keep < recptr)
|
||||||
{
|
{
|
||||||
XLByteToSeg(keep, segno, wal_segment_size);
|
XLByteToSeg(keep, segno, wal_segment_size);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user