Re: Not deleted mentions of the cleared path

From: Richard Guo <guofenglinux(at)gmail(dot)com>
To: Alena Rybakina <a(dot)rybakina(at)postgrespro(dot)ru>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Not deleted mentions of the cleared path
Date: 2023-10-31 03:25:44
Message-ID: CAMbWs4_Fp5tW0C7+CcMbD0mTtL7ReBDoKDBF6wDdqEMYsMbjDg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Oct 30, 2023 at 7:31 PM Alena Rybakina <a(dot)rybakina(at)postgrespro(dot)ru>
wrote:

> I have already written about the problem of InvalidPath [0] appearing. I
> investigated this and found an error in the add_path() function, when we
> reject a path, we free up the memory of the path, but do not delete various
> mentions of it (for example, in the ancestor of relation, as in the example
> below).
>

I agree that what you observed is true - add_path() may free a path
while it's still referenced from some lower rels. For instance, when
creating ordered paths, we may use the input path unchanged without
copying if it's already well ordered, and it might be freed afterwards
if it fails when competing in add_path().

But this doesn't seem to be a problem in practice. We will not access
these references from the lower rels.

I'm not sure if this is an issue that we need to fix, or we need to live
with. But I do think it deserves some explanation in the comment of
add_path().

Thanks
Richard

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2023-10-31 03:36:01 Re: always use runtime checks for CRC-32C instructions
Previous Message 下雨天 2023-10-31 03:15:54 fix 'ERROR: could not identify a comparison function for type unknown'