Re: BUG #18314: PARALLEL UNSAFE function does not prevent parallel index build

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: Tender Wang <tndrwang(at)gmail(dot)com>
Cc: Alexander Lakhin <exclusion(at)gmail(dot)com>, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18314: PARALLEL UNSAFE function does not prevent parallel index build
Date: 2024-02-29 09:17:41
Message-ID: CACJufxFzy4A8Pbk-TtVa1+cjx9Kf09m+7EOEAYwN0ex4mZEjSA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thu, Feb 29, 2024 at 3:08 PM Tender Wang <tndrwang(at)gmail(dot)com> wrote:
>
> Hi jian he,
> I'm sorry for the delayed response. Thanks for your reviewing, and the new v2 patch include your advices.
>
> As no others reply to this patch. I would add it to the 2024-03 commitfest.
> --

`
if (heap->rd_rel->relpersistence == RELPERSISTENCE_TEMP ||
!is_parallel_safe(root, (Node *) RelationGetIndexExpressions(index, true)) ||
!is_parallel_safe(root, (Node *) RelationGetIndexPredicate(index, true)))
{
parallel_workers = 0;
goto done;
}
`
I refactored the comments for the code above.
Feel free to change it.

I also toggled {RelationGetIndexExpressions,
RelationGetIndexPredicate}'s second argument
from false to true where it's false,
true to false where it's true.

I guess it's more intuitive to do
`
if (get_raw_expr)
return result;
`
since at that time, the `result` is a raw expression.

Overall it looks good.

Attachment Content-Type Size
v2-0001-minor-refactor-based-on-v2.no-cfbot application/octet-stream 8.7 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Alexander Lakhin 2024-02-29 10:00:00 Re: BUG #18369: logical decoding core on AssertTXNLsnOrder()
Previous Message Andrei Lepikhov 2024-02-29 09:03:37 Re: [Bugg hash join and parallel worker]