Re: Fix an incorrect assertion condition in mdwritev().

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Fix an incorrect assertion condition in mdwritev().
Дата
Msg-id 1992.1716696526@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Fix an incorrect assertion condition in mdwritev().  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Fix an incorrect assertion condition in mdwritev().
Re: Fix an incorrect assertion condition in mdwritev().
Список pgsql-hackers
I wrote:
> Hmm ... I agree that this is better normally.  But there's an
> edge case where it would fail to notice a problem that the
> existing code does notice: if blocknum is close to UINT32_MAX
> and adding nblocks causes it to wrap around to a small value.
> Is there an inexpensive way to catch that?

After a few minutes' thought, how about:

    Assert((uint64) blocknum + (uint64) nblocks <= (uint64) mdnblocks(reln, forknum));

This'd stop being helpful if we ever widen BlockNumber to 64 bits,
but I think that's unlikely.  (Partitioning seems like a better answer
for giant tables.)

            regards, tom lane



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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: AIX support
Следующее
От: Junwang Zhao
Дата:
Сообщение: Improve conditional compilation for direct I/O alignment checks