pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Greg Smith <greg@2ndquadrant.com>
To: Kevin Grittner <Kevin.Grittner@wicourts.gov>
Cc: Bruce Momjian <bruce@momjian.us>
Cc: jd@commandprompt.com, Scott Marlowe <scott.marlowe@gmail.com>
Cc: Steve Crawford <scrawford@pinpointresearch.com>
Cc: pgsql-performance@postgresql.org, Ben Chobot <bench@silentmedia.com>
Subject: Re: BBU Cache vs. spindles
Date: Fri, 22 Oct 2010 00:06:21 -0400
Message-ID: <4CC10DBD.5050509@2ndquadrant.com> (raw)
In-Reply-To: <4CC0513E0200002500036C68@gw.wicourts.gov>
References: <4CC04EA50200002500036C5E@gw.wicourts.gov>
	<201010211935.o9LJZTM21744@momjian.us>
	<4CC0513E0200002500036C68@gw.wicourts.gov>

Kevin Grittner wrote:
> With either platters or BBU cache,
> the data is persisted on fsync; why do you see a risk with one but
> not the other

Forgot to address this part.  The troublesome sequence if you don't have 
a BBU is:

1) WAL data is written to the OS cache
2) PG calls fsync
3) Data is tranferred into the drive's volatile, non battery-backed cache
4) Drive lies about data being on disk, says fsync is done
5) That 8K data page is written out to the OS cache, also with fsync, 
then onto the drive.  It says it has that too.
6) Due to current disk head location, 4KB of the data page gets written 
out before it gets to the WAL data
7) System crashes

Now you're dead.  You've just torn a data page, but not written any of 
the data to the WAL necessary to reconstruct any valid version of that page.

I think Kevin's point here may be that if your fsync isn't reliable, 
you're always in trouble.  But if your fsync is good, even torn pages 
should be repairable by the deltas written to the WAL, as I described in 
the message I just sent before this one.  That's true regardless of 
whether you achieved "non-lying fsync" with a BBU or by turning a 
drive's write cache off.  There's nothing really special about the BBU 
beyond it behind the most common form of reliable write cache that 
works.  You get the same properties at a slower rate with a drive that's 
configured to never lie about writes.

-- 
Greg Smith   2ndQuadrant US    greg@2ndQuadrant.com   Baltimore, MD
PostgreSQL Training, Services and Support        www.2ndQuadrant.us
"PostgreSQL 9.0 High Performance": http://www.2ndQuadrant.com/books




view thread (61+ messages)  latest in thread

Message-ID: <4CC10DBD.5050509@2ndquadrant.com>
Permalink:  ../4CC10DBD.5050509@2ndquadrant.com/
Also on:    postgresql.org/message-id/4CC10DBD.5050509@2ndquadrant.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: greg@2ndquadrant.com, Kevin.Grittner@wicourts.gov, bruce@momjian.us, scott.marlowe@gmail.com, scrawford@pinpointresearch.com, bench@silentmedia.com
  Subject: Re: BBU Cache vs. spindles
  In-Reply-To: <4CC10DBD.5050509@2ndquadrant.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox