Обсуждение: Raid Controller Write Cache setting for WAL and Data
Hello, Is it safe, to have RAID controller (not BBC) write cache _enabled_ for disks where data are stored and write cache _disabled_ for disks where WAL segments are stored? I _can_ afford of loosing some data in case of power failure. But I'm afraid of having database in unrecoverable state after crash. fsync = on I have 4 disks, 2 for WAL (RAID1) and 2 for data (RAID1). WAL and data are on XFS partitions (nobarrier, noatime). -- Piotr Gasidło
On Wed, Feb 16, 2011 at 04:40:43PM +0100, Piotr Gasidło wrote: > Is it safe, to have RAID controller (not BBC) write cache _enabled_ > for disks where data are stored and write cache _disabled_ for disks > where WAL segments are stored? No. > I _can_ afford of loosing some data in case of power failure. But I'm > afraid of having database in unrecoverable state after crash. It could be. Suppose you had the crash at the exact moment when the the WAL was getting flushed. Now you'll have a corrupt table. It will likely start up, but some time later when someone goes to get that data, you'll run into a problem. A battery is one of the simplest and cheapest things you can do to make your database system more reliable and faster at the same time. A -- Andrew Sullivan ajs@crankycanuck.ca
Piotr Gasidło wrote: > I _can_ afford of loosing some data in case of power failure. But I'm > afraid of having database in unrecoverable state after crash. > Then turn off synchronous_commit. That's exactly the behavior you get when it's disabled: some data loss after a crash, no risk of database corruption, and faster performance without needing a controller with a battery. If you've already got a RAID controller that accepts a battery, it would be silly not to then buy one though. The controller is normally 75% of the price of the combination, so getting that but not the final piece to really make it perform well wouldn't be a good move. -- Greg Smith 2ndQuadrant US greg@2ndQuadrant.com Baltimore, MD PostgreSQL Training, Services, and 24x7 Support www.2ndQuadrant.us "PostgreSQL 9.0 High Performance": http://www.2ndQuadrant.com/books