Re: why doesn't DestroyPartitionDirectory hash_destroy?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: why doesn't DestroyPartitionDirectory hash_destroy?
Дата
Msg-id 4624.1552582602@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: why doesn't DestroyPartitionDirectory hash_destroy?  (Robert Haas <robertmhaas@gmail.com>)
Ответы Re: why doesn't DestroyPartitionDirectory hash_destroy?
Re: why doesn't DestroyPartitionDirectory hash_destroy?
Список pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:
> On Thu, Mar 14, 2019 at 3:13 AM Amit Langote
> <Langote_Amit_f8@lab.ntt.co.jp> wrote:
>> I'm curious why DestroyPartitionDirectory doesn't do
>> hash_destroy(pdir->pdir_hash)?

> What would be the point?  It's more efficient to let context teardown
> take care of it.

Agreed, but the comments in this area are crap.  Why doesn't
CreatePartitionDirectory say something like

 * The object lives inside the given memory context and will be
 * freed when that context is destroyed.  Nonetheless, the caller
 * must *also* ensure that (unless the transaction is aborted)
 * DestroyPartitionDirectory is called before that happens, else
 * we may leak some relcache reference counts.

It's completely not acceptable that every reader of this code should
have to reverse-engineer these design assumptions, especially given
how shaky they are.

There's an independent question as to whether the planner's use of
the feature is specifying a safe memory context.  Has this code been
exercised under GEQO?

            regards, tom lane


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: hyrax vs. RelationBuildPartitionDesc
Следующее
От: Tom Lane
Дата:
Сообщение: Re: why doesn't DestroyPartitionDirectory hash_destroy?