Re: question regarding full_page_write - Mailing list pgsql-general

From Greg Smith
Subject Re: question regarding full_page_write
Date
Msg-id 4E552525.5000805@2ndQuadrant.com
Whole thread Raw
In response to Re: question regarding full_page_write  (Martín Marqués <martin.marques@gmail.com>)
List pgsql-general
On 08/24/2011 11:12 AM, Martín Marqués wrote:
> Why aren't deltas good enough for the first 8Kb? Is there other
> information in the first 8Kb that make those more important?
>

The fundamental problem is what's called a torn page.  You write out a
8K page; only part of it actually makes it to disk; the server crashes.
What you now have on disk is completely unpredictable.  It's a mix of
the old new page, but what portion of each you got, that's almost
random.  You cannot fix it with any delta.  The only way to make sure
it's back into a good state is to write an entire 8K page, a known
correct copy, from some point in time.

The way this is done in PostgreSQL, one of those is written out to the
WAL the first time any page is touched after a checkpoint.  Those become
the known copy good to recover from any torn page problem.  Then
database recovery only has to replay activity since that checkpoint
marker to fix all torn pages.

--
Greg Smith   2ndQuadrant US    greg@2ndQuadrant.com   Baltimore, MD
PostgreSQL Training, Services, and 24x7 Support  www.2ndQuadrant.us


pgsql-general by date:

Previous
From: Carlos Henrique Reimer
Date:
Subject: Explain Analyze understanding
Next
From: andreas@a-kretschmer.de
Date:
Subject: Re: init script or procedure