Re: Review: Extra Daemons / bgworker

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Markus Wanner <markus(at)bluegap(dot)ch>
Cc: kaigai(at)kaigai(dot)gr(dot)jp, PostgreSQL-development Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Review: Extra Daemons / bgworker
Date: 2012-12-04 15:05:30
Message-ID: 20121204150530.GA4905@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Alvaro Herrera wrote:

> One notable thing is that I had to introduce this in the postmaster
> startup sequence:
>
> /*
> * process any libraries that should be preloaded at postmaster start
> */
> process_shared_preload_libraries();
>
> /*
> * If loadable modules have added background workers, MaxBackends needs to
> * be updated. Do so now.
> */
> // RerunAssignHook("max_connections");
> if (GetNumShmemAttachedBgworkers() > 0)
> SetConfigOption("max_connections",
> GetConfigOption("max_connections", false, false),
> PGC_POSTMASTER, PGC_S_OVERRIDE);
>
> Note the intention here is to re-run the GUC assign hook for
> max_connections (hence the commented out hypothetical call to do so).
> Obviously, having to go through GetConfigOption and SetConfigOption is
> not a nice thing to do; we'll have to add some new entry point to guc.c
> for this to have a nicer interface.

After fooling with guc.c to create such a new entry point, I decided
that it looks too ugly. guc.c is already complex enough with the API we
have today that I don't want to be seen creating a partially-duplicate
interface, even if it is going to result in simplified processing of
this one place. If we ever get around to needing another place to
require rerunning a variable's assign_hook we can discuss it; for now it
doesn't seem worth it.

This is only called at postmaster start time, so it's not too
performance-sensitive, hence SetConfigOption( .., GetConfigOption(), ..)
seems acceptable from that POV.

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message postgresql 2012-12-04 15:06:48 Slow query: bitmap scan troubles
Previous Message Bruce Momjian 2012-12-04 14:54:43 Re: Tablespaces in the data directory