Re: releasing ParallelApplyTxnHash when pa_launch_parallel_worker returns NULL

Поиск
Список
Период
Сортировка
От Ted Yu
Тема Re: releasing ParallelApplyTxnHash when pa_launch_parallel_worker returns NULL
Дата
Msg-id CALte62yU-=b8XyNCJbHOj2g=OmqtO=tjStNsNmFqWK4ceEjs+A@mail.gmail.com
обсуждение исходный текст
Ответ на RE: releasing ParallelApplyTxnHash when pa_launch_parallel_worker returns NULL  ("houzj.fnst@fujitsu.com" <houzj.fnst@fujitsu.com>)
Ответы RE: releasing ParallelApplyTxnHash when pa_launch_parallel_worker returns NULL  ("houzj.fnst@fujitsu.com" <houzj.fnst@fujitsu.com>)
Список pgsql-hackers


On Tue, Jan 10, 2023 at 6:13 PM houzj.fnst@fujitsu.com <houzj.fnst@fujitsu.com> wrote:
On Wednesday, January 11, 2023 1:25 AM Ted Yu <yuzhihong@gmail.com> wrote:

> I was reading src/backend/replication/logical/applyparallelworker.c .
> In `pa_allocate_worker`, when pa_launch_parallel_worker returns NULL, I think the `ParallelApplyTxnHash` should be released.

Thanks for reporting.

ParallelApplyTxnHash is used to cache the state of streaming transactions being
applied. There could be multiple streaming transactions being applied in
parallel and their information were already saved in ParallelApplyTxnHash, so
we should not release them just because we don't have a worker available to
handle a new transaction here.

Best Regards,
Hou zj
Hi,

        /* 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.

Please take a look at the new patch and see if it makes sense.

Cheers
Вложения

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

Предыдущее
От: Amit Kapila
Дата:
Сообщение: Re: Handle infinite recursion in logical replication setup
Следующее
От: Robert Haas
Дата:
Сообщение: Re: pgsql: Add new GUC createrole_self_grant.