Re: Wait for parallel workers to attach

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Peter Geoghegan <pg(at)bowt(dot)ie>, Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>
Subject: Re: Wait for parallel workers to attach
Date: 2018-01-29 14:55:43
Message-ID: CA+TgmoZD2RmWYTxEOa69yqTwF419HWeg5bkNu5_UFJc9O7reLg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Jan 27, 2018 at 3:14 AM, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> During the recent development of parallel operation (parallel create
> index)[1], a need has been arised for $SUBJECT. The idea is to allow
> leader backend to rely on number of workers that are successfully
> started. This API allows leader to wait for all the workers to start
> or fail even if one of the workers fails to attach. We consider
> workers started/attached once they are attached to error queue. This
> will ensure that any error after the workers are attached won't be
> silently ignored by leader.

known_started_workers looks a lot like any_message_received. Perhaps
any_message_received should be renamed to known_started_workers and
reused here. After all, if we know that a worker was started, there's
no need for WaitForParallelWorkersToFinish to again call
GetBackgroundWorkerPid() for it.

I think that you shouldn't need the 10ms delay loop; waiting forever
should work. If a work fails to start, the postmaster should send
SIGUSR1 which should set our latch.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Fetter 2018-01-29 14:56:57 Re: \describe*
Previous Message Pavel Stehule 2018-01-29 14:55:06 Re: [HACKERS] MERGE SQL Statement for PG11