Re: BUG #17903: There is a bug in the KeepLogSeg()

Поиск
Список
Период
Сортировка
От Kyotaro Horiguchi
Тема Re: BUG #17903: There is a bug in the KeepLogSeg()
Дата
Msg-id 20230421.104231.1594652765237022266.horikyota.ntt@gmail.com
обсуждение исходный текст
Ответ на Re: BUG #17903: There is a bug in the KeepLogSeg()  (Nathan Bossart <nathandbossart@gmail.com>)
Ответы Re: BUG #17903: There is a bug in the KeepLogSeg()  (Nathan Bossart <nathandbossart@gmail.com>)
Список pgsql-bugs
At Thu, 20 Apr 2023 15:02:42 -0700, Nathan Bossart <nathandbossart@gmail.com> wrote in 
> I wonder if it'd be better to instead change
> 
>     if (currSegNo - segno > slot_keep_segs)
> to
>     if (currSegNo > segno + slot_keep_segs)
> 
> and
> 
>     if (currSegNo - segno < keep_segs)
> to
>     if (currSegNo < segNo + keep_segs)
> 
> If segno > currSegNo, the first conditional would be false as expected, and
> the second would be true as expected.  We could also use
> pg_sub_u64_overflow() to detect underflow, but that might be excessive in
> this case.

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.

regards.

-- 
Kyotaro Horiguchi
NTT Open Source Software Center



В списке pgsql-bugs по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Assert failure with ICU support
Следующее
От: Kyotaro Horiguchi
Дата:
Сообщение: Re: pg_basebackup: errors on macOS on directories with ".DS_Store" files