Re: BUG #4879: bgwriter fails to fsync the file in recovery mode

From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>, Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #4879: bgwriter fails to fsync the file in recovery mode
Date: 2009-06-25 21:39:21
Message-ID: 1245965961.4038.249.camel@ebony.2ndQuadrant
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


On Thu, 2009-06-25 at 17:11 -0400, Tom Lane wrote:
> Simon Riggs <simon(at)2ndQuadrant(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Simon Riggs 2009-06-25 21:46:31 Re: BUG #4879: bgwriter fails to fsync the file in recovery mode
Previous Message Heikki Linnakangas 2009-06-25 21:37:38 Re: BUG #4879: bgwriter fails to fsync the file in recovery mode