Re: simplehash: preserve consistency in case of OOM

Поиск
Список
Период
Сортировка
От Jeff Davis
Тема Re: simplehash: preserve consistency in case of OOM
Дата
Msg-id 1e4dc513f7feb4df416db1bf74424156131ceb63.camel@j-davis.com
обсуждение исходный текст
Ответ на Re: simplehash: preserve consistency in case of OOM  (Andres Freund <andres@anarazel.de>)
Ответы Re: simplehash: preserve consistency in case of OOM  (Andres Freund <andres@anarazel.de>)
Список pgsql-hackers
On Fri, 2023-11-17 at 12:13 -0800, Andres Freund wrote:
> On 2023-11-17 10:42:54 -0800, Jeff Davis wrote:
> > Right now, if allocation fails while growing a hashtable, it's left
> > in
> > an inconsistent state and can't be used again.
>
> I'm not against allowing this - but I am curious, in which use cases
> is this
> useful?

I committed a cache for search_path (f26c2368dc), and afterwards got
concerned that I missed some potential OOM hazards. I separately posted
a patch to fix those (mostly by simplifying things, which in hindsight
was how it should have been done to begin with). Along the way, I also
noticed that simplehash itself is not safe in that case.

I don't think there are other bugs in the system due to simplehash and
OOM, because it's mainly used in the executor.

Please tell me if you think the use of simplehash for a search_path
cache is the wrong tool for the job.

> Maybe add a comment explaining why it's important to update
> parameters after
> allocating?

Will do.

Regards,
    Jeff Davis




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

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: ResourceOwner refactoring
Следующее
От: Gurjeet Singh
Дата:
Сообщение: Re: simplehash: preserve consistency in case of OOM