[Beowulf] Sidebar: Vista Rant

Tim Cutts tjrc at sanger.ac.uk
Thu Jul 19 01:34:00 PDT 2007


On 19 Jul 2007, at 1:36 am, Chris Samuel wrote:

> InnoDB: When MySQL/InnoDB is compiled on Mac OS X 10.2 or earlier,  
> detect the
> operating system version at run time and use the fcntl() file flush  
> method on
> Mac OS X versions 10.3 and later. In Mac OS X, fsync() does not  
> flush the
> write cache in the disk drive, but the special fcntl() does;  
> however, the
> flush request is ignored by some external devices. Failure to flush  
> the
> buffers may cause severe database corruption at power outages.

And this is different from Linux how?

Man sync(2) on Linux says:

BUGS
        According  to the standard specification (e.g., SVID), sync()  
schedules
        the writes, but may return before the actual writing is  
done.  However,
        since  version  1.3.20  Linux does actually wait.  (This  
still does not
        guarantee data integrity: modern disks have large caches.)

Man fsync on Mac OS X 10.4 says:

      Note that while fsync() will flush all data from the host to  
the drive
      (i.e. the "permanent storage device"), the drive itself may not  
physi-
      cally write the data to the platters for quite some time and it  
may be
      written in an out-of-order sequence.

Those look like much the same caveats to me.  At least later versions  
of Mac OS X supply the fcntl() methods to specifically ask the driver  
to commit (although how it can possibly guarantee that I don't know -  
the device could be a long way away across a SAN); that possibility  
does not exist on Linux, as far as I know, although I'm willing to be  
corrected.

Any code that relies on sync(), or any other method which just  
results in a *request* to flush the data to the physical storage, is  
going to have small windows where the data is at risk.  Enter UPS,  
stage right.  :-)

Mind you, MySQL is perfectly capable of corrupting its own data  
without relying on rare hardware and power failures to blame for it.

Tim


-- 
The Wellcome Trust Sanger Institute is operated by Genome Research 
Limited, a charity registered in England with number 1021457 and a 
company registered in England with number 2742969, whose registered 
office is 215 Euston Road, London, NW1 2BE.



More information about the Beowulf mailing list