Re: scheduler in core

From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: Dimitri Fontaine <dfontaine(at)hi-media(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Dave Page <dpage(at)pgadmin(dot)org>, Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: scheduler in core
Date: 2010-02-22 09:17:45
Message-ID: 1266830265.7341.32243.camel@ebony
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, 2010-02-21 at 20:46 +0100, Dimitri Fontaine wrote:
> Simon Riggs <simon(at)2ndQuadrant(dot)com> writes:
> > There is currently no way to run a separate daemon process that runs
> > user code as part of Postgres, so that the startup code gets run
> > immediately we startup, re-run if we crash and shut down cleanly when
> > the server does. If there were some way to run arbitrary code in a
> > daemon using an extensibility API then we wouldn't ever get any requests
> > for the scheduler, cos you could write it yourself without troubling
> > anybody here.
>
> Please do include the Skytools / PGQ ticker as one use case in the
> design discussion, and pgbouncer too. Having user daemons as part as the
> PostgreSQL extensibility would be awesome indeed!
>
> Bonus point if you build them with PGXS and install them from SQL, so
> that the current extension packaging design applies.
>
> I guess we can say that the archive and restore command are precursors
> of managed user "daemons", or say, integrated processes. So adding them
> to the use cases to cover would make sense.

Yes, I think so. Rough design...

integrated_user_processes = 'x, y, z'

would run x(), y() and z() in their own processes. These would execute
after startup, or at consistent point in recovery. The code for these
would come from preload_libraries etc.

They would not block smart shutdown, though their shudown sequence might
delay it. User code would be executed last at startup and first thing at
shutdown.

API would be user_process_startup(), user_process_shutdown().

--
Simon Riggs www.2ndQuadrant.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Stark 2010-02-22 10:15:18 Re: pgsql: Speed up CREATE DATABASE by deferring the fsyncs until after
Previous Message Gokulakannan Somasundaram 2010-02-22 08:18:14 Re: A thought on Index Organized Tables