From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Robert Haas <robertmhaas(at)gmail(dot)com> |
Cc: | Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: why doesn't DestroyPartitionDirectory hash_destroy? |
Date: | 2019-03-14 16:56:42 |
Message-ID: | 4624.1552582602@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> On Thu, Mar 14, 2019 at 3:13 AM Amit Langote
> <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2019-03-14 17:16:01 | Re: why doesn't DestroyPartitionDirectory hash_destroy? |
Previous Message | Tom Lane | 2019-03-14 16:36:20 | Re: hyrax vs. RelationBuildPartitionDesc |