On 07/07/2015 09:01 PM, Wes Vaske (wvaske) wrote:
Regarding:
“lie about their fsync status.”

This is mostly semantics but it might help google searches on the issue.

A drive doesn’t support fsync(), that’s a filesystem/kernel process. A drive will do 
a FLUSH CACHE. Before kernels 2.6.<low numbers> the fsync() call wouldn’t sent 
any ATA or SCSI command to flush the disk cache. Whereas—AFAICT—modern kernels and 
file system versions*will*  do this. When ‘sync’ is called the filesystem will issue 
the appropriate command to the disk to flush the write cache.

For ATA, this is “FLUSH CACHE” (E7h). To check support for the command use:
[root@postgres ~]# smartctl --identify /dev/sdu | grep "FLUSH CACHE"
   83     13          1   FLUSH CACHE EXT supported
   83     12          1   FLUSH CACHE supported
   86     13          1   FLUSH CACHE EXT supported
   86     12          1   FLUSH CACHE supported

The 1s in the 3rd column represent SUPPORTED for the feature listed in the last 
column.

Right, to be precise, the problem isn't the drive lies about fsync(). It lies about FLUSH CACHE instead. Search & replace fsync() with FLUSH CACHE, and the same question remains: When the drive breaks its promise wrt. FLUSH CACHE, does it nevertheless guarantee that the order the data is eventually flushed to disk is consistent with the order in which the data and FLUSH CACHE were sent to the drive? That's an important distinction, because it makes the difference between "the most recent data the application saved might be lost even though the FLUSH CACHE command returned" and "your filesystem is corrupt".

- Heikki



--
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