Re: Hot standby, recovery infra

From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Hot standby, recovery infra
Date: 2009-01-28 14:47:48
Message-ID: 1233154068.2327.2385.camel@ebony.2ndQuadrant
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On Wed, 2009-01-28 at 23:19 +0900, Fujii Masao wrote:

> > @@ -355,6 +359,27 @@ BackgroundWriterMain(void)
> > */
> > PG_SETMASK(&UnBlockSig);
> >
> > + BgWriterRecoveryMode = IsRecoveryProcessingMode();
> > +
> > + if (BgWriterRecoveryMode)
> > + elog(DEBUG1, "bgwriter starting during recovery");
> > + else
> > + InitXLOGAccess();
>
> Why is InitXLOGAccess() called also here when bgwriter is started after
> recovery? That is already called by AuxiliaryProcessMain().

InitXLOGAccess() sets the timeline and also gets the latest record
pointer. If the bgwriter is started in recovery these values need to be
reset later. It's easier to call it twice.

> > @@ -1302,7 +1314,7 @@ ServerLoop(void)
> > * state that prevents it, start one. It doesn't matter if this
> > * fails, we'll just try again later.
> > */
> > - if (BgWriterPID == 0 && pmState == PM_RUN)
> > + if (BgWriterPID == 0 && (pmState == PM_RUN || pmState == PM_RECOVERY))
> > BgWriterPID = StartBackgroundWriter();
>
> Likewise, we should try to start also the stats collector during recovery?

We did in the previous patch...

> > @@ -2103,7 +2148,8 @@ XLogFileInit(uint32 log, uint32 seg,
> > unlink(tmppath);
> > }
> >
> > - elog(DEBUG2, "done creating and filling new WAL file");
> > + XLogFileName(tmppath, ThisTimeLineID, log, seg);
> > + elog(DEBUG2, "done creating and filling new WAL file %s", tmppath);
>
> This debug message is somewhat confusing, because the WAL file
> represented as "tmppath" might have been already created by
> previous XLogFileInit() via InstallXLogFileSegment().

I think those are just for debugging and can be removed.

--
Simon Riggs www.2ndQuadrant.com
PostgreSQL Training, Services and Support

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2009-01-28 14:50:54 Re: How to get SE-PostgreSQL acceptable
Previous Message KaiGai Kohei 2009-01-28 14:41:49 Re: How to get SE-PostgreSQL acceptable