Re: A new function to wait for the backend exit after termination

Поиск
Список
Период
Сортировка
От Noah Misch
Тема Re: A new function to wait for the backend exit after termination
Дата
Msg-id 20210601034858.GA55785@rfd.leadboat.com
обсуждение исходный текст
Ответ на Re: A new function to wait for the backend exit after termination  (Magnus Hagander <magnus@hagander.net>)
Ответы Re: A new function to wait for the backend exit after termination  (Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>)
Список pgsql-hackers
On Thu, Apr 08, 2021 at 11:41:17AM +0200, Magnus Hagander wrote:
> I've applied this patch with some minor changes.

I wondered if the new pg_wait_for_backend_termination() could replace
regress.c:wait_pid().  I think it can't, because the new function requires the
backend to still be present in the procarray:

    proc = BackendPidGetProc(pid);

    if (proc == NULL)
    {
        ereport(WARNING,
                (errmsg("PID %d is not a PostgreSQL server process", pid)));

        PG_RETURN_BOOL(false);
    }

    PG_RETURN_BOOL(pg_wait_until_termination(pid, timeout));

If a backend has left the procarray but not yet left the kernel process table,
this function will issue the warning and not wait for the final exit.  Given
that limitation, is pg_wait_for_backend_termination() useful enough?  If
waiting for procarray departure is enough, should pg_wait_until_termination()
check BackendPidGetProc(pid) instead of kill(0, pid), so it can return
earlier?  I can see the value of adding the pg_terminate_backend() timeout
argument, in any case.



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

Предыдущее
От: Amit Kapila
Дата:
Сообщение: Re: Assertion failure while streaming toasted data
Следующее
От: Amit Kapila
Дата:
Сообщение: Re: Skipping logical replication transactions on subscriber side