Re: BUG #17903: There is a bug in the KeepLogSeg() - Mailing list pgsql-bugs

From Nathan Bossart
Subject Re: BUG #17903: There is a bug in the KeepLogSeg()
Date
Msg-id 20230421214347.GA1441786@nathanxps13
Whole thread Raw
In response to Re: BUG #17903: There is a bug in the KeepLogSeg()  (Kyotaro Horiguchi <horikyota.ntt@gmail.com>)
Responses Re: BUG #17903: There is a bug in the KeepLogSeg()
List pgsql-bugs
On Fri, Apr 21, 2023 at 10:42:31AM +0900, Kyotaro Horiguchi wrote:
> From what I understand, the XLogSegNo calculations are designed
> without considering the actual value range. Basically, it assumes that
> (XLogSegNo + <any positive int>) can overflow.  If we take the actual
> value range into account, we can make that change.
> 
> The choice lies on whether we assume the actual value range or not.

Yeah, after staring at this some more, I think your proposed fix is the way
to go.  Alternatively, we could adjust the conditional for the
max_slot_wal_keep_size block to

    if (keep != InvalidXLogRecPtr && keep < recptr)

but AFAICT that yields the exact same behavior.

-- 
Nathan Bossart
Amazon Web Services: https://aws.amazon.com



pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #17906: Segmentation fault and database crash during procedure call
Next
From: Anderson Antunes
Date:
Subject: Re: BUG #16628: Hostame and string connection functions