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

From Tom Lane
Subject Re: BUG #4879: bgwriter fails to fsync the file in recovery mode
Date
Msg-id 27738.1245958733@sss.pgh.pa.us
Whole thread Raw
In response to Re: BUG #4879: bgwriter fails to fsync the file in recovery mode  (Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>)
Responses Re: BUG #4879: bgwriter fails to fsync the file in recovery mode
Re: BUG #4879: bgwriter fails to fsync the file in recovery mode
List pgsql-bugs
Heikki Linnakangas <heikki.linnakangas@enterprisedb.com> writes:
> Tom Lane wrote:
>> ... I think it might be better to fix
>> things so that InRecovery is maintained correctly in the bgwriter too.

> We could set InRecovery=true in CreateCheckPoint if it's a startup
> checkpoint, and reset it afterwards. I'm not 100% sure it's safe to have
> bgwriter running with InRecovery=true at other times. Grepping for
> InRecovery doesn't show anything that bgwriter calls, but it feels safer
> that way.

Actually, my thought was exactly that it would be better if it was set
correctly earlier in the run --- if there ever are any places where it
matters, this way is more likely to be right.  (I'm not convinced that
it doesn't matter today, anyhow --- are we sure these places are not
called in a restartpoint?)

What you suggest might be a good minimum-change solution for right now,
but I think eventually it should work the other way.

> Hmm, I see another small issue. We now keep track of the "minimum
> recovery point". Whenever a data page is flushed, we set minimum
> recovery point to the LSN of the page in XLogFlush(), instead of
> fsyncing WAL like we do in normal operation. During the end-of-recovery
> checkpoint, however, RecoveryInProgress() returns false, so we don't
> update minimum recovery point in XLogFlush(). You're unlikely to be
> bitten by that in practice; you would need to crash during the
> end-of-recovery checkpoint, and then set the recovery target to an
> earlier point. It should be fixed nevertheless.

We would want the end-of-recovery checkpoint to act like it's not in
recovery anymore for this purpose, no?

            regards, tom lane

pgsql-bugs by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: BUG #4879: bgwriter fails to fsync the file in recovery mode
Next
From: Tom Lane
Date:
Subject: Re: BUG #4879: bgwriter fails to fsync the file in recovery mode