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

From Simon Riggs
Subject Re: [COMMITTERS] pgsql: Fix bufmgr so CHECKPOINT_END_OF_RECOVERY behaves as a shutdown c
Date
Msg-id CA+U5nM+U6tEj2YrFr1i5FobbyAyFUD5-jWkupCpUtRVrtRhMYA@mail.gmail.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>)
List pgsql-hackers
On 17 September 2012 15:59, Robert Haas <robertmhaas@gmail.com> 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.

There shouldn't be, but this coding is the fail safe way.

> Am I missing something?

If you or others do, this will save us.

> 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.

Safety net is needed there, not an Assert.

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



pgsql-hackers by date:

Previous
From: "Kevin Grittner"
Date:
Subject: Re: Question about SSI, subxacts, and aborted read-only xacts
Next
From: Bruce Momjian
Date:
Subject: Re: [ADMIN] pg_upgrade from 9.1.3 to 9.2 failed