Re: putting a bgworker to rest - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: putting a bgworker to rest
Date
Msg-id 20130425160553.GS2169@eldon.alvh.no-ip.org
Whole thread Raw
In response to Re: putting a bgworker to rest  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
Peter Eisentraut wrote:
> On 4/24/13 12:30 PM, Dimitri Fontaine wrote:
> > In Erlang, the lib that cares about such things in called OTP, and that
> > proposes a model of supervisor that knows when to restart a worker. The
> > specs for the restart behaviour are:
> >
> >   Restart = permanent | transient | temporary
>
> There is also supervisord; see configuration settings "autorestart" and
> "exitcodes" here:
>
> http://supervisord.org/configuration.html#program-x-section-settings
>
> Yes, the feature creep is in full progress!

The main missing feature before this can be sensibly implemented, in my
view, is some way to make workers start when they are stopped, assuming
no intervening postmaster crash.  I suppose we could write a
SQL-callable function so that a backend can signal postmaster to launch
a worker.  For this to work, I think we need an SQL-accesible way to
list existing registered workers, along with whether they are running or
not, and some identifier.  However, the list of registered workers and
their statuses currently only exists in postmaster local memory;
exporting that might be problematic.  (Maybe a simple file with a list
of registered workers, but not the status, is good enough. Postmaster
could write it after registration is done.)

--
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services



pgsql-hackers by date:

Previous
From: Kyotaro HORIGUCHI
Date:
Subject: Re: Failing start-up archive recovery at Standby mode in PG9.2.4
Next
From: Andrew Dunstan
Date:
Subject: Re: danger of stats_temp_directory = /dev/shm