Re: question regarding full_page_write

From: Greg Smith <greg(at)2ndQuadrant(dot)com>
To: Martín Marqués <martin(dot)marques(at)gmail(dot)com>
Cc: pgsql-general General <pgsql-general(at)postgresql(dot)org>
Subject: Re: question regarding full_page_write
Date: 2011-08-24 16:21:57
Message-ID: 4E552525.5000805@2ndQuadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)2ndQuadrant(dot)com Baltimore, MD
PostgreSQL Training, Services, and 24x7 Support www.2ndQuadrant.us

In response to

Browse pgsql-general by date

  From Date Subject
Next Message bricklen 2011-08-24 16:22:21 plperlu function caused a segmentation fault
Previous Message Carlos Henrique Reimer 2011-08-24 16:18:37 Explain Analyze understanding