On Wed, 2008-10-08 at 13:24 +0100, Simon Riggs wrote:
> On Wed, 2008-10-08 at 14:43 +0300, Heikki Linnakangas wrote:
> > Again, perhaps we should do
> > this as a separate patch.
New patch enclosed with other stuff stripped out. 15% lighter...
New thread spawned for bug fix patch. Will resubmit others when we can
be sure they'll not cause patch conflicts.
> OK, I'll strip all of the above out, for separate consideration.
> The form is this
> PM_START startup process performs restartpoints
> transition when database is consistent state
> PM_RECOVERY bgwriter process performs restartpoints
> delicate transition between two states
> PM_RUN bgwriter process performs checkpoints
Above added as comments in patch.
The patch agonises over the two state transitions above. First
transition needs to be exactly correct otherwise we might be using an
inconsistent database during recovery. Second transition is harder
because it isn't just the startup process working alone any more.
The key to understanding it is all in concurrent behaviour. Startup and
bgwriter chat together through bgwriter shared memory and call functions
back and forth between xlog.c and bgwriter.c.
I haven't retested the patch yet, but it passes make check. I'll be
rechecking it later today, starting in about 2 hours time.
--
Simon Riggs www.2ndQuadrant.com
PostgreSQL Training, Services and Support