Re: releasing ParallelApplyTxnHash when pa_launch_parallel_worker returns NULL

From: Ted Yu <yuzhihong(at)gmail(dot)com>
To: "houzj(dot)fnst(at)fujitsu(dot)com" <houzj(dot)fnst(at)fujitsu(dot)com>
Cc: "akapila(at)postgresql(dot)org" <akapila(at)postgresql(dot)org>, Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: releasing ParallelApplyTxnHash when pa_launch_parallel_worker returns NULL
Date: 2023-01-11 04:01:15
Message-ID: CALte62y8XrE=AZZHxdcuP=C0u5=HFWAEt3tBpO60pfSbqqwvWw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jan 10, 2023 at 7:55 PM houzj(dot)fnst(at)fujitsu(dot)com <
houzj(dot)fnst(at)fujitsu(dot)com> wrote:

> On Wednesday, January 11, 2023 10:21 AM Ted Yu <yuzhihong(at)gmail(dot)com>
> wrote:
> > /* First time through, initialize parallel apply worker state
> hashtable. */
> > if (!ParallelApplyTxnHash)
> >
> > I think it would be better if `ParallelApplyTxnHash` is created by the
> first
> > successful parallel apply worker.
>
> Thanks for the suggestion. But I am not sure if it's worth to changing the
> order here, because It will only optimize the case where user enable
> parallel
> apply but never get an available worker which should be rare. And in such a
> case, it'd be better to increase the number of workers or disable the
> parallel mode.
>
> Best Regards,
> Hou zj
>

I think even though the chance is rare, we shouldn't leak resource.

The `ParallelApplyTxnHash` shouldn't be created if there is no single apply
worker.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message houzj.fnst@fujitsu.com 2023-01-11 04:04:04 RE: Perform streaming logical transactions by background workers and parallel apply
Previous Message John Naylor 2023-01-11 03:56:22 Re: [PATCH] Improve ability to display optimizer analysis using OPTIMIZER_DEBUG