Consumer SSDs may indeed return an early indication that a flush is complete, but whether they are lying depends heavily on your notion of persistence:
- the SSD may return done once the data is buffered in RAM
- or once it has reached a temporary log
- or once it has reached a 'permanent' location on flash
- or once it has recorded the mapping of data<->location to some separate directory
- or once it has updated some separate root pointer pointing to the latest version of the log/mapping structures in some separate special storage
I don't believe any SSD waits until the last step above before returning done. Separately, the SSD:
- may have no electrical power outage protection whatsoever
- may have supercapacitors fitted
- the supercap may guarantee full durability of every acknowledged flush
- or only guarantee atomicity up to some prior acknowledged flush
- or only guarantee that the drive has /some/ data on it in /some/ state on the next reboot
SSDs are insanely complex
I am also "excited" when I think about how the SSD shards blocks across flash chips and adds erasure codes, then people put the SSDs in RAID to shard blocks across SSDs and add erasure codes, then people put a filesystem on top of that that shards blocks across arrays and adds erasure codes, then put an application on top of that that writes to 3 replicas and writes erasure codes to 2 more. Now your "hello world" text file uses 8 gigabytes of storage, but at least you only lose it if there's one bug in the SSD controller, your RAID software, your filesystem, or your application. Or a tornado hits the SSD. Oh well.
HN often contains articles like "abstraction is bad", but even their contrived examples aren't this scary. I'm still pleasantly surprised when I log into my computer in the morning and still have a .bashrc.
Then bfitz proved in in 2005, and it turns out SCSI drives sometimes do it too: https://brad.livejournal.com/2116715.html
Once one vendor decided to screw us, the others had no choice. It was trivial for benchmarks to work around it, too: Just send more data so the cache becomes irrelevant. The whole episode took a few months at most.
I dont remember if they flat-out ignored the flush, or started a flush but didn't wait for completion.
So essentially its a no-op?
it would be impossible to write a remotely reliable high-performance database or filesystem if flushing were useless. professionals doing formal analyses like https://www.sqlite.org/psow.html would be a complete waste of time, because everyone would be just praying anyways.
some enterprise SCSI drives too. This was all back in the late 90's/early 2000's, no idea if it still happens with SATA or SAS drives...