apologies for such a late response to this thread, but there is domething I think is _really_ dangerous here.

On Thu, 18 Aug 2011, Aidan Van Dyk wrote:

On Thu, Aug 18, 2011 at 1:35 AM, Craig Ringer <ring...@ringerc.id.au> wrote:
On 18/08/2011 11:48 AM, Ogden wrote:

Isn't this very dangerous? I have the Dell PERC H700 card - I see that it
has 512Mb Cache. Is this the same thing and good enough to switch to
nobarrier? Just worried if a sudden power shut down, then data can be lost
on this option.


Yeah, I'm confused by that too. Shouldn't a write barrier flush data to
persistent storage - in this case, the RAID card's battery backed cache? Why
would it force a RAID controller cache flush to disk, too?

The "barrier" is the linux fs/block way of saying "these writes need
to be on persistent media before I can depend on them".  On typical
spinning media disks, that means out of the disk cache (which is not
persistent) and on platters.  The way it assures that the writes are
on "persistant media" is with a "flush cache" type of command.  The
"flush cache" is a close approximation to "make sure it's persistent".

If your cache is battery backed, it is now persistent, and there is no
need to "flush cache", hence the nobarrier option if you believe your
cache is persistent.

Now, make sure that even though your raid cache is persistent, your
disks have cache in write-through mode, cause it would suck for your
raid cache to "work", but believe the data is safely on disk and only
find out that it was in the disks (small) cache, and you're raid is
out of sync after an outage because of that...  I believe most raid
cards will handle that correctly for you automatically.

if you don't have barriers enabled, the data may not get written out of main memory to the battery backed memory on the card as the OS has no reason to do the write out of the OS buffers now rather than later.

Every raid card I have seen has ignored the 'flush cache' type of command if it has a battery and that battery is good, so you leave the barriers enabled and the card still gives you great performance.

David Lang

--
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance

Reply via email to