Re: [COMMITTERS] pgsql: Fix bufmgr so CHECKPOINT_END_OF_RECOVERY behaves as a shutdown c - Mailing list pgsql-hackers

From Andres Freund
Subject Re: [COMMITTERS] pgsql: Fix bufmgr so CHECKPOINT_END_OF_RECOVERY behaves as a shutdown c
Date
Msg-id 201209171714.51295.andres@2ndquadrant.com
Whole thread Raw
In response to Re: [COMMITTERS] pgsql: Fix bufmgr so CHECKPOINT_END_OF_RECOVERY behaves as a shutdown c  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: [COMMITTERS] pgsql: Fix bufmgr so CHECKPOINT_END_OF_RECOVERY behaves as a shutdown c  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
On Monday, September 17, 2012 04:59:06 PM Robert Haas wrote:
> On Sun, Sep 16, 2012 at 2:54 PM, Simon Riggs <simon@2ndquadrant.com> wrote:
> > Fix bufmgr so CHECKPOINT_END_OF_RECOVERY behaves as a shutdown
> > checkpoint. Recovery code documents clearly that a shutdown checkpoint
> > is executed at end of recovery - a shutdown checkpoint WAL record is
> > written but the buffer manager had been altered to treat end of recovery
> > as a normal checkpoint. This bug exacerbates the bufmgr relpersistence
> > bug.
> > 
> > Bug spotted by Andres Freund, patch by me.
> 
> I am confused by this patch.  It seems to me that the effect of this
> patch is to force unlogged buffers to be written at end-of-recovery as
> well as at shutdown.  But, barring bugs elsewhere, there shouldn't be
> any unlogged buffers in shared_buffers at end-of-recovery, so this
> won't make any difference at all.  Am I missing something?
I just noted during investigating of the impact of the fakerelcache bug that 
contrary to whats claimed at several places END_OF_RECOVERY checkpoints do 
*not* behave the same way CHECKPOINT_IS_SHUTDOWN ones do. Which doesn't seem to 
be a good idea. E.g. the impact of this bug would have been smaller if they 
were really treated the same. Unless I missed something thats the only place of 
relevance that treats them differently.
Imo treating them different in some remote places (2 calls away) is a good way 
to introduce further bugs.

> Maybe what we should do is - if this is an end-of-recovery checkpoint
> - *assert* that the BM_PERMANENT bit is set on every buffer we find.
> That would provide a useful cross-check that we don't have a bug
> similar to the one Jeff already fixed in any other code path.
I haven't looked into the details, but can't a new unlogged relation be created 
since the last checkpoint and thus have pages in s_b?

Greetings,

Andres

-- Andres Freund                       http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training &
Services



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: [COMMITTERS] pgsql: Fix bufmgr so CHECKPOINT_END_OF_RECOVERY behaves as a shutdown c
Next
From: Alvaro Herrera
Date:
Subject: Re: Question about SSI, subxacts, and aborted read-only xacts