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

From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Simon Riggs <simon(at)2ndQuadrant(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, 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 16:20:00
Message-ID: 4A43A3B0.2000007@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Simon Riggs wrote:
> On Thu, 2009-06-25 at 18:12 +0300, Heikki Linnakangas wrote:
>
>> A short fix would be to have bgwriter do the shutdown checkpoint instead
>> in archive recovery. I don't recall if there was a reason it wasn't
>> coded like that to begin with, though.
>
> I think the problem was that it was coded both ways at different stages
> of patch evolution. The decision to retain the shutdown checkpoint by
> the startup process was taken in January, IIRC.
>
> Having startup process issue this
>
> if (InArchiveRecovery)
> RequestCheckpoint(CHECKPOINT_IS_SHUTDOWN |
> CHECKPOINT_FORCE |
> CHECKPOINT_WAIT)
> else
>
> should make the startup process wait for bgwriter to complete the
> checkpoint. But we need to set LocalRecoveryInProgress appropriately
> also.

Yeah, the trouble is to tell bgwriter that it's OK for it to create the
checkpoint, which includes writing a WAL record, while still keeping the
system "in-recovery" for all other purposes. While we could just relax
the checks, that seems like a very important safeguard.

(I posted in the other mail to do a restartpoint before the startup
process does the checkpoint)

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Simon Riggs 2009-06-25 16:22:47 Re: BUG #4879: bgwriter fails to fsync the file in recovery mode
Previous Message Simon Riggs 2009-06-25 16:11:36 Re: BUG #4879: bgwriter fails to fsync the file in recovery mode