Re: BUG #4879: bgwriter fails to fsync the file in recovery mode - Mailing list pgsql-bugs

From Simon Riggs
Subject Re: BUG #4879: bgwriter fails to fsync the file in recovery mode
Date
Msg-id 1245965961.4038.249.camel@ebony.2ndQuadrant
Whole thread Raw
In response to Re: BUG #4879: bgwriter fails to fsync the file in recovery mode  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
On Thu, 2009-06-25 at 17:11 -0400, Tom Lane wrote:
> Simon Riggs <simon@2ndQuadrant.com> writes:
> > So, yes, there are some places where InRecovery is used in code executed
> > by the bgwriter, but the correct fix is to use RecoveryIsInProgress().
>
> Agreed, but this gets us no closer to solving the real problem, which is
> that when we perform the end-of-recovery checkpoint, we need to act like
> we are *not* in recovery anymore, for at least some purposes.

Not for some purposes, just for *one* purpose: the end of recovery
checkpoint needs to run XLogInsert() which has specific protection
against being run during recovery.

> Most
> notably, to allow us to write a WAL entry at all; but I am suspicious
> that pretty much every InRecovery/RecoveryIsInProgress test that that
> checkpoint might execute should behave as if we're not in recovery.

You are right to question whether we should revoke the patch. ISTM that
we are likely to decrease code robustness by doing that at this stage.

I think we have the problems pretty much solved now.

If we want to increase robustness, I would suggest we add a
recovery.conf parameter to explicitly enable use of bgwriter during
recovery, off by default. In addition to the fixes being worked on
currently.

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

pgsql-bugs by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: BUG #4883: tar xf fails on NFS4 mounts
Next
From: Heikki Linnakangas
Date:
Subject: Re: BUG #4879: bgwriter fails to fsync the file in recovery mode