logoalt Hacker News

croteyesterday at 6:02 PM3 repliesview on HN

Isn't that the entire point of write-ahead logs, journaling file systems, and fsync in general? A roll-back or roll-forward due to a power loss causing a partial write is completely expected, but surely consumer SSDs wouldn't just completely ignore fsync and blatantly lie that the data has been persisted?

As I understood it, the capacitors on datacenter-grade drives are to give it more flexibility, as it allows the drive to issue a successful write response for cached data: the capacitor guarantees that even with a power loss the write will still finish, so for all intents and purposes it has been persisted, so an fsync can return without having to wait on the actual flash itself, which greatly increases performance. Have I just completely misunderstood this?


Replies

unsnap_bicepsyesterday at 6:42 PM

you actually don't need capacitors for rotating media, Western Digital has a feature called "ArmorCache" that uses the rotational energy in the platters to power the drive long enough to sync the volatile cache to a non volatile storage.

https://documents.westerndigital.com/content/dam/doc-library...

show 2 replies
Nextgridyesterday at 6:16 PM

> ignore fsync and blatantly lie that the data has been persisted

Unfortunately they do: https://news.ycombinator.com/item?id=38371307

show 1 reply
Aerolfosyesterday at 11:38 PM

> but surely consumer SSDs wouldn't just completely ignore fsync and blatantly lie that the data has been persisted?

That doesn't even help if fsync() doesn't do what developers expect: https://danluu.com/fsyncgate/

I think this was the blog post that had a bunch more stuff that can go wrong too: https://danluu.com/deconstruct-files/

But basically fsync itself (sometimes) has dubious behaviour, then OS on top of kernel handles it dubiously, and then even on top of that most databases can ignore fsync erroring (and lie that the data was written properly)

So... yes.