On 01/27/2018 12:06 AM, Andres Freund wrote: > Hi, > > On 2018-01-26 23:53:33 +0100, Tomas Vondra wrote: >> But more importantly, I don't see why the size of the internal page >> would matter here at all? SSDs have non-volatile write cache (DRAM with >> battery), protecting all the internal writes to pages. If your SSD does >> not do that correctly, it's already broken no matter what page size it >> uses even with full_page_writes=on. > > Far far from all SSDs have non-volatile write caches. And if they > respect barrier requests (i.e. flush before returning), they're not > broken. >
That is true, thanks for the correction. But does that make the internal page size relevant to the atomicity question? For example, let's say we write 4kB on a drive with 2kB internal pages, and the power goes out after writing the first 2kB of data (so losing the second 2kB get lost). The disk however never confirmed the 4kB write, exactly because of the writer barrier ... I have to admit I'm not sure what happens at this point - whether the drive will produce torn page (with the first 2kB updated and 2kB old), or if it's smart enough to realize the write barrier was not reached. But perhaps this (non-volatile write cache) is one of the requirements for disabling full page writes? regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services