Re: Avoid unncessary always true test (src/backend/storage/buffer/bufmgr.c)

Поиск
Список
Период
Сортировка
От Richard Guo
Тема Re: Avoid unncessary always true test (src/backend/storage/buffer/bufmgr.c)
Дата
Msg-id CAMbWs4_Jv4p_ib2ZZvUYhgoeSpOABjAW_4chkAhrSU=iW8CRGA@mail.gmail.com
обсуждение исходный текст
Ответ на Avoid unncessary always true test (src/backend/storage/buffer/bufmgr.c)  (Ranier Vilela <ranier.vf@gmail.com>)
Ответы Re: Avoid unncessary always true test (src/backend/storage/buffer/bufmgr.c)  (Ranier Vilela <ranier.vf@gmail.com>)
Список pgsql-hackers

On Sun, Jun 4, 2023 at 8:42 PM Ranier Vilela <ranier.vf@gmail.com> wrote:
Hi,

Per Coverity.

At function ExtendBufferedRelShared, has a always true test.
eb.rel was dereferenced one line above, so in
if (eb.rel) is always true.

I think it's worth removing the test, because Coverity raises dozens of alerts thinking eb.rel might be NULL.
Besides, one less test is one less branch.

This also happens in ExtendBufferedRelTo, and the comment there explains
that the eb.rel 'could have been closed while waiting for lock'.  So for
the same consideration, the test in ExtendBufferedRelShared might be
still needed?  But I'm not familiar with the arounding codes, so need
someone else to confirm that.

Thanks
Richard

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

Предыдущее
От: Jeremy Schneider
Дата:
Сообщение: collation settings table in v16 docs
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Cleaning up array_in()